/* ==========================================================================
   Grey Sky Capital: R.I.P. ledger + "How the model works"
   GSCD-2.1 tokens only. Paired with assets/js/engine.js.
   ========================================================================== */

/* ---- Hero words link to their tab ---- */
.hero__themes a { color: inherit; text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .4s var(--ease); }
.hero__themes a:hover, .hero__themes a:focus-visible { background-size: 100% 2px; }

/* Visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- R.I.P.: three compact columns ---- */
.rip__head { margin-bottom: clamp(28px, 4vw, 44px); }
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
.ledger__row { position: relative; display: grid; align-content: start; gap: 14px; padding-top: 22px; border-top: 1px solid var(--text-head); }
.ledger__row::before {
  content: ''; position: absolute; left: 0; top: -2px; height: 3px; width: 100%;
  background: var(--row-accent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease);
}
.ledger__row:hover::before { transform: scaleX(1); }
.ledger__top { display: flex; align-items: baseline; gap: 14px; }
.ledger__letter { font-size: var(--d1-size); line-height: 1; font-weight: 700; letter-spacing: var(--d1-tr); color: var(--row-accent); }
.ledger__row > p { max-width: 38ch; }
.ledger__proof { display: grid; gap: 6px; }
.ledger__proof li {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--text);
  padding-left: 16px; position: relative;
}
.ledger__proof li::before { content: ''; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; background: var(--row-accent); }
.ledger__proof b { color: var(--text-head); font-weight: 500; }
.ledger__proof a { color: var(--accent); }
.ledger__cta { justify-self: start; margin-top: 6px; }
@media (max-width: 900px) {
  .ledger { grid-template-columns: 1fr; gap: 32px; }
}

/* ---- What could go wrong: ledger rows plus one disclosure note ---- */
.risks__head { display: grid; gap: 16px; max-width: 760px; margin-bottom: clamp(28px, 4vw, 44px); }
.risks__note { display: grid; gap: 10px; max-width: 820px; margin-top: clamp(36px, 5vw, 56px); padding: 22px 26px; background: var(--paper-200); border-left: 3px solid var(--rust); }
.risks__note b { color: var(--text-head); font-weight: 500; }

/* ---- Engine section ---- */
.engine { background: var(--paper-200); }
/* Problem and solution read as one passage: trim the seam between them */
.problem { padding-bottom: clamp(56px, 7vw, 96px); }
.engine { padding-top: 0; }
/* "Our solution": answers the Problem section above on the same ground, and its
   last line leads straight into the Quant / Multi-asset / Dynamic tabs */
.solution { position: relative; display: grid; gap: 16px; max-width: 880px; margin-bottom: clamp(8px, 1.5vw, 16px); }
.solution h2 { position: relative; z-index: 1; width: fit-content; isolation: isolate; }
/* The paragraph runs the full width of the block, so it takes fewer lines on a wide screen */
.solution__lede { font-size: var(--lead-size); line-height: var(--lead-lh); color: var(--text); }
.solution__lead {
  margin-top: clamp(20px, 3vw, 32px); font-size: var(--d3-size); line-height: var(--d3-lh); letter-spacing: var(--d3-tr);
  font-weight: 600; color: var(--text-head); max-width: 34ch;
}
.engine__head { display: flex; justify-content: flex-start; align-items: center; margin-bottom: clamp(28px, 4vw, 40px); }
/* Tabs: the selected one is circled in pen, the others pulse to invite a click */
.engine__tabs { display: flex; flex-wrap: wrap; gap: 8px clamp(24px, 4vw, 56px); padding: 12px 18px; margin-left: -18px; }
.engine__tab {
  position: relative; background: none; border: 0; padding: 8px 4px; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--d1-size); font-weight: 700; letter-spacing: var(--d1-tr); line-height: 1.1;
  color: var(--text-muted); display: inline-flex; align-items: center; gap: 10px;
  transition: color .3s var(--ease);
}
.engine__tab:hover { color: var(--text-head); }
.engine__tab.is-active { color: var(--text-head); }
.engine__tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; }
.engine__tab::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--fill); flex: none;
  box-shadow: inset 0 0 0 1px rgba(13, 18, 21, .35); opacity: 0; transform: scale(.4);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.engine__tab.is-active::before { width: 0; margin-right: -10px; }
