/* ============================================================
   The Genetics of Unicorns — storybook-science aesthetic
   Cream paper, aubergine ink, rainbow-horn accents, grain.
   ============================================================ */

:root {
  --paper:        #fbf3e9;
  --paper-2:      #f4e7d6;
  --ink:          #2c1b3d;
  --ink-soft:     #5b4a67;
  --line:         #e2d2be;

  --a:            #e8629b;   /* recessive a / rose      */
  --A:            #6f7be6;   /* dominant  A / periwinkle */
  --b:            #f0a63a;   /* b / marigold             */
  --B:            #34b79a;   /* B / mint-teal            */

  --rainbow: linear-gradient(100deg,#e8629b 0%,#f0a63a 25%,#ffd84d 42%,#34b79a 62%,#6f7be6 82%,#a86ce0 100%);

  --geno:  #f0a63a;
  --env:   #6f7be6;
  --int:   #e8629b;

  --shadow: 0 18px 44px -20px rgba(44,27,61,.42);
  --radius: 18px;

  --serif:   "Newsreader", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
  --mono:    "Space Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.72;
  color: var(--ink);
  background:
    radial-gradient(1200px 640px at 78% -8%, rgba(168,108,224,.20), transparent 60%),
    radial-gradient(900px 560px at 8% 6%, rgba(52,183,154,.16), transparent 60%),
    radial-gradient(1000px 700px at 50% 118%, rgba(232,98,155,.16), transparent 62%),
    var(--paper);
  overflow-x: hidden;
}

/* ---- texture overlays ---- */
.grain {
  position: fixed; inset: 0; z-index: 9; pointer-events: none;
  opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sparkles {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(255,216,77,.9), transparent),
    radial-gradient(2px 2px at 82% 14%, rgba(168,108,224,.85), transparent),
    radial-gradient(1.5px 1.5px at 68% 62%, rgba(52,183,154,.8), transparent),
    radial-gradient(1.5px 1.5px at 26% 78%, rgba(232,98,155,.85), transparent),
    radial-gradient(2px 2px at 46% 34%, rgba(255,216,77,.7), transparent);
  opacity: .5;
}

/* ============================== HERO ============================== */
.hero {
  position: relative; z-index: 2;
  min-height: 92vh;
  display: grid; place-items: center;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}
.hero-inner { max-width: 760px; }

.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .34em;
  font-size: .72rem;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
}

.title {
  font-family: var(--display);
  font-weight: 800;
  font-optical-sizing: auto;
  font-size: clamp(3.4rem, 12vw, 8rem);
  line-height: .92;
  letter-spacing: -.02em;
  margin: 0;
  background: var(--rainbow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise .9s cubic-bezier(.2,.7,.2,1) both;
}
.title .of {
  font-style: italic;
  font-weight: 400;
  font-size: .5em;
  -webkit-text-fill-color: var(--ink-soft);
  background: none;
}

.dek {
  font-size: clamp(1.1rem, 2.3vw, 1.45rem);
  color: var(--ink-soft);
  max-width: 40ch;
  margin: 1.8rem auto 0;
  animation: rise .9s .12s cubic-bezier(.2,.7,.2,1) both;
}

.horn {
  width: 26px; height: 120px;
  margin: 2.6rem auto 1.2rem;
  background: var(--rainbow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 8px 18px rgba(232,98,155,.4));
  animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both, sway 5s ease-in-out 1s infinite;
  transform-origin: bottom center;
}

.scroll-cue {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes rise  { from { opacity: 0; transform: translateY(26px); } }
@keyframes sway  { 50% { transform: rotate(-4deg); } }
@keyframes pulse { 50% { opacity: .35; } }

/* ============================== HOME / ESSAY INDEX ============================== */
.home-hero {
  position: relative; z-index: 2;
  text-align: center;
  padding: 6rem 1.5rem 2rem;
}
.home-title {
  font-family: var(--display);
  font-weight: 800;
  font-optical-sizing: auto;
  font-size: clamp(3rem, 11vw, 6.4rem);
  line-height: .95;
  letter-spacing: -.02em;
  margin: .4rem 0 0;
  background: var(--rainbow);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise .9s cubic-bezier(.2,.7,.2,1) both;
}
.home-dek {
  max-width: 44ch;
  margin: 1.6rem auto 0;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2.1vw, 1.32rem);
  animation: rise .9s .12s cubic-bezier(.2,.7,.2,1) both;
}

.home-main {
  position: relative; z-index: 2;
  max-width: 920px;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 4rem;
}
.home-section + .home-section {
  margin-top: 3.2rem;
}
.home-section-title {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
}
.music-hero {
  padding-top: 3.5rem;
  padding-bottom: 1rem;
}
.essay-list {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.6rem;
}
.essay-card a {
  display: block; height: 100%;
  text-decoration: none; color: inherit;
  background: rgba(255,255,255,.62);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.9rem;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  backdrop-filter: blur(3px);
}
.essay-card a::before {
  content: ""; position: absolute; left: 0; top: 0;
  height: 5px; width: 100%;
  background: var(--rainbow);
  transform: scaleX(0); transform-origin: left;
  transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.essay-card a:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 52px -22px rgba(44,27,61,.5);
  border-color: transparent;
}
.essay-card a:hover::before { transform: scaleX(1); }
.essay-emoji { font-size: 2.5rem; display: block; line-height: 1; }
.essay-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.62rem;
  line-height: 1.1;
  margin: .85rem 0 .5rem;
}
.essay-dek { color: var(--ink-soft); font-size: 1rem; line-height: 1.55; margin: 0 0 1.3rem; }
.essay-go { font-family: var(--mono); font-size: .82rem; font-weight: 700; color: var(--A); }

