/* Lantern visitor app — Material 3 look, accessibility first.
   % root size so the phone's text-size setting still scales everything (22px at default). */
html { font-size: 137.5%; -webkit-text-size-adjust: 100%; }

:root {
  color-scheme: light dark;
  /* Material 3 tokens (Google blue). Every text pair is ≥7:1 (WCAG AAA). */
  --bg: #ffffff;
  --surface-1: #f0f4f9;
  --surface-2: #e9eef6;
  --on-surface: #1f1f1f;
  --on-surface-var: #444746;
  --outline: #747775;
  --outline-var: #c4c7c5;
  --primary: #0842a0;
  --on-primary: #ffffff;
  --primary-cont: #d3e3fd;
  --on-primary-cont: #041e49;
  --ok-cont: #c4eed0;   --on-ok-cont: #072711;
  --err-cont: #ffdad6;  --on-err-cont: #410e0b;
  --warn-cont: #ffdf99; --on-warn-cont: #251a00;
  /* Destination colours (always paired with a word, never alone). */
  --blue: #d3e3fd;   --on-blue: #041e49;
  --green: #c4eed0;  --on-green: #072711;
  --orange: #ffdcc1; --on-orange: #2e1500;
  --purple: #e9ddff; --on-purple: #22005d;
  --teal: #bcebe4;   --on-teal: #00201d;
  --focus: #0b57d0;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 1px 3px 1px rgb(0 0 0 / 0.15);
  --r-xl: 1.25rem; --r-l: 1rem; --r-m: 0.75rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314;
    --surface-1: #1e1f20;
    --surface-2: #282a2c;
    --on-surface: #e3e3e3;
    --on-surface-var: #c4c7c5;
    --outline: #8e918f;
    --outline-var: #444746;
    --primary: #a8c7fa;
    --on-primary: #062e6f;
    --primary-cont: #0842a0;
    --on-primary-cont: #d3e3fd;
    --ok-cont: #0f5223;   --on-ok-cont: #c4eed0;
    --err-cont: #8c1d18;  --on-err-cont: #ffdad6;
    --warn-cont: #5c4300; --on-warn-cont: #ffdf99;
    --blue: #0842a0;   --on-blue: #d3e3fd;
    --green: #0f5223;  --on-green: #c4eed0;
    --orange: #6e3900; --on-orange: #ffdcc1;
    --purple: #4f378b; --on-purple: #e9ddff;
    --teal: #00504a;   --on-teal: #bcebe4;
    --focus: #a8c7fa;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.6);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--on-surface);
  /* Roboto ships on every Android phone, so no font download is needed offline. */
  font: 400 1rem/1.5 Roboto, "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 34rem; margin: 0 auto; padding: 0.5rem 0.75rem 2.5rem; outline: none; }
h1 { font-size: 1.45rem; font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; margin: 0.75rem 0 0.75rem; }
h2 { font-size: 1.1rem; font-weight: 500; margin: 1.25rem 0 0.5rem; color: var(--on-surface-var); }
h1:focus, h1:focus-visible { outline: none; box-shadow: none; } /* focused only so screen readers announce the new screen */
p { margin: 0 0 0.75rem; }
img { max-width: 100%; display: block; }
.muted, .loading { color: var(--on-surface-var); }
svg.i { width: 1.2em; height: 1.2em; fill: currentColor; flex: none; }

:focus-visible { outline: 0.2rem solid var(--focus); outline-offset: 0.15rem; }

/* ---------- Buttons: pill shape, icon + word, ≥ 64px tall ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; min-height: 3rem; padding: 0.5rem 1.25rem; margin: 0 0 0.75rem;
  font: inherit; font-weight: 500; letter-spacing: 0.01em; text-align: center; text-decoration: none;
  color: var(--primary); background: transparent;
  border: 1px solid var(--outline); border-radius: 999px; cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn:active { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.btn.filled { color: var(--on-primary); background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow); }
.btn.filled:hover { background: color-mix(in srgb, var(--on-primary) 8%, var(--primary)); }
.btn.filled:active { background: color-mix(in srgb, var(--on-primary) 14%, var(--primary)); }
.btn.tonal { color: var(--on-primary-cont); background: var(--primary-cont); border-color: transparent; }
.btn.text { border-color: transparent; }
.btn.xl { min-height: 4rem; font-size: 1.2rem; font-weight: 500; }
.btn[hidden] { display: none; }

.topbar { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0 -0.25rem; }
.topbar .btn { width: auto; margin: 0; padding: 0.5rem 1rem; }

/* ---------- Status banner (home) ---------- */
.status {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; margin: 0 0 1.25rem;
  border-radius: var(--r-l); background: var(--surface-2); color: var(--on-surface); font-weight: 500;
}
.status svg.i { width: 1.6rem; height: 1.6rem; }
.status.ok { background: var(--ok-cont); color: var(--on-ok-cont); }
.status.err { background: var(--err-cont); color: var(--on-err-cont); }
.spinner { width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%;
  border: 0.2rem solid var(--outline-var); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero .logo { width: 5.5rem; height: 5.5rem; margin: 0 auto 0.75rem; border-radius: 1.5rem; box-shadow: var(--shadow); }
.hero h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
.hero p { color: var(--on-surface-var); }
.how { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.75rem; }
.how li { display: flex; align-items: center; gap: 0.75rem; color: var(--on-surface-var); }
.how .num { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--on-surface); font-weight: 700; }

/* ---------- Big choice cards (where are you / where to) ---------- */
.choices { display: grid; gap: 0.75rem; margin: 0 0 1rem; }
.choice {
  display: flex; align-items: center; gap: 1rem; min-height: 3.6rem; padding: 0.75rem 1rem;
  color: var(--on-surface); text-decoration: none; background: var(--surface-1);
  border: 1px solid var(--outline-var); border-radius: var(--r-xl);
  transition: background-color 0.15s;
}
.choice:hover { background: var(--surface-2); }
.choice:active { background: color-mix(in srgb, var(--on-surface) 10%, var(--surface-1)); }
.choice .ic { width: 3rem; height: 3rem; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-cont); color: var(--on-primary-cont); }
.choice .ic svg.i { width: 1.6rem; height: 1.6rem; }
.choice .txt { flex: 1; min-width: 0; }
.choice .title { display: block; font-size: 1.1rem; font-weight: 500; line-height: 1.3; }
.choice .sub { display: block; font-size: 0.85rem; color: var(--on-surface-var); line-height: 1.35; margin-top: 0.15rem; }
.choice .chev { color: var(--on-surface-var); }
.choice.big { min-height: 6rem; padding: 1rem 1.1rem; }
.choice.big .ic { width: 3.6rem; height: 3.6rem; }
.choice.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: var(--shadow); }
.choice.primary .sub, .choice.primary .chev { color: var(--on-primary); }
.choice.primary .ic { background: var(--on-primary); color: var(--primary); }
.choice.primary:hover { background: color-mix(in srgb, var(--on-primary) 8%, var(--primary)); }
.tone-blue .ic   { background: var(--blue);   color: var(--on-blue); }
.tone-green .ic  { background: var(--green);  color: var(--on-green); }
.tone-orange .ic { background: var(--orange); color: var(--on-orange); }
.tone-purple .ic { background: var(--purple); color: var(--on-purple); }
.tone-teal .ic   { background: var(--teal);   color: var(--on-teal); }

