/* ==========================================================================
   research/*.html — long-form research articles (report + print version)
   Loaded after seidr-v2.css; only article rules live here.
   ========================================================================== */

.page-article {
  --text: color-mix(in srgb, var(--bone) 82%, var(--mist));
  --rail-w: 240px;
}

/* ---------- reading progress ---------- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 101; pointer-events: none; }
.read-progress i {
  display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--aurora), var(--sap));
  box-shadow: 0 0 12px rgba(243, 183, 95, .55);
}

/* ---------- hero ---------- */
.article-hero h1 { font-size: clamp(2.35rem, 4.8vw, 4.6rem); line-height: 1.02; max-width: 20ch; }
.article-hero .lead { max-width: 60ch; }
.report-byline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 0; margin-top: 26px; color: var(--mist); font-size: .95rem; }
.report-byline strong { color: var(--bone); font-weight: 600; }
.report-byline > * + *::before { content: "·"; margin: 0 .6em; color: var(--mist-2); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; }
.meta-item { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.article-hero .hero-actions .btn { white-space: normal; }
.article-meta .meta-item + .meta-item::before { content: "·"; margin-right: 18px; color: var(--mist-2); }
@media (max-width: 600px) {
  .report-byline { flex-direction: column; gap: 2px; }
  .report-byline > * + *::before { display: none; }
  .article-meta .meta-item + .meta-item::before { display: none; }
}

/* ---------- layout ---------- */
.article-section { padding-block: clamp(56px, 8vw, 110px) clamp(70px, 9vw, 130px); position: relative; }
.article-layout { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
.article-body { margin-inline: auto; width: 100%; min-width: 0; }

/* ---------- the rail: contents + progress ---------- */
.article-rail { position: sticky; top: 96px; max-height: calc(100svh - 120px); overflow-y: auto; scrollbar-width: thin; padding-bottom: 8px; }
.rail-inner { display: grid; gap: 22px; }
.toc-title { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--mist-2); font-weight: 500; margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; }
.toc a {
  display: grid; grid-template-columns: 2.1em 1fr; gap: 4px; padding: 7px 10px 7px 12px; text-decoration: none;
  color: var(--mist-2); font-size: .9rem; line-height: 1.35; border-left: 1px solid var(--line);
  transition: color .25s, border-color .25s, background .25s;
}
.toc a:hover { color: var(--bone); border-left-color: var(--line-2); }
.toc a[aria-current] { color: var(--bone); border-left-color: var(--sap); background: linear-gradient(90deg, rgba(243, 183, 95, .08), transparent); }
.toc-no { font-family: var(--f-mono); font-size: .75rem; color: var(--sap); opacity: .75; padding-top: .18em; }
.toc a[aria-current] .toc-no { opacity: 1; }
.rail-meta { display: grid; gap: 8px; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.rail-bar { display: block; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.rail-bar i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--aurora), var(--sap)); }
.rail-back { font-size: .85rem; color: var(--mist); text-decoration: none; }
.rail-back:hover { color: var(--sap); }

/* ---------- long-form typography ---------- */
.article-body.prose { max-width: 68ch; color: var(--text); font-size: 1.08rem; line-height: 1.78; hyphens: auto; -webkit-hyphens: auto; }
.article-body.prose > * + * { margin-top: 1.15em; }
.article-body :is(h2, h3, [id]) { scroll-margin-top: 96px; }
.article-body.prose h2 {
  font-size: clamp(1.9rem, 3vw, 2.55rem); line-height: 1.08; color: var(--bone);
  margin-top: 2.6em; padding-top: 1.1em; border-top: 1px solid var(--line);
}
.article-body.prose h3 { font-size: clamp(1.35rem, 1.9vw, 1.6rem); line-height: 1.2; color: var(--bone); margin-top: 1.9em; }
.article-body.prose h2 + * { margin-top: .9em; }
.article-body.prose h3 + * { margin-top: .7em; }
.sec-no { font-family: var(--f-mono); font-weight: 400; letter-spacing: .08em; color: var(--sap); font-style: normal; }
h2 .sec-no { display: block; font-size: .75rem; letter-spacing: .18em; margin-bottom: .9em; }
h2 .sec-no::before { content: "§ "; opacity: .6; }
h3 .sec-no { font-size: .75rem; margin-right: .9em; vertical-align: .2em; }
.article-body.prose strong { color: var(--bone); }
.article-body.prose em { color: var(--bone); }
.article-body.prose ul, .article-body.prose ol { padding-left: 1.3em; }
.article-body.prose li + li { margin-top: .6em; }
.article-body sup, .article-body sub { line-height: 0; font-size: max(.8em, 12px); }