.topic-nav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .6rem;
  max-width: 920px;
  margin: 2.2rem auto 0;
  animation: rise .9s .18s cubic-bezier(.2,.7,.2,1) both;
}
.topic-nav[hidden] { display: none; }
.topic-pill {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-soft);
  background: rgba(255,255,255,.62);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .45rem 1rem;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}
.topic-pill:hover { transform: translateY(-2px); border-color: var(--A); color: var(--A); }
.topic-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================== PROSE ============================== */
main { position: relative; z-index: 2; }

.prose {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem;
}
.prose p { margin: 0 0 1.25rem; }

.lead { font-size: 1.34rem; line-height: 1.6; }
.dropcap {
  font-family: var(--display);
  font-weight: 800;
  font-size: 3.4rem;
  line-height: .7;
  float: left;
  margin: .32rem .1rem -.2rem 0;
  color: var(--a);
}

.prose h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  margin: 3.4rem 0 1.4rem;
  position: relative;
}
.sec-no {
  display: block;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .3em;
  color: var(--a);
  margin-bottom: .5rem;
}

.prose a {
  color: var(--A);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(111,123,230,.4);
}
.prose a:hover { text-decoration-color: var(--A); }

strong { font-weight: 600; }
.kicker {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--ink);
}

/* allele glyphs */
.allele-a,.allele-A,.allele-b,.allele-B {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  padding: 0 .08em;
  border-radius: 4px;
  /* keep allele case meaningful inside uppercase-transformed labels */
  text-transform: none;
}
.allele-a { color: var(--a); }
.allele-A { color: var(--A); }
.allele-b { color: var(--b); }
.allele-B { color: var(--B); }

.chip {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .9em;
  padding: .04em .34em;
  border-radius: 6px;
  border: 1.5px solid;
}
.chip-q { color: var(--a); border-color: rgba(232,98,155,.4); background: rgba(232,98,155,.08); }
.chip-p { color: var(--A); border-color: rgba(111,123,230,.4); background: rgba(111,123,230,.08); }

.note {
  border-left: 4px solid;
  border-image: var(--rainbow) 1;
  background: rgba(255,255,255,.5);
  padding: .3rem 1.3rem;
  margin: 2rem 0;
  border-radius: 0 10px 10px 0;
}
.note p { font-size: 1.06rem; color: var(--ink-soft); margin: 1rem 0; }

/* ============================== WIDGETS ============================== */
.widget {
  margin: 2.6rem 0;
  padding: 1.8rem;
  background: rgba(255,255,255,.62);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
}

/* -- allele slider widget -- */
.widget-head {
  display: flex; flex-wrap: wrap; gap: 1.6rem;
  align-items: center; justify-content: space-between;
}
.slider-block { flex: 1 1 260px; }
.slider-block label {
  display: block;
  font-family: var(--mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-bottom: .9rem;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--A), var(--a));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff;
  border: 3px solid var(--a);
  box-shadow: 0 4px 12px rgba(44,27,61,.3);
  cursor: grab;
  transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 3px solid var(--a);
  box-shadow: 0 4px 12px rgba(44,27,61,.3); cursor: grab;
}
.slider-vals {
  display: flex; gap: 1.4rem;
  margin-top: .8rem;
  font-family: var(--mono);
  font-size: .92rem;
}
.slider-vals output { font-weight: 700; }

.unicorn-readout { text-align: center; flex: 0 0 auto; }
.big-pct {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3rem, 9vw, 4.6rem);
  line-height: 1;
  background: var(--rainbow);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pct-sign { font-size: .5em; }
.big-label { font-size: .92rem; color: var(--ink-soft); max-width: 16ch; margin: .3rem auto 0; }

