/* ============================================================================
   Site-specific styles for "Polyglot Teachers".
   Base typography, tokens, and components (.btn, .panel, .caption) come from
   chia.css — this file only adds page-specific layout.
   ============================================================================ */

section { scroll-margin-top: 1rem; }

/* caption convention from multilingual-edge-nlp: the bold lead sits darker
   (ink) than the muted caption body, with a little space after it */
.caption strong,
table.chia caption strong { color: var(--ink); margin-right: 0.35em; }


/* chia sets `text-wrap: balance` on headings, which makes long h2s wrap into
   balanced (early-breaking) lines; fill the measure instead. */
h2 { text-wrap: pretty; }

/* Subheadings, following the edge-nlp reference: Univers Light in ink,
   leading 110%, tracking -5 (-0.005em). Scoped headings (e.g. .method-card
   h3) override this with the display face. */
h3 {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 2.2rem 0 0.6rem;
}

/* Keep superscripts (footnote / sidenote / citation markers) from stretching
   the line box, which made adjacent paragraph lines look unevenly spaced. */
sup { font-size: 0.72em; line-height: 0; position: relative; vertical-align: baseline; top: -0.5em; }

/* ---------- header ---------- */

.letterhead { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2rem; }
.letterhead img { height: 44px; width: auto; }

/* The title runs long, so size it down from chia's 3rem default and let
   lines fill the full measure (`pretty`) instead of balancing into equal
   short lines, which wraps far too early on a wide viewport. */
.site-header h1 {
  font-size: clamp(2rem, 1.2rem + 2.6vw, 2.65rem);
  line-height: 1.08;
  text-wrap: pretty;
}

.site-header .subtitle {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--muted);
  margin: 0 0 1.25rem;
  text-wrap: pretty;
}
.site-header .subtitle a { color: var(--muted); }
.site-header .subtitle a:hover { border-bottom-color: var(--muted); }

/* Lead statement under the subtitle: Univers Light with the key numbers
   emphasised in brand blue. */
.site-header .tagline {
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 300;
  letter-spacing: -0.005em;
  margin: 0 0 1.5rem;
  text-wrap: pretty;
}
.site-header .tagline strong { color: var(--blue); }

.site-header .authors { font-size: 1.05rem; margin: 0 0 0.5rem; }
.site-header .authors > a { font-weight: 400; }
.site-header .authors .aff { color: var(--muted); font-size: 0.95rem; }

.site-header .top-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.6rem 0 2.6rem; }
.site-header .top-links .btn { border-bottom-width: 1.5px; }  /* keep .btn border on <a> hover */

/* ---------- Setup / Results run-in pill ----------
   Blue chip that opens a paragraph, from the grounding-synthetic-data site.
   Use: <p><span class="section-label">Setup</span>We finetune ...</p> */

.section-label {
  color: var(--blue);
  font-family: var(--font-body);
  font-weight: 500;
  margin-right: 0.5rem;
}

/* ---------- run-in paragraph label, like LaTeX \paragraph{} ---------- */

.para-label {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--ink);
  padding-right: 0.15rem;
}

/* sub-part groups (Model family / Data generation method / ...): extra space
   before each so groups read as distinct, tighter space to their own figure */
.subpart-lead { margin-top: 3rem; margin-bottom: 0.6rem; }

/* ---------- inline citations ----------
   (Author, Year) links: same color as surrounding text, dotted underline as
   the only clickability cue. Use: <a class="cite" href="...">(Name, 2025)</a> */

a.cite {
  color: inherit;
  border-bottom: none;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  white-space: nowrap;
}
a.cite:hover { border-bottom: none; text-decoration-style: solid; }

/* ---------- sidenotes ----------
   Numbered aside for tangential remarks. Sits in the right margin on wide
   viewports (Tufte-style); collapses to an indented note inside the column
   otherwise. Use: <sup class="sidenote-marker">1</sup> then a
   <span class="sidenote"> at the end of the same paragraph. */