/* symbols and numbers */
.article-body var { font-family: var(--f-display); font-style: italic; font-size: 1.14em; line-height: 0; color: var(--bone); padding-inline: .02em; }
.article-body .v { font-family: var(--f-mono); font-size: .86em; line-height: 1; color: color-mix(in srgb, var(--bone) 88%, var(--sap)); letter-spacing: -.01em; }
.article-body .num { color: var(--bone); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; }
.article-body .muted { color: var(--mist-2); }

/* equations */
.eqn, .eqn-print {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 20px 22px; border-radius: var(--r-m); border: 1px solid var(--line);
  background: radial-gradient(80% 120% at 0% 50%, rgba(243, 183, 95, .06), transparent 70%), var(--night-2);
  overflow-x: auto; scrollbar-width: thin;
}
.eqn .math, .eqn-print > span:first-child { font-family: var(--f-display); font-size: 1.35rem; color: var(--bone); white-space: nowrap; line-height: 1.4; }
.eqn .var { font-style: italic; }
.eqn .op { padding-inline: .15em; color: var(--sap); }
.eqn-no { font-family: var(--f-mono); font-size: .78rem; color: var(--mist-2); flex: none; }
.article-body.prose .eqn + p, .article-body.prose .eqn-print + p { margin-top: 1em; }

/* side notes, verdicts, callouts */
.fignote {
  position: relative; padding: 20px 22px 20px 24px; border-radius: var(--r-m); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--moss), var(--night-2)); font-size: .97rem; line-height: 1.7;
}
.fignote::before { content: ""; position: absolute; left: -1px; top: 18px; bottom: 18px; width: 2px; border-radius: 2px; background: var(--frost); opacity: .7; }
.fignote strong:first-child { color: var(--frost); }
.verdict {
  padding: 18px 22px; border-radius: 0 var(--r-m) var(--r-m) 0; border-left: 2px solid var(--aurora);
  background: linear-gradient(90deg, rgba(126, 232, 201, .07), rgba(126, 232, 201, .015));
}
.verdict-label { display: block; font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--aurora); margin-bottom: .45em; }
.callout {
  font-family: var(--f-display); font-size: clamp(1.2rem, 1.6vw, 1.4rem); line-height: 1.5; color: var(--bone);
  padding: clamp(22px, 3vw, 34px); border-radius: var(--r-l); border: 1px solid color-mix(in srgb, var(--sap) 32%, transparent);
  background: radial-gradient(90% 120% at 100% 0%, rgba(243, 183, 95, .10), transparent 60%), var(--night-2);
}
.callout strong { color: var(--sap) !important; font-weight: 600; }

/* pull-quotes: decorative repeats of lines already in the text */
.pull-quote { position: relative; margin-block: 2.4em !important; padding: 6px 0 6px clamp(22px, 3vw, 34px); border-left: 1px solid var(--sap); }
.pull-quote .rune { position: absolute; left: 0; top: -.35em; transform: translateX(-50%); font-family: var(--f-rune); font-size: 1.9rem; line-height: 1; padding-block: .15em; color: var(--sap); background: var(--night); text-shadow: 0 0 14px rgba(243, 183, 95, .6); }
.pull-quote p { font-family: var(--f-display); font-style: italic; font-weight: 400; font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.18; color: var(--bone); text-wrap: balance; }
.pq-src { display: block; margin-top: .9em; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mist-2); }

/* the report's at-a-glance list */
.report-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; margin: 0;
  padding: clamp(18px, 2.6vw, 28px); border-radius: var(--r-l); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--moss), var(--night-2)); font-size: .92rem; line-height: 1.5;
}
.report-meta > div { padding-block: 12px; border-top: 1px solid var(--line); min-width: 0; }
.report-meta > div:nth-child(-n+2) { border-top: 0; }
.report-meta > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.report-meta dt { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mist-2); margin-bottom: 4px; }
.report-meta dd { margin: 0; color: var(--bone); }
@media (max-width: 600px) {
  .report-meta { grid-template-columns: 1fr; }
  .report-meta > div:nth-child(2) { border-top: 1px solid var(--line); }
}