/* "You are at" chip */
.here {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; margin: 0.5rem 0 0;
  border-radius: var(--r-l); background: var(--surface-1);
}
.here img, .here .noimg { width: 4rem; height: 3rem; border-radius: var(--r-m); object-fit: cover; flex: none; }
.here .lbl { font-size: 0.85rem; color: var(--on-surface-var); display: block; }
.here strong { font-weight: 500; }

/* ---------- Photo grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 7rem), 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.tile {
  display: flex; flex-direction: column; text-decoration: none; color: var(--on-surface);
  background: var(--surface-1); border-radius: var(--r-l); overflow: hidden;
  border: 1px solid var(--outline-var);
}
.tile:active { background: var(--surface-2); }
.tile img, .tile .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.tile span { padding: 0.5rem 0.75rem 0.6rem; font-weight: 500; line-height: 1.3; min-height: 2.6rem; }
.noimg { display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--on-surface-var); }
.noimg svg.i { width: 40%; height: 40%; max-width: 3rem; max-height: 3rem; }

/* ---------- Place list ---------- */
.list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.list a {
  display: flex; align-items: center; gap: 0.85rem; min-height: 3.6rem; padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  color: var(--on-surface); text-decoration: none; font-weight: 500;
  background: var(--surface-1); border: 1px solid var(--outline-var); border-radius: var(--r-l);
}
.list a:active { background: var(--surface-2); }
.list img, .list .noimg { width: 4.5rem; height: 3.4rem; flex: none; object-fit: cover; border-radius: var(--r-m); }
.list .txt { flex: 1; min-width: 0; }
.list small { display: block; font-weight: 400; font-size: 0.85rem; color: var(--on-surface-var); }
.list .chev { color: var(--on-surface-var); }

/* ---------- Directions ---------- */
.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  margin: 0.5rem 0 0.4rem; font-size: 0.85rem; color: var(--on-surface-var); }
.progress-row strong { color: var(--on-surface); font-weight: 500; }
.bar { height: 0.35rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 0 0 1rem; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.instruction { font-size: 1.4rem; font-weight: 600; line-height: 1.3; margin: 0 0 0.75rem; }
.notice { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; margin: 0 0 0.75rem;
  border-radius: var(--r-m); background: var(--warn-cont); color: var(--on-warn-cont); font-weight: 500; }
.target { background: var(--surface-1); border-radius: var(--r-xl); overflow: hidden; margin: 0 0 1rem; }
.target img, .target .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.target .cap { padding: 0.75rem 1rem 0.9rem; }
.target .see { display: block; font-size: 0.9rem; color: var(--on-surface-var); }
.target .name { display: block; font-size: 1.3rem; font-weight: 500; line-height: 1.3; }
.row2 { display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.row2 .btn { flex: 1 1 auto; width: auto; padding-inline: 1rem; }

.arrived { text-align: center; padding-top: 1rem; }
.arrived .badge-ok { width: 5.5rem; height: 5.5rem; margin: 0 auto 0.5rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-cont); color: var(--on-ok-cont); }
.arrived .badge-ok svg.i { width: 3.5rem; height: 3.5rem; }
.arrived h1 { margin-bottom: 0.25rem; }
.arrived .dest { font-size: 1.2rem; color: var(--on-surface-var); }

.empty { text-align: center; padding-top: 1.5rem; }
.empty .ic { width: 4.5rem; height: 4.5rem; margin: 0 auto 0.5rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); color: var(--on-surface-var); }
.empty .ic svg.i { width: 2.4rem; height: 2.4rem; }

/* ---------- Scanner ---------- */
.scanner { position: relative; border-radius: var(--r-xl); overflow: hidden; background: #000; margin: 0 0 0.75rem; aspect-ratio: 3 / 4; max-height: 60vh; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border-radius: var(--r-l);
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.35); outline: 0.2rem solid #fff; }
.scanmsg { min-height: 1.5rem; font-weight: 500; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation: none; }
}