.hw-bar {
  display: flex;
  height: 56px;
  margin: 1.8rem 0 .8rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--line);
}
.hw-seg {
  display: grid; place-items: center;
  transition: width .18s ease;
  overflow: hidden;
  min-width: 0;
}
.seg-AA { background: repeating-linear-gradient(45deg, var(--A), var(--A) 8px, #7d88ea 8px, #7d88ea 16px); }
.seg-Aa { background: repeating-linear-gradient(45deg, #b07be0, #b07be0 8px, #bd8be8 8px, #bd8be8 16px); }
.seg-aa { background: var(--rainbow); }
.seg-lab {
  font-family: var(--mono); font-weight: 700; font-size: .82rem;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35);
  white-space: nowrap;
}

.hw-legend {
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
  font-size: .88rem; color: var(--ink-soft);
}
.hw-legend b { color: var(--ink); font-family: var(--mono); }
.sw { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: -1px; margin-right: .3rem; }
.sw-AA { background: var(--A); }
.sw-Aa { background: #b07be0; }
.sw-aa { background: var(--a); }

.effects {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 1.6rem;
}
.effect {
  text-align: center;
  padding: 1.1rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: rgba(255,255,255,.5);
}
.effect-lab { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-bottom: .3rem; }
.effect-num { font-family: var(--display); font-weight: 800; font-size: 2.1rem; line-height: 1; }
.effect-a .effect-num { color: var(--a); }
.effect-A .effect-num { color: var(--A); }

.widget-cap {
  margin-top: 1.4rem;
  font-size: .92rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

/* -- ANOVA widget -- */
.preset-row {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1.4rem;
}
.preset-lab { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); margin-right: .3rem; }
.preset {
  font-family: var(--mono); font-size: .82rem;
  padding: .45rem .8rem;
  border: 1.5px solid var(--line);
  background: rgba(255,255,255,.6);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.preset:hover { border-color: var(--A); }
.preset[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.anova-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  margin-bottom: 1.8rem;
}
.anova-table th, .anova-table td {
  padding: .55rem .5rem;
  text-align: center;
  border: 1px solid var(--line);
}
.anova-table thead th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); font-weight: 700;
  background: rgba(255,255,255,.4);
}
.anova-table tbody th {
  font-size: 1.05rem;
  background: rgba(255,255,255,.4);
}
.cell {
  width: 68px;
  font-family: var(--mono); font-size: 1rem; font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: rgba(255,255,255,.85);
  border: 1.5px solid var(--line);
  border-radius: 7px;
  padding: .34rem .2rem;
  transition: border-color .12s, box-shadow .12s;
}
.cell:focus {
  outline: none;
  border-color: var(--a);
  box-shadow: 0 0 0 3px rgba(232,98,155,.18);
}
.cell::-webkit-inner-spin-button { opacity: .3; }
.rowmean, .colmean, .grandmean {
  font-weight: 700; color: var(--ink-soft);
  background: rgba(240,166,58,.08);
}
.rowmean-h { color: var(--ink-soft); }
.colmean-row th { color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.grandmean { color: var(--ink); background: rgba(232,98,155,.1); }

.decomp-intro { font-size: 1rem; color: var(--ink-soft); margin: 0 0 1.1rem; }
.decomp { display: grid; gap: .9rem; }
.decomp-row { display: grid; grid-template-columns: 108px 1fr 52px; align-items: center; gap: .8rem; }
.decomp-lab { font-family: var(--mono); font-size: .82rem; text-align: right; }
.decomp-track { height: 20px; background: rgba(44,27,61,.07); border-radius: 999px; overflow: hidden; }
.decomp-fill { height: 100%; width: 0; border-radius: 999px; transition: width .35s cubic-bezier(.3,.8,.3,1); }
.fill-geno { background: var(--geno); }
.fill-env  { background: var(--env); }
.fill-int  { background: var(--int); }
.decomp-val { font-family: var(--mono); font-weight: 700; font-size: .92rem; text-align: right; }

.warn {
  display: block;
  margin-top: .6rem;
  font-style: normal;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--int);
}
.warn.hide { display: none; }

.ledger {
  list-style: none; padding: 0; margin: 1.6rem 0;
  border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
  font-family: var(--mono); font-size: 1rem;
}
.ledger li {
  display: flex; justify-content: space-between;
  padding: .7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.4);
}
.ledger li span { color: var(--ink-soft); }
.ledger-total { background: rgba(232,98,155,.1); font-weight: 700; border-bottom: none; }
.ledger-total span, .ledger-total b { color: var(--ink); }

/* ============================== FOOTER ============================== */
.site-foot {
  position: relative; z-index: 2;
  text-align: center;
  padding: 4rem 1.5rem 5rem;
  margin-top: 3rem;
  border-top: 1.5px solid var(--line);
  color: var(--ink-soft);
}
.site-foot p { margin: .4rem 0; }
.foot-meta { font-family: var(--mono); font-size: .84rem; }
.home-foot { margin-top: 1rem; padding-top: 3rem; }
.home-foot a { color: var(--A); }

/* publication date on home-page essay cards */
.essay-date {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-soft);
  opacity: .75;
  margin-bottom: .55rem;
}

/* ============================== SCROLL REVEAL ============================== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease var(--d, 0ms), transform .6s cubic-bezier(.2,.7,.2,1) var(--d, 0ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 560px) {
  body { font-size: 1.08rem; }
  .widget { padding: 1.2rem; }
  .widget-head { flex-direction: column; align-items: stretch; }
  .unicorn-readout { order: -1; }
  .effects { grid-template-columns: 1fr; }
  .cell { width: 56px; }
  .anova-table th, .anova-table td { padding: .4rem .25rem; }
  .decomp-row { grid-template-columns: 78px 1fr 44px; }
  .hw-legend { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto; transition: none !important; }
}

/* ============================================================
   ANCESTRY PAGE — shared palette, page-specific pieces
   ============================================================ */

/* -- top nav between the two essays -- */
.topnav {
  position: relative; z-index: 3;
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
  align-items: center; justify-content: space-between;
  padding: 1rem clamp(1.5rem, 5vw, 3rem);
  font-family: var(--mono); font-size: .78rem;
  letter-spacing: .04em;
  border-bottom: 1.5px solid var(--line);
  background: rgba(255,255,255,.35);
  backdrop-filter: blur(3px);
}
.topnav a { color: var(--A); text-decoration: none; }
.topnav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.topnav-home { color: var(--ink-soft); }
.topnav-here { color: var(--ink-soft); }

/* -- hero "ancestry pie" motif -- */
.pie {
  width: 118px; height: 118px;
  margin: 2.6rem auto 1.2rem;
  border-radius: 50%;
  background: conic-gradient(
    var(--a) 0 34%, var(--b) 34% 54%, var(--B) 54% 71%,
    var(--A) 71% 83%, #a86ce0 83% 92%, #ffd84d 92% 100%);
  box-shadow: var(--shadow), inset 0 0 0 6px rgba(255,255,255,.6);
  position: relative;
  animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both, spin 26s linear 1s infinite;
}
.pie::after {
  content: ""; position: absolute; inset: 34%;
  border-radius: 50%; background: var(--paper);
  box-shadow: inset 0 2px 6px rgba(44,27,61,.18);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- chromosome-painting illustration -- */
.paint { margin: 2.2rem 0; }
.chr {
  display: flex; height: 48px;
  border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
}
.chr-seg {
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .68rem; font-weight: 700;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  white-space: nowrap; overflow: hidden; min-width: 0;
  padding: 0 .2rem;
}
.chr-seg.amb {
  color: var(--ink-soft); text-shadow: none;
  background:
    repeating-linear-gradient(45deg, rgba(44,27,61,.12), rgba(44,27,61,.12) 6px, rgba(44,27,61,.02) 6px, rgba(44,27,61,.02) 12px);
}

/* -- widget 1: same-DNA verdict switcher -- */
.verdict-spotlight {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; text-align: left;
  margin: .4rem 0 1.6rem;
}
.spot-num {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(3rem, 10vw, 4.8rem); line-height: 1;
  background: var(--rainbow);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.spot-lab { font-size: 1rem; color: var(--ink-soft); line-height: 1.35; }
.spot-sub { font-family: var(--mono); font-size: .74rem; }

.verdict-list { display: grid; gap: .7rem; }
.vrow {
  display: grid; grid-template-columns: 168px 1fr 48px;
  align-items: center; gap: .8rem;
}
.vlab { font-size: .9rem; color: var(--ink-soft); text-align: right; line-height: 1.2; }
.vtrack { height: 20px; background: rgba(44,27,61,.07); border-radius: 999px; overflow: hidden; }
.vfill { height: 100%; width: 0; border-radius: 999px; transition: width .5s cubic-bezier(.3,.8,.3,1); }
.vval { font-family: var(--mono); font-weight: 700; font-size: .9rem; text-align: right; }
.vrow.is-italian .vlab { color: var(--ink); font-weight: 700; }
.vrow.is-italian .vtrack { box-shadow: 0 0 0 2px rgba(232,98,155,.35); }
.vrow.is-italian .vval { color: var(--a); }

/* -- widget 3: lineage graph -- */
.lineage-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.1rem; }
.lineage-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ln { fill: none; stroke-width: 1.4; transition: stroke .2s; }
.ln-live { stroke: rgba(44,27,61,.30); }
.ln-dead { stroke: rgba(44,27,61,.08); }
.ln-cone { stroke: var(--a); stroke-width: 2.6; }
.lineage-svg.focused .ln-live { stroke: rgba(44,27,61,.12); }
.nd { transition: fill .2s; }
.nd-live { fill: #9384a3; }
.nd-dead { fill: #dccfbe; }
.lineage-svg.focused .nd-live { fill: #c6bacd; }
.nd-cone { fill: var(--a); }
.nd-anc { fill: #ffd84d; stroke: var(--ink); stroke-width: 2; }
.axis-lab { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); letter-spacing: .04em; }

/* -- widget 2: pedigree explosion -- */
.ped-bars { margin: 1.8rem 0 .4rem; display: grid; gap: 1.3rem; }
.ped-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; margin-bottom: .45rem;
}
.ped-head span { font-size: .96rem; color: var(--ink-soft); }
.ped-head em { font-style: italic; color: var(--ink); }
.ped-head b { font-family: var(--mono); font-weight: 700; font-size: 1.02rem; white-space: nowrap; }
.ped-track {
  height: 26px; background: rgba(44,27,61,.07);
  border-radius: 999px; overflow: hidden;
  background-image: repeating-linear-gradient(90deg, transparent, transparent calc(10% - 1px), rgba(44,27,61,.09) 10%);
}
.ped-fill { height: 100%; width: 0; border-radius: 999px; transition: width .4s cubic-bezier(.3,.8,.3,1); }
.fill-slots { background: var(--rainbow); }
.fill-pop { background: var(--A); }
.ped-scale { font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); text-align: center; margin: .2rem 0 0; }
#ped-msg { text-align: left; }
#ped-msg b { color: var(--ink); font-family: var(--mono); font-style: normal; }

/* -- common-ancestor fact cards -- */
.fact-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  margin: 2.2rem 0;
}
.fact-card {
  padding: 1.3rem 1.1rem; border-radius: 14px;
  border: 1.5px solid var(--line); background: rgba(255,255,255,.6);
  box-shadow: var(--shadow);
}
.fact-card p { margin: .6rem 0 0; font-size: .9rem; line-height: 1.4; color: var(--ink-soft); }
.fact-big { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; }
.fact-big span { font-size: .5em; font-weight: 600; color: var(--ink-soft); }
.fact-cite { font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); }
.fc-a .fact-big { color: var(--a); }
.fc-b .fact-big { color: var(--B); }
.fc-c .fact-big { color: var(--A); }

@media (max-width: 620px) {
  .fact-cards { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: 116px 1fr 42px; }
  .vlab { font-size: .82rem; }
  .verdict-spotlight { flex-direction: column; text-align: center; gap: .4rem; }
  .spot-lab { text-align: center; }
}

/* ============================================================
   MONTY HALL PAGE — shared palette, page-specific pieces
   switch = mint-teal (the winner), stay = rose
   ============================================================ */

/* -- hero doors motif -- */
.hero-doors { display: flex; gap: .8rem; justify-content: center; margin: 2.4rem 0 1.4rem; }
.mini-door {
  width: 42px; height: 68px;
  border-radius: 5px 5px 3px 3px;
  background: var(--paper-2);
  border: 2px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255,255,255,.4);
  position: relative;
  animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both;
}
.mini-door::after {
  content: ""; position: absolute; top: 50%; right: 7px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--b); transform: translateY(-50%);
}
.mini-door.ajar {
  background: var(--rainbow);
  border-color: transparent;
  transform: rotate(-3deg) translateY(-3px);
  box-shadow: 0 12px 26px -10px rgba(232,98,155,.55);
}
.mini-door.ajar::after { background: rgba(255,255,255,.85); }

