/* The first hour: night-time sibling of the esigatavs.lv stylesheet.
   Local only: system fonts, no external requests, no inline styles. */
/* One system with the Room (DESIGN-ROOM §8): the colours, the two font stacks and the type scale are the
   shared tokens in nav.css (--bg, --ink, --muted, --lit, --sans, --t1 … --t6); this page only adds its own
   surfaces. Night navy by default, the light theme when the reader picks it (js/theme.js). */
:root {
  --canvas: var(--bg); --accent: var(--lit); --on-accent: var(--on-lit);
  --surface: #0F1828; --soft: #162238; --line: #2B3548; --control: #8E97A8; --accent-soft: #2A2410; --alert: #FF9C8A; --alert-soft: #33231F; --track: #2B3548;
  --radius: 3px;
  font: 400 var(--t3)/1.55 var(--sans);
  color: var(--ink);
  background: var(--canvas);
}
:root[data-theme="light"] { --surface: #ffffff; --soft: #ece9e2; --line: #d9d4cb; --control: #777168; --accent-soft: #e7eff0; --alert: #a3362b; --alert-soft: #f7ece8; --track: #d9d4cb; }
/* JavaScript off: no theme script ran, so a light device gets the day tokens */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) { --surface: #ffffff; --soft: #ece9e2; --line: #d9d4cb; --control: #777168; --accent-soft: #e7eff0; --alert: #a3362b; --alert-soft: #f7ece8; --track: #d9d4cb; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.55; background: var(--canvas); color: var(--ink); overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, summary, label { -webkit-tap-highlight-color: transparent; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
q { quotes: "\201C" "\201D"; }

.wrap { width: min(40rem, calc(100% - 32px)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 12px 18px; background: var(--surface); border: 1px solid var(--control); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
main:focus { outline: none; }

/* ---------- instruments (the bar above is the only header) ---------- */
.top { position: sticky; top: var(--eb-h, 0px); z-index: 10; background: var(--canvas); }
body.is-playing .top { border-bottom: 1px solid var(--line); }
.sim-label { display: inline-flex; align-items: center; gap: 7px; margin: 10px 0 0; font-size: var(--t1); color: var(--muted); padding: 3px 10px; border: 1px dashed var(--control); border-radius: 999px; }
.sim-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.restart { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 8px 10px; border: 1px solid var(--control); border-radius: var(--radius); background: transparent; font-size: var(--t1); }
.restart svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 419px) {
  .restart-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (hover: hover) { .restart:hover { background: var(--soft); } }
body:not(.is-playing) .restart { display: none; }

/* One row on phones (clock, a thin ruler, battery), so the first choice stays near the thumb. */
.instruments { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; column-gap: 12px; padding-block: 4px; }
.clock-wrap { line-height: 1; }
.clock { font-size: var(--t5); font-weight: 300; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.clock-sec { font-size: var(--t3); letter-spacing: -.02em; color: var(--muted); margin-left: 2px; }
.battery { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: var(--t3); }
.battery-icon { width: 34px; height: 15px; }
.b-case { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.b-cap { fill: var(--ink); }
.b-fill { fill: var(--ink); }
.battery.is-low .b-fill { fill: var(--alert); }
.battery.is-low #battery-pct { color: var(--alert); }
.ruler-wrap { min-width: 0; grid-column: 2; grid-row: 1; }
.battery { grid-column: 3; grid-row: 1; }
.restart { grid-column: 4; grid-row: 1; }
.ruler { display: block; width: 100%; height: 8px; overflow: visible; }
.r-track { fill: var(--track); }
.r-tick { fill: var(--control); }
.r-now { fill: var(--ink); }
.r-seg.r-good { fill: var(--accent); }
/* "costs time" is an outlined segment, so it never melts into the track */
.r-seg.r-slow { fill: var(--canvas); stroke: var(--ink); stroke-width: 1.25px; vector-effect: non-scaling-stroke; }
.r-seg.r-risk { fill: var(--alert); }
.elapsed { margin-top: 2px; font-size: var(--t1); line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.is-end .ruler-wrap { visibility: hidden; }

/* ---------- intro ---------- */
.intro { padding-block: 20px 40px; }
.intro-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .35em; font-size: var(--h1); line-height: 1.15; }
.intro-clock { font-size: 1em; font-weight: 200; letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--muted); }
.intro h1 { font-size: 1em; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.lead { margin-top: 16px; font-size: var(--t4); line-height: 1.42; letter-spacing: -.012em; max-width: 36ch; }
.rules { margin-top: 22px; display: grid; gap: 10px; font-size: var(--t3); color: var(--muted); }
.rules li { padding-left: 16px; border-left: 2px solid var(--line); max-width: 60ch; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 22px; font-size: var(--t3); }
.toggle input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.toggle-note { font-size: var(--t1); color: var(--muted); margin-left: 36px; }
.loading { margin-top: 18px; color: var(--muted); }

.nojs { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.js .nojs { display: none; }
html:not(.js) .js-only { display: none; }
.nojs h2 { font-size: var(--t4); font-weight: 400; letter-spacing: -.03em; line-height: 1.2; }
.nojs > p { margin-top: 12px; }
.nojs-steps { margin-top: 16px; display: grid; gap: 14px; counter-reset: s; }
.nojs-steps li { padding-left: 34px; position: relative; counter-increment: s; }
.nojs-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- photos ---------- */
.photo { margin-top: 26px; }
.photo img { width: 100%; object-fit: cover; aspect-ratio: 3 / 2; background: var(--soft); }
.p-radio img { aspect-ratio: 4 / 3; object-position: 50% 45%; }
.p-irpin img { aspect-ratio: 4 / 5; object-position: 50% 60%; }
.p-westwards img { aspect-ratio: 16 / 9; }
.p-blackout img { aspect-ratio: 16 / 10; }
.p-blocks img { aspect-ratio: 16 / 10; object-position: 30% 50%; }
.photo figcaption { display: grid; gap: 2px; margin-top: 8px; font-size: var(--t1); line-height: 1.45; }
.photo .place { color: var(--ink); }
.photo .credit { color: var(--muted); }

/* ---------- scenes ---------- */
.stage { padding-block: 16px 56px; }
/* before the simulation starts the stage is empty: no blank block above the closing note (pass 7) */
.stage:empty { padding: 0; }
.scene-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--t1); }
.scene h2 { margin-top: 4px; font-size: var(--t5); font-weight: 400; letter-spacing: -.04em; line-height: 1.12; max-width: 22ch; }
.scene h2:focus, .outcome h3:focus { outline: none; }
.scene h2:focus-visible, .outcome h3:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.scene-text { margin-top: 12px; max-width: 60ch; }
.ask { margin-top: 20px; font-weight: 600; }
@media (max-width: 419px) {
  .sim-alert-body { font-size: var(--t3); line-height: 1.45; }
  .sim-alert-head { font-size: var(--t1); }
  .scene h2 { font-size: var(--t5); }
  .scene .scene-text { margin-top: 10px; line-height: 1.45; }
}

.choices { margin-top: 10px; display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 12px 16px;
  text-align: left; line-height: 1.35;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--control); border-radius: var(--radius);
}
@media (hover: hover) {
  .stage:not(.is-fresh) .choice:hover:not(:disabled), .intro .choice:hover { border-color: var(--accent); background: var(--accent-soft); }
}
.choice:disabled { cursor: default; }
/* a ledger: the options not taken stay visible, struck through */
.choices.is-answered .choice:not(.is-chosen) { color: var(--muted); border-color: var(--line); background: transparent; }
.choice.is-not-taken .choice-label { text-decoration: line-through; text-decoration-thickness: 1px; }
.choice.is-chosen { border: 2px solid var(--accent); padding: 11px 15px; }
.choice.is-chosen::after { content: "Your choice"; margin-left: auto; padding-left: 10px; font-size: var(--t1); color: var(--accent); white-space: nowrap; }

/* simulated alert: visibly an exercise, never a copy of a real broadcast */
.sim-alert { margin-top: 16px; padding: 12px 14px; border: 2px dashed var(--control); border-radius: 10px; background: var(--soft); }
.sim-alert-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--t1); color: var(--muted); }
.sim-alert-body .sim-chip { margin-right: 4px; font-size: var(--t1); vertical-align: 2px; white-space: nowrap; }
.sim-chip { padding: 1px 8px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); font-weight: 600; }
.sim-alert-body { font-size: var(--t3); }
.sim-alert-foot { margin-top: 8px; font-size: var(--t1); color: var(--muted); }
.move { margin-bottom: 14px; padding: 8px 12px; font-size: var(--t1); color: var(--muted); border-left: 3px solid var(--line); font-variant-numeric: tabular-nums; }
.move time { color: var(--ink); }

