/* netmap.mu — "nautical chart" design system.
   Day chart by default, night chart in dark mode. */

:root {
  --paper: #F1F5F5;
  --surface: #FFFFFF;
  --sea: #D4E7EB;
  --sea-line: #B6D3DA;
  --land: #ECE1C3;
  --land-line: #BFAD84;
  --ink: #15323D;
  --ink-2: #4A6670;
  --rule: #C8D7DA;
  --buoy: #C9372A;
  --focus: #1B6A9C;
  --ev-confirmed: #1E7B4F;
  --ev-reported: #9A5F12;
  --ev-measured: #1B6A9C;
  --ev-inferred: #6550C2;
  --bar: #15323D;
  --bar-track: #DCE7E9;

  --font: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0C1D26;
    --surface: #11252E;
    --sea: #0F2E3B;
    --sea-line: #1B4555;
    --land: #22343B;
    --land-line: #3D545C;
    --ink: #DCE9EB;
    --ink-2: #9AB4BB;
    --rule: #24424D;
    --buoy: #FF6B5D;
    --focus: #7CC4F0;
    --ev-confirmed: #5FCB95;
    --ev-reported: #E2A657;
    --ev-measured: #73B8E8;
    --ev-inferred: #ADA0F2;
    --bar: #9AD0E4;
    --bar-track: #1C3843;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0C1D26; --surface: #11252E; --sea: #0F2E3B; --sea-line: #1B4555; --land: #22343B; --land-line: #3D545C;
  --ink: #DCE9EB; --ink-2: #9AB4BB; --rule: #24424D; --buoy: #FF6B5D; --focus: #7CC4F0;
  --ev-confirmed: #5FCB95; --ev-reported: #E2A657; --ev-measured: #73B8E8; --ev-inferred: #ADA0F2;
  --bar: #9AD0E4; --bar-track: #1C3843; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Type scale (minor third, ~1.2), headings set wide like chart titles */
h1, h2, h3 { font-variation-settings: "wdth" 118; font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); font-weight: 760; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); margin-top: 2.6rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.15rem; font-variation-settings: "wdth" 108; }
p { margin: 0 0 1rem; max-width: var(--measure); }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-2); max-width: 60ch; margin-top: 1rem; }
.section-lede { color: var(--ink-2); }
.sub { display: block; font-size: 0.85rem; color: var(--ink-2); font-weight: 400; font-variation-settings: "wdth" 100; }
.sub-title { color: var(--ink-2); margin-top: 0.4rem; }
.fineprint { font-size: 0.9rem; color: var(--ink-2); }
.muted { color: var(--ink-2); }
code, .asn, pre { font-family: var(--mono); font-size: 0.9em; }
.asn { color: var(--ink-2); margin: 0.3rem 0 0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead-inner { max-width: 1400px; margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 760; font-variation-settings: "wdth" 125; font-size: 1.15rem; letter-spacing: 0.01em; }
.wordmark-mark { width: 26px; height: 26px; }
.wordmark-mark .ring { fill: none; stroke: var(--ink); stroke-width: 2; }
.wordmark-mark .cross { stroke: var(--ink); stroke-width: 1.2; }
.wordmark-mark .dot { fill: var(--buoy); }
.mainnav { display: flex; gap: 4px 20px; flex-wrap: wrap; flex: 1; }
.mainnav a { text-decoration: none; color: var(--ink-2); padding: 4px 0; border-bottom: 2px solid transparent; }
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--buoy); }
.langswitch { font-size: 0.95rem; text-decoration: none; border: 1px solid var(--rule); padding: 4px 12px; border-radius: 999px; }
.langswitch:hover { border-color: var(--ink-2); }