/* -- widget 1: the door game -- */
.game-prompt {
  font-family: var(--display);
  font-size: 1.24rem;
  line-height: 1.35;
  text-align: center;
  min-height: 2.4em;
  margin: 0 0 1.4rem;
}
.doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 460px;
  margin: 0 auto 1.4rem;
}
.door {
  aspect-ratio: 3 / 4;
  border-radius: 8px 8px 5px 5px;
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 0 5px rgba(255,255,255,.4);
  cursor: pointer;
  position: relative;
  display: grid; place-items: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  font-family: var(--display);
}
.door::after {
  content: ""; position: absolute; top: 50%; right: 12%;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--b); transform: translateY(-50%);
  transition: opacity .2s;
}
.door:hover { transform: translateY(-3px); border-color: var(--A); }
.door:disabled { cursor: default; }
.door-num {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  color: var(--ink-soft);
}
.door-prize { font-size: clamp(2rem, 9vw, 3rem); line-height: 1; display: none; }
.door.is-open .door-num { display: none; }
.door.is-open::after { opacity: 0; }
.door.is-open .door-prize { display: block; animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }
.door.is-open { background: rgba(255,255,255,.55); }
.door.has-car { background: var(--rainbow); border-color: transparent; box-shadow: 0 16px 34px -12px rgba(232,98,155,.5); }
.door.is-picked { border-color: var(--A); }
.door.is-switch-target { border-color: var(--B); border-style: dashed; }
.door.is-final { box-shadow: 0 0 0 3px var(--ink), var(--shadow); }