.sidenote-marker { font-family: var(--font-mono); font-size: 0.72rem; color: var(--blue); }
.sidenote {
  display: block;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--muted);
  margin: 0.6rem 0 0.25rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--rule);
}
.sidenote sup { font-family: var(--font-mono); font-size: 0.72rem; }
@media (min-width: 1360px) {
  .sidenote {
    float: right;
    clear: right;
    width: 200px;
    margin: 0 -240px 0.75rem 0;  /* push into the right page margin */
    border-left: none;
    padding-left: 0;
  }
}

/* ---------- method cards (Generate / Translate / Respond) ----------
   Three chat viewports that play in sequence; see js/methods.js. Bubble
   colors follow chia's chat palette: seed inputs in panel gray on the left,
   teacher outputs in cream on the right. */

.method-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 1.75rem 0 2.75rem;
}
.method-card {
  margin: 0;
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: var(--white);
  display: flex;
  flex-direction: column;
}
.method-card figcaption { padding: 0.85rem 1rem 0.7rem; border-bottom: 1px solid var(--rule); }
.method-card h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue);
  margin: 0 0 0.2rem;
  letter-spacing: 0;
}
.method-card figcaption .caption { margin: 0; }

.method-chat {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 0.9rem 0.5rem;
  min-height: 250px;
}

.chat-item { opacity: 0; transform: translateY(8px); transition: opacity 0.3s ease, transform 0.3s ease; margin-bottom: 0.55rem; }
.chat-item.is-shown, .chat-item.is-typing { opacity: 1; transform: none; }

.msg-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.from-teacher .msg-label { text-align: right; }

.method-chat .msg { font-size: 0.8rem; margin-bottom: 0; }
.msg.seed    { background: var(--panel); color: var(--ink); margin-right: auto; border-bottom-left-radius: 4px; }
.msg.teacher { background: var(--cream); color: var(--blue); margin-left: auto;  border-bottom-right-radius: 4px; }

/* Typing indicator: shown in place of a teacher bubble while "generating". */
.msg.typing { display: none; gap: 4px; align-items: center; width: fit-content; padding: 0.6rem 0.7rem; }
.chat-item.is-typing .msg:not(.typing) { display: none; }
.chat-item.is-typing .msg.typing { display: flex; }
.msg.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
  animation: method-typing 1s infinite;
}
.msg.typing span:nth-child(2) { animation-delay: 0.15s; }
.msg.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes method-typing {
  0%, 60%, 100% { opacity: 0.35; transform: none; }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* Mobile: keep the cards side by side and scroll horizontally instead of
   stacking; the peeking next card plus the swipe hint signal scrollability. */
@media (max-width: 820px) {
  .method-cards {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 1rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .method-card { flex: 0 0 80%; scroll-snap-align: center; }
}

/* "Swipe ▸" affordance under horizontally scrollable blocks, mobile only */
.scroll-hint { display: none; }
.scroll-tri { color: var(--blue); font-style: normal; }
@media (max-width: 820px) {
  .scroll-hint { display: block; font-style: italic; margin: 0 0 2rem; }
}

/* ---------- Polyglot Score figure ----------
   Equation lockup on top, metric panels in the middle, and the pipeline
   (teacher cube → synthetic data → student cube) at the bottom. The cubes
   are three.js canvases driven by js/pgscore.js; arrows are pure CSS. */

.pgscore { position: relative; margin: 2.25rem 0 1rem; }

.pg-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.85rem;
  text-align: center;
  margin: 1.5rem 0 1rem;
}
.pg-equation > * { flex-shrink: 0; }
.pg-badge {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  background: var(--blue);
  color: var(--white);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 0.45rem 0.85rem;
}
.pg-op { font-family: var(--font-heading); font-weight: 600; font-size: 1.25rem; }
.pg-term {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.15;
}
.pg-term-icon { display: inline-flex; }
@media (max-width: 640px) {
  .pg-equation {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 0.3rem;
    scrollbar-width: thin;
  }
}

/* ---------- metrics: intrinsic / extrinsic (PG-Score components) ----------
   Two boxes side by side, sitting under their matching terms in the equation.
   A small icon caps each box (synthetic dataset / student model) as
   connective tissue back to the pipeline. Clicking a chip swaps the detail
   text (js/metrics.js). Intrinsic is chia blue; extrinsic uses the burnt
   orange from the edge-nlp chart palette. */

:root { --orange: #C96A2E; }

.pg-panel { padding: 0.85rem 1rem; }
.pg-panel h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--blue);
  margin: 0 0 0.45rem;
}
.pg-panel ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; }
.pg-panel li { margin: 0.22rem 0; }

