/* Waypoint — styled for the Meta Ray-Ban Display (600×600, additive light).
   Black = transparent to the wearer, so the canvas is pure black and only
   the information you need is lit. */

:root {
  --bg: #000;
  --text: #f2f5f7;
  --dim: #8d98a3;
  --accent: #4fe3c1;      /* aqua: bright on an additive display */
  --accent-ink: #00110c;
  --warn: #ffb547;
  --danger: #ff6b6b;
  --surface: #12171b;
  --surface-2: #1c2328;
  --line: #2a333a;
  --radius: 18px;
  --gutter: 5vmin;
  font-size: clamp(16px, 3.6vmin, 26px);
}

* { box-sizing: border-box; }

html, body, #app {
  inline-size: 100%;
  block-size: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.3;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell { position: relative; overflow: hidden; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--gutter);
  gap: 0.8rem;
}
.screen[hidden] { display: none; }

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

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- brand (doubles as the location status button) ---------- */
:root { --ok: #4cd97b; }
.home-head { display: flex; align-items: center; gap: 0.6rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--accent); background: transparent;
  border: 0; border-radius: 999px;
  padding: 0.25rem 0.9rem 0.25rem 0.3rem;
  cursor: pointer;
}
/* Location status is shown by the colour of the word "Waypoint":
   white = all good (or still finding you), red = a problem — select it for details. */
.brand .brand-name { transition: color 0.4s ease; }
.brand.bad .brand-name { color: var(--danger); }
.brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.brand-mark { width: 2.1rem; height: 2.1rem; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: 0.02em; color: #ffffff; }

/* ---------- header buttons, chips ---------- */
.icon-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 0; border-radius: 999px;
  background: var(--surface);
  padding: 0.55rem 1rem 0.55rem 0.8rem;
  font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap;
  cursor: pointer;
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; color: var(--accent); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.chip {
  border: 0; border-radius: 999px;
  background: var(--surface);
  padding: 0.45rem 0.2rem;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:focus-visible { background: var(--surface-2); color: var(--accent); }

.heard { margin: -0.3rem 0.2rem 0; font-size: 0.85rem; color: var(--dim); }
.heard b { color: var(--text); font-weight: 600; }
.grow { flex: 1 1 auto; }
.topbar .search input { font-size: 1.05rem; padding: 0.5rem 0.9rem; }

/* ---------- location badge + help ---------- */
.kv .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--warn); flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.8rem; margin: 0.2rem 0.2rem 0.6rem; font-size: 0.9rem; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; font-weight: 600; }
.help { background: var(--surface); border-radius: var(--radius); padding: 0.6rem 0.9rem; font-size: 0.8rem; }
.scroll:focus-visible { outline: 2px solid var(--line); border-radius: var(--radius); }
.help p { margin: 0.2rem 0; }
.help ol { margin: 0.3rem 0; padding-left: 1.2rem; }
.help li { margin: 0.15rem 0; }

/* ---------- phone pairing ---------- */
.phone-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 0.2rem; }
.phone-body .hint { margin: 0.2rem; }
.phone-url { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text); word-break: break-all; }
.phone-code { margin: 0.2rem 0 0.4rem; font-size: 2.8rem; font-weight: 800; letter-spacing: 0.08em; color: var(--accent); font-variant-numeric: tabular-nums; }
.phone-status { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--dim); margin: 0.3rem 0 0; }
.phone-status .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--warn); }
.phone-status.on .dot { background: var(--accent); }

/* ---------- search ---------- */
.search input {
  width: 100%;
  font: inherit;
  font-size: 1.2rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--dim); }

/* ---------- lists ---------- */
.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 3px; /* room for focus ring */
}
.scroll::-webkit-scrollbar { display: none; }

.section-label {
  margin: 0.6rem 0 0.35rem 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
}

.list { display: flex; flex-direction: column; gap: 0.45rem; }

