/* Two Faces of a Turn Exchange — page styles.
   Tokens first; every colour in the page and in the charts is one of these, so the dark theme is one block. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --card: #f5f4f1;
  --card-2: #ecebe6;
  --ink: #262524;
  --ink-2: #504945;
  --muted: #6b6866;
  --rule: #e4e2dd;
  --grid: #e1dfd9;
  --link: #262524;
  --sea: #2a78d6;          /* Seamless Interaction: same room */
  --can: #eb6834;          /* CANDOR: video call */
  --listener: #fbe7a1;     /* role chips, as in the report */
  --speaker: #ddd8fb;
  --listener-ink: #8a6a00;
  --speaker-ink: #5a48c9;
  --play: #e5484d;
  --sea-1: #86b6ef; --sea-2: #2a78d6; --sea-3: #104281;   /* ordinal steps of each corpus hue: least to most */
  --can-1: #f2a37f; --can-2: #eb6834; --can-3: #8f3511;
  --neutral: #cfcdc6;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 6px 24px rgb(0 0 0 / .06);
  --serif: "Source Serif 4", "Iowan Old Style", "Iowan Old Style BT", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --col: 680px;
  --toc: 210px;
  --note: 250px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #151514; --card: #1e1e1c; --card-2: #2a2a27; --ink: #ecebe7; --ink-2: #cfcdc6; --muted: #a09e97;
    --rule: #32312e; --grid: #33322f; --link: #ecebe7; --sea: #3987e5; --can: #d95926;
    --listener: #5a4a12; --speaker: #3a3270; --listener-ink: #f2c94c; --speaker-ink: #a99cf5;
    --neutral: #55534d; --shadow: 0 1px 2px rgb(0 0 0 / .5);
    --sea-1: #1c5cab; --sea-2: #3987e5; --sea-3: #b7d3f6; --can-1: #a8431a; --can-2: #d95926; --can-3: #f4b193;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151514; --card: #1e1e1c; --card-2: #2a2a27; --ink: #ecebe7; --ink-2: #cfcdc6; --muted: #a09e97;
  --rule: #32312e; --grid: #33322f; --link: #ecebe7; --sea: #3987e5; --can: #d95926;
  --listener: #5a4a12; --speaker: #3a3270; --listener-ink: #f2c94c; --speaker-ink: #a99cf5;
  --neutral: #55534d; --shadow: 0 1px 2px rgb(0 0 0 / .5);
    --sea-1: #1c5cab; --sea-2: #3987e5; --sea-3: #b7d3f6; --can-1: #a8431a; --can-2: #d95926; --can-3: #f4b193;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 18px; line-height: 1.62;
  font-optical-sizing: auto; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "onum";
}
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--ink); }

/* --- site header: the rules of .site-header in the site's src/styles/global.css, on this page's colour tokens --- */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 20px; top: 8px; z-index: 10; background: var(--bg); padding: 6px 10px; font-family: var(--sans); font-size: 14px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 20px; font-family: var(--sans); font-size: 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 600; letter-spacing: .01em; font-size: 15px; }
.site-header ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 22px; margin: 0; padding: 0; }
.site-header nav a { text-decoration: none; color: var(--ink); }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--muted); }
.nav-icon a { display: inline-flex; padding: 2px; }
.nav-icon svg, .nav-icon img { display: block; }
.nav-icon + .nav-icon { margin-left: -8px; }
@media (max-width: 640px) { .site-header { align-items: flex-start; } .site-header ul { gap: 2px 14px; } }

