/* LANTAW interface system: one set of tokens and components for every page.
   Direction: a first-class map app at Apple Maps craft (see PRODUCT.md). */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ground: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --material: rgba(250, 250, 252, 0.92);  /* opaque enough for secondary text over dark scenes */
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --label: #1d1d1f;
  --label-2: #636366;
  --label-3: #8e8e93;
  --separator: rgba(60, 60, 67, 0.16);
  --tint: #0064d2;
  --tint-pressed: #0052ad;
  --tint-text: #0064d2;   /* 4.8:1 on the grey tile fill, 5.6:1 under white text */
  --tint-soft: rgba(0, 100, 210, 0.12);
  --on-tint: #ffffff;
  --hazard-low: #ffcc00;
  --hazard-mid: #ff9500;
  --hazard-high: #ff3b30;

  --shadow-float: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 -1px 3px rgba(0, 0, 0, 0.05), 0 -10px 32px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.07);
  --blur: saturate(180%) blur(22px);

  --r-ctl: 12px;
  --r-card: 14px;
  --r-sheet: 18px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --material: rgba(30, 30, 32, 0.92);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #7c7c80;
    --separator: rgba(84, 84, 88, 0.55);
    --tint-text: #5aa9ff;
    --tint-soft: rgba(90, 169, 255, 0.16);
    --shadow-float: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-sheet: 0 -10px 32px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  color: var(--label);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--tint);
  accent-color: var(--tint);
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--tint-text); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }  /* component display rules must never un-hide */
::selection { background: var(--tint-soft); color: var(--label); }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--tint); outline: 3px solid color-mix(in srgb, var(--tint) 55%, transparent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
.num, time { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 200; padding: 10px 14px;
  border-radius: var(--r-ctl); background: var(--surface); color: var(--label);
  font-size: 15px; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-float);
  transform: translateY(-160%); transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

/* ---------- type ---------- */
.t-title { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; }
.t-title2 { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.015em; }
.t-headline { font-size: 17px; line-height: 22px; font-weight: 600; }
.t-sub { font-size: 15px; line-height: 20px; }
.t-foot { font-size: 13px; line-height: 18px; color: var(--label-2); }

/* ---------- icons (authored SVG, one stroke weight) ---------- */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-fill { fill: currentColor; stroke: none; }

/* ---------- surfaces ---------- */
.material {
  background: var(--material);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-float);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .material { background: var(--surface); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border: 0; border-radius: var(--r-ctl);
  font-size: 17px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, transform 0.12s var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn-filled { background: var(--tint); color: var(--on-tint); }
.btn-filled:hover { background: var(--tint-pressed); }
.btn-tinted { background: var(--tint-soft); color: var(--tint-text); }
.btn-gray { background: var(--fill); color: var(--label); }
.btn-gray:hover { background: var(--fill-strong); }
.btn-plain { background: transparent; color: var(--tint-text); padding: 0 8px; }
.btn-block { display: flex; width: 100%; min-height: 50px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.btn-round {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap);
  padding: 0; border: 0; border-radius: 50%; color: var(--label);
}
.btn-round:active { transform: scale(0.94); }

/* Apple Maps action tiles: icon over label, tinted fill */
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 56px; padding: 7px 4px 6px; border: 0; border-radius: var(--r-ctl);
  background: var(--fill); color: var(--tint-text); font-size: 12px; font-weight: 600;
  line-height: 14px; text-align: center; text-decoration: none;
  transition: background-color 0.15s, color 0.15s, transform 0.12s var(--ease-out);
}
.action:hover { background: var(--fill-strong); }
.action:active { transform: scale(0.97); }
.action .ico { width: 22px; height: 22px; }
.action.active, .action[aria-pressed="true"] { background: var(--tint); color: var(--on-tint); }
.action span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--separator); background: var(--surface); color: var(--label);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--tint); color: var(--on-tint); }

/* ---------- search field ---------- */
.search {
  position: relative; display: flex; align-items: center;
  min-height: 40px; border-radius: 11px; background: var(--fill);
}
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 40px 0 12px; border: 0; background: transparent;
  font-size: 17px; color: var(--label); -webkit-appearance: none; appearance: none; border-radius: 11px;
}
.search input::placeholder { color: var(--label-2); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .ico { position: absolute; right: 12px; color: var(--label-2); pointer-events: none; }
.search:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 45%, transparent); }
.search input:focus-visible { outline: none; }

/* ---------- floating map controls ---------- */
.map-ctl { display: flex; flex-direction: column; border-radius: var(--r-ctl); overflow: hidden; }
.map-ctl > button, .map-ctl > a {
  display: grid; place-items: center; width: var(--tap); height: var(--tap);
  border: 0; background: transparent; color: var(--label); padding: 0;
}
.map-ctl > * + * { border-top: 0.5px solid var(--separator); }
.map-ctl > button:hover { background: var(--fill); }
.map-ctl > button:active { background: var(--fill-strong); }
.map-ctl > button.on, .map-ctl > button[aria-pressed="true"] { color: var(--tint-text); }
.compass { border-radius: 50%; }
.compass svg { width: 30px; height: 30px; transition: transform 0.12s linear; }