.metric-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.08rem 0.4rem;
  border: 1px solid currentColor;
  margin-right: 0.4rem;
  vertical-align: 2px;
}
.metric-intrinsic .metric-tag { color: var(--blue); }
.metric-extrinsic .metric-tag { color: var(--blue); }

.metrics-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
  margin: 2rem 0 1rem;
}
.metric-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.7rem 0 0.9rem; }
/* quieter than the retro .btn: thin light border, no shadow, no lift/press */
.btn.metric-btn {
  font-size: 0.8rem;
  padding: 0.24rem 0.6rem;
  border-width: 1px;
  border-color: var(--rule);
  color: var(--muted);
  box-shadow: none;
}
.btn.metric-btn:hover { transform: none; box-shadow: none; border-color: var(--ink); color: var(--ink); }
.btn.metric-btn:active { transform: none; box-shadow: none; }
.btn.metric-btn.is-active { background: var(--blue); border-color: var(--blue); color: var(--white); }
/* min-height fits the longest item so the box doesn't resize per chip;
   taller here than a full-width box since text wraps to more lines at
   half width */
.metric-detail-item { display: none; font-size: 0.9rem; min-height: 12em; }
.metric-detail-item.is-active { display: block; }
.metric-detail-item p { margin: 0 0 0.45rem; }
.metric-detail-item .how { color: var(--muted); font-size: 0.85rem; margin: 0; }
.metric-detail-item .how strong { color: var(--ink); }

/* mini synthetic-dataset icon: a small stacked chatbox */
.mini-stack { position: relative; display: inline-block; width: 34px; height: 38px; }
.mini-stack .mini-sheet {
  position: absolute; left: 5px; top: 0; width: 27px; height: 33px;
  background: var(--white); border: 1.5px solid var(--ink);
}
.mini-chat {
  position: absolute; left: 0; top: 5px; width: 27px; height: 33px;
  background: var(--white); border: 1.5px solid var(--ink);
  padding: 3px; display: flex; flex-direction: column; gap: 3px;
}
.mini-bubble { height: 4px; border-radius: 2px; }
.mini-bubble.seed { width: 60%; background: var(--panel); align-self: flex-start; }
.mini-bubble.teacher { width: 68%; background: var(--cream); align-self: flex-end; }
.mini-bubble.short { width: 42%; }

.pg-cube-xs { width: 40px; height: 40px; flex: none; }
.pg-cube-xs.is-fallback { width: 30px; height: 30px; margin: 5px; }

@media (max-width: 820px) {
  .metrics-duo { grid-template-columns: 1fr; }
}

/* ---- pipeline row: seed → teacher → synthetic dataset → student ---- */

.pg-pipeline { display: flex; align-items: flex-start; gap: 0.25rem; }

.pg-caption { margin: 1.5rem 0 0; }
.pg-caption strong { color: var(--ink); }
/* On desktop the base-model cube hangs below the pipeline, leaving an empty
   pocket at the bottom-left of the figure — tuck the caption in there,
   bottom-aligned with the base model. */
@media (min-width: 821px) {
  .pg-caption {
    position: absolute;
    left: 0;
    bottom: 0;
    max-width: 67%;
    margin: 0;
  }
}
.pg-node { display: flex; flex-direction: column; align-items: center; }
/* Every node's visual sits in a fixed-height box so arrow shafts (placed at
   half that height) line up with the visuals' centers, not their labels. */
.pg-vis { height: 150px; display: flex; align-items: center; justify-content: center; }
.pg-node-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; text-align: center; }
/* the two nodes we measure — see the Polyglot Score paragraph */
.pg-node-label.em { color: var(--blue); font-weight: 500; }

/* staged reveal: everything starts hidden, the timeline adds .is-on */
.pg-anim { opacity: 0; transform: translateY(6px); transition: opacity 0.45s ease, transform 0.45s ease; }
.pg-anim.is-on { opacity: 1; transform: none; }