.engine__tab.is-pulsing::before { opacity: 1; transform: none; animation: tab-ping 1.8s cubic-bezier(.2, .7, .1, 1) 2; }   /* twice, under 5 s (WCAG 2.2.2) */
.engine__tab.is-pulsing { animation: tab-breathe 1.8s ease-in-out 2; }
.engine__tab.is-pulsing:hover { animation: none; color: var(--text-head); }
@keyframes tab-ping {
  0%   { box-shadow: inset 0 0 0 1px rgba(13, 18, 21, .35), 0 0 0 0 rgba(63, 84, 22, .45); }
  70%  { box-shadow: inset 0 0 0 1px rgba(13, 18, 21, .35), 0 0 0 9px rgba(63, 84, 22, 0); }
  100% { box-shadow: inset 0 0 0 1px rgba(13, 18, 21, .35), 0 0 0 0 rgba(63, 84, 22, 0); }
}
@keyframes tab-breathe { 50% { color: var(--text-head); } }
.engine__pen { position: absolute; overflow: visible; pointer-events: none; transform: rotate(-1.5deg); }
.engine__pen path {
  fill: none; stroke: var(--rust); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset .7s cubic-bezier(.65, 0, .35, 1);
}
.engine__pen.is-drawn path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .engine__tab.is-pulsing, .engine__tab.is-pulsing::before { animation: none; }
}
/* Phones: the three tabs share one row, spread edge to edge, so none wraps onto
   a line of its own. The pulsing dots stay on the unselected tabs. */
@media (max-width: 600px) {
  .engine__tabs { flex: 1; flex-wrap: nowrap; justify-content: space-between; gap: 6px; padding: 12px 10px; margin: 0 -10px; }
  .engine__tab { font-size: clamp(19px, 6vw, 32px); padding: 8px 2px; gap: 6px; white-space: nowrap; }
  .engine__tab.is-active::before { margin-right: -6px; }
}
.engine__panel {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px 56px; align-items: start;   /* headers start at the same height in every panel */
  background: var(--paper-100); border: 1px solid var(--hairline); padding: clamp(24px, 3.4vw, 44px);
  min-height: 540px;   /* the tallest panel (Multi-asset), so switching tabs doesn't move the page */
}
.engine__panel[hidden] { display: none; }
.engine__panel.is-entering .engine__copy, .engine__panel.is-entering .engine__viz { animation: engine-in .55s var(--ease) both; }
.engine__panel.is-entering .engine__viz { animation-delay: .08s; }
@keyframes engine-in { from { opacity: 0; filter: blur(6px); transform: translateY(8px); } }
.engine__copy { display: grid; gap: 16px; align-content: start; }
.engine__copy p { max-width: 50ch; }
.engine__soft { color: var(--text-muted); }
.engine__facts { display: grid; gap: 12px; margin-top: 4px; }
.engine__facts div { display: grid; gap: 4px; }
.engine__facts dd { font-family: var(--font-mono); font-size: var(--data-size); line-height: 1.6; color: var(--text-head); }
.engine__viz { margin: 0; display: grid; gap: 12px; }
@media (max-width: 960px) { .engine__panel { grid-template-columns: 1fr; min-height: 0; } }

