/* shell.css - the ONE token set and the ONE header for every surface.
 *
 * A page may ADD tokens; it may never redefine these. The reason the surfaces
 * read as "assembled" rather than built is that each page declared its own
 * ink, paper, hair and yellow, and they disagreed.
 *
 * Danfo yellow is CHROME ONLY: primary action, active tab, selected chip. It
 * is never a data colour - the map's red/amber/green must never be mistaken
 * for the brand.
 */
:root {
  --danfo:#ffc800;
  /* The gate greps for this exact form (tests/run.sh: the danfo-yellow
     primary is the app primary) - no space after the colon, ever. */
  --primary:#ffc800;
  --ink:     #1b1511;
  --paper:   #f6efe1;
  --strip:   #fdfaf3;
  --hair:    #e9e2d3;
  --muted:   #667085;
  --red:     #d7263d;
  --green:   #12b76a;
  /* Warning is a DEEPER orange, never #f5a524. A second yellow beside danfo
     made a "slow" road and the brand accent read as the same signal. */
  --warn:    #e07b00;
  /* Canonical brand surfaces. Asphalt is chrome and the OG background; the two
     steps exist so cards, sheets and disabled states do not collapse into one
     flat block. Do not invent a third step, and never repaint a surface that
     the data colours sit on. */
  --asphalt:  #181410;
  --surface-1:#221c17;
  --surface-2:#2c241d;
  --amber:    var(--warn);
  --topbar-h: calc(70px + env(safe-area-inset-top));
  --attrib-h: 26px;
  --zoom-h:   220px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
/* For a heading or label that belongs to the document but not to the screen. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a { color: inherit; text-decoration: none; }

/* --- the header: brand left, ONE nav right -------------------------------- */
.shell-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border-bottom: 1px solid var(--hair);
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
}
.shell-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.shell-brand img { width: 44px; height: 44px; display: block; }
.shell-brand .word { font-size: 20px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; }
.shell-brand .sub {
  font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; flex: 0 0 auto;
}
.shell-nav {
  display: flex; gap: 2px; background: #faf6ec; border: 1px solid var(--hair);
  border-radius: 999px; padding: 3px; flex: 0 0 auto;
}
.shell-nav a {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  color: #5c564c; white-space: nowrap;
}
.shell-nav a[aria-current="page"] { background: var(--primary); color: var(--ink); }
.shell-nav a:active { opacity: .8; }

@media (max-width: 430px) {
  :root { --topbar-h: calc(52px + env(safe-area-inset-top)); }
  .shell-top { padding-left: 10px; padding-right: 10px; }
  .shell-brand img { width: 30px; height: 30px; }
  .shell-brand .word { font-size: 15.5px; }
  .shell-brand .sub { font-size: 9.5px; letter-spacing: .15px; margin-left: 2px; }
  .shell-nav a { font-size: 10px; padding: 3px 6px; }
}

/* --- mobile: the map is the page, the sheet is the menu ---------------------
 * At 800px the desktop arrangement was being squeezed, not changed: the second
 * legend, its collapsed key and the zoom stack all floated over the road the
 * user came to see. They are desktop furniture. The sheet is the phone's menu.
 */
@media (max-width: 800px) {
  #roads-legend, #roads-key { display: none !important; }
  /* Zoom + GPS stay: they are the only way to move the camera without a
     pinch, and they now sit in the top-right column where nothing covers them. */
  #sheet { max-height: 46vh; }
}

@media (max-width: 340px) {
  :root { --topbar-h: calc(48px + env(safe-area-inset-top)); }
  .shell-brand img { width: 28px; height: 28px; }
  .shell-brand .word { font-size: 14.5px; }
  .shell-brand .sub { font-size: 8.5px; letter-spacing: 0; }
  .shell-nav a { font-size: 9px; padding: 2px 4px; }
}