/* Operation boxes (Synthesize, Supervised Finetuning): bordered nodes with
   arrows in and out. The Synthesize box lists its three methods below. */
.pg-op-col, .pg-sft-col { display: flex; flex-direction: column; align-items: center; }
.pg-sft-box {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.2;
  text-align: center;
  padding: 0.5rem 0.55rem;
  color: var(--blue);
  background: var(--white);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.pg-sft-box .sub {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}
/* negative top margin pulls the arrow up to meet the SFT box, which sits
   centered in (and so doesn't fill) the fixed-height .pg-vis row */
.pg-uparrow { position: relative; width: 12px; height: 46px; margin: -40px 0 8px; }
.pg-uparrow .shaft {
  position: absolute;
  left: calc(50% - 1px);
  top: 4px;
  bottom: 0;
  width: 2px;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: center bottom;
  transition: transform 0.5s ease;
}
.pg-uparrow.is-on .shaft { transform: scaleY(1); }
.pg-uparrow .shaft::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -3.5px;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-bottom: 8px solid var(--ink);
}
.pg-uparrow .shaft::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

/* arrows: shaft draws left→right, arrowhead rides its tip */
.pg-arrow-label { font-size: 0.72rem; color: var(--muted); text-align: center; line-height: 1.3; }
.pg-harrow { position: relative; height: 150px; flex: 1 1 0; min-width: 40px; }
.pg-harrow .pg-arrow-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(50% + 9px);
}

.pg-harrow .shaft {
  position: absolute;
  left: 2px;
  right: 3px;
  top: calc(50% - 1px);
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s ease;
}
.pg-harrow.is-on .shaft { transform: scaleX(1); }
/* triangular head at the tip, round dot at the origin */
.pg-harrow .shaft::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -3.5px;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 8px solid var(--ink);
}
.pg-harrow .shaft::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

/* cubes */
.pg-cube canvas { display: block; }
.pg-cube-lg { width: 118px; height: 118px; }
.pg-cube-sm { width: 86px; height: 86px; }
.pg-cube.is-fallback { background: var(--blue); border: 1.5px solid var(--ink); box-shadow: var(--shadow-md); }
.pg-cube-lg.is-fallback { width: 82px; height: 82px; margin: 18px; }
.pg-cube-sm.is-fallback { width: 60px; height: 60px; margin: 13px; }

/* seed dataset: stack of sheets */
.pg-stack { position: relative; width: 66px; height: 80px; }
.pg-stack .sheet { position: absolute; width: 54px; height: 68px; background: var(--white); border: 1.5px solid var(--ink); }
.pg-stack .sheet:nth-child(1) { left: 0;    top: 12px; }
.pg-stack .sheet:nth-child(2) { left: 6px;  top: 6px; }
.pg-stack .sheet:nth-child(3) { left: 12px; top: 0; box-shadow: var(--shadow-sm); }
.pg-stack .sheet:nth-child(3)::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  height: 30px;
  background: repeating-linear-gradient(to bottom, var(--muted) 0 2px, transparent 2px 9px);
  opacity: 0.55;
}

/* synthetic dataset: a mini chatbox, same look as the method cards, with
   more chatboxes stacked behind it to suggest volume (like the seed sheets) */
