/* Latest history of evolution of humans: a calm, human-centred story.
   The page is the Indian Ocean (the map's own sea colour), so East Africa floats on it.
   Ochre, humanity's first pigment, marks causes: arrows, numbers, the current milestone.
   Desktop (body.fit, set by main.js): one screen, no page scroll. Smaller screens: the page scrolls. */
:root {
  --sea: #1f3a4d;
  --chalk: #f2ead7;
  --mist: #a8bcc7;
  --line: rgba(242, 234, 215, .14);
  --ochre: #f0b347;
  --ink: #10202a;
  --forest: #42633e;
  --wood: #85915a;
  --grass: #c4b270;
  --dry: #d6c4a0;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --top-h: 82px;
  --side-w: 214px;
  /* type: tightened in steps when a milestone would not fit (main.js fitPanel) */
  --t-title: 34px; --t-lede: 17.5px; --t-text: 15.5px; --t-small: 13.5px; --gap: 16px; --more-h: 156px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sea); color: var(--chalk); font: 400 17px/1.55 var(--serif); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; border-radius: 4px; }
a { color: var(--chalk); }

/* ---------------------------------------------------------------- page header: beside the Surriworks corner on desktop */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px 12px; }
.top h1 { margin: 0; font: 600 15px/1.25 var(--sans); font-stretch: 112%; letter-spacing: .005em; color: var(--chalk); }
.top .sub { margin: 2px 0 0; font: 400 14px/1.3 var(--serif); color: var(--mist); }
.top cite { font-style: italic; }
.link-btn { flex: none; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: 500 13px/1 var(--sans); color: var(--mist); cursor: pointer; }
.link-btn:hover { color: var(--chalk); border-color: rgba(242, 234, 215, .35); }