/* ---------- sheets ---------- */
.sheet {
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
}
.grabber { width: 36px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: var(--fill-strong); }

/* ---------- place cards ---------- */
.place {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 10px;
  border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card);
  color: var(--label); text-decoration: none; text-align: left; border: 0;
  transition: transform 0.18s var(--ease-out);
}
.place:active { transform: scale(0.98); }
.place[aria-current="true"] { box-shadow: 0 0 0 2px var(--tint), var(--shadow-card); }
.place-media, .place-body, .place-title, .place-meta { display: block; }
.place-media {
  aspect-ratio: 3 / 2; width: 100%; border-radius: 10px; overflow: hidden; background: var(--fill);
}
/* lift the capture grade a touch so plates sit right on the light UI */
.place-media img { width: 100%; height: 100%; object-fit: cover; filter: brightness(1.06) saturate(1.06); }
.place-body { padding: 0 6px; }
.place-title { font-size: 15px; line-height: 20px; font-weight: 600; }
.place-title .num { font-weight: 400; color: var(--label-2); }
.place-meta { font-size: 13px; line-height: 18px; color: var(--label-2); }

/* ---------- inset grouped lists ---------- */
.group { border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 16px; }
.row + .row { border-top: 0.5px solid var(--separator); }
.row-grow { flex: 1; min-width: 0; }
.group-head { margin: 22px 16px 7px; font-size: 13px; line-height: 18px; color: var(--label-2); }

/* ---------- data-class badges: glyph shape carries the class ---------- */
.cls { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cls::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none;
  border: 1.5px solid currentColor; box-sizing: border-box;
}
.cls-measured::before { background: currentColor; }
.cls-derived::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.cls-modeled::before { border-style: dashed; }
.cls-authored::before { border-radius: 2px; transform: rotate(45deg) scale(0.85); }

/* ---------- controls ---------- */
input[type="range"] { width: 100%; margin: 0; accent-color: var(--tint); }
.switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none;
  width: 51px; height: 31px; margin: 0; border-radius: 999px; background: var(--fill-strong);
  transition: background-color 0.2s; cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.22s var(--ease);
}
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 2px;
  border-radius: 9px; background: var(--fill);
}
.seg button {
  min-height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--label);
  font-size: 13px; font-weight: 500; transition: background-color 0.2s, box-shadow 0.2s;
}
.seg button[aria-pressed="true"], .seg button.on {
  background: var(--surface); font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90;
  max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none;
  transform: translate(-50%, 8px); transition: opacity 0.2s, transform 0.25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- dropped pin ---------- */
.pin { position: absolute; left: 0; top: 0; z-index: 12; pointer-events: none; will-change: transform; }
.pin-head {
  position: absolute; left: -15px; top: -40px; width: 30px; height: 40px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.callout {
  position: absolute; left: 0; bottom: 48px; transform: translateX(-50%);
  width: max-content; max-width: min(280px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px; border-radius: var(--r-card); pointer-events: auto;
  font-size: 15px; line-height: 20px;
}
.callout-head { display: flex; align-items: baseline; gap: 10px; }
.callout-title { font-weight: 600; }
.callout-close { margin: -8px -8px -8px auto; width: 32px; height: 32px; color: var(--label-2); }
.callout .t-foot { margin-top: 2px; }

/* ---------- map labels over terrain ---------- */
.map-label { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -100%); opacity: 0; will-change: transform, opacity; }
.map-label .name {
  padding-bottom: 5px; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.85), 0 1px 4px rgba(0, 0, 0, 0.6);
}
.map-label .leader { width: 1.5px; height: 26px; background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); }
.map-label .dot { width: 9px; height: 9px; margin-top: -1px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }

/* ---------- reading pages ---------- */
.doc { max-width: 720px; margin: 0 auto; padding: 0 20px 64px; }
.doc h1 { font-family: var(--font-display); font-size: clamp(30px, 6vw, 40px); line-height: 1.12; font-weight: 700; letter-spacing: -0.022em; margin: 28px 0 14px; text-wrap: balance; }
.doc h2 { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.015em; margin: 40px 0 10px; text-wrap: balance; }
.doc h3 { font-size: 17px; line-height: 22px; font-weight: 600; margin: 24px 0 6px; }
.doc p, .doc li { max-width: 68ch; font-size: 17px; line-height: 1.55; }
.doc p + p { margin-top: 12px; }
.doc ul { list-style: disc; padding-left: 1.2em; }
.doc li + li { margin-top: 6px; }
.doc .lede { font-size: 19px; line-height: 1.5; color: var(--label-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