/* abstract */
.article-body .abstract {
  margin-top: 2em; padding: clamp(22px, 3vw, 34px); border-radius: var(--r-l);
  border: 1px solid color-mix(in srgb, var(--violet) 26%, transparent);
  background: radial-gradient(70% 60% at 0% 0%, rgba(174, 150, 255, .08), transparent 70%), var(--night-2);
  font-size: 1rem; line-height: 1.72;
}
.article-body .abstract > * + * { margin-top: 1em; }
.article-body.prose .abstract h2 {
  font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--violet);
  font-weight: 500; margin: 0; padding: 0; border: 0;
}
.keywords { font-size: .88rem; color: var(--mist); padding-top: 1em; border-top: 1px solid var(--line); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); scrollbar-width: thin; }
/* on narrow screens a table scrolls sideways: a soft amber edge shows there is more to the right (or left) */
.table-wrap {
  background:
    linear-gradient(90deg, var(--night-2) 40%, transparent) left / 36px 100% no-repeat local,
    linear-gradient(270deg, var(--night-2) 40%, transparent) right / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(243, 183, 95, .22), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(243, 183, 95, .22), transparent) right / 14px 100% no-repeat scroll,
    var(--night-2);
}
.article-body table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.article-body caption { caption-side: top; text-align: left; padding: 14px 16px 10px; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; color: var(--mist); border-bottom: 1px solid var(--line); }
.article-body th { text-wrap: balance; text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mist-2); padding: 12px 16px; background: rgba(237, 230, 213, .025); }
.article-body td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: top; color: var(--text); }
.article-body tbody tr:hover td { background: rgba(237, 230, 213, .025); }
.article-body td.n { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--bone); }
.article-body tfoot td { font-size: .85rem; font-style: italic; color: var(--mist); background: rgba(237, 230, 213, .02); }
.article-body td strong { color: var(--bone); }
.verdict-table td:nth-child(2) { font-family: var(--f-mono); font-size: .8rem; color: var(--sap); white-space: nowrap; }
.verdict-table .muted { font-size: .84rem; }

/* citations */
.cite {
  display: inline-block; font-family: var(--f-mono); font-size: max(.64em, 12px); line-height: 1; vertical-align: super;
  margin-left: .14em; padding: .22em .42em; border-radius: 99px; text-decoration: none;
  color: var(--sap); background: rgba(243, 183, 95, .1); border: 1px solid rgba(243, 183, 95, .22);
  transition: background .2s, color .2s;
}
.cite + .cite { margin-left: .2em; }
/* the chip is tiny; give fingers a bigger invisible target without moving the text */
.cite { position: relative; }
.cite::after { content: ""; position: absolute; inset: -6px -3px; }
.cite:hover, .cite:focus-visible { background: var(--sap); color: var(--ink-on-sap); }
.cite-pop {
  position: absolute; z-index: 130; width: min(380px, calc(100vw - 32px)); padding: 14px 16px 15px;
  border-radius: var(--r-m); border: 1px solid var(--line-2); background: #0c1618;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .8); font-size: .84rem; line-height: 1.55; color: var(--mist);
  opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s var(--ease); pointer-events: none;
}
.cite-pop.show { opacity: 1; transform: none; }
.cite-pop .pop-no { display: block; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sap); margin-bottom: 6px; }
.cite-pop em, .cite-pop strong { color: var(--bone); }

/* references */
.refs { list-style: none; padding-left: 0 !important; counter-reset: ref; font-size: .92rem; line-height: 1.6; }
.refs > li { counter-increment: ref; position: relative; display: block; padding: 12px 12px 12px 3.3em; margin: 0 !important; border-top: 1px solid var(--line); border-radius: 10px; transition: background .5s; }
.refs > li::before { content: "[" counter(ref) "]"; position: absolute; left: 10px; top: 13px; font-family: var(--f-mono); font-size: .75rem; color: var(--sap); }
.refs > li:first-child { border-top: 0; }
.refs em { color: var(--bone); }
.refs .doi { font-family: var(--f-mono); font-size: .78rem; color: var(--aurora); word-break: break-word; }
.refs .venue { color: var(--mist-2); }
.refs > li:target, .refs > li.is-target { background: rgba(243, 183, 95, .08); border-top-color: transparent; }
.ref-back { display: inline-flex; align-items: center; gap: .4em; margin-left: .6em; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sap); text-decoration: none; }
.ref-back:hover { text-decoration: underline; }
.refs-note, .article-body p.meta { font-size: .92rem; color: var(--mist-2); }