/* Quant: explainer video card (opens the player in the panel) */
.vcard {
  all: unset; box-sizing: border-box; cursor: pointer; margin-top: 8px;
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 10px; border: 1px solid var(--hairline); background: var(--paper-200);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.vcard:hover { border-color: var(--grey-500); background: var(--paper-100); }
.vcard:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.vcard__media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--slate-900); }
.vcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.vcard:hover .vcard__media img { transform: scale(1.05); }
.vcard__play {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  background: var(--lime); display: grid; place-items: center; transition: transform .35s var(--ease);
}
.vcard__play::before { content: ''; margin-left: 3px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #0D1215; }
.vcard:hover .vcard__play { transform: scale(1.1); }
.vcard__meta { display: grid; gap: 6px; }
.vcard__title { font-weight: 600; color: var(--text-head); line-height: 1.3; }
@media (max-width: 420px) { .vcard { grid-template-columns: 1fr; } }
/* the explainer as the Quant panel's visual: full-width poster, title underneath */
.engine__viz--video { align-content: center; }
.vcard--feature { margin-top: 0; grid-template-columns: 1fr; gap: 14px; padding: 12px; }
.vcard--feature .vcard__play { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.vcard--feature .vcard__play::before { margin-left: 5px; border-width: 11px 0 11px 17px; }
.vcard--feature .vcard__title { font-size: clamp(17px, 1.5vw, 20px); }

/* Video player inside the panel dialog */
.panel.panel--video { max-width: min(1040px, calc(100vw - 32px)); }
.video { position: relative; aspect-ratio: 16 / 9; background: var(--slate-900); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Multi-asset: asset classes x strategies */
.matrix { display: grid; }
.matrix__row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(var(--n, 3), minmax(0, 1fr)); align-items: center; min-height: 44px; border-bottom: 1px solid var(--hairline); }
.matrix__row--head { border-bottom: 1px solid var(--text-head); min-height: 56px; align-items: end; padding-bottom: 10px; }
.matrix__col { display: grid; justify-items: center; gap: 2px; text-align: center; }
.matrix__col b { font-weight: 600; color: var(--text-head); font-size: 15px; }
.matrix__col i { font-style: normal; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; color: var(--text-muted); }
.matrix__label { font-weight: 600; color: var(--text-head); font-size: 15px; }
.matrix__cell { display: grid; place-items: center; }
.matrix__dot {
  width: 14px; height: 14px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(13, 18, 21, .2);
  transform: scale(0); transition: transform .5s cubic-bezier(.34, 1.4, .64, 1); transition-delay: calc(var(--r) * 70ms + var(--k) * 40ms);
}
.matrix__dot--lime { background: var(--lime); }
.matrix__dot--flare { background: var(--flare); }
.matrix__dot--azure { background: var(--azure); }
.matrix__dot--slate { background: var(--grey-500); }
.matrix__none { width: 10px; height: 1px; background: var(--grey-500); display: block; opacity: .6; }
.matrix.is-drawn .matrix__dot { transform: scale(1); }
.matrix__row:not(.matrix__row--head):hover { background: var(--paper-200); }
@media (max-width: 600px) {
  .matrix__row { grid-template-columns: minmax(0, 1.1fr) repeat(var(--n, 3), minmax(0, 1fr)); }
  .matrix__col b, .matrix__label { font-size: 12px; }
  /* strategy names read upwards in the header, so no name breaks mid-word */
  .matrix__col b { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; line-height: 1.1; }
  .matrix__col { align-self: end; }
}
@media (prefers-reduced-motion: reduce) { .matrix__dot { transition: none; } }

/* Multi-asset: ranges */
.ranges { display: grid; gap: 18px; }
.ranges__axis { display: flex; justify-content: space-between; margin-left: calc(30% + 16px); margin-right: 72px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.ranges__row { display: grid; grid-template-columns: 30% minmax(0, 1fr) 72px; gap: 16px; align-items: center; }
.ranges__label { font-weight: 600; color: var(--text-head); font-size: 15px; }
.ranges__track {
  position: relative; height: 28px;
  background: repeating-linear-gradient(90deg, var(--hairline) 0 1px, transparent 1px 25%), var(--paper-200);
}
.ranges__band { position: absolute; top: 6px; bottom: 6px; transform: scaleX(0); transform-origin: left; transition: transform 1s cubic-bezier(.65, 0, .35, 1); transition-delay: calc(var(--i) * 120ms); }
.ranges__band--lime { background: var(--lime); }
.ranges__band--flare { background: var(--flare); }
.ranges__band--azure { background: var(--azure); }
.ranges__band--slate { background: var(--grey-500); }
.ranges__avg {
  position: absolute; top: -4px; bottom: -4px; left: 0; width: 2px; background: var(--ink-head);
  transform: translateX(0); transition: transform 1.1s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i) * 120ms + .5s);
}
.ranges__avg span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--text-head); background: var(--paper-100); padding: 0 3px;
}
.ranges.is-drawn .ranges__band { transform: scaleX(1); }
.ranges.is-drawn .ranges__avg { left: var(--avg); }
.ranges__val { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-align: right; }
.ranges__note { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
@media (max-width: 600px) {
  .ranges__row { grid-template-columns: 1fr 64px; }
  .ranges__label { grid-column: 1 / -1; }
  .ranges__axis { margin-left: 0; margin-right: 80px; }
}

/* Dynamic: regime buttons and the allocation line */
.regime__now { display: grid; gap: 2px; min-height: 58px; }
.regime__now span:last-child { color: var(--text-muted); }
.regime__controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.regime__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.regime__tab, .regime__pause {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 12px; border: 1px solid var(--grey-500); background: transparent; color: var(--text-head);
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s;
}
.regime__tab.is-on { background: var(--text-head); color: var(--paper-100); border-color: var(--text-head); }
.regime__tab:hover:not(.is-on), .regime__pause:hover { border-color: var(--text-head); }
.regime__pause { color: var(--text-muted); }
.engine__evidence { justify-self: start; background: none; border: 0; border-bottom: 1px solid currentColor; padding: 0 0 3px; font: inherit; font-weight: 600; cursor: pointer; }
/* one allocation line: equity / gold & silver / debt, widths set per regime */
.engine__viz--alloc { align-content: center; gap: 18px; }
.alloc { display: grid; gap: 10px; }
.alloc__bar {
  position: relative; height: clamp(72px, 9vw, 112px); border-radius: 18px; overflow: hidden; background: var(--paper-200);
  box-shadow: inset 0 0 0 1px rgb(13 18 21 / .14), inset 0 -6px 14px rgb(13 18 21 / .08);
}
.alloc__bar canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.alloc__key { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 4px 0 0; padding: 0; }
.alloc__item { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--text-head); }
.alloc__item i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgb(13 18 21 / .15); }
.alloc__item--lime i  { background: var(--lime); }
.alloc__item--flare i { background: var(--flare); }
.alloc__item--azure i { background: var(--azure); }

