/* theme.css: the colour, depth and motion layer over the article's own design (index.html / appendix.html <style>).
   Loaded after the page's styles; every rule starts with :root so it wins over the page's equal selectors.
   Palette: the page orange stays the brand and "ours" colour (charts); a warm orange -> amber gradient for accents;
   the logo's lime only as a faint glow behind the logo. Cards are white on a warm off-white page with soft shadows
   instead of the 2-2.5 px black outlines. Motion needs theme.js (html.fx-js) and is off under prefers-reduced-motion. */

:root {
  --page: #faf9f6;
  --line: rgba(21, 23, 26, .09);
  --grad: linear-gradient(100deg, #ff4f2b 0%, #ff6a1f 38%, #ff9a1f 72%, #ffbe3b 100%);  /* fills with dark text */
  --grad-deep: linear-gradient(100deg, #f2421a 0%, #ff5a1f 55%, #ff7a1a 100%);         /* fills with white text */
  --grad-text: linear-gradient(100deg, #e5370f 0%, #ff5a1f 45%, #ff8a00 100%);         /* text on white */
  --sh-1: 0 1px 2px rgba(21, 23, 26, .04), 0 6px 18px -8px rgba(21, 23, 26, .12);
  --sh-2: 0 2px 6px rgba(21, 23, 26, .05), 0 22px 44px -18px rgba(21, 23, 26, .26);
  --sh-org: 0 14px 30px -12px rgba(255, 90, 31, .55);
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* demo cards (player.css variables) */
  --card-bg: linear-gradient(162deg, #262a31 0%, #181a1e 48%, #121417 100%);
  --shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 20px 40px -20px rgba(21, 23, 26, .6);
  --reason-bg: transparent; --json-bg: transparent;
  --tps-bg: linear-gradient(100deg, #ff6a1f, #ff9a1f);
  --rbar-fill: linear-gradient(90deg, #22c55e, #6ee7a0);
}
:root body { background: var(--page); overflow-x: clip; position: relative; }
:root ::selection { background: rgba(255, 106, 31, .22); }
:root :is(a, button, summary):focus-visible { outline: 2px solid #ff5a1f; outline-offset: 3px; border-radius: 8px; }
:root .wrap { position: relative; z-index: 1; }

/* ---------- hero backdrop: drifting warm light + a faint grid (theme.js adds .fx-aura) ---------- */
.fx-aura { position: absolute; left: 0; right: 0; top: 0; height: min(1150px, 125vh); z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 50%, transparent); mask-image: linear-gradient(#000 50%, transparent); }
.fx-aura::before { content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(21, 23, 26, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(21, 23, 26, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, #000 10%, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, #000 10%, transparent 75%); }
.fx-aura i { position: absolute; border-radius: 50%; filter: blur(60px); will-change: transform; }
.fx-aura i:nth-child(1) { width: 640px; height: 640px; right: -140px; top: -260px; background: radial-gradient(circle, rgba(255, 122, 51, .42), transparent 68%); animation: fxDrift1 24s ease-in-out infinite alternate; }
.fx-aura i:nth-child(2) { width: 520px; height: 520px; right: 22%; top: 120px; background: radial-gradient(circle, rgba(255, 190, 70, .30), transparent 68%); animation: fxDrift2 30s ease-in-out infinite alternate; }
.fx-aura i:nth-child(3) { width: 420px; height: 420px; left: -120px; top: -150px; background: radial-gradient(circle, rgba(175, 251, 5, .20), transparent 68%); animation: fxDrift3 27s ease-in-out infinite alternate; }
@keyframes fxDrift1 { to { transform: translate(-120px, 90px) scale(1.12); } }
@keyframes fxDrift2 { to { transform: translate(140px, -60px) scale(.9); } }
@keyframes fxDrift3 { to { transform: translate(90px, 60px) scale(1.15); } }

/* ---------- hero ---------- */
.fx-logo { position: relative; display: block; width: fit-content; max-width: 100%; line-height: 0; }
.fx-sheen { position: absolute; inset: 0; pointer-events: none; -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 150, 40, .0) 42%, rgba(255, 120, 30, .95) 50%, rgba(255, 210, 90, .9) 53%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 160% 0; animation: fxSheen 6s var(--ease) 1s infinite; }
.fx-logo:hover .fx-sheen { animation-duration: 2s; animation-delay: 0s; }
@keyframes fxSheen { 0% { background-position: 160% 0; } 30%, 100% { background-position: -60% 0; } }  /* one sweep every 6 s */
:root .tagline em { background: linear-gradient(90deg, #f2421a, #ff7a1a 25%, #ffb020 50%, #ff7a1a 75%, #f2421a); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: fxFlow 7s linear infinite; }
@keyframes fxFlow { to { background-position: -200% 0; } }
:root .byline .authors a { border-bottom: 0; background: var(--grad-deep) 0 100% / 100% 1.5px no-repeat; transition: background-size .3s var(--ease), color .3s; padding-bottom: 1px; }
:root .byline .authors a:hover { background-size: 100% 100%; color: #fff; border-radius: 3px; }
:root .logos img { transition: scale .3s var(--ease), filter .3s; }
:root .logos img:hover { scale: 1.07; }

/* the four link buttons */
:root .links .lk { position: relative; overflow: hidden; background: linear-gradient(180deg, #2a2d33, #15171a); box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 8px 18px -10px rgba(21, 23, 26, .7);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), color .25s, opacity .3s, filter .3s; isolation: isolate; }
:root .links .lk::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--grad); opacity: 0; transition: opacity .3s; }
:root .links .lk:hover { background: linear-gradient(180deg, #2a2d33, #15171a); color: #15171a; transform: translateY(-2px); box-shadow: var(--sh-org); }
:root .links .lk:hover::before { opacity: 1; }
:root .links .lk:active { transform: translateY(0) scale(.98); }

/* the five headline numbers */
:root .tiles > div { background: rgba(255, 255, 255, .82); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-1);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
:root .tiles b { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
:root .tiles > div:hover { transform: translateY(-4px); box-shadow: var(--sh-2); }

/* ---------- section titles ---------- */
:root section h2 .n, :root section h3.sub .n, :root .hl { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root section.sec > h2::after { content: ''; display: block; width: 56px; height: 4px; border-radius: 4px; margin-top: 12px; background: var(--grad); transform-origin: left; transition: transform .9s var(--ease) .15s; }
.fx-js section.sec > h2.fx-r:not(.in)::after { transform: scaleX(0); }
:root .vd-h b { background: linear-gradient(90deg, #15171a 55%, #ff5a1f); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- cards: white, soft shadow, no black outline ---------- */
:root .card, :root .formula, :root .four > div, :root .cards3 a, :root details.cmpbox, :root .bib {
  background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-1); }
:root .card:hover, :root details.cmpbox:hover { box-shadow: var(--sh-2); border-color: rgba(255, 90, 31, .22); }
:root .card .fn { background: rgba(255, 90, 31, .1); padding: 5px 9px; border-radius: 999px; align-self: center; }
:root .formula { background: radial-gradient(120% 140% at 0% 0%, rgba(255, 176, 32, .10), transparent 50%), radial-gradient(120% 140% at 100% 100%, rgba(255, 90, 31, .08), transparent 50%), #fff; }
:root .four > div:hover, :root .cards3 a:hover { transform: translateY(-4px); box-shadow: var(--sh-2); background: #fff; color: var(--ink); }
:root .cards3 a:hover p { color: var(--ink); }
:root .cards3 em { transition: letter-spacing .3s var(--ease); }
:root .cards3 a:hover em { letter-spacing: .02em; }
:root .four.oss a:hover { background: #fff; color: var(--ink); }

/* TL;DR as a card with a gradient edge */
:root #tldr .tldr { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px 26px 20px 32px; box-shadow: var(--sh-1); color: #4a4d52; }
:root #tldr .tldr::before { content: ''; position: absolute; left: 12px; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, #ff4f2b, #ffbe3b); }

/* ---------- section 1: the pipeline ---------- */
:root .pnode.p1, :root .pnode.p2, :root .pnode.p3 { background: linear-gradient(160deg, #2a2e35 0%, #16181c 70%); box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 14px 28px -16px rgba(21, 23, 26, .7); }
:root .pnode.p1:hover, :root .pnode.p2:hover, :root .pnode.p3:hover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 20px 36px -16px rgba(255, 90, 31, .55); }
:root .pnode.pin { border: 1px solid var(--line); background: #fff; box-shadow: var(--sh-1); }
:root .pnode.pout { border: 2px solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--grad) border-box; }
:root .pnode strong.ptot, :root .pnode em.px { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root .pnode.p1 em.px, :root .pnode.p2 em.px, :root .pnode.p3 em.px { background: linear-gradient(90deg, #ff7a33, #ffc24d); -webkit-background-clip: text; background-clip: text; }
:root .pipe > i { display: inline-block; }
.fx-js .pipe > i.in { animation: fxNudge 2.4s ease-in-out infinite; animation-delay: calc(var(--d, 0s) + 1s); }
@keyframes fxNudge { 0%, 60%, 100% { transform: none; opacity: 1; } 30% { transform: translateX(5px); opacity: .55; } }
.fx-js .pnode.pout.in { animation: fxGlow 3.2s ease-in-out 1.4s infinite; }
@keyframes fxGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0), var(--sh-1); } 50% { box-shadow: 0 0 0 6px rgba(255, 90, 31, .10), 0 18px 36px -14px rgba(255, 90, 31, .45); } }

/* ---------- buttons, toggles, details ---------- */
:root .codebtn { border: 1px solid rgba(21, 23, 26, .2); background: #fff; box-shadow: var(--sh-1); transition: background .25s, color .25s, box-shadow .25s, transform .25s var(--ease); }
:root .codebtn i { display: inline-block; transition: transform .25s var(--ease); }
:root .codebtn:hover { background: #15171a; color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(21, 23, 26, .6); }
:root .codebtn:hover i { transform: translateX(3px); color: #ffb020; }
:root .seg { background: #f1f0ec; }
:root .seg button, :root .cmp-tog button { transition: color .25s, background-color .25s; }
.fx-pill { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 999px; background: #15171a; box-shadow: 0 6px 14px -6px rgba(21, 23, 26, .55);
  transition: transform .38s var(--ease), width .38s var(--ease), height .38s var(--ease); pointer-events: none; }
.fx-slide > button { position: relative; z-index: 1; }
:root .fx-slide > button.on { background: transparent; }
:root details.secd > summary { transition: color .2s; }
:root details.secd > summary:hover { color: #ff5a1f; }
:root details.secd[open] > .secd-body { animation: fxDrop .4s var(--ease); }
@keyframes fxDrop { from { opacity: 0; transform: translateY(-6px); } }
:root .bib .copy { transition: background .25s, transform .2s; }
:root .bib .copy:hover { background: var(--grad-deep); }
:root .appx a, :root .refs a { transition: color .2s; }
:root .refs a:hover { color: #ff5a1f; }

/* ---------- video demo boxes ---------- */
:root details.cmpbox[open] > summary > em { background: var(--grad); }
:root details.cmpbox > summary > em { transition: background .3s; }
:root .cmp-ours { background: var(--grad-deep); border-color: transparent; box-shadow: var(--sh-org); }
:root .cmp-tog { border-width: 1.5px; }
:root .cmp-reset { border-width: 1.5px; transition: background .2s, color .2s; }
:root .pc { transition: box-shadow .3s var(--ease); }
:root .pc-speed button.on { background: var(--grad); }
:root .p-tps { box-shadow: 0 6px 14px -8px rgba(255, 90, 31, .8); }

/* ---------- cursor spotlight: a glow and a lit edge follow the pointer over a card (theme.js sets --mx / --my) ---------- */
.fx-spot { position: relative; isolation: isolate; }
.fx-spot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 130, 40, .11), transparent 55%); }
.fx-spot::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 96, 31, .95), rgba(255, 176, 32, .55) 40%, transparent 72%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.fx-spot:hover::after, .fx-spot:hover::before { opacity: 1; }
.fx-spot:hover { z-index: 4; }  /* a chart tooltip near the card's edge stays above the next card */
.pnode.fx-spot::after { background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 130, 40, .28), transparent 60%); }

/* ---------- reveal on scroll (theme.js adds .fx-r, then .in once the element is in view) ---------- */
.fx-js .fx-r { opacity: 0; translate: 0 22px;
  transition: opacity .55s var(--ease) var(--d, 0s), translate .55s var(--ease) var(--d, 0s), transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s, background-color .3s, color .3s, filter .3s; }
.fx-js .fx-r.in { opacity: 1; translate: none; }
/* the hero comes in on load */
.fx-js h1.brand, .fx-js .tagline, .fx-js .byline, .fx-js .links { animation: fxUp .9s var(--ease) both; }
.fx-js .tagline { animation-delay: .08s; } .fx-js .byline { animation-delay: .16s; } .fx-js .links { animation-delay: .24s; }
@keyframes fxUp { from { opacity: 0; translate: 0 18px; } }

/* ---------- progress bar and back-to-top ---------- */
.fx-progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 50; transform-origin: 0 50%; transform: scaleX(0); background: var(--grad); pointer-events: none; }
.fx-top { position: fixed; right: 22px; bottom: 22px; z-index: 50; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, #2a2d33, #15171a); box-shadow: 0 12px 24px -12px rgba(21, 23, 26, .7); display: grid; place-items: center;
  opacity: 0; translate: 0 12px; pointer-events: none; transition: opacity .3s, translate .3s var(--ease), background .3s, color .3s; }
.fx-top.on { opacity: 1; translate: none; pointer-events: auto; }
.fx-top:hover { background: var(--grad); color: #15171a; }

/* ---------- charts: growth, plotting and hover focus (marks tagged in charts.js) ---------- */
:root .tip { background: rgba(21, 23, 26, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px; box-shadow: 0 14px 30px -12px rgba(21, 23, 26, .55); padding: 9px 12px; }
.fx-js .chart .bx { transform-box: fill-box; transform-origin: 0 50%; animation: fxGrowX var(--dur, .6s) var(--ease) var(--t0, 0s) backwards paused; }
.fx-js .chart .by { transform-box: fill-box; transform-origin: 50% 100%; animation: fxGrowY var(--dur, .6s) var(--ease) var(--t0, 0s) backwards paused; }
.fx-js .chart .race { animation-timing-function: linear; }
.fx-js .chart .fxslide { animation: fxSlide .6s var(--ease) var(--t0, 0s) backwards paused; }
.fx-js .chart .fxpop { transform-box: fill-box; transform-origin: center; animation: fxPop .5s cubic-bezier(.3, 1.6, .5, 1) var(--t0, 0s) backwards paused; }
.fx-js .chart .fxdraw { stroke-dasharray: calc(var(--len) + 6px) 100000px; animation: fxDraw .6s var(--ease) var(--t0, 0s) backwards paused; }
.fx-js .chart :is(.fxv, .fxfade) { animation: fxFade var(--dur, .35s) ease var(--t0, .5s) backwards paused; }
.fx-js .chart text.val:not(.fxv) { animation: fxFade .35s ease var(--t0, .5s) backwards paused; }
:root.fx-js .chart.in :is(.bx, .by, .fxslide, .fxpop, .fxdraw, .fxv, .fxfade, text.val) { animation-play-state: running; }  /* outranks every paused rule above */
@keyframes fxGrowX { from { transform: scaleX(0); } }
@keyframes fxGrowY { from { transform: scaleY(0); } }
@keyframes fxSlide { from { transform: translateX(var(--dx, 0)); } }
@keyframes fxPop { from { transform: scale(0); opacity: 0; } }
@keyframes fxDraw { from { stroke-dashoffset: calc(var(--len) + 6px); } }
@keyframes fxFade { from { opacity: 0; } }
:root .chart svg .mk { transition: opacity .18s ease, filter .18s; }
:root .chart svg.hov .mk:not(.hot) { opacity: .3; }
:root .chart svg .mk.hot { filter: brightness(1.06) saturate(1.1); }
:root .chart circle { transform-box: fill-box; transform-origin: center; transition: scale .2s var(--ease); }
:root .chart circle:hover { scale: 1.35; }

/* ---------- phones and reduced motion ---------- */
@media (max-width: 760px) {
  .fx-aura i { filter: blur(44px); } .fx-aura i:nth-child(1) { width: 420px; height: 420px; } .fx-aura i:nth-child(2) { display: none; }
  .fx-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
}
@media (hover: none) { .fx-spot::before, .fx-spot::after { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .fx-aura i, .fx-sheen, :root .tagline em, .fx-js .pipe > i.in, .fx-js .pnode.pout.in { animation: none !important; }
  .fx-js h1.brand, .fx-js .tagline, .fx-js .byline, .fx-js .links { animation: none; }
  .fx-js .fx-r { opacity: 1; translate: none; transition: none; }
  .fx-js .chart * { animation: none !important; }
  .fx-js section.sec > h2.fx-r:not(.in)::after { transform: none; }
}
@media print { .fx-aura, .fx-progress, .fx-top, .fx-sheen { display: none !important; } .fx-js .fx-r { opacity: 1; translate: none; } }

/* ---------- which way is better: a badge in every figure's title row (user 12-04: higher-is-better and lower-is-better
   figures were easy to mix up); green up = higher is better, blue down = lower is better ---------- */
:root .card figcaption { flex-wrap: wrap; row-gap: 6px; }
.dir { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: auto; align-self: center; white-space: nowrap;
  font: 700 12.5px/1 'JetBrains Mono', monospace; letter-spacing: 0; padding: 6px 11px; border-radius: 999px; }
.dir.up { color: #15803d; background: #e6f6ec; box-shadow: inset 0 0 0 1px rgba(21, 128, 61, .18); }
.dir.dn { color: #1d4ed8; background: #e8eefd; box-shadow: inset 0 0 0 1px rgba(29, 78, 216, .18); }
.ft .dir { margin-left: 10px; vertical-align: 2px; }
/* chart text a step darker for readability */
:root .chart .ax { fill: #585d64; }
:root .chart .lab { fill: #15171a; }

/* ---------- from the /v2/ preview (fx.css): the card under the cursor stays, its neighbours step back; pill buttons get
   a light sweep on hover ---------- */
@media (hover: hover) and (pointer: fine) {
  :root .tiles:has(> div:hover) > div:not(:hover), :root .four:has(> div:hover) > div:not(:hover), :root .cards3:has(> a:hover) > a:not(:hover),
  :root .pipe:has(> .pnode:hover) > .pnode:not(:hover), :root .links:has(> .lk:hover) > .lk:not(:hover) { opacity: .5; filter: saturate(.5); }
}
:root .codebtn { position: relative; overflow: hidden; }
:root .links .lk::after, :root .codebtn::after { content: ''; position: absolute; inset: 0; pointer-events: none; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); }
:root .links .lk:hover::after, :root .codebtn:hover::after { transform: translateX(120%); transition: transform .7s var(--ease); }

/* a figure's one-line takeaway, under its title (user 12-04: Fig. 9 needed a short insight) */
:root .card .insight { margin: 2px 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 15px !important; line-height: 1.55 !important; color: #3a3d42;
  background: linear-gradient(90deg, rgba(255, 90, 31, .08), rgba(255, 176, 32, .04)); border-left: 3px solid #ff5a1f; }
:root .card .insight b { color: #15171a; }

/* chart bars (charts.js paint): ours lifted by a soft orange shadow */
:root .chart svg rect.p-ours { filter: drop-shadow(0 2px 5px rgba(255, 90, 31, .32)); }
:root .chart svg .mk.hot.p-ours { filter: brightness(1.06) saturate(1.1) drop-shadow(0 3px 8px rgba(255, 90, 31, .45)); }