.game-actions {
  display: flex; flex-wrap: wrap; gap: .7rem;
  justify-content: center; min-height: 2.8rem;
  margin-bottom: 1.6rem;
}
.act {
  font-family: var(--mono); font-size: .9rem; font-weight: 700;
  padding: .7rem 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform .12s, background .15s, color .15s;
}
.act:hover { transform: translateY(-2px); }
.act-switch { background: var(--B); color: #fff; border-color: var(--B); }
.act-stay { background: rgba(255,255,255,.6); color: var(--ink); }
.act-again { background: var(--ink); color: var(--paper); }

.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.score {
  text-align: center;
  padding: 1.1rem;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: rgba(255,255,255,.5);
}
.score-strat { display: block; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.score-frac { display: block; font-family: var(--mono); font-size: .84rem; color: var(--ink-soft); margin: .5rem 0 .2rem; }
.score-pct { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1; }
.sc-switch { border-color: rgba(52,183,154,.4); }
.sc-switch .score-pct { color: var(--B); }
.sc-stay { border-color: rgba(232,98,155,.4); }
.sc-stay .score-pct { color: var(--a); }

/* -- section 02: the three worlds -- */
.worlds {
  margin: 2.4rem 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255,255,255,.5);
  box-shadow: var(--shadow);
}
.worlds-head {
  padding: 1rem 1.3rem;
  font-size: .98rem; color: var(--ink-soft);
  border-bottom: 1.5px solid var(--line);
  background: rgba(255,255,255,.4);
}
.worlds-head b { color: var(--ink); }
.world {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .6rem 1rem;
  padding: .9rem 1.3rem;
  border-bottom: 1px solid var(--line);
}
.world-lab { font-family: var(--mono); font-size: .9rem; color: var(--ink-soft); }
.world-lab b { color: var(--ink); }
.world-outcomes { display: flex; gap: .5rem; flex-wrap: wrap; }
.wout {
  font-family: var(--mono); font-size: .82rem; font-weight: 700;
  padding: .32rem .7rem; border-radius: 999px;
}
.wout.win { background: rgba(52,183,154,.16); color: #1f7a68; }
.wout.lose { background: rgba(44,27,61,.06); color: var(--ink-soft); }
.worlds-tally {
  padding: 1rem 1.3rem;
  font-family: var(--display); font-size: 1.1rem;
  background: rgba(52,183,154,.08);
}
.worlds-tally b { color: var(--B); }
.worlds-tally b:last-of-type { color: var(--a); }

/* -- widget 2: simulator -- */
.sim-controls { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.6rem; }
.btn-run {
  font-family: var(--mono); font-size: .9rem; font-weight: 700;
  background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 999px;
  padding: .7rem 1.5rem; cursor: pointer;
  transition: transform .12s, background .15s;
}
.btn-run:hover { transform: translateY(-2px); background: var(--B); border-color: var(--B); }
.sim-readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.6rem; }
.sim-col {
  text-align: center; padding: 1.1rem;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.5);
}
.sim-lab { display: block; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.sim-big { font-family: var(--display); font-weight: 900; font-size: clamp(2.4rem, 8vw, 3.4rem); line-height: 1.05; margin: .3rem 0 .1rem; }
.col-switch { border-color: rgba(52,183,154,.4); }
.col-switch .sim-big { color: var(--B); }
.col-stay { border-color: rgba(232,98,155,.4); }
.col-stay .sim-big { color: var(--a); }
.sim-sub { font-family: var(--mono); font-size: .76rem; color: var(--ink-soft); }
#sim-chart { width: 100%; height: auto; display: block; overflow: visible; }
.sim-axis { stroke: var(--line); stroke-width: 1.5; }
.sim-ref { stroke-width: 1.5; stroke-dasharray: 4 4; }
.sim-ref.ref-switch { stroke: rgba(52,183,154,.6); }
.sim-ref.ref-stay { stroke: rgba(232,98,155,.6); }
.sim-ref-lab { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); }
.sim-line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.line-switch { stroke: var(--B); }
.line-stay { stroke: var(--a); }

/* -- widget 3: N doors -- */
.nd-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.8rem 0 .4rem; }
.nd-strat {
  text-align: center; padding: 1.1rem;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.5);
}
.nd-strat-lab { display: block; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-bottom: .4rem; }
.nd-strat b { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1; }
.nd-switch { border-color: rgba(52,183,154,.4); }
.nd-switch b { color: var(--B); }
.nd-stay { border-color: rgba(232,98,155,.4); }
.nd-stay b { color: var(--a); }

@media (max-width: 560px) {
  .scoreboard, .sim-readouts, .nd-readout, .sim-controls { }
  .world { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   CONFIDENCE INTERVALS PAGE — shared palette, page pieces
   cover / normal = periwinkle (--A); miss = rose (--a);
   bars = mint-teal (--B); true mean = marigold (--b)
   ============================================================ */

/* -- hero motif: a little interval catching a mark -- */
.ci-hero {
  position: relative;
  width: 220px; height: 60px;
  margin: 2.6rem auto 1.2rem;
  animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both;
}
.ci-hero::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 3px;
  transform: translateY(-50%);
  background: var(--A);
  border-radius: 2px;
}
.ci-hero::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 16px; height: 16px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--b);
  box-shadow: 0 0 0 5px rgba(240,166,58,.25), var(--shadow);
}

