/* Hallmark · genre: editorial · macrostructure: Long Document (kept: the report's own section order) · theme: Newsprint-style news report
 * tone: investigative news (Reuters Graphics / ProPublica) · paper: warm off-white · ink: near-black · accent: ink-blue links, red only for over-limit
 * Loaded last on sai-series1.html: re-skins sai-3d.css / sai-analysis.css / the Series 1 styles without touching content.
 * Light theme only; the dark theme keeps its own tokens (:root[data-theme=dark] .nx outranks .nx below). */

:root:not([data-theme="dark"]), :root:not([data-theme="dark"]) .nx {
  --news-paper: #f6f7f3;     /* same paper as the homepage (sai-route.html) */
  --news-paper-2: #eceee6;
  --news-ink: #151515;
  --news-ink-2: #2e2e2e;
  --news-muted: #5e5e5e;
  --news-rule: rgba(21, 21, 21, .2);
  --news-rule-soft: rgba(21, 21, 21, .1);
  --news-link: #1d4f91;
  --news-red: #c1121f;
  --news-mark: rgba(242, 201, 76, .55);
  --bg: var(--news-paper); --bg2: var(--news-paper-2); --surface: var(--news-paper); --surface2: var(--news-paper-2);
  --line: var(--news-rule); --line2: var(--news-rule-soft);
  --ink: var(--news-ink); --ink2: var(--news-ink-2); --muted: var(--news-muted);
  --accent: var(--news-link); --accent-soft: rgba(29, 79, 145, .07); --on-accent: var(--news-paper);
  --hot: var(--news-red); --red: var(--news-red);
}
/* fonts: the homepage's (sai-route.html / ai-care-research.re-groups.com): Kanit for headings and big numbers (--f-head),
   IBM Plex Sans Thai for text (--f-th), Oswald for Latin labels (--f-en); the template sets those three, this file only
   points its own roles at them */
:root, .nx { --f-serif: var(--f-head); --f-kick: "Oswald", "IBM Plex Sans Thai", sans-serif; }
.nx { font-family: var(--f-head); }   /* text and tables in Kanit, as on the homepage */
.nx .note { font-family: var(--f-th); }   /* small grey notes stay in Plex, as there */
.nx code, .nx .mono { font-family: var(--f-th); }   /* formulas: their Thai subscripts read better in Plex than in a monospace */

/* ---- headlines: bold, black */
.nx h2, .nx .headline { font-family: var(--f-serif); font-weight: 600; letter-spacing: -.005em; }
.nx h2 { font-size: clamp(23px, 2.7vw, 32px); line-height: 1.35; }
.nx .headline { line-height: 1.45; }
.nx .headline em { color: inherit; background: linear-gradient(transparent 58%, var(--news-mark) 58%); }

/* ---- hero: fonts and colours of the homepage hero (sai-route.html #intro: Oswald kicker in rust, Kanit title and sub),
   sizes and measure from the series source (.brand h1 26-42 px, sub capped at 880 px) so the long title does not spill */
