/* ipcensus.org. Two token sets on one structure (William's pick, 2026-11-05):
   Atlas (light, default): engraved plate. Observatory: its dark edition, chosen
   by prefers-color-scheme unless the visitor picks. Ramps live in ramps.js. */

:root, [data-theme="atlas"] {
  --paper:#f4f0e7; --paper-2:#ece6d8; --ink:#1f1a14; --ink-2:#4a4036; --muted:#7a7062;
  --rule:#cdc3b2; --rule-2:#e2d9c8; --accent:#8a3725; --accent-2:#c7693b;
  --map-empty:#f4f0e7; --map-assigned:#e3dccd; --map-hatch:#b9ad98;
  --display:"Fraunces", Georgia, serif; --text:"Spectral", Georgia, serif; --mono:"IBM Plex Mono", ui-monospace, monospace;
  --h1-size:54px; --h1-weight:300; --radius:0px;
}
[data-theme="observatory"] {
  --paper:#05101e; --paper-2:#0a1a2e; --ink:#e8eef6; --ink-2:#b6c3d4; --muted:#7f8ea3;
  --rule:#1d3550; --rule-2:#132a42; --accent:#f2c14e; --accent-2:#53c2b0;
  --map-empty:#07142a; --map-assigned:#0d2240; --map-hatch:#1f3a5e;
  --display:"IBM Plex Sans", system-ui, sans-serif; --text:"IBM Plex Sans", system-ui, sans-serif;
  --h1-size:44px; --h1-weight:300;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* component display rules must never un-hide */
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--text); font-size: 15px;
       line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 40px; }
.num { font-family: var(--display); font-feature-settings: "tnum" 1, "lnum" 1; font-variation-settings: "opsz" 72; }
.sc { font-family: var(--display); font-variant-caps: all-small-caps; letter-spacing: .14em; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.muted { color: var(--muted); }

header { border-bottom: 1px solid var(--ink); padding: 22px 0 12px; }
header .top { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 23px; letter-spacing: -.01em; font-variation-settings: "opsz" 144; }
.brand small { font-family: var(--text); font-style: italic; font-size: 14px; color: var(--muted); margin-left: 14px; }
nav a { margin-left: 24px; font-size: 14px; color: var(--ink-2); }
nav a.on { color: var(--ink); border-bottom: 1px solid var(--ink); }
.census-line { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--rule);
               margin-top: 12px; padding-top: 6px; font-size: 12.5px; color: var(--muted); font-style: italic; }
[data-theme="observatory"] .census-line { font-style: normal; font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; }

.preview { margin: 18px 0 0; padding: 10px 14px; border: 1px dashed var(--rule); font-size: 13.5px; color: var(--ink-2); }
.preview b { color: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 56px; padding: 40px 0 28px; align-items: start; }

.plate { position: relative; margin: 0; border: 1px solid var(--ink); padding: 14px; background: var(--paper-2);
         box-shadow: inset 0 0 0 4px var(--paper-2), inset 0 0 0 5px var(--rule); }
.plate .frame { position: relative; aspect-ratio: 1 / 1; width: 100%; border: 1px solid var(--ink-2); background: var(--map-empty); overflow: hidden; }
.plate .graticule { display: flex; justify-content: space-between; font: 10px var(--display); color: var(--muted); letter-spacing: .08em; margin: -6px 2px 6px; }
.plate-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.plate-cap b { font-family: var(--display); font-weight: 500; }
.plate-cap i { color: var(--muted); }
.scalebar { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.scalebar i { display: inline-block; width: 64px; height: 7px; border: 1px solid var(--ink); border-top: none; position: relative; }
.scalebar i::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--ink); }
[data-theme="observatory"] .plate { box-shadow: none; padding: 10px; }
[data-theme="observatory"] .plate { background: var(--paper); border-color: var(--rule); }

.leaflet-container { background: var(--map-empty); font-family: var(--text); cursor: crosshair; }
.leaflet-tile { image-rendering: pixelated; }
.leaflet-bar a { background: var(--paper); color: var(--ink); border-color: var(--rule); }

.side h1 { font-family: var(--display); font-size: var(--h1-size); line-height: 1.0; font-weight: var(--h1-weight);
           margin: 0; max-width: 12ch; letter-spacing: -.01em; font-variation-settings: "opsz" 144, "SOFT" 30; }
.side h1 em { font-style: italic; font-weight: 400; }
[data-theme="observatory"] .side h1 em { color: var(--accent); font-style: normal; }
.deck { font-size: 16.5px; line-height: 1.5; color: var(--ink-2); margin: 18px 0 22px; font-weight: 300; }
.deck b { font-weight: 500; color: var(--ink); }

.layers { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); margin: 0 0 16px; }
.layers button { appearance: none; background: none; border: 0; border-right: 1px solid var(--ink); padding: 10px 8px;
                 font-family: var(--display); font-size: 14.5px; color: var(--ink); cursor: pointer; text-align: center; }
