/* =========================================================
   sentiment-play.css — Sentiment case, the two hands-on figures
   1. Fig. 1 playhead (sentiment.js §1b): hairline, dots, pins, grip, read-out chip
   2. Fig. 4 coin test (coin.js): the dial in the sentence, the figure
   Colour roles: --accent = handles; --play = what the visitor makes; --mark = pins.
   ========================================================= */

/* ---------- 1. Fig. 1 playhead ---------- */
.cs-sent-chart .cs-figure-frame.sp-on { touch-action: pan-y; }
.sp-layer { position: absolute; inset: 0; pointer-events: none; }
.sp-layer.is-off { visibility: hidden; }
.sp-layer > * { position: absolute; left: 0; top: 0; will-change: transform; }
.sp-line { width: 1px; margin-left: -.5px; background: var(--ink-2); opacity: .55; }
.sp-layer.is-read .sp-line { opacity: .9; }
.sp-dot { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid var(--paper-2); box-sizing: border-box; }
.sp-dot.sp-b { background: var(--ink); }
.sp-dot.sp-s { background: var(--accent); }
.sp-dot.sp-a { background: var(--ink-2); width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-width: 1.5px; }
.sp-dot[hidden], .sp-pin[hidden] { display: none; }
.sp-pins { position: absolute; inset: 0; transform: none; }
.sp-pin { position: absolute; left: 0; top: 0; width: 3px; height: 9px; margin: -9px 0 0 -1.5px; background: var(--mark); border-radius: 1px; }

/* The grip: a 44 px target with an accent pill sitting on the x-axis */
.sp-grip { width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; pointer-events: auto; cursor: ew-resize;
  touch-action: none; border-radius: 999px; outline-offset: -6px; }
.sp-grip span { display: grid; place-items: center; width: 34px; height: 20px; border-radius: 999px; background: var(--accent); color: var(--paper-2);
  font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: -.08em; box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 18%, transparent);
  transition: transform .25s var(--ease); }
.sp-grip:hover span, .sp-grip.is-drag span { transform: scale(1.12); }
.sp-grip:focus-visible { outline: 2px solid var(--accent); }

/* Read-out chip: shown while the visitor is using the playhead */
.sp-chip { display: flex; flex-direction: column; gap: 2px; max-width: min(300px, calc(100% - 8px)); padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px;
  background: color-mix(in srgb, var(--paper-2) 94%, transparent); font-family: var(--mono); font-size: 11.5px; line-height: 1.35; color: var(--ink-2);
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .2s var(--ease); }
.sp-chip b { font-weight: 500; color: var(--ink); }
.sp-layer.is-pin .sp-chip b { color: var(--mark); }
.sp-layer.is-read .sp-chip { opacity: 1; }
@media (max-width: 600px) { .sp-chip { font-size: 10.5px; padding: 5px 8px; max-width: min(230px, calc(100% - 8px)); } }

/* ---------- 2. The coin test ---------- */
.coin { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3vw, 40px); align-items: start;
  margin-top: clamp(40px, 6vw, 72px); padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--rule); }
.coin-text { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.coin-q { margin: 0; font-size: 18px; line-height: 1.75; }
.coin-read { margin: 0; font-size: 15.5px; color: var(--ink-2); min-height: 6.2em; }
.coin-read strong { color: var(--ink); font-weight: 500; }
.coin-fig .coin-frame { height: 340px; }
.coin-fig canvas { display: block; width: 100%; height: 100%; }

/* The dial: the percentage in the sentence, with visible steppers either side */
.coin-dial { white-space: nowrap; font-family: var(--mono); font-size: 16px; }
.coin-dial.is-live { display: inline-flex; align-items: center; gap: 2px; vertical-align: baseline; padding: 0 3px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); line-height: 1.5; }
.coin-step { all: unset; position: relative; display: inline-grid; place-items: center; width: 18px; height: 22px; color: var(--accent); font-size: 12px; cursor: pointer;
  border-radius: 999px; }
.coin-step::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
.coin-step:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.coin-step:disabled { opacity: .35; cursor: default; }
.coin-dial.is-live .coin-val { min-width: 3.1ch; padding: 0 2px; text-align: center; font-weight: 500; cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none;
  border-radius: 4px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.coin-val.is-drag { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.coin-val:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .coin { grid-template-columns: 1fr; }
  .coin-read { min-height: 0; }
}
@media (max-width: 600px) {
  .coin-q { font-size: 17px; }
  .coin-fig .coin-frame { height: 260px; }
}
/* ---------- 3. Hero: the pull line, tools that point at the method, the outcome link ---------- */
.cs-hero-pull { margin: clamp(18px, 2.4vw, 28px) 0 0; max-width: 34ch; padding-left: clamp(14px, 2vw, 22px); border-left: 2px solid var(--mark);
  font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2vw, 25px); line-height: 1.35; color: var(--ink); }
