/* Hormuz Watch — nautical-chart palette, Atkinson Hyperlegible for reading, Newsreader italic for water names. */

:root {
  color-scheme: light;
  --page: #f7f9fb;
  --surface: #ffffff;
  --ink: #0f2233;
  --ink-2: #44566a;
  --muted: #5b6b7b;
  --rule: #dbe3ea;
  --grid: #e3e9ef;
  --axis: #b4c1cd;
  --ship-off: #8d9db0;
  --water: #d4e6f1;
  --water-ink: #2b5b84;
  --land: #ece3c6;
  --land-ink: #5b4d2a;
  --coast: #7a6a40;
  --border-ink: #a2936a;
  --magenta: #b0207e;
  --magenta-soft: rgba(176, 32, 126, 0.16);
  --oil: #8a4f00;
  --iran: #8a2f2f;
  --s1: #2a78d6;
  --s1-track: #cde2fb;
  --s2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --tick-dark: #0f2233;
  --tick-light: #ffffff;
  --halo: rgba(247, 249, 251, 0.9);
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --wide: 1120px;
  --measure: 66ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b1520;
    --surface: #101d2b;
    --ink: #e6edf3;
    --ink-2: #a7b6c4;
    --muted: #8394a4;
    --rule: #1f2e3d;
    --grid: #1a2734;
    --axis: #33475a;
    --ship-off: #5b7088;
    --water: #12283b;
    --water-ink: #9cc3e6;
    --land: #2a3033;
    --land-ink: #c9c2a8;
    --coast: #8a8466;
    --border-ink: #5e6a64;
    --magenta: #e35db4;
    --magenta-soft: rgba(227, 93, 180, 0.2);
    --oil: #e0a044;
    --iran: #e58a7a;
    --s1: #3987e5;
    --s1-track: #1c3a5e;
    --s2: #d95926;
    --tick-dark: #e6edf3;
    --tick-light: #0b1520;
    --halo: rgba(11, 21, 32, 0.85);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1520;
  --surface: #101d2b;
  --ink: #e6edf3;
  --ink-2: #a7b6c4;
  --muted: #8394a4;
  --rule: #1f2e3d;
  --grid: #1a2734;
  --axis: #33475a;
  --ship-off: #5b7088;
  --water: #12283b;
  --water-ink: #9cc3e6;
  --land: #2a3033;
  --land-ink: #c9c2a8;
  --coast: #8a8466;
  --border-ink: #5e6a64;
  --magenta: #e35db4;
  --magenta-soft: rgba(227, 93, 180, 0.2);
  --oil: #e0a044;
  --iran: #e58a7a;
  --s1: #3987e5;
  --s1-track: #1c3a5e;
  --s2: #d95926;
  --tick-dark: #e6edf3;
  --tick-light: #0b1520;
  --halo: rgba(11, 21, 32, 0.85);
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--font);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
a { color: var(--ink); text-decoration-color: var(--magenta); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--magenta); }
:focus-visible { outline: 3px solid var(--s1); outline-offset: 3px; border-radius: 2px; }
.defs { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--page); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner { display: flex; align-items: center; gap: 28px; min-height: 56px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.wordmark:hover { color: var(--ink); }
.wordmark-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--water); flex: none; }
.wm-land { fill: var(--land); stroke: var(--coast); stroke-width: 0.8; }
.wm-lane { fill: none; stroke: var(--magenta); stroke-width: 2.2; stroke-linecap: round; }
.sections { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; font-size: 0.94rem; margin-left: auto; }
.sections::-webkit-scrollbar { display: none; }
.sections a { color: var(--ink-2); text-decoration: none; white-space: nowrap; padding: 6px 0; }
.sections a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--magenta); }