/* Hero: the chart is the hero */
.hero { position: relative; display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "text map" "legend map"; background: var(--sea); border-bottom: 1px solid var(--rule); }
.hero-text { grid-area: text; padding: clamp(28px, 4vw, 56px) 28px 8px var(--gutter); position: relative; z-index: 2; }
.hero-text h1 { font-size: clamp(2rem, 3.1vw, 3rem); max-width: 12ch; }
.hero-text .lede { font-size: 1.1rem; }
.atlas { margin: 0; position: relative; }
.hero .atlas { grid-area: map; min-height: 520px; border-left: 1px solid var(--sea-line); }
.atlas-canvas { width: 100%; height: 100%; min-height: inherit; }
.atlas-canvas svg { display: block; width: 100%; height: auto; }
.atlas-caption { font-size: 0.82rem; color: var(--ink-2); padding: 8px var(--gutter) 14px; }
.atlas-inline { background: var(--sea); border-block: 1px solid var(--rule); margin: 2rem 0; min-height: 360px; }
.atlas-legend { grid-area: legend; align-self: start; padding: 8px 28px 32px var(--gutter); position: relative; z-index: 2; }
.legend-title { font-size: 0.95rem; margin: 0 0 0.6rem; font-variation-settings: "wdth" 110; }
.atlas-legend ul { list-style: none; margin: 0; padding: 0; }
.atlas-legend a { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 4px; padding: 7px 0; text-decoration: none; border-bottom: 1px solid var(--sea-line); }
.atlas-legend a:hover .legend-name, .atlas-legend a.is-active .legend-name { text-decoration: underline; text-underline-offset: 3px; }
.legend-name { font-weight: 620; }
.legend-year { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.swatch { vertical-align: middle; margin-right: 8px; overflow: visible; }
.swatch-lg { margin-right: 14px; }

/* Map layers (drawn by site.js) */
.atlas-canvas svg path, .atlas-canvas svg circle, .atlas-canvas svg rect { vector-effect: non-scaling-stroke; }
.is-narrow .m-label { font-size: 28px; stroke-width: 6px; }
.m-graticule { fill: none; stroke: var(--sea-line); stroke-width: 0.6; }
.m-contour { fill: none; stroke: var(--sea-line); stroke-width: 0.8; stroke-dasharray: 2 4; }
.m-land { fill: var(--land); stroke: var(--land-line); stroke-width: 0.7; }
.m-cable { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: opacity 160ms ease, stroke-width 160ms ease; }
.m-cable.is-context { stroke: var(--ink-2); stroke-width: 1.4; stroke-dasharray: 5 5; opacity: 0.55; }
.m-cable.is-planned { stroke-dasharray: 3 6; }
.m-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.atlas.has-focus .m-cable:not(.is-focus) { opacity: 0.18; }
.m-cable.is-focus { stroke-width: 4; }
.m-landing { fill: var(--surface); stroke: var(--ink); stroke-width: 1.4; }
.m-pop { fill: var(--ink); }
.m-home { fill: var(--buoy); }
.m-home-ring { fill: none; stroke: var(--buoy); stroke-width: 1.5; }
.m-label { font-family: var(--font); font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; stroke-linejoin: round; }
.m-label.is-pop { font-weight: 650; }
.m-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); padding: 6px 10px; border-radius: 4px; font-size: 0.88rem; box-shadow: 0 4px 14px rgb(0 0 0 / 0.12); white-space: nowrap; z-index: 5; }
.m-tip[hidden] { display: none; }

/* Bands */
.band { padding: clamp(40px, 6vw, 80px) 0; }
.band h2:first-child { margin-top: 0; }
.band-alt { background: var(--surface); border-block: 1px solid var(--rule); }

/* Latency ruler — the scale bar of the chart */
.ruler { width: 100%; height: auto; margin: 1.5rem 0 0.5rem; overflow: visible; }
.ruler-axis { stroke: var(--ink); stroke-width: 2; }
.ruler-ticks line { stroke: var(--ink); stroke-width: 1.2; }
.ruler-ticks text { font-size: 13px; fill: var(--ink-2); text-anchor: middle; font-variant-numeric: tabular-nums; }
.ruler-stop circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.ruler-stop.is-local circle { fill: var(--buoy); }
.ruler-stem { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.ruler-city { font-size: 16px; font-weight: 680; fill: var(--ink); text-anchor: middle; font-variation-settings: "wdth" 112; }
.ruler-ms { font-size: 14px; fill: var(--ink-2); text-anchor: middle; font-variant-numeric: tabular-nums; }

/* Evidence badges */
.ev { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid currentColor; line-height: 1.5; white-space: nowrap; }
.ev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ev-confirmed { color: var(--ev-confirmed); }
.ev-reported { color: var(--ev-reported); }
.ev-reported::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border: 1px solid currentColor; }
.ev-measured { color: var(--ev-measured); }
.ev-measured::before { border-radius: 1px; transform: rotate(45deg); width: 7px; height: 7px; }
.ev-inferred { color: var(--ev-inferred); }
.ev-inferred::before { background: transparent; border: 1.5px solid currentColor; }
.legend-evidence { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 8px; font-size: 0.92rem; color: var(--ink-2); }

/* Findings */
.findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 48px; margin: 1.5rem 0 1rem; }
.finding { padding: 22px 0; border-top: 2px solid var(--ink); }
.finding h3 { margin: 12px 0 8px; }
.finding p { color: var(--ink-2); margin: 0; }
.textlink { font-weight: 620; }

/* Explore list */
.explore { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 48px; margin: 1.2rem 0 0; }
.explore > div { padding: 16px 0; border-top: 1px solid var(--rule); }
.explore dt { font-size: 1.2rem; font-weight: 700; font-variation-settings: "wdth" 115; }
.explore dt a { text-decoration: none; }
.explore dt a:hover { text-decoration: underline; }
.explore dd { margin: 4px 0 0; color: var(--ink-2); }

/* Page headers */
.page-head { padding-top: clamp(32px, 5vw, 64px); padding-bottom: 8px; }
.crumb { margin: 0 0 0.8rem; font-size: 0.95rem; color: var(--ink-2); }
.cable-title { display: flex; align-items: center; }