/* -- shared chart canvas -- */
.stat-svg { width: 100%; height: auto; display: block; overflow: visible; margin: .4rem 0 1rem; }
.stat-axis { stroke: var(--line); stroke-width: 1.5; }
.stat-tick { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); }
.mu-line { stroke: var(--b); stroke-width: 2; stroke-dasharray: 4 4; }

/* -- widget 1: sampling distribution -- */
.pop-curve { fill: none; stroke: rgba(44,27,61,.28); stroke-width: 1.6; stroke-dasharray: 3 3; }
.hbar { fill: var(--B); opacity: .72; }
.theory-curve { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }

.stat-controls { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: .4rem; }

/* -- widget 2: the CI dance -- */
.ci-mu { stroke: var(--b); stroke-width: 2; }
.ci { stroke-width: 2.2; stroke-linecap: round; }
.ci-cover { stroke: var(--A); }
.ci-miss { stroke: var(--a); }
.ci-dot { stroke: none; }
circle.ci-cover { fill: var(--A); }
circle.ci-miss { fill: var(--a); }

.stat-readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.4rem 0; }
.stat-box {
  text-align: center; padding: 1.1rem;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.5);
}
.stat-lab { display: block; font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); line-height: 1.3; }
.stat-big { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; margin: .3rem 0 .1rem; }
.stat-sub { font-family: var(--mono); font-size: .74rem; color: var(--ink-soft); }
.box-cover { border-color: rgba(111,123,230,.4); }
.box-cover .stat-big { color: var(--A); }
.box-target { border-color: rgba(240,166,58,.45); }
.box-target .stat-big { color: var(--b); }

/* -- widget 3: t vs normal -- */
.t-normal { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 5 4; }
.t-curve { fill: none; stroke: var(--A); stroke-width: 2.6; stroke-linejoin: round; }
.t-crit-line { stroke: var(--A); stroke-width: 1.4; stroke-dasharray: 2 3; }
.t-ref-line { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 3; opacity: .5; }

@media (max-width: 560px) {
  .stat-readouts { grid-template-columns: 1fr; }
}

/* ============================================================
   ANOVA PAGE — "Signal or Noise?"
   signal / between = teal (--B); noise / within = grey;
   groups = rose / teal / periwinkle
   ============================================================ */

/* -- hero motif: three little scattered columns -- */
.anova-hero { display: flex; gap: 1.4rem; justify-content: center; align-items: flex-end; height: 96px; margin: 2.6rem auto 1.2rem; animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both; }
.ah-col { position: relative; width: 30px; height: 100%; }
.ah-col i { position: absolute; left: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translateX(-50%); }
.ah-col:nth-child(1) i { background: var(--a); }
.ah-col:nth-child(2) i { background: var(--B); }
.ah-col:nth-child(3) i { background: var(--A); }
.ah-col:nth-child(1) i:nth-child(1){top:52%}.ah-col:nth-child(1) i:nth-child(2){top:66%}.ah-col:nth-child(1) i:nth-child(3){top:78%}.ah-col:nth-child(1) i:nth-child(4){top:60%}
.ah-col:nth-child(2) i:nth-child(1){top:30%}.ah-col:nth-child(2) i:nth-child(2){top:44%}.ah-col:nth-child(2) i:nth-child(3){top:38%}.ah-col:nth-child(2) i:nth-child(4){top:52%}
.ah-col:nth-child(3) i:nth-child(1){top:8%}.ah-col:nth-child(3) i:nth-child(2){top:22%}.ah-col:nth-child(3) i:nth-child(3){top:16%}.ah-col:nth-child(3) i:nth-child(4){top:30%}

/* -- widget 1: pairwise-test grid -- */
.mc-cell { transition: fill .15s; }
.mc-ok { fill: rgba(44,27,61,.09); }
.mc-fp { fill: var(--a); }
.box-miss { border-color: rgba(232,98,155,.4); }
.box-miss .stat-big { color: var(--a); }

/* -- widget 2: signal vs noise sandbox -- */
.grand-line { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 5 4; }
.av-dot { opacity: .8; }
.av-mean { stroke-width: 3.5; stroke-linecap: round; }