.pg-chat-stack { position: relative; padding: 0 0 12px 12px; }
.pg-chat-stack::before,
.pg-chat-stack::after {
  content: '';
  position: absolute;
  width: 118px;
  height: 136px;
  background: var(--white);
  border: 1.5px solid var(--ink);
}
.pg-chat-stack::before { left: 0;   top: 12px; }
.pg-chat-stack::after  { left: 6px; top: 6px; }
.pg-chat {
  position: relative;
  z-index: 1;
  width: 118px;
  height: 136px;
  padding: 9px;
  background: var(--white);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pg-chat .msg {
  padding: 6px 9px;
  margin-bottom: 5px;
  border-radius: 9px;
  max-width: 80%;
  min-width: 34%;
}
.pg-chat .msg.seed    { background: var(--panel); color: var(--muted); margin-right: auto; border-bottom-left-radius: 3px; }
.pg-chat .msg.teacher { background: var(--cream); color: var(--blue);  margin-left: auto;  border-bottom-right-radius: 3px; }
.pg-chat .bar { display: block; height: 4px; border-radius: 2px; background: currentColor; opacity: 0.5; }
.pg-chat .bar + .bar { margin-top: 4px; }

/* On narrow viewports the pipeline keeps its desktop layout and scrolls
   horizontally instead of restacking, so the figure reads the same
   everywhere. min-width forces the overflow; the harrows have min-widths so
   flex can't crush them. */
@media (max-width: 820px) {
  .pg-pipeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    padding-bottom: 6px;  /* keep retro shadows clear of the scroll edge */
  }
  .pg-pipeline > * { flex-shrink: 0; }
  .pg-caption { margin-top: 0.75rem; }
}

/* ---------- figures ---------- */

.placeholder {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ---------- findings charts ---------- */

/* auto-number the findings subsections (1. , 2. , ...) */
#findings { counter-reset: finding; }
#findings h3 { counter-increment: finding; scroll-margin-top: 1rem; margin-top: 3.6rem; }
#findings h3:first-of-type { margin-top: 2.2rem; }
/* findings section is item 2 in the TOC, so subsections read 2.1, 2.2, ... */
#findings h3::before { content: "2." counter(finding) "\00a0\00a0"; }

/* hover-revealed "#" anchor for linking to a subsection (added by main.js) */
.hanchor {
  margin-left: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
h3:hover .hanchor, .hanchor:focus { opacity: 1; }

.reg-table { width: auto; max-width: 480px; margin: 1.25rem 0; }

/* compact regression table inside the stat sidenote */
.reg-table--mini { max-width: 360px; font-size: 0.8rem; margin: 0; }
.sidenote--stat p { margin: 0 0 0.5rem; }
.sidenote--stat strong { color: var(--ink); }
.sidenote--stat sup { font-family: var(--font-mono); }
.sidenote--stat .reg-table--mini {
  width: 100%; max-width: none;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}
.sidenote--stat .reg-table--mini th,
.sidenote--stat .reg-table--mini td { padding: 0.22rem 0.3rem; white-space: nowrap; }
.sidenote--stat { margin-top: 0; clear: none; position: relative; top: -0.6rem; }
@media (min-width: 1360px) {
  .sidenote--stat { top: -2.4rem; }
}

/* 4 chips per row (so 7 languages sit 4 on top, 3 below) */
.chart-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0 0 1rem; }
@media (max-width: 720px) { .chart-chips { grid-template-columns: repeat(3, 1fr); } }
/* Flat ink-bordered chips; only the selected one pops with the retro shadow
   (Average is selected by default). */
.btn.chart-chip { font-size: 0.8rem; padding: 0.3rem 0.65rem; box-shadow: none; }
.btn.chart-chip:hover { transform: none; box-shadow: none; background: var(--panel); }
.btn.chart-chip:active { transform: none; box-shadow: none; }
.btn.chart-chip.is-active {
  background: var(--blue);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn.chart-chip.is-active:hover { background: var(--blue); }
.chart-mount { width: 100%; min-height: 380px; }

/* text on the left, figure on the right (stacks on narrow screens) */
.finding-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; align-items: center; margin: 1.25rem 0; }
.finding-split .chart-mount { min-height: 0; }
/* narrower text + wider figure: gives a tall chart room and makes the text
   wrap taller so the two columns come closer in height */
.finding-split--fig { grid-template-columns: 0.68fr 1.32fr; align-items: center; }
.finding-split .split-fig { margin: 0; }
.finding-split .split-fig figcaption { margin-top: 0.5rem; }
@media (max-width: 720px) {
  .finding-split { grid-template-columns: 1fr; gap: 1rem; }
}

/* two charts side by side (heatmap + scatter), stacking on narrow screens */
.chart-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.25rem 0; }
.chart-duo figure { margin: 0; }
.chart-duo .chart-mount { min-height: 320px; }
.chart-duo figcaption { margin-top: 0.5rem; }
@media (max-width: 720px) {
  .chart-duo { grid-template-columns: 1fr; }
}