/* Evidence (inside the panel dialog) */
.bench { display: grid; margin: 8px 0; }
.bench__row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr) 56px 56px; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--hairline); }
.bench__row--head { border-top: 0; padding-bottom: 6px; }
.bench__row > span:nth-child(n+3) { text-align: right; }
.bench__bar { height: 10px; background: var(--paper-200); }
.bench__bar i { display: block; height: 100%; background: var(--grey-500); }
.bench__row.is-best { font-weight: 600; color: var(--text-head); }
.bench__row.is-best .bench__bar i { background: var(--azure-ink); }

@media (prefers-reduced-motion: reduce) {
  .ranges__band, .ranges__avg { transition: none; }
  .engine__panel.is-entering .engine__copy, .engine__panel.is-entering .engine__viz { animation: none; }
}

/* ---- The problem ---- */
.problem__head { display: grid; gap: 16px; max-width: 900px; margin-bottom: clamp(32px, 4vw, 48px); }
.problem .mk[data-mark="circle"] { --mk: var(--ember-ink); }
/* Carousel: one problem at a time, shown as a dark, full-width band (instrument palette).
   The photo fills the band edge to edge, desaturated and dimmed; a slate wash rises
   behind the text column on the right and along the bottom, where the tabs sit.
   Type is light on slate. The big marker and the title run a gradient from flare to
   azure, two accents with the same contrast on slate-900 (8.1:1 and 8.0:1). */