.ms-bars { margin: 1.6rem 0 .6rem; display: grid; gap: 1rem; }
.ms-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .4rem; }
.ms-head span { font-size: .96rem; color: var(--ink-soft); }
.ms-head em { font-style: italic; color: var(--ink); }
.ms-head b { font-family: var(--mono); font-weight: 700; font-size: 1rem; }
.ms-track { height: 22px; background: rgba(44,27,61,.07); border-radius: 999px; overflow: hidden; }
.ms-fill { height: 100%; width: 0; border-radius: 999px; transition: width .25s cubic-bezier(.3,.8,.3,1); }
.fill-signal { background: var(--B); }
.fill-noise { background: #b9ac97; }

.f-readout { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1.5px solid var(--line); }
.f-spot { display: flex; align-items: baseline; gap: .7rem; }
.f-lab { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.f-num { font-family: var(--display); font-weight: 900; font-size: clamp(2.4rem, 8vw, 3.4rem); line-height: 1;
  background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.f-verdict { font-family: var(--mono); font-size: .86rem; padding: .4rem .9rem; border-radius: 999px; }
.verdict-signal { background: rgba(52,183,154,.16); color: #1f7a68; }
.verdict-noise { background: rgba(44,27,61,.06); color: var(--ink-soft); }

/* -- widget 3: F-distribution -- */
.fd-curve { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.fd-tail { fill: rgba(232,98,155,.28); stroke: none; }
.fd-crit { stroke: var(--a); stroke-width: 1.8; stroke-dasharray: 3 3; }
.fd-crit-lab { font-family: var(--mono); font-size: 12px; font-weight: 700; fill: var(--a); }

@media (max-width: 560px) {
  .anova-hero { gap: 1rem; }
}

/* ============================================================
   DRAWN BY CIRCLES (FOURIER) PAGE
   epicycles + code blocks; rose pen, periwinkle vectors,
   mint-teal leading trace
   ============================================================ */

/* -- hero motif: nested spinning rings with a pen -- */
.fourier-hero { position: relative; width: 150px; height: 150px; margin: 2.6rem auto 1.2rem; animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both; }
.fh-ring { position: absolute; border-radius: 50%; border: 1.5px dashed; top: 50%; left: 50%; }
.fh-r1 { width: 150px; height: 150px; margin: -75px 0 0 -75px; border-color: rgba(111,123,230,.5); animation: fh-spin 9s linear infinite; }
.fh-r2 { width: 84px; height: 84px; margin: -42px 0 0 -8px; border-color: rgba(232,98,155,.55); animation: fh-spin 4s linear infinite; }
.fh-r3 { width: 40px; height: 40px; margin: -20px 0 0 20px; border-color: rgba(52,183,154,.6); animation: fh-spin 1.6s linear infinite; }
.fh-pen { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--a); top: 50%; left: 50%; margin: -4.5px 0 0 34px; box-shadow: 0 0 0 4px rgba(232,98,155,.18); animation: fh-spin 1.6s linear infinite; transform-origin: -14px 4.5px; }
@keyframes fh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .fh-r1, .fh-r2, .fh-r3, .fh-pen { animation: none; }
}

/* -- widget 1: square wave from harmonics -- */
.sq-target { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; stroke-dasharray: 4 4; opacity: .35; stroke-linejoin: round; }
.sq-sum { fill: none; stroke: var(--A); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }

/* -- widget 2: epicycle canvas -- */
.epi-canvas { width: 100%; height: auto; display: block; margin: .4rem 0 1rem;
  background: rgba(255,255,255,.35); border: 1.5px solid var(--line); border-radius: 12px; }

/* -- shared: Python code blocks -- */
.codeblock { position: relative; font-family: var(--mono); font-size: .82rem; line-height: 1.65;
  background: rgba(44,27,61,.045); border-left: 3px solid transparent; border-image: var(--rainbow) 1;
  border-radius: 0 10px 10px 0; padding: 1.9rem 1.2rem 1.15rem; margin: 1.6rem 0; overflow-x: auto;
  color: var(--ink); }
.codeblock code { font-family: var(--mono); white-space: pre; display: block; }
.code-tag { position: absolute; top: .5rem; left: 1.2rem; font-family: var(--mono); font-size: .64rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-soft); }

/* -- project write-up: figures + links (rudolph page) -- */
.figure-card { margin: 1.9rem 0; }
.proj-img { width: 100%; height: auto; display: block; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--paper); }
.proj-links { display: flex; flex-wrap: wrap; gap: .7rem 1.8rem; margin-top: 1.8rem;
  font-family: var(--mono); font-size: .9rem; }
.proj-links a { color: var(--A); text-decoration: none; border-bottom: 1.5px solid transparent; }
.proj-links a:hover { border-bottom-color: var(--A); }
.prose code { font-family: var(--mono); font-size: .86em; background: rgba(44,27,61,.06);
  padding: .08em .35em; border-radius: 4px; }
.codeblock code { background: none; padding: 0; }

@media (max-width: 560px) {
  .fourier-hero { width: 120px; height: 120px; }
  .codeblock { font-size: .74rem; }
}

/* ============================================================
   When Should I Run My Dishwasher? — carbon-intensity page
   ============================================================ */
/* live/snapshot banner */
.data-note { display: flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
  font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-soft);
  flex: none; box-shadow: 0 0 0 0 rgba(52,183,154,.5); }
.live-dot.on { background: #34b79a; animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,183,154,.55); }
  70% { box-shadow: 0 0 0 7px rgba(52,183,154,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,183,154,0); }
}

/* "right now" readout */
.now-box { text-align: left; }
.now-box .stat-big { margin: .1rem 0 .3rem; }

/* heatmap — breaks out wider than the prose column */
.chart-wide { max-width: 1060px; margin: 0 auto; padding: 1rem 1.5rem 0; }
.chart-wide .widget { margin-top: 0; }
.hm-region { font-family: var(--mono); font-size: 13px; fill: var(--ink); }
.hm-tick { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); }
.hm-tick-day { font-weight: 700; fill: var(--ink); }
.hm-grid { stroke: rgba(44,27,61,.16); stroke-width: 1; }
.hm-tip { position: absolute; z-index: 20; pointer-events: none; opacity: 0;
  transition: opacity .12s; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: .72rem; line-height: 1.4; padding: .45rem .6rem;
  border-radius: 8px; max-width: 240px; box-shadow: var(--shadow); }
.hm-tip strong { font-family: var(--display); font-size: .82rem; }

/* planner */
.mini-sel { font-family: var(--mono); font-size: .82rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px;
  padding: .35rem .5rem; margin-right: .4rem; }
.mini-sel:focus { outline: none; border-color: var(--A); }
.plan-readouts { grid-template-columns: 1fr 1fr; margin: 1.2rem 0 .6rem; }
.plan-readouts .stat-big { font-size: clamp(1.35rem, 4.6vw, 2rem); }
.plan-area { fill: rgba(52,183,154,.14); stroke: none; }
.plan-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.plan-best-lab { font-family: var(--mono); font-size: 10px; font-weight: 700; fill: var(--ink); }
.plan-now { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 3 3; }
.green-head { font-family: var(--mono); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-soft); margin: 1rem 0 .5rem; }
.green-list { list-style: none; padding: 0; margin: 0; font-family: var(--mono);
  font-size: .82rem; display: grid; gap: .4rem; }
