/* esigatavs.lv — the sticky navbar (DESIGN-ROOM §10). Self-contained: its own tokens, "eb-"
   classes only, so /now/, /checklist/ and /first-hour/ can include it next to their own CSS.
   The theme follows the device on a first visit (night when it says nothing) and the reader's choice
   after that (data-theme, set by js/theme.js; the button says "Day" or "Night").
   Phone (< 1024 px): row 1 = wordmark · day/night · language; row 2 = the four modes, each with a
   one-word subtitle. SIRENS NOW, 112 and Where to go (/map/) sit in a dock at the bottom of the screen, in
   thumb reach; while a sheet is open the sheet's own foot carries SIRENS NOW and 112 (room.css).
   Desktop: one 64 px row = wordmark · modes · SIRENS NOW · 112 · Walk · night/day · language.
   Amber is spent once: SIRENS NOW. The active mode is ink with an underline; Walk is an outline. */
/* ONE token set for every page (craft review): colours, the two font stacks and the type scale.
   Every stylesheet (room.css, site.css, first-hour.css) reads these; none redefines them. */
:root {
  --bg: #0B1220; --ink: #F4F1EA; --muted: #A3ACBB; --rule: rgba(244, 241, 234, .18); --lit: #F2A900; --on-lit: #0B1220;
  --sans: "Inter", "Inter var", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  /* the type scale: 14 / 17 / 21 / 26 / 36 px, nothing a reader needs below 14 px (--t2 is the small UI step) */
  --t1: 14px; --t2: 14px; --t3: 17px; --t4: 21px; --t5: 26px; --t6: 36px;
  color-scheme: dark;
}
:root[data-theme="light"] { --bg: #F6F4EF; --ink: #1F1D1A; --muted: #4F545D; --rule: rgba(31, 29, 26, .2); --lit: #0F5F6B; --on-lit: #F6F4EF; color-scheme: light; }
/* JavaScript off: no theme script ran, so the device decides (light devices get the day theme) */
@media (prefers-color-scheme: light) { :root:not([data-theme]) { --bg: #F6F4EF; --ink: #1F1D1A; --muted: #4F545D; --rule: rgba(31, 29, 26, .2); --lit: #0F5F6B; --on-lit: #F6F4EF; color-scheme: light; } }
.eb {
  --eb-bg: var(--bg); --eb-ink: var(--ink); --eb-muted: var(--muted); --eb-rule: var(--rule); --eb-lit: var(--lit); --eb-on-lit: var(--on-lit);
  position: sticky; top: 0; z-index: 40; background: var(--eb-bg); color: var(--eb-ink);
  border-bottom: 1px solid var(--eb-rule);
  font: 400 var(--t1)/1.2 var(--sans);
}
/* JavaScript off (js/theme.js swaps no-js for js before the first paint): the controls that need it hide.
   The modes re-light the Room and Walk the flat steps through it; without JS the home page is the list. */
.no-js .eb-modes, .no-js .eb-walk, .no-js .eb-theme { display: none !important; }
/* The bar's height, for pages that stick something below it or offset anchors (scroll-padding). */
:root { --eb-h: 92px; --dock-h: 0px; }
/* One type scale (craft review): every page's h1 is this one token, weight 500 */
:root { --h1: var(--t5); }
@media (min-width: 1024px) { :root { --h1: var(--t6); } }
@media (max-width: 1023.98px) { :root { --dock-h: 61px; } body { padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); } }
@media (min-width: 1024px) { :root { --eb-h: 65px; } }
/* (the scripts replace the --eb-h fallbacks with the bar's measured height) */
.eb *, .eb *::before, .eb *::after { box-sizing: border-box; }
.eb a { color: inherit; text-decoration: none; }
.eb a:focus-visible, .eb button:focus-visible { outline: 2px solid var(--eb-ink); outline-offset: 2px; }
.eb svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.eb-in {
  display: grid; align-items: center; column-gap: 8px;
  grid-template-columns: 1fr auto auto auto; grid-template-areas: "mark walk theme lang" "modes modes modes modes";
  max-width: 1600px; margin: 0 auto; padding: 0 16px;
}
.eb-mark { grid-area: mark; display: inline-flex; align-items: center; min-height: 44px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.eb-mark span { color: var(--eb-muted); font-weight: 400; }
.eb-theme {
  grid-area: theme; display: inline-flex; align-items: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 10px; cursor: pointer;
  border: 1px solid var(--eb-rule); border-radius: 4px; background: transparent; color: var(--eb-ink);
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1;
}
.eb-tw { font-size: 14px; }
/* the button shows what it switches to: a sun and "Day" at night, a moon and "Night" by day */
.eb-theme .eb-moon { display: none; }
:root[data-theme="light"] .eb-theme .eb-moon { display: block; }
:root[data-theme="light"] .eb-theme .eb-sun { display: none; }
/* EN is a marker, not a control, until a Latvian edition exists: plain text, no box */
.eb-lang { grid-area: lang; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px 0 6px; color: var(--eb-muted); font-family: inherit; font-size: 14px; font-weight: 400; line-height: 1; cursor: default; }
.eb-maplink { display:none; color:var(--eb-ink); font:500 14px/1.1 var(--sans); text-decoration:underline; text-underline-offset:.2em; }
/* the language marker says Latvian is coming (desktop; phones keep it in the title and for screen readers) */
.eb-ln { display: none; margin-left: 6px; font-size: 14px; color: var(--eb-muted); white-space: nowrap; }
@media (min-width: 1440px) { .eb-ln { display: inline; } }
.eb-modes { grid-area: modes; display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; margin: 0 -16px; padding: 0 12px; border-top: 1px solid var(--eb-rule); }
.eb-modes a {
  display: grid; place-content: center; justify-items: center; row-gap: 2px; min-height: 46px; min-width: 44px; padding: 2px 6px 0; white-space: nowrap; border-bottom: 3px solid transparent;
  color: var(--eb-muted);
}
.eb-ml { font: 600 var(--t1)/1 var(--mono); letter-spacing: .04em; color: var(--eb-ink); opacity: .78; }
/* the one-word subtitle says what a mode is (pensioner review): Sirens, Blackout, Evacuate, Facts */
.eb-sub { font: 400 var(--t1)/1.05 var(--sans); color: var(--eb-muted); }
.eb-modes a[aria-current="true"] { border-bottom-color: var(--eb-ink); }
.eb-modes a[aria-current="true"] .eb-ml { opacity: 1; font-weight: 700; }
.eb-modes a[aria-current="true"] .eb-sub { color: var(--eb-ink); }
.eb-modes a:not([aria-current="true"]):hover { color: var(--eb-ink); }

/* the actions: a bottom dock on phones, inline on desktop */
.eb-act {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 6px;
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); background: var(--eb-bg); border-top: 1px solid var(--eb-rule);
}
.eb-sirens, .eb-112, .eb-walk { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 8px; border-radius: 4px; text-align: center; }
.eb-sirens { min-width: 76px; padding: 0 10px; }
@media (max-width: 1023.98px) { .eb-sirens { max-width: 88px; } }
.eb-sirens svg { display: none; }
.eb-sirens { background: var(--eb-lit); color: var(--eb-on-lit) !important; font-weight: 700; font-size: var(--t1); letter-spacing: .02em; line-height: 1.05; }
/* 112 + the §11 note, side by side: "Gas, fire, unexploded shells, injury: yes. Questions: no." (never a half rule) */
.eb-112 { border: 1px solid var(--eb-ink); gap: 10px; padding: 2px 10px; justify-content: flex-start; text-align: left; }
.eb-112n { font-weight: 700; font-size: 17px; line-height: 1; white-space: nowrap; }
.eb-112t { font-size: 14px; line-height: 1.1; color: var(--eb-ink); white-space: normal; }
.eb-112t > span, .sf-note > span { display: block; text-wrap: balance; }
/* the whole rule and the note: on hover or keyboard focus (desktop) and on a long press (phones) */
.eb-112, [data-112] { position: relative; }
.eb-112p {
  position: absolute; z-index: 45; right: 0; bottom: calc(100% + 8px); width: min(300px, 80vw); padding: 10px 12px; text-align: left;
  border: 1px solid var(--eb-ink, currentColor); border-radius: 4px; background: var(--eb-bg, var(--bg, #0B1220)); color: var(--eb-ink, inherit); font-size: 14px; font-weight: 400; line-height: 1.35; white-space: normal; visibility: hidden;
}
.eb-112p b { display: block; margin-bottom: 4px; font-size: 14px; }
[data-112].show-note .eb-112p { visibility: visible; }
.eb-112.show-note .eb-112p { visibility: visible; }
.eb-call { display: none; }
.eb-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Where to go (/map/) on phones: the dock's third cell, a pin pictogram over its label, so the map is one tap
   away on every page at every width (the desktop row has .eb-maplink instead). The 112 note keeps its three
   lines and the dock its height (chrome budget), so the label folds with the width: "Where / to go" from
   360 px, one line from 480 px, "Map" below 360 px (where "Where to go" stays in the name, visually hidden). */
.eb-map {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; min-height: 48px;
  padding: 0 6px; border: 1px solid var(--eb-rule); border-radius: 4px; color: var(--eb-ink); font: 500 14px/1 var(--sans); text-align: center;
}
.eb-mapl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eb-mapl > span { display: block; white-space: nowrap; }
@media (min-width: 360px) { .eb-mapl { position: static; width: auto; height: auto; overflow: visible; clip-path: none; } .eb-maps { display: none; } }
@media (min-width: 480px) { .eb-map { flex-direction: row; gap: 6px; padding: 0 12px; } .eb-mapl > span { display: inline; } }
/* Walk the flat: on phones it sits in the bar's first row (the dock keeps SIRENS NOW and 112 only) */
.eb-walk { grid-area: walk; border: 1px solid var(--eb-rule); font-weight: 500; font-size: 14px; gap: 6px; line-height: 1.05; min-height: 40px; margin: 2px 0; padding: 0 10px; white-space: nowrap; }
.eb-walk .eb-ws { display: none; }
.eb-act a[aria-current="page"] { outline: 2px solid var(--eb-ink); outline-offset: 2px; }
@media (min-width: 480px) and (max-width: 1023.98px) {
  .eb-sirens svg { display: block; }
}
/* narrow phones: the theme button keeps its word (Day/Night; pensioner review, pass 7), Walk keeps its words */
@media (max-width: 399.98px) { .eb-theme { padding: 0 8px; gap: 4px; } .eb-walk svg { display: none; } .eb-walk { padding: 0 10px; } }
@media (max-width: 359.98px) { .eb-theme svg { display: none; } }

@media (max-width: 359.98px) {
  /* the 112 note ("…unexploded shells…", pass 7) stays three lines, so the dock keeps the chrome budget */
  .eb-sirens { min-width: 70px; max-width: 74px; padding: 0 6px; }
  .eb-112 { gap: 7px; padding: 2px 7px; }
  .eb-112t > span { text-wrap: wrap; }
  .eb-in { padding: 0 10px; }
  .eb-modes { margin: 0 -10px; padding: 0 4px; }
  .eb-modes a { padding: 3px 3px 2px; }
  .eb-ml { letter-spacing: 0; }
  .eb-theme { padding: 0 8px; }
  .eb-act { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .eb-walk { padding: 0 8px; }
  .eb-walk svg { display: none; }
  .eb-112t { line-height: 1.05; }
  .eb-mark { font-size: var(--t2); }
}
/* the room the dock's third cell takes: SIRENS NOW at its two-line width, 112 and the dock a little tighter */
@media (max-width: 479.98px) { .eb-sirens { max-width: 76px; padding: 0 8px; } .eb-112 { gap: 7px; padding: 2px 6px; } }
@media (max-width: 374.98px) {
  .eb-act { gap: 3px; padding-left: 3px; padding-right: 3px; }
  .eb-sirens { min-width: 0; max-width: 64px; padding: 0 2px; }
  .eb-112 { gap: 5px; padding: 2px; }
}
@media (max-width: 359.98px) { .eb-map { width: 44px; padding: 0; } }
@media (min-width: 1024px) {
  .eb-in {
    grid-template-columns: auto 1fr auto auto auto auto auto; grid-template-areas: "mark modes map act walk theme lang";
    column-gap: 12px; min-height: 64px; padding: 0 24px;
  }
  .eb-maplink { display:inline-flex; grid-area:map; align-items:center; min-height:44px; white-space:nowrap; }
  .eb-map { display: none; }
  .eb-modes { display: flex; justify-content: center; margin: 0; padding: 0; border: 0; gap: 4px; }
  .eb-modes a { padding: 0 12px; min-height: 63px; }
  .eb-sub { display: none; }
  .eb-112p { bottom: auto; top: calc(100% + 8px); }
  .eb-112:hover .eb-112p, .eb-112:focus-visible .eb-112p { visibility: visible; }
  .eb-act { grid-area: act; position: static; display: flex; gap: 10px; padding: 0; border: 0; background: none; }
  .eb-sirens, .eb-112, .eb-walk { min-height: 44px; padding: 0 14px; white-space: nowrap; }
  .eb-112 { flex-direction: row; gap: 8px; border-color: var(--eb-rule); position: relative; }
  .eb-call { display: inline; }
  .eb-112 { min-height: 52px; padding: 2px 12px; }
  .eb-112t { font-size: 14px; line-height: 1.1; color: var(--eb-ink); max-width: 20ch; text-wrap: balance; }
  .eb-walk { gap: 8px; border-color: var(--eb-rule); margin: 0; }
  .eb-walk .eb-ws { display: none; } .eb-walk .eb-wl { display: inline; }
}
/* 1024–1279: the 112 note shows on hover, focus or long-press (spec §10), so the row stays one line */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .eb-in { column-gap: 8px; padding: 0 16px; }
  .eb-modes a { padding: 0 8px; }
  .eb-theme .eb-tw { display: none; } .eb-theme { width: 44px; padding: 0; justify-content: center; }
}
/* 1024–1439: "Where to go" joined the bar, so Walk the flat folds to its icon (its aria-label keeps the name)
   and the bar stays one row with no horizontal overflow on every page, /map/ included (UX-14) */
@media (min-width: 1024px) and (max-width: 1439.98px) {
  .eb-in { column-gap: 8px; padding: 0 16px; }
  .eb-modes a { padding: 0 8px; }
  .eb-walk { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .eb-walk .eb-ws, .eb-walk .eb-wl { display: none; }
}
/* wide: the note's first sentence on one line, "Questions: no." under it */
@media (min-width: 1280px) { .eb-112t { max-width: none; } .eb-112t > span:first-child { white-space: nowrap; } }
/* phones: while a sheet is open the dock steps aside; the sheet's own foot carries SIRENS NOW and 112 */
@media (max-width: 1023.98px) { html.sheet-open .eb-act { display: none; } html.sheet-open body { padding-bottom: 0; } }
@media (max-width: 1023.98px) { .eb-walk { min-height: 44px; margin: 0; } }
/* phones, chrome budget (stress gate, ≤ 25 % of the screen in every state): while a sheet is open the bar
   folds to its mode row (the sheet carries its own head, SIRENS NOW and 112); while the First Hour plays,
   the mode row folds instead and its instruments sit under the wordmark row */
@media (max-width: 1023.98px) {
  html.sheet-open .eb-mark, html.sheet-open .eb-walk, html.sheet-open .eb-theme, html.sheet-open .eb-lang { display: none; }
  body.is-playing .eb-modes { display: none; }
}
/* the mode row stays at every scroll position, a sheet or a walk open too (§10): a mode tap re-lights the
   open panel in place. Keyboard focus never lands under the bar or the dock (scroll-padding, WCAG 2.4.11). */
@media (max-width: 1023.98px) { html { scroll-padding-bottom: calc(var(--dock-h) + 16px); } }
/* paper is white with black ink whatever the screen theme (craft gate): the canvas, the page margins
   (color-scheme decides their colour in Chrome) and every token */
@media print {
  :root, :root[data-theme] { color-scheme: light !important; --bg: #fff; --ink: #000; --muted: #333; --rule: #999; --lit: #000; --on-lit: #fff; }
  html, body { background: #fff !important; color: #000 !important; }
  /* the wordmark, the title and the list share one left edge on paper */
  .eb-in { padding-left: 0 !important; padding-right: 0 !important; max-width: none; }
}
@media print { .eb { position: static; background: #fff; color: #000; border-color: #999; } .eb-modes, .eb-act, .eb-walk, .eb-theme, .eb-lang { display: none !important; } .eb-mark span { color: #333; } body { padding-bottom: 0 !important; } }