.cs-hero-pull .label { display: block; margin-bottom: 6px; font-style: normal; color: var(--mark); }
.cs-tools { font-family: var(--serif); }
.cs-tool { all: unset; box-sizing: border-box; position: relative; cursor: pointer; color: var(--ink); text-decoration: underline dotted;
  text-decoration-color: var(--ink-3); text-underline-offset: 4px; transition: color .2s var(--ease), text-decoration-color .2s var(--ease); }
.cs-tool::before { content: ""; position: absolute; inset: -10px -4px; }   /* a 40px target */
/* Phones: the names wrap to two lines, where 40px targets would overlap and a tap on one name could open its neighbour.
   Looser lines instead (each name's box is then a 36px target); the negative margin keeps the first line level with "Timeline". */
@media (max-width: 800px) { .cs-meta dd.cs-tools { line-height: 2; margin-block: -6px; } .cs-tool::before { inset: 0 -4px; } }
.cs-tool:hover, .cs-tool:focus-visible { color: var(--accent); text-decoration-color: var(--accent); text-decoration-style: solid; }
.cs-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.cs-outcome { color: inherit; text-decoration: none; }
.cs-outcome-go { display: inline-flex; gap: 4px; font-family: var(--mono); font-style: normal; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); white-space: nowrap; padding: 4px 0; }
.cs-outcome:hover .cs-outcome-go span, .cs-outcome:focus-visible .cs-outcome-go span { transform: translateY(2px); }
.cs-outcome-go span { display: inline-block; transition: transform .25s var(--ease); }
.cs-outcome:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- 4. Headline figures: each label opens its source slip ---------- */
.cs-sent-facts li.has-slip { position: relative; }
.cs-fact-l { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 40px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); line-height: 1.4; }
.cs-fact-src { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 999px; font-size: 10.5px;
  color: var(--ink-2); transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease); }
.cs-fact-src span { display: inline-block; transition: transform .3s var(--ease); }
.cs-fact-l:hover .cs-fact-src, .cs-fact-l:focus-visible .cs-fact-src { border-color: var(--accent); color: var(--accent); }
.cs-fact-l[aria-expanded="true"] .cs-fact-src { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cs-fact-l[aria-expanded="true"] .cs-fact-src span { transform: rotate(180deg); }
.cs-fact-l:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.cs-fact-slip { position: absolute; z-index: 5; left: 0; top: calc(100% - 10px); width: min(300px, calc(100vw - 32px)); padding: 12px 14px 14px;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--ink) 45%, transparent);
  display: flex; flex-direction: column; gap: 8px; transform-origin: 20px 0; opacity: 0; transform: translateY(-6px) scale(.97);
  transition: opacity .2s var(--ease), transform .3s var(--ease); }
.cs-fact-slip.is-open { opacity: 1; transform: none; }
.cs-fact-slip[hidden] { display: none; }
.cs-fact-slip .cs-fact-n { color: var(--ink); font-weight: 500; }
.cs-fact-slip p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.cs-fact-slip a { align-self: flex-start; font-size: 14px; padding: 4px 0; }
.cs-sent-facts li:nth-child(even) .cs-fact-slip { left: auto; right: 0; transform-origin: calc(100% - 20px) 0; }
@media (min-width: 901px) { .cs-sent-facts li:nth-child(2) .cs-fact-slip { left: 20px; right: auto; transform-origin: 20px 0; } }

/* ---------- 5. Fig. 1 steps: the old one fades out (120 ms), then the new one fades in. Never both at once. ---------- */
.cs-sent-scene:not(.is-static) .cs-sent-step { transition: opacity .12s linear, transform .12s linear; transform: translateY(6px); }
.cs-sent-scene:not(.is-static) .cs-sent-step.is-on { transition: opacity .26s var(--ease) .12s, transform .32s var(--ease) .12s; transform: none; }
.sp-layer.is-flip .sp-chip { border-color: color-mix(in srgb, var(--accent) 30%, var(--rule)); }