.pcar { --pcar-dur: 3.5s; }
.problem {
  overflow-x: clip;
  --grad-a: var(--flare);
  --grad-b: var(--azure);
  /* Left edge of the text column, matching .pcar__copy's grid (page max, text 520px) */
  --copy-x: calc(50vw + min(50vw, var(--max) / 2) - var(--gutter) - 520px);
}
.pcar__stage {
  position: relative; margin-inline: calc(50% - 50vw); min-height: clamp(520px, 46vw, 680px);
  display: grid; grid-template-rows: 1fr auto; background: var(--slate-900); color: var(--grey-100);
}
.pcar__media { position: absolute; inset: 0; margin: 0; overflow: hidden; }
.pcar__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06); filter: saturate(.7) brightness(.82) contrast(1.05);
  transition: opacity .9s var(--ease), transform 1.2s var(--ease);
}
.pcar__img.is-active { opacity: 1; transform: scale(1); }
.pcar.is-playing .pcar__img.is-active { animation: pcar-zoom calc(var(--pcar-dur) + .8s) linear both; }
@keyframes pcar-zoom { from { transform: scale(1.06); } to { transform: scale(1); } }
.pcar__media::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(0deg, rgb(13 18 21 / .92) 0, rgb(13 18 21 / .55) 90px, transparent 200px),
    linear-gradient(90deg, rgb(13 18 21 / .12) 0, rgb(13 18 21 / .3) calc(var(--copy-x) - 280px), rgb(13 18 21 / .84) calc(var(--copy-x) - 24px), rgb(13 18 21 / .9) 100%);
}
.pcar__credit {
  position: absolute; right: var(--gutter); top: 16px; z-index: 1;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: rgb(242 244 242 / .55);
}
.pcar__copy {
  position: relative; z-index: 1; width: 100%; max-width: var(--max); margin: 0 auto; align-self: center;
  padding: clamp(56px, 6vw, 88px) var(--gutter) clamp(24px, 3vw, 40px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
}
.pcar__slide { grid-area: 1 / 2; display: grid; align-content: center; gap: 14px; }
.pcar__slide[hidden] { display: grid; visibility: hidden; }
.pcar__slide > * { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.pcar__slide.is-active > * { opacity: 1; transform: none; }
.pcar__slide.is-active > :nth-child(2) { transition-delay: .06s; }
.pcar__slide.is-active > :nth-child(3) { transition-delay: .12s; }
.pcar__slide.is-active > :nth-child(4) { transition-delay: .18s; }
.pcar__slide.is-active > :nth-child(5) { transition-delay: .26s; }
.pcar__idx { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; color: var(--grey-400); }
.pcar__idx b { color: var(--grey-100); font-weight: 500; }
.pcar__slide h3 { color: var(--grey-100); font-size: var(--d2-size); line-height: var(--d2-lh); letter-spacing: var(--d2-tr); }
.pcar__slide p { color: var(--grey-300); max-width: 44ch; font-size: var(--lead-size); line-height: var(--lead-lh); }
/* Each glyph of the marker and each word of the title is tinted by its position
   across the column (JS sets --t), so the gradient reads left to right. */
.pcar__slide .g { color: color-mix(in srgb, var(--grad-a), var(--grad-b) var(--t, 0%)); }
.problem__big {
  display: block; font-size: clamp(64px, 6vw + 16px, 104px); line-height: .95; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; min-height: 1em; margin: 4px 0 6px;
}

/* Tabs live inside the band, along its bottom edge */
.pcar__nav {
  position: relative; z-index: 1; width: 100%; max-width: var(--max); margin: 0 auto;
  padding: 0 var(--gutter) clamp(24px, 3vw, 36px); display: flex; align-items: stretch; gap: 24px;
}
.pcar__tabs { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.pcar__tab {
  appearance: none; background: none; border: 0; padding: 14px 0 0; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; position: relative; color: var(--grey-400);
  font: inherit; transition: color .3s var(--ease);
}
.pcar__num { font-family: var(--font-mono); font-size: 12px; }
.pcar__label { font-weight: 600; font-size: 15px; }
.pcar__bar { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgb(242 244 242 / .18); overflow: hidden; }
.pcar__bar i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--grad-a), var(--grad-b)); transform: scaleX(0); transform-origin: left; }
.pcar__tab:hover, .pcar__tab[aria-selected="true"] { color: var(--grey-100); }
.pcar__tab[aria-selected="true"] .pcar__bar i { transform: scaleX(1); }
.pcar.is-playing .pcar__tab[aria-selected="true"] .pcar__bar i { animation: pcar-fill var(--pcar-dur) linear both; }
.pcar.is-paused .pcar__tab[aria-selected="true"] .pcar__bar i { animation-play-state: paused; }
/* Bars for slides already seen stay full; while paused by the button the current bar shows full */
.pcar__tab.is-done .pcar__bar i { transform: scaleX(1); }
.pcar.is-user-paused .pcar__tab[aria-selected="true"] .pcar__bar i { animation: none; transform: scaleX(1); }
@keyframes pcar-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.pcar__tab:focus-visible { outline: 2px solid var(--grey-100); outline-offset: 4px; }
.pcar__arrows { display: flex; gap: 8px; align-self: end; }
.pcar__arrow {
  appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgb(242 244 242 / .4);
  background: transparent; color: var(--grey-100); cursor: pointer; font-size: 18px;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.pcar__arrow:hover { background: var(--grey-100); color: var(--slate-900); border-color: var(--grey-100); }
.pcar__arrow:focus-visible { outline: 2px solid var(--grey-100); outline-offset: 3px; }
/* Pause / play: two bars while playing, a triangle once paused */
.pcar__toggle { display: grid; place-items: center; }
.pcar__icon-pause { width: 12px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; box-sizing: border-box; }
.pcar.is-user-paused .pcar__toggle .pcar__icon-pause {
  width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent currentColor; margin-left: 3px;
}


/* "Hunch": a question mark sketches in after the word, then keeps a slight
   uncertain tilt back and forth, the way a guess never quite settles */
.problem__big--hunch { display: inline-flex; align-items: baseline; justify-self: start; }
.problem__q {
  display: inline-block; margin-left: .04em; transform-origin: 50% 85%;
  opacity: 0; transform: translateY(.12em) rotate(-24deg) scale(.6);
  transition: opacity .5s var(--ease) .35s, transform .7s var(--ease) .35s;
}
.pcar__slide.is-active .problem__q { opacity: 1; transform: none; animation: hunch-tilt 2.8s ease-in-out 1.1s 1; }   /* one tilt, done by 3.9 s, even when the carousel is paused (WCAG 2.2.2) */
@keyframes hunch-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-10deg); } 65% { transform: rotate(7deg); } }
/* "Conflicted": letters start out of line, then snap straight once the slide
   has settled, the way the fee structure lines incentives up */