/* Tables */
.table-scroll { overflow-x: auto; margin: 1rem 0 0.5rem; border-top: 2px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.97rem; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: 11px 14px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data thead th { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); font-variation-settings: "wdth" 105; }
table.data tbody th { font-weight: 640; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.is-highlight th, table.data tr.is-highlight td { background: color-mix(in srgb, var(--buoy) 9%, transparent); }
.barcell { white-space: nowrap; }
.barcell svg { vertical-align: middle; }
.bar { fill: var(--bar); }
.bar-track { fill: var(--bar-track); }
.barval { margin-left: 10px; font-variant-numeric: tabular-nums; }

/* Facts */
.facts { margin: 0; display: grid; gap: 0; }
.facts > div { display: grid; grid-template-columns: 11rem 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 560; }
.facts-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 32px; margin-top: 1.5rem; }
.facts-row > div { display: block; border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 12px; }
.facts-row dd { font-size: 1.5rem; font-weight: 700; font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; }
.facts-row dd.sub { font-size: 0.85rem; font-weight: 400; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; margin-top: 1rem; }
.two-col h2:first-child { margin-top: 0; }

.stations { padding-left: 1.4rem; margin: 0.6rem 0 0; }
.stations li { padding: 4px 0; }
.station-name { font-weight: 620; }
.country { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-2); }
.sourcelist, .plainlist { padding-left: 1.2rem; }
.sourcelist li, .plainlist li { margin: 6px 0; max-width: var(--measure); }

/* Operators */
.operator-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 40px; }
.operator { border-top: 2px solid var(--ink); padding: 18px 0 24px; }
.operator h2 { margin: 0; font-size: 1.35rem; }
.operator h2 a { text-decoration: none; }
.operator.is-pending { border-top-color: var(--rule); }
.operator.is-pending h2 { color: var(--ink-2); }
.op-figures { display: flex; gap: 20px; flex-wrap: wrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 24px; border: 1px dashed var(--rule); color: var(--ink-2); max-width: 60ch; }

/* Topology diagram */
.topology { margin: 1.2rem 0 0; }
.topology svg { width: 100%; height: auto; }
.topology figcaption { font-size: 0.9rem; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.topo-links path { fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.topo-node rect { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.topo-node.is-home rect { stroke: var(--buoy); stroke-width: 2; }
.topo-node.is-exit rect { fill: var(--sea); }
.topo-node text { font-size: 14px; font-weight: 650; fill: var(--ink); text-anchor: middle; }
.topo-node text.topo-sub { font-size: 12px; font-weight: 400; fill: var(--ink-2); }
.topo-tunnel rect { fill: none; stroke: var(--ev-inferred); stroke-width: 1.5; stroke-dasharray: 6 5; }
.topo-tunnel text { font-size: 13px; fill: var(--ev-inferred); text-anchor: middle; font-weight: 650; }

/* Timeline (a real sequence) */
.timeline { list-style: none; padding: 0; margin: 1.5rem 0; border-left: 2px solid var(--ink); }
.timeline li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 24px; padding: 0 0 2.2rem 24px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--buoy); border: 2px solid var(--paper); }
.timeline time { font-family: var(--mono); color: var(--ink-2); padding-top: 2px; }
.timeline h2 { margin: 0 0 4px; font-size: 1.3rem; }

/* Open data */
.endpoints { list-style: none; padding: 0; }
.endpoints li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.endpoints .sub { display: inline; margin-left: 8px; }
pre.code { background: var(--surface); border: 1px solid var(--rule); padding: 14px 16px; overflow-x: auto; border-radius: 4px; }

/* Footer */
.colophon { margin-top: 5rem; border-top: 2px solid var(--ink); background: var(--surface); }
.colophon-inner { max-width: 1180px; margin: 0 auto; padding: 36px var(--gutter) 48px; display: grid; grid-template-columns: 1.2fr 1.6fr 1fr; gap: 40px; font-size: 0.95rem; }
.colophon-name { font-weight: 760; font-variation-settings: "wdth" 125; font-size: 1.1rem; margin-bottom: 0.4rem; }

/* Small screens */
@media (max-width: 860px) {
  .masthead-inner { gap: 10px 16px; }
  .mainnav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 4px; scrollbar-width: none; }
  .mainnav a { white-space: nowrap; }
  .langswitch { margin-left: auto; }
  .hero .atlas { min-height: 0; }
  .atlas-canvas { min-height: 0; }
  .ruler-wrap { overflow-x: auto; }
  .ruler { min-width: 720px; }
  .hero { grid-template-columns: 1fr; grid-template-areas: "text" "map" "legend"; }
  .hero .atlas { min-height: 300px; border-left: 0; }
  .atlas-legend { padding: 8px var(--gutter) 28px; }
  .atlas-legend ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 20px; }
  .two-col { grid-template-columns: 1fr; gap: 8px; }
  .facts > div { grid-template-columns: 9rem 1fr; }
  .colophon-inner { grid-template-columns: 1fr; gap: 20px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.facts-row dd.dd-text { font-size: 1.05rem; font-weight: 600; }