/* ---------------------------------------------------------------- the map */
.stage { position: relative; width: 100%; aspect-ratio: 1000 / 1170; }
.ea, .globe { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .45s ease; }
.globe, .era {
  /* the frame dissolves into the page's sea */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 3.5%, #000 96.5%, transparent 100%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 3.5%, #000 96.5%, transparent 100%); mask-composite: intersect; }
.globe { opacity: 0; pointer-events: none; }
.stage.on-globe .ea { opacity: 0; }
.stage.on-globe .globe { opacity: 1; }
.stage:not(.fade) .ea, .stage:not(.fade) .globe { transition: none; }
.era { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .6s ease; user-select: none; -webkit-user-drag: none; }
.era.on { opacity: 1; }
.ea.dimmed .era { filter: saturate(.5) brightness(.5); }
.marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* map marks: sizes are in screen pixels times --k (user units per pixel) */
.marks { --k: 1; }
.marks text { font-family: var(--sans); }
.pill-bg { fill: rgba(16, 32, 42, .86); stroke: rgba(240, 179, 71, .55); stroke-width: calc(1px * var(--k)); }
.pill.off .pill-bg { stroke: rgba(242, 234, 215, .35); }
.pill-t { fill: var(--chalk); font-size: calc(13.5px * var(--k)); font-weight: 600; }
.pill.node .pill-bg { stroke: rgba(242, 234, 215, .4); }
.badge { fill: var(--ochre); }
.badge-n { fill: var(--ink); font-size: calc(13px * var(--k)); font-weight: 700; }
.a-case { fill: none; stroke: rgba(16, 32, 42, .82); stroke-width: calc(7px * var(--k)); stroke-linecap: round; }
.a-line { fill: none; stroke: var(--ochre); stroke-width: calc(3.4px * var(--k)); stroke-linecap: round; }
.a-line.dashed { stroke-dasharray: calc(7px * var(--k)) calc(6px * var(--k)); }
.a-head { fill: var(--ochre); stroke: rgba(16, 32, 42, .82); stroke-width: calc(2px * var(--k)); stroke-linejoin: round; }
.arrow.minor .a-line { stroke-width: calc(2.4px * var(--k)); opacity: .8; }
.arrow.minor .a-case { stroke-width: calc(5.4px * var(--k)); opacity: .7; }
.layer.has-hot .arrow:not(.hot):not(.loop-arc) { opacity: .28; }
.arrow { transition: opacity .2s; }
.arrow.hot .pill-bg { stroke: var(--ochre); stroke-width: calc(2px * var(--k)); }

.s-ring { fill: rgba(16, 32, 42, .5); stroke: var(--chalk); stroke-width: calc(2px * var(--k)); }
.s-dot { fill: var(--chalk); }
.s-t { fill: var(--chalk); font-size: calc(12.5px * var(--k)); font-weight: 600; paint-order: stroke; stroke: rgba(16, 32, 42, .88); stroke-width: calc(4px * var(--k)); stroke-linejoin: round; }
.s-t .s-head { fill: var(--ochre); }

.rift .r-case { fill: none; stroke: rgba(16, 32, 42, .55); stroke-width: calc(5px * var(--k)); stroke-linecap: round; stroke-linejoin: round; }
.rift .r-line { fill: none; stroke: var(--chalk); stroke-width: calc(2px * var(--k)); stroke-dasharray: calc(9px * var(--k)) calc(5px * var(--k)); stroke-linecap: round; opacity: .85; }
.rift .r-west { fill: none; stroke: var(--chalk); stroke-width: calc(1.4px * var(--k)); stroke-dasharray: calc(5px * var(--k)) calc(5px * var(--k)); opacity: .45; }
.rift.strong .r-case { stroke-width: calc(9px * var(--k)); }
.rift.strong .r-line { stroke-width: calc(3.4px * var(--k)); opacity: 1; }
.rift .r-t { fill: var(--chalk); font-size: calc(12.5px * var(--k)); font-weight: 600; font-style: italic; paint-order: stroke; stroke: rgba(16, 32, 42, .85); stroke-width: calc(4px * var(--k)); }
.lost-a { fill: url(#hatch); stroke: var(--ochre); stroke-width: calc(1.4px * var(--k)); stroke-opacity: .8; }
.hatch-line { stroke: var(--ochre); stroke-width: 2.6; opacity: .75; }
.loop-t { fill: var(--mist); font-size: calc(14px * var(--k)); font-weight: 500; }

/* one orchestrated reveal per milestone: lines draw, then heads and labels appear */
.layer.out { opacity: 0; transition: opacity .2s; }
.layer.anim .a-line[pathLength], .layer.anim .a-case[pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .75s cubic-bezier(.3, .7, .3, 1) forwards; animation-delay: calc(.25s + var(--i, 0) * .22s); }
.layer.anim .arrow .a-head, .layer.anim .arrow .pill, .layer.anim .site, .layer.anim .loop-node { opacity: 0; animation: appear .35s ease forwards; animation-delay: calc(.6s + var(--i, 0) * .22s); }
.layer.anim .site { animation-delay: calc(.15s + var(--i, 0) * .12s); }
.layer.anim .lost, .layer.anim .rift { opacity: 0; animation: appear .6s ease forwards .1s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 6px 0 0; font: 500 12.5px/1.4 var(--sans); color: var(--mist); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg.note { font-weight: 400; opacity: .85; }
.sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.sw-forest { background: var(--forest); } .sw-wood { background: var(--wood); } .sw-grass { background: var(--grass); } .sw-dry { background: var(--dry); }
.sw-lost { background: repeating-linear-gradient(130deg, var(--ochre) 0 2px, transparent 2px 5px); outline: 1px solid var(--ochre); }
.sw-ice { background: #eef4f7; } .sw-route { background: var(--ochre); height: 4px; border-radius: 2px; }
.sw-hatch { background: repeating-linear-gradient(135deg, rgba(233, 223, 200, .7) 0 1.5px, transparent 1.5px 5px); outline: 1px dashed rgba(233, 223, 200, .7); }

/* the ice film */
.film { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 8px; }
.film[hidden] { display: none; }
.film-note { margin: 0; justify-self: start; max-width: 38em; padding: 8px 12px; border-radius: 10px; background: rgba(16, 32, 42, .82); font: 400 15px/1.45 var(--serif); color: var(--chalk); }
.film-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(16, 32, 42, .86); }
.film-bar .play { flex: none; min-width: 74px; padding: 7px 12px; border-radius: 999px; border: 0; background: var(--ochre); color: var(--ink); font: 600 13.5px/1 var(--sans); cursor: pointer; }
.film-bar input { flex: 1; min-width: 60px; accent-color: var(--ochre); }
.film-bar output { flex: none; min-width: 10.5em; text-align: right; font: 600 15px/1 var(--sans); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- the story */
.intro { margin: 0 0 var(--gap); padding: 0 0 12px; border-bottom: 1px solid var(--line); font: 400 var(--t-text)/1.5 var(--serif); color: var(--mist); }
.head { margin: 0 0 10px; }
.count { margin: 0; font: 500 13px/1.3 var(--sans); color: var(--mist); }
.title { margin: 4px 0 4px; font: 650 var(--t-title)/1.08 var(--sans); font-stretch: 115%; letter-spacing: -.012em; text-wrap: balance; }
.when { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font: 600 15px/1.3 var(--sans); color: var(--ochre); }
.key { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(240, 179, 71, .5); font: 500 12.5px/1.3 var(--sans); }
.lede { margin: 0 0 var(--gap); font-size: var(--t-lede); line-height: 1.55; text-wrap: pretty; max-width: 46em; }
.panel h3 { margin: 0 0 6px; font: 600 var(--t-small)/1.3 var(--sans); color: var(--mist); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
.changed dl { margin: 0; }
.changed .row { display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.changed .row:last-child { border-bottom: 1px solid var(--line); }
.changed dt { font: 600 13px/1.65 var(--sans); color: var(--chalk); }
.changed dd { margin: 0; font-size: var(--t-text); line-height: 1.45; }
.because { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: 1px; }
.b-n { width: 17px; height: 17px; border-radius: 50%; display: inline-grid; place-items: center; background: rgba(240, 179, 71, .18); border: 1px solid rgba(240, 179, 71, .75); color: var(--ochre); font: 700 10.5px/1 var(--sans); cursor: default; }
.b-n:hover { background: var(--ochre); color: var(--ink); }
.gauge-wrap { display: flex; align-items: center; gap: 8px; margin: 1px 0; }
.gauge { display: block; overflow: visible; flex: none; }
.g-track { fill: rgba(242, 234, 215, .12); }
.g-fill { fill: var(--ochre); }
.g-tick { stroke: var(--mist); stroke-width: 1.5; }
.g-lab { fill: var(--mist); font: 500 9.5px var(--sans); }
.cc { font: 600 13.5px/1 var(--sans); white-space: nowrap; }
.b-txt { display: block; color: var(--chalk); }

.why ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.why li { display: grid; grid-template-columns: 24px 1fr; gap: 9px; align-items: start; border-radius: 10px; padding: 5px 8px 5px 6px; margin: 0 -8px 0 -6px; transition: background-color .15s; }
.why ol.num li:hover, .why ol.num li:focus-within { background: rgba(240, 179, 71, .09); }
.why .n { width: 22px; height: 22px; border-radius: 50%; background: var(--ochre); color: var(--ink); display: grid; place-items: center; font: 700 12.5px/1 var(--sans); margin-top: 2px; }
.why .n.plain { width: 8px; height: 8px; margin: 9px 0 0 7px; background: var(--mist); }
.why p { margin: 0; font-size: var(--t-text); line-height: 1.45; }
.why .kind { font: 600 12.5px/1 var(--sans); color: var(--ochre); margin-right: 7px; }

/* who lived then / picture / Bennett's view / still debated: one box, chosen with tabs */
.more { margin-top: var(--gap); border-top: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 10px; }
.tabs [role=tab] { padding: 6px 12px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--mist); font: 600 13px/1.2 var(--sans); cursor: pointer; }
.tabs [role=tab]:hover { color: var(--chalk); border-color: var(--line); }
.tabs [role=tab][aria-selected=true] { color: var(--ink); background: var(--chalk); }
.tp { padding-top: 10px; }
.tp[hidden] { display: none; }
.tp-h { display: none; }
/* room to spare (main.js fitPanel): every box at once, side by side, each with its own heading */
.more.open { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 28px; align-items: start; padding-top: 6px; }
.more.open .tabs { display: none; }
.more.open .tp, .more.open .tp[hidden] { display: block; flex: none !important; overflow: visible !important; min-height: auto !important; }
body.fit .panel .more.open { flex: none; min-height: auto; }        /* never squeezed: if it does not fit, tabs are used */
.more.open .tp-h { display: block; margin: 0 0 6px; font: 600 var(--t-small)/1.3 var(--sans); color: var(--mist); }
.more.open .tp p { color: var(--mist); }
.tp p { margin: 0; font-size: var(--t-text); line-height: 1.5; color: var(--chalk); max-width: 52em; }
.tp .aside { margin: 0 0 8px; font-style: italic; color: var(--mist); }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 5px 12px 5px 5px; border-radius: 12px; border: 1px solid var(--line); background: rgba(16, 32, 42, .35); cursor: pointer; max-width: 100%; }
.chip:hover { border-color: rgba(242, 234, 215, .4); background: rgba(16, 32, 42, .55); }
.chip img, .chip .noimg { grid-row: span 2; width: 48px; height: 48px; border-radius: 9px; object-fit: cover; background: #d9d1bf; }
.chip .noimg { background: rgba(242, 234, 215, .08); border: 1px dashed var(--line); }
.chip .c-name { align-self: end; font: 600 13.5px/1.2 var(--sans); }
.chip .c-when { align-self: start; font: 400 12.5px/1.3 var(--serif); color: var(--mist); }
.panel .chip.term { text-decoration: none; border-bottom: 1px solid var(--line); }

.plate { margin: 0; display: flex; align-items: flex-end; gap: 12px; }
.plate .enlarge { padding: 8px; border: 0; border-radius: 4px; background: #eee6d4; cursor: zoom-in; line-height: 0; }
.plate img { display: block; height: 128px; width: auto; max-width: 100%; mix-blend-mode: multiply; }
.plate figcaption { font: 400 12px/1.35 var(--sans); color: var(--mist); max-width: 16em; }
.lightbox { padding: 0; border: 0; background: none; max-width: min(92vw, 1100px); max-height: 92vh; }
.lightbox::backdrop { background: rgba(8, 16, 22, .82); }
.lightbox figure { margin: 0; padding: 14px; background: #eee6d4; border-radius: 6px; cursor: zoom-out; }
.lightbox img { display: block; max-width: 100%; max-height: calc(92vh - 70px); margin: 0 auto; mix-blend-mode: multiply; }
.lightbox figcaption { margin-top: 8px; font: 400 13px/1.35 var(--sans); color: #4b493f; text-align: center; }

/* words with an explanation */
.term { border-bottom: 1px dotted rgba(242, 234, 215, .55); cursor: help; }
.term:hover { border-bottom-color: var(--chalk); }
.term.sp { border-bottom-color: rgba(240, 179, 71, .8); cursor: pointer; }

/* ---------------------------------------------------------------- milestones, with Back and Next under them */
.rail ol { list-style: none; margin: 0; padding: 0; position: relative; }
.rail ol::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.rail button { position: relative; display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; width: 100%; text-align: left; padding: 5px 8px 5px 0; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--mist); }
.rail button:hover .r-title { opacity: 1; }
.rail .dot { grid-row: span 3; justify-self: center; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid rgba(168, 188, 199, .7); background: var(--sea); transition: background-color .2s, box-shadow .2s; }
.rail .r-when { font: 500 12.5px/1.3 var(--sans); }
.rail .r-title { font: 400 15px/1.25 var(--serif); color: var(--chalk); opacity: .72; }
.rail .r-key { font: 500 12px/1.3 var(--sans); color: var(--ochre); }
.rail .past .dot { background: rgba(168, 188, 199, .7); }
.rail [aria-current] .dot { background: var(--ochre); border-color: var(--ochre); box-shadow: 0 0 0 5px rgba(240, 179, 71, .2); }
.rail [aria-current] .r-title { opacity: 1; font-weight: 600; }
.rail [aria-current] .r-when { color: var(--ochre); }

/* Back and Next: the main controls, under the story */
.steps { display: flex; gap: 10px; }
.steps button { height: 56px; border-radius: 16px; cursor: pointer; }
.steps .arr { font: 600 19px/1 var(--sans); }
.steps .prev { flex: none; display: inline-flex; align-items: center; gap: 9px; padding: 0 20px 0 16px; background: none; border: 1.5px solid rgba(242, 234, 215, .3); color: var(--chalk); font: 600 15px/1 var(--sans); }
.steps .prev:hover:not(:disabled) { border-color: rgba(242, 234, 215, .6); background: rgba(242, 234, 215, .05); }
.steps .prev:disabled { opacity: .3; cursor: default; }
.steps .next { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 14px; padding: 0 20px 0 22px;
  background: var(--ochre); border: 0; color: var(--ink); text-align: left; box-shadow: 0 8px 24px rgba(240, 179, 71, .16); transition: filter .15s, box-shadow .15s; }
.steps .next:hover { filter: brightness(1.06); box-shadow: 0 8px 28px rgba(240, 179, 71, .3); }
.steps .next .arr { transition: transform .15s; }
.steps .next:hover .arr { transform: translateX(3px); }
.steps .n-l { font: 700 12px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; opacity: .68; }
.steps .n-t { font: 650 18px/1.2 var(--sans); font-stretch: 106%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- cards that pop up from a word or a portrait */
.tip { position: fixed; z-index: 50; max-width: 340px; padding: 14px 16px; border-radius: 14px; background: #10222d; border: 1px solid rgba(242, 234, 215, .18); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); font: 400 15px/1.45 var(--serif); color: var(--chalk); }
.tip p { margin: 6px 0 0; }
.tip-name { font: 600 15px/1.25 var(--sans); }
.tip-head { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; }
.tip-head figure { margin: 0; }
.tip-head img { width: 104px; height: 104px; border-radius: 10px; object-fit: cover; background: #d9d1bf; display: block; }
.tip-head .tip-name { display: block; }
.tip-nick { display: block; font: italic 400 14px/1.3 var(--serif); color: var(--mist); }
.tip-when { display: block; margin-top: 4px; font: 500 13px/1.3 var(--sans); color: var(--ochre); }
.tip-dl { display: grid; grid-template-columns: 62px 1fr; gap: 4px 10px; margin: 12px 0 0; font-size: 14.5px; line-height: 1.4; }
.tip-dl dt { font: 600 12.5px/1.5 var(--sans); color: var(--mist); }
.tip-dl dd { margin: 0; }
.tip-credit { font: 400 11.5px/1.35 var(--sans) !important; color: var(--mist); }
.tip-credit a { color: var(--mist); }
.tip .go { margin-top: 10px; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(240, 179, 71, .6); background: none; color: var(--ochre); font: 600 13px/1.2 var(--sans); cursor: pointer; text-align: left; }
.tip .go:hover { background: rgba(240, 179, 71, .1); }

/* ---------------------------------------------------------------- sources */
.sources { max-width: min(760px, calc(100vw - 32px)); max-height: min(82vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: #10222d; color: var(--chalk); }
.sources::backdrop { background: rgba(8, 16, 22, .6); }
.sources-in { padding: 22px 26px 20px; }
.sources h2 { margin: 0 0 10px; font: 650 22px/1.2 var(--sans); font-stretch: 112%; }
.sources p { margin: 0 0 14px; color: var(--mist); font-size: 15.5px; }
.sources ol { margin: 0; padding-left: 1.3em; font-size: 14.5px; line-height: 1.45; color: var(--mist); }
.sources li { margin: 0 0 6px; }
.sources a { color: var(--chalk); text-decoration-color: rgba(242, 234, 215, .35); }
.sources .close { position: sticky; bottom: 0; margin-top: 14px; padding: 9px 16px; border-radius: 999px; border: 0; background: var(--ochre); color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer; }

/* ================================================================ desktop: everything on one screen */
body.fit { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.fit .swb-bar { flex: none; }
body.fit .top { position: absolute; top: 0; left: 250px; right: 24px; height: var(--top-h); padding: 0; z-index: 6; pointer-events: none; }
body.fit .top > * { pointer-events: auto; }
body.fit .app { flex: 1; min-height: 0; width: 100%; max-width: 2200px; margin: 0 auto; padding: 0 24px 14px;
  display: grid; grid-template-columns: var(--stage-w) minmax(0, 1fr) var(--side-w); gap: 0 32px; }
@media (max-width: 1439px) { body.fit .app { padding: 0 20px 12px; gap: 0 26px; } }
body.fit .mapcol { min-height: 0; }
body.fit .stage { width: var(--stage-w); height: var(--stage-h); aspect-ratio: auto; }
body.fit .mid { min-height: 0; display: flex; flex-direction: column; }
body.fit .panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding-right: 4px; }
body.fit .panel > * { flex: none; }
/* the tab box sits at the bottom and gives up height first (its own content scrolls) when space is short */
body.fit .panel .more { flex: 0 1 auto; min-height: 118px; display: flex; flex-direction: column; }
body.fit .panel .more .tabs { flex: none; }
body.fit .panel .more .tp { flex: 0 1 var(--more-h); min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(242, 234, 215, .2) transparent; }
body.fit .panel.tight { --t-title: 30px; --t-lede: 16.5px; --t-text: 14.5px; --gap: 12px; --more-h: 140px; }
body.fit .panel.tighter { --t-title: 27px; --t-lede: 15.5px; --t-text: 13.8px; --gap: 9px; --more-h: 128px; }
body.fit .panel.tighter .changed .row { padding: 4px 0; }
body.fit .panel.tightest { --t-title: 24px; --t-lede: 14.8px; --t-text: 13.2px; --gap: 7px; --more-h: 112px; }
body.fit .panel.tightest .intro, body.fit .panel.tightest .count { display: none; }
body.fit .panel.tightest .more { min-height: 100px; }
body.fit .panel.tightest .lede { line-height: 1.45; }
/* a short screen (main.js fitPanel): only the row of tabs stays; a tab opens its box over the story */
body.fit .panel .more.drawer { flex: none; min-height: 0; position: relative; }
body.fit .panel .more.drawer .tp { display: none; }
body.fit .panel .more.drawer.show .tp:not([hidden]) { display: block; position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 4; max-height: 52vh; overflow-y: auto;
  padding: 14px 16px; border-radius: 14px; background: #183243; border: 1px solid rgba(242, 234, 215, .2); box-shadow: 0 -12px 32px rgba(8, 18, 26, .5); }
body.fit .panel .more.drawer .tabs [role=tab] { border-color: var(--line); }
body.fit .panel .more.drawer .tabs [role=tab]::after { content: "▴"; margin-left: 6px; font-size: 10px; opacity: .55; }
body.fit .panel .more.drawer:not(.show) .tabs [role=tab][aria-selected=true] { color: var(--mist); background: none; }
body.fit .panel .more.drawer.show .tabs [role=tab][aria-selected=true]::after { content: "▾"; }
body.fit .panel.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(242, 234, 215, .2) transparent; }
body.fit .side { min-height: 0; overflow-y: auto; scrollbar-width: none; }
body.fit .steps { flex: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-height: 820px) { body.fit .steps { margin-top: 8px; padding-top: 10px; } body.fit .steps button { height: 50px; } body.fit .steps .n-t { font-size: 16.5px; } }
@media (max-height: 699px) { body.fit .steps { margin-top: 6px; padding-top: 8px; } body.fit .steps button { height: 46px; } }

/* ================================================================ smaller screens: the page scrolls */
body:not(.fit) .app { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); grid-template-areas: "side side" "map panel"; gap: 0 28px; padding: 0 24px 96px; }
body:not(.fit) .side { grid-area: side; min-width: 0; }
body:not(.fit) .mapcol { grid-area: map; min-width: 0; position: sticky; top: 8px; align-self: start; }
body:not(.fit) .mid { grid-area: panel; min-width: 0; }
body:not(.fit) .cols { grid-template-columns: 1fr; gap: var(--gap); }
body:not(.fit) .rail { margin: 0 -24px 12px; padding: 0 24px; overflow-x: auto; scrollbar-width: none; }
body:not(.fit) .rail::-webkit-scrollbar { display: none; }
body:not(.fit) .rail ol { display: flex; gap: 4px; width: max-content; padding-bottom: 4px; }
body:not(.fit) .rail ol::before { left: 0; right: 0; top: 11px; bottom: auto; width: auto; height: 2px; }
body:not(.fit) .rail button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 148px; padding: 4px 10px 6px 0; }
body:not(.fit) .rail .dot { margin: 0 0 4px; justify-self: start; }
body:not(.fit) .rail .r-title { font-size: 14px; }
body:not(.fit) .rail .r-key { display: none; }
/* Back and Next stay at hand at the bottom of the screen */
body:not(.fit) .steps { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); background: #1a3243; border-top: 1px solid var(--line); }
/* tablets: the bar's buttons sit under the story column, as on desktop */
@media (min-width: 820px) { body:not(.fit) .steps { padding-left: calc(24px + (100vw - 76px) * .46 + 28px); } }
body:not(.fit) .steps button { height: 50px; }
body:not(.fit) .steps .n-t { font-size: 16px; }
body:not(.fit) .tp { min-height: 0; }
@media (max-width: 819px) {
  body { font-size: 16.5px; }
  .top { padding: 0 16px 10px; }
  .top h1 { font-size: 14px; }
  body:not(.fit) .app { display: flex; flex-direction: column; align-items: stretch; padding: 0 16px 88px; }
  body:not(.fit) .side { order: -1; }
  body:not(.fit) .rail { margin: 0 -16px 12px; padding: 0 16px; }
  body:not(.fit) .rail button { width: 132px; }
  body:not(.fit) .mapcol { position: static; }
  body:not(.fit) .panel { margin-top: 14px; }
  /* phones: Next on two lines (label over the title), so the title has the whole button */
  body:not(.fit) .steps { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  body:not(.fit) .steps .prev { padding: 0 14px 0 12px; gap: 7px; }
  body:not(.fit) .steps .next { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-content: center; column-gap: 10px; row-gap: 3px; padding: 0 16px; }
  body:not(.fit) .steps .n-l { grid-area: 1 / 1; font-size: 10.5px; }
  body:not(.fit) .steps .n-t { grid-area: 2 / 1; font-size: 15.5px; }
  body:not(.fit) .steps .next .arr { grid-area: 1 / 2 / 3 / 3; }
  :root { --t-title: 28px; --t-lede: 17px; --t-text: 15.5px; }
  .film { left: 8px; right: 8px; bottom: 8px; }
  .film-note { font-size: 14px; }
  .film-bar output { min-width: 0; font-size: 13.5px; }
  .tip { max-width: calc(100vw - 24px); }
  .plate img { height: 150px; }
  .legend { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