/* outcome */
.outcome { margin-top: 26px; padding: 4px 0 4px 18px; border-left: 3px solid var(--line); scroll-margin-top: 110px; }
.fact.narrative { font-weight: 500; }
.outcome.k-good { border-left-color: var(--accent); }
.outcome.k-slow { border-left-color: var(--muted); border-left-style: dashed; }
.outcome.k-risk { border-left-color: var(--alert); }
.verdict { display: flex; align-items: center; gap: 8px; font-size: var(--t1); font-weight: 600; }
.k-good .verdict { color: var(--accent); }
.k-slow .verdict { color: var(--muted); }
.k-risk .verdict { color: var(--alert); }
.mark { display: inline-block; width: 11px; height: 11px; flex: 0 0 auto; }
.k-good .mark { background: var(--accent); border-radius: 50%; }
.k-slow .mark { border: 2px solid var(--muted); border-radius: 50%; }
.k-risk .mark { background: var(--alert); transform: rotate(45deg) scale(.85); }
.outcome h3 { margin-top: 8px; font-size: var(--t4); font-weight: 500; letter-spacing: -.015em; line-height: 1.35; }
.fact { margin-top: 10px; max-width: 60ch; }
.delta { margin-top: 12px; font-size: var(--t1); color: var(--muted); font-variant-numeric: tabular-nums; }