.green-list li { display: flex; align-items: center; gap: .6rem; }
.green-dot { width: 11px; height: 11px; border-radius: 50%; flex: none;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--line); }

@media (max-width: 560px) {
  .plan-readouts { grid-template-columns: 1fr; }
  .hm-region { font-size: 9px; }
}

/* ============================================================
   BULGE PAGE — The Pull of the Equator
   gravity = periwinkle (--A); centrifugal = marigold (--b);
   unbalanced pull = rose (--a); effective gravity = teal (--B)
   ============================================================ */

/* hero motif: a globe squashing into its bulge */
.bulge-hero {
  position: relative;
  width: 120px; height: 120px;
  margin: 2.6rem auto 1.2rem;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #8fd0e4, #3aa7c9 62%, #2c86a6);
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255,255,255,.35);
  animation: rise .9s .2s cubic-bezier(.2,.7,.2,1) both, squash 3.4s ease-in-out 1.4s infinite;
}
.bh-axis {
  position: absolute; left: 50%; top: -14px; bottom: -14px;
  border-left: 1.5px dashed rgba(44,27,61,.45);
}
.bh-eq {
  position: absolute; top: 50%; left: -8px; right: -8px;
  border-top: 1.5px dashed rgba(255,255,255,.75);
}
@keyframes squash {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.09, .88); }
}

/* the force-diagram widgets */
.force-canvas {
  width: 100%; height: auto; display: block;
  margin: .4rem 0 1rem;
  background: rgba(255,255,255,.35);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: crosshair;
}
.force-head {
  display: flex; flex-wrap: wrap; gap: .3rem 1.2rem;
  align-items: baseline; justify-content: space-between;
  margin-bottom: .6rem;
}
.force-hint {
  font-family: var(--mono); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-soft); margin: 0;
}
.force-readout {
  font-family: var(--mono); font-size: .82rem; font-weight: 700;
  color: var(--ink); margin: 0; white-space: nowrap;
}
.force-controls {
  display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; align-items: center;
}
.force-legend {
  display: inline-flex; flex-wrap: wrap; gap: .4rem 1rem;
  margin-left: auto;
}
.sw-grav  { background: var(--A); }
.sw-spin  { background: var(--b); }
.sw-resid { background: var(--a); }
.sw-eff   { background: var(--B); }

@media (max-width: 560px) {
  .force-legend { margin-left: 0; }
  .force-readout { white-space: normal; }
}

/* ============================================================
   SCREENING PAGE — base rates, Bayes, the icon grid
   ============================================================ */

/* quiz hook */
.quiz-q { font-size: 1.02rem; line-height: 1.6; margin: 0 0 1.3rem; text-align: center; }
.quiz-q b { font-family: var(--mono); color: var(--ink); }
.act[disabled] { cursor: default; opacity: .55; }
.act[disabled][aria-pressed="true"] { opacity: 1; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.quiz-reveal[hidden] { display: none; }
.quiz-reveal p { margin: .9rem 0; }

/* highlighted outcome words in the prose */
.k-tp { color: var(--B); font-weight: 600; }
.k-fn { color: var(--a); font-weight: 600; }
.k-fp { color: var(--b); font-weight: 600; }

/* the icon grid */
.dot { transition: fill .25s ease; }
.dot-tp { fill: var(--B); }
.dot-fn { fill: var(--a); }
.dot-fp { fill: var(--b); }
.dot-tn { fill: rgba(44, 27, 61, .13); }

.grid-legend {
  display: flex; flex-wrap: wrap; gap: .5rem 1.1rem;
  justify-content: center; margin: .4rem 0 1.4rem;
}
.leg-item {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .76rem; color: var(--ink-soft);
}
.leg-swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sw-tp { background: var(--B); }
.sw-fn { background: var(--a); }
.sw-fp { background: var(--b); }
.sw-tn { background: rgba(44, 27, 61, .13); }

/* testing-twice probability bar */
.chain-track {
  height: 22px; background: rgba(44, 27, 61, .07);
  border-radius: 999px; overflow: hidden; margin: .4rem 0 .2rem;
}
.chain-fill {
  height: 100%; width: 1%;
  background: linear-gradient(90deg, var(--b), var(--a));
  border-radius: 999px; transition: width .4s cubic-bezier(.3, .8, .3, 1);
}

/* policy ledger accents */
.ledger .pol-good b { color: var(--B); }
.ledger .pol-bad b { color: var(--a); }

/* ============================================================
   BIRTHDAY PAGE — probability curve widgets
   ============================================================ */
.bday-curve { fill: none; stroke: var(--A); stroke-width: 2.6; stroke-linejoin: round; }
.bday-ref { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.bday-now { stroke: var(--a); stroke-width: 1.4; stroke-dasharray: 2 3; }
.bday-dot { fill: var(--a); stroke: #fff; stroke-width: 1.5; }

/* ============================================================
   How Many Draws Is Enough? — box-of-balls widgets
   ============================================================ */
.urn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 16px;
  margin: .2rem 0 .8rem;
}
.urn-ball {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
}
.urn-ball-b { background: var(--ink); }
.urn-ball-w { background: #fff; }
.urn-grid { stroke: var(--line); stroke-width: 1; }
.urn-path { fill: none; stroke: var(--A); stroke-width: 2.4; stroke-linejoin: round; }
.urn-dot { fill: var(--A); stroke: #fff; stroke-width: 1.5; }
.urn-funnel { fill: rgba(240,166,58,.16); }
.urn-marker { stroke: var(--a); stroke-width: 1.4; stroke-dasharray: 2 3; }
.author-note {
  font-size: .95rem;
  font-style: italic;
  color: var(--ink-soft);
  border-left: 3px solid var(--line);
  padding-left: 1rem;
  margin: 0 0 2.2rem;
}