.layers button:last-child { border-right: 0; }
.layers button small { display: block; font-family: var(--text); font-style: italic; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.layers button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.layers button[aria-pressed="true"] small { color: var(--rule); }
[data-theme="observatory"] .layers button[aria-pressed="true"] { background: var(--accent); color: #05101e; }
button:focus-visible, input:focus-visible, a:focus-visible, #map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lookup { margin: 0 0 18px; }
.lookup label { display: block; font-size: 12px; color: var(--muted); font-variant-caps: all-small-caps; letter-spacing: .1em; }
.lookup div { display: flex; gap: 0; margin-top: 4px; }
.lookup input { flex: 1; min-width: 0; font: 15px var(--mono); padding: 8px 10px; border: 1px solid var(--ink); border-right: 0;
                background: var(--paper); color: var(--ink); border-radius: 0; }
.lookup button { font-family: var(--display); padding: 8px 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; }

.legend canvas { width: 100%; height: 10px; display: block; border: 1px solid var(--ink-2); }
.ticks { position: relative; height: 16px; font-size: 11px; color: var(--ink-2); font-family: var(--display); }
.ticks span { position: absolute; transform: translateX(-50%); top: 2px; }
.ticks span::before { content: ""; position: absolute; left: 50%; top: -3px; height: 4px; border-left: 1px solid var(--ink-2); }
.key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 11px; height: 11px; border: 1px solid var(--rule); margin-left: 6px; }
.sw.assigned { background: var(--map-assigned); } .sw.empty { background: var(--map-empty); }
.sw.hatch { background: repeating-linear-gradient(45deg, var(--map-empty) 0 2px, var(--map-hatch) 2px 3px); }

.cursor { border: 1px dashed var(--rule); padding: 12px 14px; margin: 18px 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); min-height: 76px; }
.cursor b { display: block; color: var(--ink); font-weight: 500; font-family: var(--display); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; border-top: 1px solid var(--ink); padding-top: 16px; margin: 0; }
.stats div { margin: 0; }
.stats dt { font-size: 34px; line-height: 1.05; color: var(--ink); }
.stats dd { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); font-style: italic; }

.block { border-top: 1px solid var(--ink); padding: 26px 0 8px; }
.block:focus { outline: none; }          /* focused programmatically after a lookup, for screen readers */
.block h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 14px; display: flex; gap: 14px; align-items: baseline; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 28px; margin: 0 0 16px; }
.facts .wide { grid-column: span 2; }
.facts dt { font-size: 12px; color: var(--muted); font-variant-caps: all-small-caps; letter-spacing: .1em; }
.facts dd { margin: 2px 0 0; }
.facts dd.num { font-size: 30px; line-height: 1.1; }
.facts dd.unit { font-size: 12px; color: var(--muted); font-style: italic; }
.facts a { border-bottom: 1px solid var(--rule); }
.tier { border-left: 3px solid var(--accent); padding: 8px 14px; background: var(--paper-2); display: grid; gap: 2px; max-width: 760px; }
.tier b { font-family: var(--display); font-weight: 500; }
.tier span { font-size: 13.5px; color: var(--ink-2); }
.tier-T2 { border-color: var(--accent-2); }

.blast { border-top: 1px solid var(--ink); padding: 30px 0 18px; }
.blast-head { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: baseline; }
.blast h2 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 0; }
.blast .deck { margin: 0; font-size: 15px; max-width: 64ch; }
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg button { appearance: none; border: 0; background: none; padding: 6px 12px; font-family: var(--display); cursor: pointer; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.blast-rows { list-style: none; margin: 18px 0 0; padding: 0; counter-reset: r; }
.blast-rows li { display: grid; grid-template-columns: 26px minmax(220px, 300px) 1fr 70px; gap: 14px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--rule-2); counter-increment: r; }
.blast-rows li::before { content: counter(r); font-family: var(--display); color: var(--muted); font-size: 13px; }
.blast-rows .org { display: block; }
.blast-rows .asn { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.blast-rows .bar { height: 9px; background: var(--rule-2); position: relative; }
.blast-rows .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.blast-rows .num { text-align: right; font-size: 17px; }

footer { border-top: 1px solid var(--ink); margin-top: 26px; padding: 22px 0 44px; color: var(--ink-2); font-size: 13.5px; max-width: 900px; }
footer b { color: var(--ink); font-family: var(--display); font-weight: 500; }
.themes a { margin-left: 10px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.themes a.on { color: var(--accent); border-color: var(--accent); }

@media (max-width: 980px) {
  .wrap { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .side h1 { font-size: calc(var(--h1-size) * .72); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blast-head { grid-template-columns: 1fr; gap: 10px; }
  .blast-rows li { grid-template-columns: 22px 1fr 64px; }
  .blast-rows li > a { grid-column: 2; grid-row: 1; }
  .blast-rows li > .num { grid-column: 3; grid-row: 1; }
  .blast-rows li > .bar { grid-column: 2 / 4; grid-row: 2; }
  nav a { margin-left: 0; margin-right: 18px; }
  header .top { gap: 10px; }
}