.problem__big--conflicted { justify-self: start; }
.problem__big--conflicted > span { display: inline-block; transition: transform .7s var(--ease); }
.problem__big--conflicted > span:nth-child(odd)  { transform: translateY(-.07em) rotate(-4deg); }
.problem__big--conflicted > span:nth-child(even) { transform: translateY(.06em) rotate(3deg); }
.problem__big--conflicted > span:nth-child(3n)   { transform: translateY(.1em) rotate(-2deg); }
.pcar__slide.is-active .problem__big--conflicted > span { transform: none; transition-delay: calc(1.1s + var(--li, 0) * 40ms); }


/* "Our answer": links to the explainer tab or R.I.P. column that solves this problem */
.pcar__answer {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 10px; padding-top: 16px;
  border-top: 1px solid rgb(242 244 242 / .16); font-size: 15px; color: var(--grey-300);
}
.pcar__answer-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey-400); }
.pcar__ans {
  color: var(--grey-100); font-weight: 600; text-decoration: none;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b)) left bottom / 100% 2px no-repeat;
  padding-bottom: 3px; transition: background-size .35s var(--ease), color .25s var(--ease);
}
.pcar__ans:hover { background-size: 100% 100%; color: var(--slate-900); }
.pcar__ans:focus-visible { outline: 2px solid var(--grey-100); outline-offset: 3px; }
.pcar__answer .arrow { color: var(--grey-400); }