.rule { border: 0; height: 1px; background: var(--line-2); margin-block: 3em !important; }
.provenance, .article-body hr + p.meta {
  font-size: .9rem; line-height: 1.65; color: var(--mist); padding: 20px 22px; border-radius: var(--r-m);
  border: 1px dashed var(--line-2);
}
.article-body hr + p.meta + p.meta { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; }

/* ---------- keep reading ---------- */
.more-reading { padding-block: clamp(60px, 8vw, 110px); border-top: 1px solid var(--line); background: linear-gradient(180deg, var(--night-2), var(--night)); }
.more-title { font-size: var(--t-h3); margin-bottom: 28px; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.more-card {
  position: relative; display: grid; gap: 8px; align-content: start; padding: 24px 24px 26px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--moss), var(--night-2)); text-decoration: none; overflow: hidden;
  transition: border-color .35s;
}
.more-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), rgba(243, 183, 95, .12), transparent 60%); opacity: 0; transition: opacity .35s; }
.more-card:hover { border-color: color-mix(in srgb, var(--sap) 45%, transparent); }
.more-card:hover::before { opacity: 1; }
.more-card strong { text-wrap: balance; font-family: var(--f-display); font-weight: 500; font-size: 1.65rem; line-height: 1.1; color: var(--bone); padding-right: 1.4em; }
.more-sub { color: var(--mist); font-size: .92rem; }
.more-card .arr { position: absolute; top: 20px; right: 22px; color: var(--sap); transition: transform .35s var(--ease); }
.more-card:hover .arr { transform: translate(3px, -3px); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .page-article { --rail-w: 210px; }
}
@media (max-width: 960px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  /* one column: contents box and text share the text measure and the hero's left edge */
  .article-rail { position: static; max-height: none; overflow: visible; padding: 20px 20px 16px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--night-2); max-width: 42.5rem; width: 100%; margin-inline: 0; }
  .article-body, .article-body.prose { margin-inline: 0; max-width: 42.5rem; }
  .toc ol { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); column-gap: 10px; }
  .rail-meta, .rail-back { display: none; }
  .more-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .article-body.prose { font-size: 1.03rem; line-height: 1.72; hyphens: auto; }
  /* a shared basis instead of auto, so buttons that share a row come out (near) equal width */
  .article-hero .hero-actions .btn { flex: 1 1 150px; min-width: max-content; justify-content: center; }
  .eqn, .eqn-print { padding: 16px; }
  .eqn .math, .eqn-print > span:first-child { font-size: 1.15rem; }
  .refs > li { padding-left: 2.9em; padding-right: 4px; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  html, body { background: #fff !important; color: #111 !important; }
  body::before, .site-nav, .site-footer, .skip-link, .read-progress, .article-rail, .more-reading,
  .page-hero canvas, .page-rune, .hero-actions, .pull-quote, .cite-pop, .ref-back { display: none !important; }
  .page-article { --text: #222; --bone: #111; --mist: #333; --mist-2: #555; --sap: #8a5a12; --aurora: #1f6e5a; --frost: #245a80; --violet: #5a3fb0; --line: #ddd; --line-2: #bbb; --night: #fff; --night-2: #fff; --moss: #fff; }
  .page-hero { padding: 0 0 12pt; background: none; border-bottom: 1px solid #ccc; }
  .article-hero h1 { font-size: 26pt; max-width: none; }
  .article-hero .lead { font-size: 11.5pt; max-width: none; }
  .status { border-color: #999; }
  .container { padding-inline: 0; max-width: none; }
  .article-section { padding: 12pt 0 0; }
  .article-layout { display: block; }
  .article-body.prose { max-width: none; font-size: 10.5pt; line-height: 1.55; color: #222; }
  .eqn, .eqn-print, .fignote, .verdict, .callout, .abstract, .report-meta, .table-wrap, .provenance { background: none !important; box-shadow: none; break-inside: avoid; }
  .article-body h2, .article-body h3 { break-after: avoid; }
  .article-body table { min-width: 0; }
  .table-wrap { overflow: visible; }
  .cite { background: none; border: 0; padding: 0; color: #8a5a12; }
  a { color: inherit; }
  html.js .reveal { opacity: 1 !important; transform: none !important; }
}