:root:not([data-theme="dark"]) .r-hero {   /* light only: dark mode keeps the template's dark tokens (light text, orange accent) */
  --ink: #221e19; --ink2: #352f27; --muted: #5a5145; --accent: #b34812; --line: rgba(52, 42, 30, .2); --line2: rgba(52, 42, 30, .1); --surface: #fff;
}
.r-hero .r-kicker { font: 600 14px var(--f-en); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.r-hero h1 { font: 600 clamp(26px, 4vw, 42px)/1.25 var(--f-head); color: var(--ink); margin: 6px 0 8px; max-width: 30em; overflow-wrap: anywhere; min-width: 0; text-wrap: balance; }
.r-hero p.sub { font: 400 clamp(17px, 2vw, 21px)/1.5 var(--f-head); color: var(--ink2); margin: 0 0 18px; max-width: 880px; }

/* ---- boxes become ruled blocks: no fill, no radius, no shadow */
.nx :is(.card, .about, .set-card, .step, .stat, .params label, .refs li, .why, .takeaway, .advice, .kpi),
.nx svg.chart, .tw, .gauge {
  background: none; border: 0; border-radius: 0; box-shadow: none;
}
.nx :is(.card, .about, .set-card, .stat, .params label, .refs li, .advice) { border-top: 1px solid var(--line); padding-left: 0; padding-right: 0; }
/* method steps: ruled like the rest, with room on the left for a rust number disc (same colour as the section badges) */
.nx .step { border-top: 1px solid var(--line); padding: 12px 0 12px 40px; }
.nx .step::before { left: 0; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--s1-rust); color: #fff; font: 600 14px/26px var(--f-kick); text-align: center; }
.nx :is(.why, .takeaway), #summary .why { background: none; border: 0; border-radius: 0; border-left: 3px solid var(--ink); padding: 4px 0 4px 16px; }
.nx .takeaway { font-family: var(--f-serif); font-weight: 600; }
.nx svg.chart { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tw { border-top: 2px solid var(--ink); }
.nx th { background: none; border-bottom: 1px solid var(--ink); }
/* section label: rust number badge + rust label, the hero kicker's colour and face (Oswald for Latin, Plex for Thai) */
.nx { --s1-rust: #b34812; }
.nx .eyebrow { font: 500 13.5px var(--f-head); color: var(--s1-rust); letter-spacing: .06em; }
.nx .eyebrow .num { background: var(--s1-rust); color: #fff; padding: 1px 8px; border-radius: 3px; margin-right: 10px; font: 600 14px/1.5 var(--f-kick); letter-spacing: .04em; }
.nx .flag { border-radius: 0; background: none; }
.nx :is(.btn, .btn-go, .chip, .pend, .seg, .pl-go button) { border-radius: 2px; }
.nx .btn-go { background: var(--ink); color: var(--news-paper); }

/* ---- key numbers: big black serif, ruled above; red only where the value is over the limit */
.nx .kpi { border-top: 2px solid var(--ink); padding: 12px 0 4px; cursor: pointer; }
.nx .kpi .v { font: 600 clamp(36px, 4vw, 48px)/1.1 var(--f-serif); color: var(--ink); }
.nx .kpi .v.over, .nx .kpi.over .v { color: var(--hot); }
.nx .kpi .src { color: var(--muted); }
.nx .kpi.cam-on { outline: 0; border-top-width: 5px; }
.nx .kpi:hover .t { text-decoration: underline; }

/* ---- 3D model frames and labels: square, flat */
.t3d, .t3d-fly, .t3d-story { border-radius: 2px; }
#summary.scrolly > #t3d-story { box-shadow: none; }
.t3d .lbl, .t3d-story .lbl, .t3d-fly .esri-chip, .t3d-story .esri-chip { border-radius: 2px; box-shadow: none; }
.t3d .lbl { background: rgba(21, 21, 21, .9); }

/* ---- links: underlined ink-blue, as in print-style news pages */
.nx a:not(.btn):not([class*="pl-"]) { text-underline-offset: .18em; }

/* ---- hero: the homepage's outlined "แม่น้ำสาย" behind the 3D model (same rule as .slab .ghost in sai-route.html);
   it sits in the #t3d slot, under the flying model layer, and shows through the canvas' transparent sky */
.t3d .ghost { position: absolute; left: 50%; bottom: 50%; transform: translateX(-50%); font: 700 clamp(84px, 17vw, 240px)/1 var(--f-head);
  color: transparent; -webkit-text-stroke: 1.5px var(--line); letter-spacing: -.02em; pointer-events: none; user-select: none; white-space: nowrap; }

/* ---- about box (copied from the homepage): the team and acknowledgement tables share one name-column width, so their
   second columns line up; on phones each name sits above its role */
:is(.r-hero, #about) .team-table { table-layout: fixed; }
:is(.r-hero, #about) .team-table .team-name { width: 19em; }
@media (max-width: 640px) {   /* phones: name above its role, full width, instead of two cramped columns */
  :is(.r-hero, #about) .team-table, :is(.r-hero, #about) .team-table tbody, :is(.r-hero, #about) .team-table tr, :is(.r-hero, #about) .team-table td { display: block; width: auto; }
  :is(.r-hero, #about) .team-table tr { border-bottom: 1px solid var(--line2); padding: 8px 0; }
  :is(.r-hero, #about) .team-table td { border: 0; padding: 0 10px; }
}

/* ---- workings / references modal (tools/build_series1.py): the series' own views, shown over the page */
.s1-modal { width: min(1500px, calc(100vw - 48px)); max-width: none; max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); box-shadow: 0 24px 60px rgba(20, 16, 10, .35); overflow: hidden; }
.s1-modal::backdrop { background: rgba(20, 18, 14, .55); }
.s1-modal[open] { display: flex; flex-direction: column; }
.s1-modal-body { overflow: auto; overscroll-behavior: contain; max-height: calc(100vh - 32px); }
.s1-modal-body .view > .wrap { max-width: none !important; padding: 0 clamp(16px, 3vw, 40px) !important; }   /* full modal width; !important: sai-3d.css caps .nx .wrap with !important at >= 1025 px */
.s1-modal-body .view { padding-top: 8px; }
.s1-modal-body .view .page { padding-top: 24px; }
.s1-modal-close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.s1-modal-close:hover { background: var(--bg2); }
.s1-modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.s1-modal .refs li.ref-hit { outline: 2px solid #b34812; outline-offset: 2px; }
html:has(.s1-modal[open]) { overflow: hidden; }
@media (max-width: 640px) { .s1-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .s1-modal-body { max-height: 100dvh; } }

/* ---- 3D model as a 2D map in section 03 (series1-terrain.js): markers, zoom buttons, hint, coordinate popup */
.t3d-fly.in-map { background: #1d1c18; }
.t3d-fly.at-map, .t3d-fly.at-map canvas { pointer-events: auto; }
.t3d-fly.at-map canvas { cursor: grab; touch-action: pan-y; }
.t3d-fly.at-map canvas:active { cursor: grabbing; }
.t3d-fly .mk { position: absolute; left: 0; top: 0; visibility: hidden; display: flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  translate: -50% -50%; cursor: pointer; font: 600 12px/1 var(--f-th); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .9); white-space: nowrap; }
.t3d-fly.at-map .mk { pointer-events: auto; }
.t3d-fly .mk i { display: block; width: var(--d, 10px); height: var(--d, 10px); border-radius: 50%; border: 2px solid #fff; background: #6b7c93; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.t3d-fly .mk-sa i { background: #2e6f34; }   /* legend colours of the figure below: green under, red over the limit */
.t3d-fly .mk.over i { background: #b92d22; }
.t3d-fly .mk span { position: absolute; left: calc(100% + 2px); top: 50%; translate: 0 -50%; }
.t3d-fly .mk-sa span { left: 50%; top: calc(100% + 3px); translate: -50% 0; }
.t3d-fly .mk-fish i { width: 11px; height: 11px; border-radius: 2px; background: #2563eb; }
.t3d-fly .mk-nu i { width: 10px; height: 10px; border-radius: 1px; rotate: 45deg; background: #0d9488; }
.t3d-fly .mk:focus-visible i { outline: 2px solid #fff; outline-offset: 2px; }
.t3d-fly .map-ui { display: none; }
.t3d-fly.at-map .map-ui { display: block; }
.map-ui .map-btns { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-ui .map-btns button { width: 36px; height: 36px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px; background: rgba(20, 20, 18, .82); color: #fff;
  font: 600 18px/1 var(--f-th); cursor: pointer; pointer-events: auto; }
.map-ui .map-btns button:hover { background: rgba(40, 40, 36, .92); }
.map-ui .map-btns button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.map-ui .map-hint, .map-ui .map-round { position: absolute; left: 10px; margin: 0; padding: 3px 8px; border-radius: 4px; background: rgba(20, 20, 18, .78); color: #f1efe9;
  font: 400 12px/1.4 var(--f-th); pointer-events: none; max-width: calc(100% - 70px); }
.map-ui .map-round { top: 10px; font-weight: 600; }
.map-ui .map-hint { bottom: 10px; }
.map-ui .mk-pop { position: absolute; left: 10px; top: 42px; max-width: min(320px, calc(100% - 70px)); padding: 8px 12px; border-radius: 6px; background: #fff; color: #221e19;
  font: 400 13px/1.55 var(--f-th); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); pointer-events: auto; }
.t3d-fly.at-map .esri-chip { bottom: 40px; }
.t3d-fly .mk-sa:is([data-id="SA02"], [data-id="SA03"]) span { top: auto; bottom: calc(100% + 3px); }   /* alternate above/below, as in the static figure */
.t3d-fly .mk-nu span { display: none; }   /* RR-MS, CH01, CH03, RU01 crowd SA01-SA03 at full view: names show once zoomed in */
.t3d-fly.map-zoomed .mk-nu span { display: inline; }
/* model narrower than 1000 px (tablet, small laptop): short station labels, the long ones overlap */
.t3d-fly.compact .lbl small, .t3d-fly.compact .lbl .l { display: none; }
.t3d-fly.compact .lbl .s { display: inline; }
.t3d .lbl .nm { display: none; }
.t3d-fly.compact .lbl .nm { display: block; font: 400 11.5px/1.3 var(--f-th); color: #d7dbe6; }   /* station name under the short label */
@media (max-width: 640px) { .t3d-fly.compact .lbl .nm { display: none; } }   /* phones: two-line labels collide; the table under the map names every station */
.t3d-fly.compact .lbl { font-size: 12.5px; padding: 3px 8px; }

/* ---- section 03: timeline of sampling rounds under the station map (homepage timeline, sai-3d.css .ge-timeline-overlay),
   set in the page instead of over a picture; amber tick = round at 5x the limit or more */
.nx .s1-tl { position: static; margin-top: 8px; border-radius: 8px; background: #1d1c18; backdrop-filter: none; -webkit-backdrop-filter: none; z-index: auto; }
.nx .s1-tl .tl-months { margin-left: 44px; height: 16px; color: rgba(255, 255, 255, .7); font: 600 11px var(--f-th); }
.nx .s1-tl .tl-rail button[aria-current="true"]::after { background: #f97316; box-shadow: 0 0 0 4px rgba(249, 115, 22, .3); }
.nx .s1-tl .tl-rail .tl-event::before { background: #fbbf24; }
.t3d-fly .map-ui .map-round { display: none; }   /* the timeline under the map names the round */
.nx .grid2 > * { min-width: 0; }   /* grid items: the round table and the timeline must not widen the column past the screen (the table scrolls in .tw) */

/* ---- inline notes: sai-3d.css styles every .note as a boxed block (padding, top rule, tint); the series uses <span class="note">
   for small grey text inside a sentence, where that box paints over the lines above and below */
.nx span.note, .s1-modal span.note { padding: 0; margin: 0; border: 0; border-radius: 0; background: none; max-width: none; }

/* ---- hero content on the same column as sections 01-10 (desktop): the hero background still runs the full window, its
   content takes main's left and right edges (the sidebar and step-indicator gutters), and the blocks under the model fill it */
@media (min-width: 1025px) {
  .r-hero { padding-left: var(--gauge-w); padding-right: var(--side); }
  .r-hero > .wrap { max-width: var(--content-w); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
}
.r-hero .slab-credit { width: auto; max-width: none; margin-left: 0; margin-right: 0; text-align: left; }
/* legend entries are flex rows (swatch + label); an entry that is a sentence with links must flow as text, or each link
   becomes its own flex item and the sentence breaks apart on narrow screens */
.nx .legend span:has(> a) { display: block; }

/* ---- references as a table: number | category | APA-style entry (tools/series1_refs_apa.json); notes sit under the entry */
.nx .refs-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.nx .refs-table th { text-align: left; }
.nx .refs-table td { vertical-align: top; padding: 10px 10px; border-bottom: 1px solid var(--line2); }
.nx .refs-table :is(th, td):nth-child(1) { width: 4.2em; white-space: nowrap; }
.nx .refs-table :is(th, td):nth-child(2) { width: 11em; }
.nx .refs-table .ref-n { font-weight: 600; color: var(--s1-rust); }
.nx .refs-table .ref-tag { color: var(--ink2); }
.nx .refs-table .ref-apa { padding-left: 2em; text-indent: -2em; overflow-wrap: anywhere; line-height: 1.6; }   /* hanging indent, as APA lists */
.nx .refs-table .ref-apa small { display: block; text-indent: 0; margin-top: 4px; color: var(--muted); }
.s1-modal .refs-table tr.ref-hit td { background: rgba(179, 72, 18, .1); }
@media (max-width: 640px) {
  .nx .refs-table :is(th, td):nth-child(1) { width: 3em; padding-left: 4px; padding-right: 4px; }
  .nx .refs-table :is(th, td):nth-child(2) { width: 5.6em; padding-left: 4px; }
  .nx .refs-table .ref-apa { padding-left: 1.2em; text-indent: -1.2em; padding-right: 4px; }
}

/* ---- one round picker: the source's floating round panel is off (the timeline under the section 03 map does its job, and
   carries the arsenic / lead switch); its elements stay in the page because the series script writes to them */
.nx.player { display: none !important; }
.nx .s1-tl .s1-el { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 44px; font: 400 12px var(--f-th); color: rgba(255, 255, 255, .75); }
.nx .s1-tl .s1-el button { border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 6px; padding: 5px 12px;
  font: 600 12.5px var(--f-th); cursor: pointer; }
.nx .s1-tl .s1-el button[aria-pressed="true"] { background: #c2410c; border-color: #c2410c; }   /* white text needs the darker orange (4.5:1) */
.nx .s1-tl .s1-el button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 899px) { .nx .kpi { cursor: auto; } }   /* no model to fly on phones */

/* ---- dark mode: the rust of the section labels, step and reference numbers is too dark on navy (3.5:1); use the template's
   own dark-mode orange, with dark text inside the filled badges */
:root[data-theme="dark"] .nx { --s1-rust: #e8814a; }
:root[data-theme="dark"] .nx :is(.eyebrow .num, .step::before) { color: #1d0e02; }
/* "no specific limit on this page" in the biota table: the source's grey is too pale in both themes */
:root .nx td .cell-na, :root .nx .cell-na { color: var(--muted); }   /* :root: outranks the source's html[data-theme=dark] rule */