.why { margin-top: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 6px; font-size: var(--t1); font-weight: 500; letter-spacing: .05em; line-height: 1.4; border: 1px solid var(--control); border-radius: 2px; color: var(--muted); }
.tag.t-official-lv { color: var(--ink); border-color: var(--ink); background: transparent; }
.tag.t-ukraine { color: var(--ink); }
.why details { margin-top: 8px; }
.why summary { display: flex; align-items: center; min-height: 44px; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: ""; width: 7px; height: 7px; margin-right: 12px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.why details[open] summary::before { transform: rotate(45deg); }
.why-body { display: grid; gap: 16px; padding: 4px 0 8px; font-size: var(--t1); }
.why-card { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.why-title { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.why-id { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.why-card > p + p { margin-top: 6px; }
.why-ua { padding-left: 10px; border-left: 2px solid var(--control); }
.why-sources { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 0 14px; font-size: var(--t1); }
.why-sources a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

.next-row { margin-top: 28px; }
.next, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 18px;
  font-size: var(--t3); font-weight: 500; line-height: 1.2; text-decoration: none;
  border: 1px solid var(--control); border-radius: var(--radius);
  background: transparent; color: var(--ink);
}
.next { width: 100%; background: transparent; color: var(--ink); border: 2px solid var(--ink); font-weight: 600; }
@media (hover: hover) {
  .next:hover, .button.primary:hover { text-decoration: underline; }
  .button:not(.primary):hover { background: var(--soft); }
}
.button.primary { background: transparent; color: var(--ink); border: 2px solid var(--ink); font-weight: 600; }

/* ---------- end ---------- */
.end-ruler { margin-top: 22px; }
.ruler.big { height: 30px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: var(--t1); color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.lg { display: inline-block; width: 18px; height: 10px; flex: 0 0 auto; }
.lg-good { background: var(--accent); }
.lg-slow { background: var(--canvas); border: 1.5px solid var(--ink); }
.lg-risk { background: var(--alert); }
.count { color: var(--muted); font-variant-numeric: tabular-nums; }
.tally { margin-top: 12px; display: grid; }
.tally li { display: grid; grid-template-columns: 3.4rem 1fr; column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.tally li:first-child { border-top: 0; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--t1); padding-top: 1px; }
.tl-choice { display: flex; align-items: baseline; gap: 9px; font-weight: 500; }
.tl-choice .mark { transform: translateY(1px); }
.k-risk .tl-choice .mark { transform: translateY(1px) rotate(45deg) scale(.85); }
.tl-scene { margin-top: 2px; font-size: var(--t1); color: var(--muted); }
.tl-better { margin-top: 4px; font-size: var(--t1); }
.tl-k { font-weight: 600; }
.tl-cards { margin-top: 3px; font-size: var(--t1); color: var(--muted); letter-spacing: .02em; }
.list-h { margin-top: 18px; font-size: var(--t3); font-weight: 600; }
.end-block { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.end-block h3 { font-size: var(--t4); font-weight: 400; letter-spacing: -.03em; }
.review { margin-top: 12px; display: grid; }
.review li { padding: 14px 0 14px 16px; border-left: 3px solid var(--line); }
.review li + li { border-top: 1px solid var(--line); }
.review li.k-good { border-left-color: var(--accent); }
.review li.k-slow { border-left-color: var(--muted); border-left-style: dashed; }
.review li.k-risk { border-left-color: var(--alert); }
.rv-time { font-size: var(--t1); color: var(--muted); font-variant-numeric: tabular-nums; }
.rv-choice { display: flex; align-items: baseline; gap: 9px; margin-top: 3px; font-weight: 500; }
.rv-choice .mark { transform: translateY(1px); }
.k-risk .rv-choice .mark { transform: translateY(1px) rotate(45deg) scale(.85); }
.rv-better { margin-top: 4px; font-size: var(--t1); }
.rv-cards { margin-top: 4px; font-size: var(--t1); color: var(--muted); letter-spacing: .02em; }
.mylist { margin-top: 8px; display: grid; gap: 8px; }
.mylist li { padding: 10px 12px 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.mylist.from-hour li { border-left: 4px solid var(--accent); }
.end-actions { display: grid; gap: 10px; margin-top: 18px; }
@media (min-width: 560px) { .end-actions { display: flex; flex-wrap: wrap; } }
.credits { margin-top: 12px; display: grid; gap: 10px; font-size: var(--t1); }
.credits a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.note { margin-top: 16px; font-size: var(--t1); color: var(--muted); }
.photo.wide { margin-top: 18px; }

.foot { padding-block: 24px 40px; border-top: 1px solid var(--line); font-size: var(--t1); color: var(--muted); }
.foot a { display: inline-block; padding-block: 12px; }
.foot-sim { margin-bottom: 10px; color: var(--ink); }
.foot-credits { margin-bottom: 10px; }
.foot-credits summary { display: flex; align-items: center; min-height: 44px; font-weight: 500; color: var(--ink); }
.foot-credits .credits { margin-top: 4px; }
/* the site's footer statement, as on every page */
.foot-site { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.foot-site p { margin: 0 0 6px; max-width: 90ch; }
.foot-site a { display: inline; padding: 0; }
.foot-site p:first-child { line-height: 1.9; }
.foot-site .verified { font: var(--t1)/1.3 var(--mono); color: var(--muted); letter-spacing: 0; text-transform: none; }
/* offline: the saved copy says so; a photo that cannot load folds to its caption */
.offline-note { margin: 0; padding: 8px 20px; border-bottom: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink); font-size: var(--t1); text-align: center; }
.photo.no-photo img { display: none; }

/* ---------- larger screens ---------- */
@media (min-width: 900px) {
  .wrap { width: min(44rem, calc(100% - 64px)); }
  .instruments { column-gap: 20px; padding-block: 2px 10px; }
  .clock { font-size: var(--t6); font-weight: 250; }
  .scene h2 { font-size: var(--t6); }
  .ruler { height: 12px; }
  /* photos keep the text column's edges (craft review: the intro and its photo align) */
  .p-irpin { margin-inline: 6rem; }
  .next { width: auto; min-width: 14rem; }
  .intro { padding-top: 48px; }
}

/* ---------- motion ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- forced colours ---------- */
@media (forced-colors: active) {
  .choice, .button, .next, .tag, .sim-alert, .why-card, .mylist li { border-color: ButtonText; }
  .mark { forced-color-adjust: none; }
}

/* ---------- print: the checklist travels, the story does not ---------- */
@media print {
  /* paper: the decisions as a readable script (the no-JS summary), the reader's own list if they played,
     and the footer; no instruments, no buttons, black on white */
  :root { color-scheme: light; --canvas: #fff; --surface: #fff; --soft: #fff; --ink: #000; --muted: #333; --line: #999; --accent: #000; --accent-soft: #fff; }
  html, body, .stage, main { background: #fff !important; color: #000; }
  .top, .end-ruler, .scene-time, .end-actions, .skip-link, .js-only, .rules, .intro .photo, .offline-note, #app .scene:not(.end), .end-block:not(.checklist-block), .foot-credits summary::marker { display: none !important; }
  .js .nojs, .nojs { display: block !important; margin-top: 6mm; padding-top: 4mm; }
  .nojs-steps li { break-inside: avoid; }
  .nojs .button { display: none; }
  .mylist:empty, .checklist-block:has(.mylist:empty) { display: none; }
  .end-block { border: 0; margin: 0; }
  .mylist li { break-inside: avoid; }
  .mylist li::before { content: "\2610  "; }
  .foot { display: block !important; padding: 4mm 0 0; font-size: 8.5pt; }
  .foot a { padding: 0; }
  .foot-credits[open] summary, .foot-credits summary { min-height: 0; }
  .foot-credits::details-content { content-visibility: visible; display: contents; }
}


/* §10 in the simulation: each scene and each verdict leads with its rule pictogram (the same drawings as the
   Room and /now/). Amber is spent once on the page (SIRENS NOW): Continue and the source tags are ink. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.picto { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; color: var(--ink); overflow: visible; }
.pg * { vector-effect: non-scaling-stroke; }
.pa { stroke: var(--accent); }
.paf { fill: var(--accent); fill-opacity: .18; stroke: none; }
.pd { stroke-dasharray: 4 4; }
.pt { stroke-width: 1.25; }
.scene-head { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; }
.scene-pic { width: 72px; height: 72px; }
.verdict-row { display: flex; align-items: center; gap: 12px; }
.verdict-pic { width: 56px; height: 56px; }
@media (min-width: 600px) { .scene-head { grid-template-columns: 88px 1fr; } .scene-pic { width: 88px; height: 88px; } }
@media print { .picto, .pa { stroke: #000; color: #000; } .paf { fill: #000; } }