/* --- heading -------------------------------------------------------------------------------------------------- */
.post-heading { max-width: 780px; margin: 56px auto 0; padding: 0 20px; text-align: center; }
.post-heading h1 { font-size: clamp(30px, 4.6vw, 40px); line-height: 1.16; font-weight: 600; letter-spacing: -.012em; margin: 0 0 14px; text-wrap: balance; }
.post-heading .dek { font-size: 20px; line-height: 1.45; color: var(--ink-2); margin: 0 auto 18px; max-width: 620px; text-wrap: balance; }
.meta { font-family: var(--sans); font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.meta .date { color: var(--muted); }

/* --- shell: contents rail, text column, margin for notes ------------------------------------------------------ */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 0 20px; }
.toc { display: none; }
@media (min-width: 1020px) {
  .shell { grid-template-columns: var(--toc) minmax(0, var(--col)); gap: 34px; max-width: calc(var(--toc) + var(--col) + 34px + 40px); }
  .toc { display: block; position: sticky; top: 28px; align-self: start; font-family: var(--sans); font-size: 13px; line-height: 1.4; margin-top: 8px; }
}
@media (min-width: 1340px) {
  .shell { max-width: calc(var(--toc) + var(--col) + 34px + 64px + var(--note) + 40px); grid-template-columns: var(--toc) minmax(0, var(--col)) var(--note); column-gap: 34px; }
  .shell > article { grid-column: 2; }
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 9px; position: relative; padding-left: 14px; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc li.on a { color: var(--ink); }
.toc li.on::before { content: ""; position: absolute; left: 2px; top: .52em; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }

article { min-width: 0; padding-bottom: 80px; counter-reset: fig; }
article > p, article > ul, article > ol { margin: 0 0 1.15em; }
article > p { hanging-punctuation: first; }
article h2 { font-size: 25px; line-height: 1.3; font-weight: 600; margin: 2.2em 0 .7em; letter-spacing: -.006em; scroll-margin-top: 24px; text-wrap: balance; }
article h3 { font-size: 19px; line-height: 1.35; font-weight: 600; margin: 1.8em 0 .5em; }
article ul { padding-left: 1.15em; }
article li { margin-bottom: .45em; }
article li::marker { color: var(--muted); }
.lead { font-size: 19.5px; }
em.role-l, em.role-s { font-style: normal; padding: 0 .28em; border-radius: 4px; white-space: nowrap; }
em.role-l { background: var(--listener); } em.role-s { background: var(--speaker); }
code { font-family: var(--mono); font-size: .82em; background: var(--card); padding: .1em .35em; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
abbr { text-decoration: none; }

/* --- margin notes (references sit beside the sentence that uses them) ------------------------------------------ */
sup.cite { font-family: var(--sans); font-size: .62em; line-height: 0; margin-left: 1px; font-variant-numeric: lining-nums; }
sup.cite a { text-decoration: none; color: var(--ink-2); padding: 0 1px; }
sup.cite a:hover { color: var(--ink); text-decoration: underline; }
.sidenote { display: none; }
@media (min-width: 1340px) {
  .sidenote { display: block; float: right; clear: right; width: var(--note); margin-right: calc(-1 * (var(--note) + 64px)); margin-top: .25em; margin-bottom: 14px;
    font-family: var(--serif); font-size: 13.5px; line-height: 1.42; color: var(--ink-2); text-align: left; text-indent: 0; }
  .sidenote .n { font-family: var(--sans); font-size: 10px; vertical-align: super; margin-right: 3px; color: var(--muted); }
  .sidenote a { color: var(--ink-2); }
}

/* --- formulas ------------------------------------------------------------------------------------------------- */
.formula { margin: 1.3em 0; padding: .35em 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.formula .katex-display { margin: 0; }
.katex { font-size: 1.04em; }
.where { font-size: 16px; color: var(--ink-2); margin-top: -.4em !important; }

/* --- figures -------------------------------------------------------------------------------------------------- */
figure { margin: 2.1em 0 2.2em; }
figure.wide { margin-left: 0; margin-right: 0; }
@media (min-width: 1340px) { figure.wide { margin-right: -170px; clear: right; } }   /* into the notes margin; never over the contents rail */
.card { background: var(--card); border-radius: 14px; padding: 18px 18px 14px; font-family: var(--sans); position: relative; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chart-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.chart-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; font-weight: 400; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--card-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button, .pill { font: 500 12.5px/1 var(--sans); color: var(--ink-2); border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.pill { background: var(--card-2); display: inline-flex; align-items: center; gap: 7px; }
.pill[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.pill[aria-pressed="false"] { opacity: .55; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pill .sq { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
button:focus-visible, input:focus-visible, .scrub:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
.play { display: inline-flex; align-items: center; gap: 7px; font: 500 12.5px/1 var(--sans); color: var(--ink-2); background: var(--card-2); border: 0; border-radius: 999px; padding: 7px 13px 7px 10px; cursor: pointer; }
.play svg { width: 11px; height: 11px; fill: currentColor; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-2); margin: 8px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend svg { width: 26px; height: 8px; overflow: visible; }
.plot { position: relative; }
.plot svg { display: block; width: 100%; overflow: visible; }
.plot text { font-family: var(--sans); fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums lining-nums; }
.plot .lab { fill: var(--ink); }
.plot .halo { paint-order: stroke; stroke: var(--card); stroke-width: 5px; stroke-linejoin: round; }
.plot .axis-label { fill: var(--ink-2); font-size: 12.5px; }
.plot .gridline { stroke: var(--grid); stroke-width: 1; }
.plot .axisline { stroke: var(--ink-2); stroke-width: 1; }
.plot .zero { stroke: var(--ink); stroke-width: 1.2; }
.tip { position: absolute; pointer-events: none; background: var(--bg); color: var(--ink); border-radius: 9px; box-shadow: var(--shadow); border: 1px solid var(--rule);
  padding: 8px 10px; font: 12.5px/1.45 var(--sans); min-width: 150px; opacity: 0; transition: opacity .12s; z-index: 5; font-variant-numeric: tabular-nums lining-nums; }
.tip.on { opacity: 1; }
.tip b { font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; align-items: center; white-space: nowrap; }
.tip .k { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .sw { width: 14px; height: 0; border-top: 2.5px solid; display: inline-block; }
.tip .sw.dash { border-top-style: dashed; }
.tip .t { color: var(--muted); margin-bottom: 4px; }
figcaption { font-family: var(--sans); font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 12px; }
figcaption b { color: var(--ink-2); font-weight: 600; }
figcaption::before { counter-increment: fig; content: "Figure " counter(fig) ": "; font-weight: 600; color: var(--ink-2); }
figcaption.plain::before { content: none; counter-increment: none; }
details.table-view { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 8px; }
details.table-view summary { cursor: pointer; width: fit-content; }
details.table-view table { margin-top: 8px; }

/* readout tiles inside cards */
.readout { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: baseline; margin: 6px 2px 2px; }
.stat { display: flex; flex-direction: column; gap: 2px; flex: 1 1 190px; min-width: 0; }
.stat .v { font: 600 30px/1.05 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.02em; }
.stat .k { font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--card-2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--card-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); margin-top: -7px; cursor: grab; box-shadow: 0 0 0 1px var(--ink); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); cursor: grab; }
.slider-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }

/* --- clips ---------------------------------------------------------------------------------------------------- */
.clip .stage { position: relative; border-radius: 10px; overflow: hidden; background: #111214; line-height: 0; }
.clip video { width: 100%; height: auto; display: block; }
.clip .chips { position: absolute; inset: 0; display: grid; pointer-events: none; }
.clip .chip { align-self: start; justify-self: start; margin: 10px; font: 600 12.5px/1 var(--sans); padding: 6px 9px; border-radius: 6px; color: #17161a; }
.clip .chip.listener { background: #f2c94c; } .clip .chip.speaker { background: #b5aaf7; }
.clip .chip.heard::after { content: " · sound on"; font-weight: 500; }
.clip .tracks { display: grid; gap: 14px; margin-top: 10px; }
.clip .track svg { display: block; width: 100%; touch-action: none; cursor: ew-resize; overflow: visible; }
.clip .track text { font-family: var(--sans); font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums lining-nums; }
.clip .when { font: 600 13px/1.2 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums lining-nums; min-width: 14em; }
.clip .card-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 10px; }

/* --- tables --------------------------------------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; margin: 1.6em 0; }
table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 13.5px; line-height: 1.4; font-variant-numeric: tabular-nums lining-nums; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 500; color: var(--muted); border-bottom-color: var(--ink-2); white-space: nowrap; }
td.r, th.r { text-align: right; padding-right: 0; padding-left: 12px; }
tr:last-child td { border-bottom: 0; }
td b { font-weight: 600; }

/* --- callouts, references, citation ------------------------------------------------------------------------- */
.note { border-left: 2px solid var(--ink-2); padding: 2px 0 2px 16px; margin: 1.5em 0; color: var(--ink-2); font-size: 17px; }
.refs { font-size: 15.5px; line-height: 1.5; padding-left: 1.6em; }
.refs li { margin-bottom: .6em; padding-left: .2em; scroll-margin-top: 20px; }
.refs li:target { background: color-mix(in srgb, var(--listener) 60%, transparent); border-radius: 4px; }
pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--card); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 1em 0 1.4em; }
/* site footer: the rules of .site-footer in the site's src/styles/global.css */
.site-footer { max-width: 960px; width: 100%; margin: 40px auto 0; padding: 36px 20px 40px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13.5px; color: var(--muted); }
.footer-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.site-footer h2 { font-size: 13.5px; font-weight: 500; color: var(--ink); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 6px; }
.site-footer a { text-decoration: none; color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.footer-note { margin: 36px 0 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) {
  body { font-size: 17px; }
  .card { padding: 14px 12px 12px; border-radius: 12px; margin-left: -8px; margin-right: -8px; }
  .stat .v { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tip { transition: none; } }