@media (max-width: 860px) {
  /* Phones and small tablets: the whole slide fits one screen. Story-style
     progress bars across the top say "this is a carousel"; the photo sits behind
     the text under a slate wash; a swipe hint and previous / pause / next run
     along the bottom. */
  .pcar__stage { min-height: 0; grid-template-rows: auto auto auto; }
  .pcar__media { position: absolute; inset: 0; }
  .pcar__img { object-position: 50% 30%; }
  .pcar__media::after {
    background: linear-gradient(180deg, rgb(13 18 21 / .12) 0, rgb(13 18 21 / .4) 100px, rgb(13 18 21 / .86) 215px, rgb(13 18 21 / .94) 100%);
  }
  .pcar__credit { top: 76px; font-size: 10px; }
  .pcar__nav { display: contents; }
  .pcar__tabs {
    grid-row: 1; position: relative; z-index: 1; width: 100%; box-sizing: border-box;
    padding: 14px var(--gutter) 0; gap: 6px; align-items: start;
  }
  .pcar__tab { display: block; padding: 12px 0 4px; }
  .pcar__bar { height: 3px; border-radius: 2px; background: rgb(242 244 242 / .32); }
  /* Names under the bars, small; the current one brightens */
  .pcar__num {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .pcar__label { display: block; font-size: 11px; line-height: 1.3; font-weight: 600; color: var(--grey-400); overflow-wrap: anywhere; }
  .pcar__tab[aria-selected="true"] .pcar__label { color: var(--grey-100); }
  .pcar__copy { grid-row: 2; grid-template-columns: 1fr; margin: 0; padding: 72px var(--gutter) 4px; }
  .pcar__slide { grid-area: 1 / 1; align-content: start; gap: 10px; }
  .problem__big { font-size: clamp(48px, 15vw, 72px); margin: 2px 0 0; }
  .pcar__slide h3 { font-size: 24px; }
  .pcar__slide p { font-size: 16px; line-height: 1.55; }
  .pcar__answer { margin-top: 4px; padding-top: 12px; }
  .pcar__answer .arrow { display: none; }
  .pcar__arrows {
    grid-row: 3; position: relative; z-index: 1; width: 100%; box-sizing: border-box; align-self: auto;
    padding: 10px var(--gutter) 20px; align-items: center;
  }
  .pcar__arrows::before {
    content: 'Swipe or use the arrows'; margin-right: auto;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey-400);
  }
  .pcar__arrow { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .pcar__slide.is-active .problem__q { animation: none; }
  .problem__big--conflicted > span { transform: none !important; }
  .pcar__img, .pcar__slide > * { transition: opacity .2s linear; transform: none !important; animation: none !important; }
}

/* ---- Interludes: quiet single-column pauses between busy sections ---- */
.interlude { padding: clamp(96px, 12vw, 168px) 0; background: var(--paper-100); position: relative; }
.interlude__fig { margin: 0 auto; max-width: 940px; display: grid; justify-items: center; text-align: center; gap: 0; }
.interlude__fig .eyebrow { margin-bottom: clamp(24px, 3vw, 40px); }
.interlude__mark {
  display: block; height: .5em; font-size: clamp(96px, 10vw, 140px); line-height: 1; font-weight: 700;
  color: var(--ember-ink); opacity: .18; margin-bottom: clamp(24px, 3vw, 36px);
  transform: translateY(16px) scale(.9); transition: transform 1.1s var(--ease), opacity 1.1s var(--ease);
}
.interlude.is-in .interlude__mark { transform: none; opacity: .28; }
.interlude__q { margin: 0; display: grid; gap: .6em; }
.interlude__q p {
  font-size: var(--d2-size); line-height: 1.22; letter-spacing: var(--d2-tr); font-weight: 500;
  color: var(--text-head); text-wrap: balance; max-width: 34ch; margin: 0 auto;
}
.interlude__q .qw { color: var(--ink-muted); transition: color .4s var(--ease); }   /* unread: ink-muted, 5.78:1 (WCAG 1.4.3) */
.interlude__q .qw.is-lit { color: var(--text-head); }
.interlude__by {
  margin-top: clamp(28px, 3vw, 40px); font-family: var(--font-mono); font-size: 13px; letter-spacing: .04em; color: var(--text);
}

/* Our story. Phones: heading centred, paragraphs beside a rail that draws as you
   read. Wide screens: the heading and the list of parts stay put on the left
   while the text moves up on the right. */
.interlude--story { padding: clamp(64px, 8vw, 112px) 0; }
.story { max-width: 1120px; margin: 0 auto; }
.story__side { text-align: center; }
.story__side .eyebrow { display: flex; width: fit-content; margin: 0 auto 16px; }
.story__side h2 { margin-bottom: clamp(32px, 4vw, 48px); }
.story__nav { display: none; }
.story__body { position: relative; display: grid; gap: 1.25em; padding-left: 44px; max-width: 780px; margin: 0 auto; }
.story__body p { font-size: var(--lead-size); line-height: 1.65; color: var(--ink-muted); transition: color .6s var(--ease); }
.story__body p[id] { scroll-margin-top: 40px; }
.story__body p.is-read { color: var(--text-head); }
/* Line-by-line reveal: engine.js wraps each word and lights it as it is read.
   Unread lines start in ink-muted, as the interlude quotes do: still readable
   at 5.78:1 (WCAG 1.4.3), and the step up to full ink shows the reading line. */
.story__body p.is-words, .story__body p.is-words.is-read { color: var(--ink-muted); }
.story__body .sw { transition: color .5s var(--ease); }
.story__body .sw.is-lit { color: var(--text-head); }
/* Key words: rust, and they light with the line they sit in */
.story__key { font-weight: 700; color: var(--rust); }
.story__body p.is-words .story__key { color: inherit; }
.story__body .story__key .sw.is-lit { color: var(--rust); }
/* The turning line, set large */
.story__body .story__pivot {
  margin: .5em 0 .3em; font-size: var(--d2-size); line-height: var(--d2-lh); letter-spacing: var(--d2-tr);
  font-weight: 700; color: var(--text-head);
}
.js .story__body .story__pivot:not(.is-read) { color: var(--ink-muted); }
@media (min-width: 960px) {
  .story { max-width: none; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(48px, 6vw, 96px); align-items: start; }
  .story__side { position: sticky; top: calc(var(--nav-h) + 48px); text-align: left; }
  .story__side .eyebrow { margin-left: 0; }
  .story__side h2 { margin-bottom: 0; }
  .story__nav { display: block; margin-top: 40px; }
  .story__nav ol { display: grid; list-style: none; counter-reset: part; }
  .story__nav li { counter-increment: part; }
  .story__nav a {
    display: grid; grid-template-columns: 36px auto; justify-content: start; align-items: center; min-height: 40px;
    font-size: 15px; font-weight: 600; color: var(--ink-muted); text-decoration: none; transition: color .3s var(--ease);
  }
  .story__nav a::before { content: counter(part, decimal-leading-zero); font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
  .story__nav a:hover { color: var(--text-head); }
  .story__nav a.is-on { color: var(--rust); font-weight: 700; }
  .story__body { padding-left: 0; margin: 0; max-width: 720px; }
  .story__body .story__rail { display: none; }
}
.story__rail { position: absolute; left: 6px; top: .5em; bottom: .5em; width: 2px; background: var(--paper-300); border-radius: 2px; }
.story__rail::before, .story__rail::after {
  content: ''; position: absolute; left: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--paper-300); transition: background .4s var(--ease);
}
.story__rail::before { top: 0; background: var(--ember-ink); }
.story__rail::after { top: 100%; }
.story__rail.is-done::after { background: var(--ember-ink); }
.story__rail i { position: absolute; inset: 0; background: var(--ember-ink); transform-origin: top; transform: scaleY(var(--p, 0)); }

@media (max-width: 560px) {
  .interlude__q p { font-size: 24px; }
  .story__body { padding-left: 28px; }
  .story__rail { left: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .interlude__mark { transform: none; transition: none; }
  .interlude__q .qw { color: var(--text-head); }
  .story__body p, .story__body p.is-words, .story__body .sw { color: var(--text-head); }
  .story__rail i { transform: none; }
}

/* ------------------------------ Depth (tokens.css, --lit-*) ------------------------------ */
.ranges__track { box-shadow: var(--lit-well); }
.ranges__band, .ranges__band--lime, .ranges__band--flare, .ranges__band--azure, .ranges__band--slate { border-radius: 4px; background-image: var(--lit-bar); box-shadow: var(--lit-drop); }
.bench__bar { border-radius: 5px; box-shadow: var(--lit-well); }
.bench__bar i, .bench__row.is-best .bench__bar i { border-radius: 5px; background-image: var(--lit-bar); box-shadow: var(--lit-drop); }