/* ---------- hero ---------- */
.hero { padding-top: 64px; padding-bottom: 8px; }
.hero h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 700; letter-spacing: -0.012em; color: var(--ink-2); }
.answer-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 28px; margin-top: 6px; }
.answer { font-size: clamp(4.2rem, 14vw, 9.5rem); font-weight: 800; line-height: 0.92; letter-spacing: -0.045em; }
.status { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.status-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; }
.status-icon svg { width: 14px; height: 14px; }
.lvl-open { background: var(--good); }
.lvl-restricted { background: var(--warning); color: #0b0b0b; }
.lvl-severe { background: var(--serious); color: #0b0b0b; }
.lvl-closed { background: var(--critical); }
.day { margin-top: 18px; font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.day strong { color: var(--ink); }

.fleet { margin-top: 36px; }
.fleet-ships { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 18px 16px; max-width: 900px; }
.fleet-ships svg { width: 100%; height: auto; aspect-ratio: 48 / 16; display: block; overflow: visible; }
.ship-on { color: var(--s1); fill: currentColor; }
.ship-off { color: var(--ship-off); fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; }
.fleet-cap { margin-top: 14px; font-size: 1.05rem; max-width: 60ch; }
.fleet-cap small { display: block; margin-top: 2px; font-size: 0.85rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .fleet-ships svg { animation: sail 700ms cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * 45ms); }
  @keyframes sail { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
}
.summary { margin-top: 28px; max-width: 62ch; font-size: 1.2rem; line-height: 1.55; }

/* ---------- headline numbers ---------- */
.tiles-wrap { margin-top: 48px; }
.panel {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px;
}
.tile { padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile + .tile { border-left: 1px solid var(--rule); }
.tile-label { font-size: 0.95rem; font-weight: 700; color: var(--ink-2); }
.tile-value { font-size: clamp(1.9rem, 3.4vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; }
.tile-unit { font-size: 0.95rem; font-weight: 400; color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }
.tile-delta { font-size: 0.98rem; }
.tile-spark { height: 32px; margin: 8px 0 4px; }
.spark { width: 100%; height: 32px; display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--axis); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-dot { stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tile-meta { font-size: 0.85rem; color: var(--muted); margin-top: auto; }
.tile-meta a { color: var(--muted); }
.stamp { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }

/* ---------- sections ---------- */
.section { margin-top: 112px; }
.section h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 20px; max-width: 30ch; }
.lede { max-width: var(--measure); font-size: 1.15rem; }
.brief-head { font-size: 1.4rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; max-width: 42ch; margin-bottom: 18px; }
.stale[hidden] { display: none; }
.stale { display: inline-block; margin-bottom: 18px; padding: 8px 12px; border-left: 3px solid var(--warning); background: var(--surface); font-size: 0.95rem; }

/* ---------- maps ---------- */
.maps { display: grid; grid-template-columns: 1fr; gap: 56px; margin-top: 36px; }
.map-fig figcaption { margin-top: 12px; max-width: var(--measure); font-size: 1rem; color: var(--ink-2); }
.map-fig figcaption strong { color: var(--ink); }
.map { width: 100%; }
.map-svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.water { fill: var(--water); }
.land { fill: var(--land); }
.coast { fill: none; stroke: var(--coast); stroke-width: 0.9; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.border { fill: none; stroke: var(--border-ink); stroke-width: 0.8; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.tick-dark { fill: var(--tick-dark); }
.tick-light { fill: var(--tick-light); }
.neat-outer, .neat-inner { fill: none; stroke: var(--tick-dark); stroke-width: 1; }
.coord { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.lbl { paint-order: stroke; stroke: var(--halo); stroke-width: 3px; stroke-linejoin: round; }
.lbl-country { font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; fill: var(--land-ink); stroke: var(--land); }
.lbl-sub { font-size: 11px; font-weight: 400; letter-spacing: 0.02em; text-transform: none; }
.lbl-water { font-family: var(--serif); font-style: italic; font-size: 16px; fill: var(--water-ink); stroke: var(--water); }
.lbl-big { font-size: 19px; }
.lbl-title { font-family: var(--serif); font-style: italic; font-size: 24px; fill: var(--ink); stroke: var(--land); }
.compact .lbl-title { font-size: 17px; }
.pt-island { fill: var(--land); stroke: var(--coast); stroke-width: 1; }
.lbl-island { font-family: var(--serif); font-style: italic; font-size: 13px; fill: var(--land-ink); }
.lbl-pt { font-size: 12px; fill: var(--ink); }
.lbl-pipe { font-size: 12px; font-weight: 700; fill: var(--oil); stroke: var(--land); }
.lbl-route { font-size: 12px; font-weight: 700; fill: var(--ink); }
.lbl-lane { font-size: 12px; font-weight: 700; fill: var(--magenta); }
.lbl-measure { font-size: 12px; fill: var(--ink-2); }
.lbl-focus { font-size: 12.5px; font-weight: 700; fill: var(--magenta); }
.focus-box { fill: var(--magenta-soft); stroke: var(--magenta); stroke-width: 1.5; }
.pt-mark { fill: var(--ink); stroke: var(--halo); stroke-width: 1.5; }
.pt-terminal .pt-mark { fill: var(--oil); }
.pipeline { fill: none; stroke: var(--oil); stroke-width: 2.5; stroke-linecap: round; }
.pipeline-head { fill: var(--oil); }
.lane { fill: none; stroke: var(--magenta); stroke-width: 2; }
.lane-head { fill: var(--magenta); }
.lane-zone { fill: none; stroke: var(--magenta-soft); stroke-width: 7; stroke-linecap: round; }
.route { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.route-iran { stroke: var(--iran); stroke-dasharray: 7 5; }
.route-us { stroke: var(--s1); stroke-dasharray: 2 5; }
.route-head-iran { fill: var(--iran); }
.route-head-us { fill: var(--s1); }
.measure { stroke: var(--ink); stroke-width: 1; }
.measure-end { fill: var(--ink); }
.compact .lbl-water { font-size: 13px; }
.compact .lbl-big { font-size: 15px; }
.compact .lbl-country { font-size: 11px; }

.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 0.92rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 26px; height: 0; flex: none; }
.key-pipe { border-top: 2.5px solid var(--oil); }
.key-terminal { width: 9px; height: 9px; background: var(--oil); transform: rotate(45deg); margin: 0 8px; }
.key-lane { border-top: 2px solid var(--magenta); box-shadow: 0 5px 0 -3px var(--magenta); height: 6px; }
.key-iran { border-top: 2.5px dashed var(--iran); }
.key-us { border-top: 2.5px dotted var(--s1); }
.key-line { border-top-width: 2px; border-top-style: solid; width: 22px; }
.key-box { width: 12px; height: 12px; border-radius: 3px; }

/* ---------- charts ---------- */
.chart-fig { margin-top: 44px; }
.chart-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.chart { position: relative; width: 100%; }
.chart-svg { display: block; overflow: visible; font-family: var(--font); touch-action: pan-y; }
.chart-svg:focus-visible { outline-offset: 6px; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.tick { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.area { opacity: 0.1; }
.col { transition: opacity 120ms; }
.col-est { opacity: 0.55; }
.col.is-active { opacity: 0.75; }
.dot { stroke: var(--page); stroke-width: 2; }
.crosshair { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.hit { fill: transparent; cursor: crosshair; }
.annot { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.annot-label { font-size: 12px; fill: var(--ink-2); }
.ref { stroke: var(--magenta); stroke-width: 1.5; stroke-dasharray: 6 4; }
.ref-label { font-size: 12px; font-weight: 700; fill: var(--magenta); paint-order: stroke; stroke: var(--page); stroke-width: 4px; }
.end-label { font-size: 12.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--page); stroke-width: 4px; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 4px 16px rgba(15, 34, 51, 0.12); padding: 8px 10px; font-size: 0.85rem; line-height: 1.4;
}
.tip-date { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { font-size: 1rem; }
.tip-key { width: 14px; height: 2px; border-radius: 1px; flex: none; }
.tip-key-box { width: 10px; height: 10px; border-radius: 2px; }
.tip-name { color: var(--ink-2); }
.tip-note { margin-top: 4px; color: var(--ink-2); }
.chart-note { margin-top: 10px; font-size: 0.92rem; color: var(--muted); max-width: var(--measure); }
.chart-empty { padding: 24px 0; color: var(--muted); }
.legend-lines { margin: 0 0 6px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }

.table-view { margin-top: 10px; font-size: 0.92rem; }
.table-view summary { cursor: pointer; color: var(--ink-2); width: max-content; }
.table-view summary:hover { color: var(--ink); }
.table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); }
.table-view table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.table-view caption { text-align: left; padding: 8px 10px; color: var(--muted); }
.table-view th, .table-view td { text-align: left; padding: 6px 10px; border-top: 1px solid var(--rule); }
.table-view th { position: sticky; top: 0; background: var(--surface); font-weight: 700; }

/* visible vs dark split (tall segmented bar) */
.split-fig { margin-top: 40px; max-width: 760px; }
.split-fig figcaption { font-weight: 700; margin-bottom: 10px; font-size: 1rem; }
.split-bar { display: flex; gap: 2px; height: 28px; }
.seg { display: flex; align-items: center; padding: 0 8px; border-radius: 4px; color: #fff; font-weight: 700; font-size: 0.9rem; min-width: 0; white-space: nowrap; overflow: hidden; }
.seg-a { background: var(--s1); }
.seg-b { background: var(--s2); }
.key-a { background: var(--s1); }
.key-b { background: var(--s2); }

.method { margin-top: 36px; max-width: var(--measure); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 12px 0; }
.method summary, .faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.method summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.method summary::after, .faq summary::after { content: "+"; font-weight: 400; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.method[open] summary::after, .faq details[open] summary::after { content: "–"; }
.method p { margin-top: 10px; color: var(--ink-2); }

/* reserve gauge */
.gauge { margin-top: 40px; max-width: 860px; }
.gauge-head { font-size: 1.1rem; margin-bottom: 34px; }
.gauge-head strong { font-size: 1.6rem; letter-spacing: -0.01em; }
.gauge-track { position: relative; height: 18px; border-radius: 9px; background: var(--s1-track); }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 9px; background: var(--s1); }
.gauge-mark { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px solid var(--ink); }
.gauge-mark span { position: absolute; left: -1px; white-space: nowrap; font-size: 0.88rem; color: var(--ink-2); }
.gauge-mark.above span { bottom: calc(100% + 4px); }
.gauge-mark.below span { top: calc(100% + 4px); }
.gauge-mark.flip span { left: auto; right: 1px; text-align: right; }
.gauge-scale { display: flex; justify-content: space-between; margin-top: 34px; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.facts { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 40px; }
.facts dt { font-weight: 700; font-size: 0.95rem; }
.facts dd { margin-top: 4px; font-size: 0.98rem; color: var(--ink-2); }
.facts dd a { color: var(--muted); font-size: 0.88rem; }

/* impacts */
.impacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 56px; max-width: 980px; }
.impact h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.impact p { color: var(--ink-2); }

/* timeline */
.timeline { list-style: none; padding: 0; max-width: 820px; border-left: 2px solid var(--rule); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 26px 28px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--page); border: 2px solid var(--magenta); }
.timeline time { display: block; font-size: 0.9rem; font-weight: 700; color: var(--magenta); font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: 1.1rem; font-weight: 700; margin-top: 2px; }
.timeline p { color: var(--ink-2); margin-top: 2px; }
.timeline p a { color: var(--muted); font-size: 0.88rem; margin-left: 4px; }

/* faq */
.faq { max-width: var(--measure); border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.faq details p { margin-top: 10px; color: var(--ink-2); }

/* sources */
.sources { list-style: none; padding: 0; margin-top: 24px; columns: 2; column-gap: 48px; font-size: 0.95rem; max-width: 1000px; }
.sources li { break-inside: avoid; padding: 4px 0; }

.foot { margin-top: 120px; padding: 28px 0 48px; border-top: 1px solid var(--rule); font-size: 0.92rem; color: var(--muted); }
.noscript { padding: 24px; }
body.load-error .tiles-wrap, body.load-error .section { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .two-up { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .wrap { padding: 0 16px; }
  .masthead-inner { gap: 16px; }
  .wordmark span { display: none; }
  .sections { gap: 16px; margin-left: 0; }
  .hero { padding-top: 40px; }
  .fleet-ships { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 14px; max-width: 360px; }
  .summary { font-size: 1.1rem; }
  .section { margin-top: 80px; }
  .tile { padding: 16px 14px 14px; }
  .tile-unit { display: block; margin: 2px 0 0; }
  .impacts, .facts { grid-template-columns: 1fr; }
  .sources { columns: 1; }
  .gauge-head { margin-bottom: 40px; }
}
@media print {
  .masthead, .table-view, .method summary::after { display: none; }
  .section { margin-top: 40px; break-inside: avoid-page; }
}