/* ---------- 6. What the model kept: plain names, the raw name small beneath, 40px rows ---------- */
.cs-sent-feat { min-height: 40px; padding-top: 4px; padding-bottom: 4px; }
.cs-sent-bars .k { display: flex; flex-direction: column; gap: 1px; white-space: normal; overflow: hidden; }
.cs-sent-bars .k-p { font-family: var(--sans); font-size: 14px; line-height: 1.25; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-sent-bars .k-raw { font-family: var(--mono); font-size: 10.5px; line-height: 1.3; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-sent-bars li.is-zero .k-p { color: var(--ink-2); }
.cs-sent-inl { display: none; }
.cs-sent-adjust { align-self: flex-start; }
.cs-sent-adjust.is-open { border-color: var(--accent); color: var(--accent); }
html:not(.js) .cs-sent-adjust { display: none; }
.cs-sent-lam[hidden] { display: none; }
@media (max-width: 900px) {
  /* On a phone the sentence opens under the tapped row instead of above the list */
  .cs-sent-explain h3, .cs-sent-explain p, .cs-sent-explain [data-x="tag"] { display: none; }
  .cs-sent-explain { gap: 0; }
  .cs-sent-inl { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 8px; padding: 10px 12px; border-left: 2px solid var(--accent);
    background: var(--accent-soft); border-radius: 0 8px 8px 0; animation: cs-inl-in .3s var(--ease); }
  .cs-sent-inl.is-zero { border-left-color: var(--ink-3); background: var(--paper-3); }
  .cs-sent-inl .label { color: var(--accent); }
  .cs-sent-inl.is-zero .label { color: var(--ink-3); }
  .cs-sent-inl p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
}
@keyframes cs-inl-in { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 600px) {
  .cs-sent-feat { min-height: 44px; }
  .cs-sent-bars .k-p { font-size: 13px; }
}

/* ---------- 7. Coins: buttons, the tally ---------- */
.coin-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.coin-btns[hidden] { display: none; }
.coin-btns .btn { min-height: 42px; }
.coin-clear { min-height: 40px; padding: 0 10px; border: 0; background: none; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); cursor: pointer; transition: color .2s var(--ease); }
.coin-clear:hover:not(:disabled) { color: var(--ink); }
.coin-clear:disabled { opacity: .4; cursor: default; }
.coin-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.coin-tally { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.coin-tally .label { margin-right: 4px; color: var(--play); }
.coin-tally b { font-weight: 500; color: var(--play); }
.coin-tally.is-hit .coin-k { animation: coin-hit .9s var(--ease); }
@keyframes coin-hit { 0% { color: var(--mark); background: color-mix(in srgb, var(--mark) 22%, transparent); } 100% { background: transparent; } }

/* ---------- 8. "What we still want to know": each card points somewhere ---------- */
.cs-take-go { display: inline-block; margin-top: 12px; padding: 6px 0; font-size: 14px; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .sp-chip, .sp-grip span { transition: none; }
  .cs-fact-slip, .cs-fact-src span, .cs-outcome-go span, .cs-tool { transition: none; }
  .cs-sent-scene .cs-sent-step, .cs-sent-scene .cs-sent-step.is-on { transition: none; }
  .cs-sent-inl, .coin-tally.is-hit .coin-k { animation: none; }
}
/* Footnote back-links: a 32px box with a 44px hit area */
/* The visible box stays inside the line (no taller last line); the invisible ::after carries a ~44px target */
.cs-sentiment .ak-fn-back { position: relative; display: inline-grid; place-items: center; min-width: 28px; min-height: 22px; line-height: 1; vertical-align: 0; border-radius: 6px; }
.cs-sentiment .ak-fn-back::after { content: ""; position: absolute; inset: -11px -8px; }

/* Touch: the dial's value gets a 40px+ hit area (a touch wider, and taller by a pseudo-element; it sits above the steppers) */
@media (pointer: coarse), (max-width: 800px) {
  .coin-dial.is-live .coin-val { padding: 0 4px; }
  .coin-dial.is-live .coin-val::after { content: ""; position: absolute; left: -2px; right: -2px; top: -9px; bottom: -9px; }
}

/* Figure 3 cue: touch screens are told to tap, not hover */
.cue-tap { display: none; }
@media (hover: none) { .cue-hov { display: none; } .cue-tap { display: inline; } }

/* Phones: the section subtitle sits on its own line, so its leading dash goes (as on About and Record) */
@media (max-width: 600px) {
  .cs-sentiment .sect-head .sect-dash { display: none; }
  .cs-fact-src { font-size: 11px; padding: 3px 9px; }
}