/* Collapsible full-table block: a thin rule above and below the summary,
   inspired by owickstrom.github.io/the-proportional-web. */
.data-details { margin: 1.5rem 0; }
.data-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.data-details > summary::-webkit-details-marker { display: none; }
.data-details > summary::after { content: '+'; font-size: 1.1rem; line-height: 1; }
.data-details[open] > summary::after { content: '\2013'; }  /* en dash */
.data-details[open] > summary { border-bottom: none; }
.data-details .table-scroll { margin-top: 1rem; }

/* setup bullet list (Data / Evaluation / Baselines) */
.setup-list { margin: 0.5rem 0 1.25rem; padding-left: 1.2rem; }
.setup-list li { margin: 0.5rem 0; }

/* interactive ablation: chart + controls on the left, explanation on the right */
.ablation { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1.75rem; align-items: center; margin: 1.25rem 0 0.75rem; }
.ablation-fig .chart-mount { min-height: 0; }
.ablation-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.4rem; }
.ablation-step {
  font-family: var(--font-heading); font-weight: 600; font-size: 0.85rem;
  color: var(--muted); min-width: 8.5rem; text-align: center;
}
.ablation-explain { align-self: center; }
.ablation-explain h4 {
  font-family: var(--font-heading); font-weight: 600; font-size: 1.05rem;
  color: var(--blue); margin: 0 0 0.5rem;
}
.ablation-explain p { margin: 0; }

/* disabled chia buttons (Back/Next at the ends) */
.btn:disabled, .btn:disabled:hover { opacity: 0.4; box-shadow: none; transform: none; cursor: default; }

@media (max-width: 720px) {
  .ablation { grid-template-columns: 1fr; gap: 1rem; }
}

/* recipe bullet list in the Discussion (parallel to the Tagalog interventions) */
.recipe-list { margin: 1rem 0 1.25rem; padding-left: 1.2rem; }
.recipe-list li { margin: 0.7rem 0; }
.recipe-list strong { color: var(--blue); }

/* collapsible table of contents */
.toc { margin: 2rem 0; }
.toc nav ol { list-style: none; margin: 1rem 0 0.35rem; padding-left: 0; counter-reset: toc; }
.toc nav > ol > li { counter-increment: toc; margin: 0.4rem 0; }
.toc nav > ol > li > a::before { content: counter(toc) ".\00a0\00a0"; color: var(--muted); }
.toc nav ol ol { margin: 0.3rem 0 0.5rem; padding-left: 1.6rem; counter-reset: tocsub; }
.toc nav ol ol li { counter-increment: tocsub; margin: 0.25rem 0; font-size: 0.95rem; }
.toc nav ol ol li a::before { content: counter(toc) "." counter(tocsub) "\00a0\00a0"; color: var(--muted); }
.toc a { color: var(--ink); border-bottom: none; }
.toc a:hover { color: var(--blue); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0.5rem 0 1.75rem; }
/* highlight a single column (chia ships tr.is-highlight; this is cell-level) */
table.chia td.is-highlight { color: var(--blue); font-weight: 500; }

/* rank highlights: three shades of chia blue for 1st / 2nd / 3rd best */
.hl-1 { background: rgba(37, 78, 255, 0.26); }
.hl-2 { background: rgba(37, 78, 255, 0.14); }
.hl-3 { background: rgba(37, 78, 255, 0.06); }
/* swatches in the caption legend */
.hl-key { padding: 0.02rem 0.3rem; border-radius: 2px; color: var(--ink); }

/* ---------- citation ---------- */

.bibtex-wrap { position: relative; }
.bibtex {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  line-height: 1.5;
  padding-right: 5.5rem;   /* room for the copy button */
}
.copy-btn { position: absolute; top: 0.75rem; right: 0.75rem; }
.copy-btn.is-copied { background: var(--blue); color: var(--white); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  h2 { font-size: 1.4rem; }
  .site-header .subtitle { font-size: 1.1rem; }
  /* captions run large on small screens */
  .caption, table.chia caption { font-size: 0.8rem; }
}