.item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}
.item:focus-visible { background: var(--surface-2); }
.item .ico {
  flex: 0 0 auto;
  width: 1.6rem; height: 1.6rem;
  color: var(--accent);
}
.item .txt { min-width: 0; flex: 1 1 auto; }
.item .name {
  display: block; font-weight: 600; font-size: 1.05rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item .sub {
  display: block; color: var(--dim); font-size: 0.82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item .meta { flex: 0 0 auto; color: var(--dim); font-size: 0.85rem; }

.hint { color: var(--dim); font-size: 0.9rem; margin: 0.4rem 0.2rem; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 0.6rem; }
.back {
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  font-size: 1.6rem; line-height: 1;
  padding-bottom: 0.15rem;
  cursor: pointer;
}
.title { margin: 0; font-size: 1.15rem; font-weight: 600; }

/* ---------- preview ---------- */
.preview-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 0.3rem; }
.pv-name { margin: 0; font-size: 1.55rem; line-height: 1.15; }
.pv-addr { margin: 0; color: var(--dim); font-size: 0.95rem; }
.pv-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  margin-top: 1rem;
}
.pv-stats > div {
  background: var(--surface); border-radius: var(--radius);
  padding: 0.6rem; text-align: center;
  display: flex; flex-direction: column;
}
.big { font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.small { font-size: 0.75rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }

.actions { display: flex; gap: 0.6rem; }
.btn {
  flex: 1 1 0;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { background: var(--surface-2); color: var(--dim); }
.btn.danger { color: var(--danger); }

/* ---------- navigation ---------- */
.nav { gap: 0.5rem; }
.nav-focus {
  position: absolute; inset: 0;
  background: transparent; border: 0; opacity: 0;
  z-index: 0;
}
.nav-focus:focus-visible { outline: none; }
.instr, .map-wrap, .navbar, .peek-tag { position: relative; z-index: 1; pointer-events: none; }

.instr {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}
.instr.peek { outline: 2px dashed var(--dim); }
.instr.soon .instr-icon { color: #fff; }
.instr-icon {
  flex: 0 0 auto;
  width: 5.2rem; height: 5.2rem;
  color: var(--accent);
}
.instr-text { min-width: 0; }
.instr-dist { font-size: 2.3rem; font-weight: 800; line-height: 1; letter-spacing: -0.01em; }
.instr-street {
  font-size: 1.05rem; margin-top: 0.3rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.peek-tag {
  align-self: center; margin-top: -0.2rem;
  font-size: 0.75rem; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}

.map-wrap { flex: 1 1 auto; min-height: 0; }
#map { width: 100%; height: 100%; display: block; }
.gps-warn {
  position: absolute; top: 0.3rem; left: 0.3rem;
  font-size: 0.75rem; color: var(--warn);
  border: 1px solid var(--warn); border-radius: 999px; padding: 0.1rem 0.5rem;
}

.navbar {
  display: flex; justify-content: space-between;
  font-size: 1.05rem; font-weight: 600;
  padding: 0 0.3rem;
}
#nav-eta { color: var(--accent); }

.menu {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  padding: var(--gutter);
}
.menu[hidden] { display: none; }
.menu-card { width: 100%; max-width: 22rem; display: flex; flex-direction: column; gap: 0.55rem; }

/* ---------- arrived ---------- */
.arrive { align-items: center; justify-content: center; text-align: center; }
.arrive-mark { width: 7rem; height: 7rem; color: var(--accent); }
.arrive-title { margin: 0.4rem 0 0; font-size: 1.8rem; }
.arrive .actions { width: 70%; margin-top: 1.4rem; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: var(--gutter);
  transform: translateX(-50%);
  max-width: 92%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  z-index: 10;
  text-align: center;
}
.toast[hidden] { display: none; }
/* During navigation, messages sit just under the instruction card, clear of the stats. */
.toast.on-nav { bottom: auto; top: calc(var(--gutter) + 7.6rem); font-size: 0.85rem; }
input[type=search]::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
