/* sharadbapat.com: one stylesheet, no dependencies, no build.
   Visual grammar: gray for the work, color for the play.
   The UI is monochrome; color lives only inside experiment covers. */

/* Tokens */

@property --x1 { syntax: "<percentage>"; inherits: false; initial-value: 20%; }
@property --y1 { syntax: "<percentage>"; inherits: false; initial-value: 25%; }
@property --x2 { syntax: "<percentage>"; inherits: false; initial-value: 85%; }
@property --y2 { syntax: "<percentage>"; inherits: false; initial-value: 30%; }
@property --x3 { syntax: "<percentage>"; inherits: false; initial-value: 55%; }
@property --y3 { syntax: "<percentage>"; inherits: false; initial-value: 100%; }

:root {
  color-scheme: light dark;

  --bg: #efefee;          /* light neutral gray */
  --text: #141414;        /* 16.0:1 on --bg */
  --muted: #555553;       /* 6.5:1 on --bg (AA) */
  --rule: #d8d8d6;
  --hover: #e6e6e5;
  --accent: #141414;
  --chart: #2a5aa8;       /* data marks; validated vs --bg (dataviz check) */

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;

  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-lead: clamp(1.3rem, 1.12rem + 0.9vw, 1.65rem);
  --step-small: 0.875rem;

  --measure: 42rem;
  --gutter: 1rem;
  --section: clamp(3rem, 2.25rem + 3vw, 4.5rem);
  --radius: 6px;

  /* Watercolour mask: fractal noise turned into soft-edged blotches (alpha = 3R - 1.1). */
  --wash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100' preserveAspectRatio='none'%3E%3Cfilter id='w' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.018 .026' numOctaves='4' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 -1.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");

  /* Film grain: one ~400-byte SVG shared by every cover. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --text: #ebebea;
    --muted: #a3a3a0;
    --rule: #2e2e2d;
    --hover: #1f1f1f;
    --accent: #ebebea;
    --chart: #5a86d8;     /* validated vs dark --bg */
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: var(--text);
    --rule: var(--muted);
  }
}

/* Base */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

.page {
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

main.page { padding-top: clamp(4rem, 3rem + 8vh, 8rem); }

[id] { scroll-margin-top: 2rem; }

h1,
h2 {
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Icons: 20px grid, 1.5 stroke, currentColor. */

.i {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Intro */

.intro { margin-bottom: var(--section); }

.mark {
  display: block;
  height: 2.25rem;
  width: auto;
  margin-bottom: 1.75rem;
  fill: currentColor;
}

.intro h1 {
  font-size: var(--step-0);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.lead {
  font-family: var(--display);
  font-size: var(--step-lead);
  font-weight: 450;
  line-height: 1.28;
  letter-spacing: -0.018em;
  max-width: 36rem;
  margin-bottom: 1.25rem;
  text-wrap: pretty;       /* no orphans, no forced even lines */
}

.intro p:not(.lead) {
  color: var(--muted);
  max-width: 34rem;
}

.intro p:not(.lead) a { color: var(--text); }

/* Inner pages: small header (mark + name, links home), page title. */

.site-header { padding-top: clamp(1.75rem, 1.25rem + 2.5vh, 3rem); }

.site-header a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.4rem;   /* touch target */
  font-weight: 600;
  text-decoration: none;
}

.site-header .mark {
  height: 1.4rem;
  margin: 0;
}

main.page.inner { padding-top: clamp(3rem, 2rem + 6vh, 6rem); }

.page-head { margin-bottom: var(--section); }

.page-head h1 {
  font-family: var(--display);
  font-size: var(--step-lead);
  font-weight: 450;
  line-height: 1.28;
  letter-spacing: -0.018em;
  margin-bottom: 0.75rem;
  text-wrap: pretty;
}

.page-head p {
  color: var(--muted);
  max-width: 34rem;
}

.page-head p a { color: var(--text); }

/* Sections: label left, optional link right. */

section { margin-bottom: var(--section); }

.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.head h2 {
  font-size: var(--step-small);
  font-weight: 500;
  color: var(--muted);
}

.head a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--step-small);
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.35rem;   /* tap target */
}

.head a:hover { color: var(--text); }

section > p { margin-top: 1rem; }

/* Form 2 - Cards: generative cover, title, description, kind. */

.cards {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 2rem 1.5rem;
}

/* Not written up yet: listed at the end, quieter, no link. */
.card.soon .cover { opacity: 0.45; filter: saturate(0.6); }
.card.soon .title, .card.soon .desc { color: var(--muted); }

/* An experiment's lesson cards, between its facts and its write-up. */
.article > .cards { margin: 0 0 var(--section); }

.card { position: relative; }

.card .title {
  display: block;
  font-weight: 500;
  text-decoration: none;
}

.card .desc {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
}

.card .kind {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Linked cards: link on .title, whole card is the target. */

.card a.title::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card a.title:focus-visible { outline: none; }

.card:has(a.title:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: var(--radius);
}

/* Covers (D36): a family (the recipe, .c-*) times a palette (the colours, .p-*: --c1 light
   to --c4 dark). The base colour sits on .cover; the family's field is an oversized ::before,
   so it can move without repainting (G2); grain sits on ::after. Sizes are in cqi, so a cover
   looks the same at 100px and at 400px. The build refuses two entries with the same pair.
   Families approximate the shader looks of feralui.dev/gradients in plain CSS. */

.cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  container-type: inline-size;
  aspect-ratio: 16 / 10;
  margin-bottom: 0.85rem;
  border-radius: var(--radius);
  background: var(--c4);
}

.cover::before {
  content: "";
  position: absolute;
  inset: -15%;
  pointer-events: none;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grain);
  background-size: 180px;
  mix-blend-mode: overlay;
  opacity: 0.55;
  pointer-events: none;
}

.cover .glyph {
  position: absolute;
  left: 0.75rem;
  bottom: 0.7rem;
  z-index: 1;
  width: 1.5rem;
  height: 1.5rem;
  color: rgb(255 255 255 / 0.92);
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.25));
}

/* Mesh: soft fields of colour drifting over a base. */
.c-mesh::before {
  background:
    radial-gradient(60% 80% at var(--x1) var(--y1), var(--c1), transparent 70%),
    radial-gradient(55% 75% at var(--x2) var(--y2), var(--c2), transparent 70%),
    radial-gradient(80% 90% at var(--x3) var(--y3), var(--c3), transparent 72%);
  filter: blur(3cqi);
}

/* Aurora: curtains of light over a night sky. */
.c-aurora { background: linear-gradient(to bottom, color-mix(in oklab, var(--c4), black 55%), color-mix(in oklab, var(--c3), black 35%)); }
.c-aurora::before {
  inset: -10%;
  background:
    radial-gradient(110% 42% at 40% 100%, transparent 40%, var(--c1) 56%, transparent 76%),
    radial-gradient(150% 130% at 45% 128%, transparent 32%, var(--c2) 52%, color-mix(in oklab, var(--c2), transparent 60%) 68%, transparent 92%);
  /* Two stripe patterns multiplied, so rays vary in brightness like real curtains. */
  -webkit-mask-image:
    repeating-linear-gradient(90deg, #000 0 2cqi, rgb(0 0 0 / 0.45) 2cqi 3.6cqi),
    repeating-linear-gradient(90deg, #000 0 9cqi, rgb(0 0 0 / 0.55) 9cqi 14cqi);
  -webkit-mask-composite: source-in;
  mask-image:
    repeating-linear-gradient(90deg, #000 0 2cqi, rgb(0 0 0 / 0.45) 2cqi 3.6cqi),
    repeating-linear-gradient(90deg, #000 0 9cqi, rgb(0 0 0 / 0.55) 9cqi 14cqi);
  mask-composite: intersect;
  filter: blur(1.4cqi);
  mix-blend-mode: screen;
}

/* Bars: stepped columns rising left to right. */
.c-bars { background: color-mix(in oklab, var(--c4), black 15%); }
.c-bars::before {
  inset: 0;
  background:
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 0% 100% / 15.5% 26% no-repeat,
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 20% 100% / 15.5% 40% no-repeat,
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 40% 100% / 15.5% 54% no-repeat,
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 60% 100% / 15.5% 68% no-repeat,
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 80% 100% / 15.5% 82% no-repeat,
    linear-gradient(to top, var(--c1), var(--c2) 45%, color-mix(in oklab, var(--c2), transparent 70%) 85%, transparent) 100% 100% / 15.5% 96% no-repeat;
  filter: blur(0.35cqi);
}

/* Prism: a glow broken into columns of light. */
.c-prism { background: color-mix(in oklab, var(--c4), black 25%); }
.c-prism::before {
  background: radial-gradient(55% 95% at 50% 105%, var(--c1), var(--c2) 38%, color-mix(in oklab, var(--c3), transparent 20%) 62%, transparent 80%);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 6cqi, rgb(0 0 0 / 0.62) 6cqi 12cqi);
  mask-image: repeating-linear-gradient(90deg, #000 0 6cqi, rgb(0 0 0 / 0.62) 6cqi 12cqi);
}

/* Forms: one large arc rising over a pale ground. */
.c-forms { background: color-mix(in oklab, var(--c1), white 30%); }
.c-forms::before {
  background: radial-gradient(circle at 50% 128%, var(--c3) 0 34%, var(--c2) 44%, color-mix(in oklab, var(--c2), transparent 50%) 50%, transparent 60%);
  filter: blur(1.5cqi);
}

/* Sky: a vertical wash with soft clouds. */
.c-sky { background: linear-gradient(to bottom, var(--c3), var(--c2) 55%, var(--c1)); }
.c-sky::before {
  background:
    radial-gradient(34% 18% at 30% 64%, rgb(255 255 255 / 0.9), transparent 70%),
    radial-gradient(28% 14% at 60% 56%, rgb(255 255 255 / 0.75), transparent 70%),
    radial-gradient(42% 16% at 78% 74%, rgb(255 255 255 / 0.7), transparent 70%);
  filter: blur(2.5cqi);
}

/* Watercolour: pigment pooled by a noise mask (SVG turbulence, a static data: image). */
.c-watercolour { background: color-mix(in oklab, var(--c1), white 25%); }
.c-watercolour::before {
  background: linear-gradient(150deg, var(--c2), color-mix(in oklab, var(--c2), var(--c3) 35%) 70%);
  opacity: 0.8;
  -webkit-mask-image: var(--wash);
  mask-image: var(--wash);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  filter: blur(1cqi);
}

/* Swirl: a blurred conic sweep. */
.c-swirl::before {
  inset: -60%;   /* big enough to cover the box at any angle while it turns */
  background: conic-gradient(from var(--turn, 0deg) at 45% 55%, var(--c1), var(--c2), var(--c3), var(--c4), var(--c2), var(--c1));
  filter: blur(7cqi);
}

/* Glyphs sit bottom-left; on the pale families they need dark ink. */
.c-forms .glyph, .c-sky .glyph, .c-watercolour .glyph { color: rgb(0 0 0 / 0.72); filter: none; }

/* Motion (D36): every cover moves by default and holds still while you hover it.
   Transform only, on the ::before layer, so the compositor animates it without repainting.
   Staggered start points keep covers of the same family out of step.
   prefers-reduced-motion switches all of this off (see the reduced-motion block). */
.cover::before { will-change: transform; animation: var(--motion) ease-in-out infinite alternate; }
.card:hover .cover::before { animation-play-state: paused; }
.card:nth-child(3n + 2) .cover::before { animation-delay: -5s; }
.card:nth-child(3n + 3) .cover::before { animation-delay: -11s; }

/* Travel and margin go together: a layer inset by m can move about m / (1 + 2m) of its own
   size before an edge shows, so each family's inset is set for its range here. */
.c-mesh        { --motion: cover-drift 9s; }
.c-aurora      { --motion: cover-sway 7s; }
.c-bars        { --motion: cover-breathe 3.2s; }
.c-prism       { --motion: cover-shimmer 5.5s; }
.c-forms       { --motion: cover-rise 5s; }
.c-sky         { --motion: cover-clouds 10s; }
.c-watercolour { --motion: cover-bloom 8s; }
.c-swirl::before { animation: cover-turn 16s linear infinite; }

.c-mesh::before        { inset: -30%; }
.c-aurora::before      { inset: -10% -30%; }
.c-prism::before       { inset: -15% -30%; }
.c-sky::before         { inset: -15% -35%; }
.c-watercolour::before { inset: -20%; }

@keyframes cover-drift   { from { transform: translate(14%, -10%) scale(1); }         to { transform: translate(-14%, 10%) scale(1.12) rotate(10deg); } }
@keyframes cover-sway    { from { transform: translateX(12%) skewX(-10deg); }         to { transform: translateX(-12%) skewX(10deg); } }
@keyframes cover-breathe { from { transform: scaleY(0.6); }                           to { transform: scaleY(1.06); } }
@keyframes cover-shimmer { from { transform: translateX(-14%) scale(1); }             to { transform: translateX(14%) scale(1.1); } }
@keyframes cover-rise    { from { transform: translateY(10%); }                       to { transform: translateY(-9%) scale(1.08); } }
@keyframes cover-clouds  { from { transform: translateX(-18%); }                      to { transform: translateX(18%); } }
@keyframes cover-bloom   { from { transform: scale(1) rotate(0deg); }                 to { transform: translate(-4%, 3%) scale(1.3) rotate(-12deg); } }
@keyframes cover-turn    { to { transform: rotate(1turn); } }
.c-bars::before { transform-origin: 50% 100%; }

/* Form 2b - The homepage list (D35): one row per entry, cover left, text right. */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list .card {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  column-gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

.list .card:last-child { border-bottom: 0; }

.list .cover {
  grid-row: 1 / -1;
  margin-bottom: 0;
}

.list .title,
.list .desc,
.list .kind { grid-column: 2; }

.list .title { margin-top: 0.1rem; }
.list .kind { align-self: end; }

@media (hover: hover) {
  .list .card:has(a.title) { transition: background-color 0.15s ease, box-shadow 0.15s ease; }

  .list .card:has(a.title):hover {
    background: var(--hover);
    box-shadow: -0.75rem 0 0 var(--hover), 0.75rem 0 0 var(--hover);
  }
}

@media (max-width: 34rem) {
  .list .card {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 1rem;
  }

  .list .cover { aspect-ratio: 1; align-self: start; }
  .list .kind { align-self: start; }

  .list .glyph {
    width: 1.1rem;
    height: 1.1rem;
    left: 0.5rem;
    bottom: 0.45rem;
  }
}

.kind .sep { opacity: 0.6; }

/* Palettes. Naming rule: one Hindi word for something in the world that already has these
   colours (a pigment, spice, material, sky or time of day), lowercase, simple romanisation,
   no diacritics. --c1 is the lightest, --c4 the darkest. Add new ones to PALETTES in site.mjs. */

.p-geru   { --c1: #e8893a; --c2: #a8391b; --c3: #1f2a55; --c4: #0e1330; }   /* ochre + indigo night: Before History */
.p-godhuli { --c1: #eaf4fc; --c2: #f09199; --c3: #1e50a2; --c4: #895b8a; }   /* godhuli, the cow-dust hour: dusk. Colours from feralui.dev "Iridescent cloud" */
.p-neel   { --c1: #c9d6ee; --c2: #3a5ba0; --c3: #0f1c3f; --c4: #1b2437;
            --x1: 70%; --y1: 20%; --x2: 20%; --y2: 60%; }                    /* indigo */
.p-laksha { --c1: #f2e3cf; --c2: #c8553d; --c3: #7a1f1f; --c4: #3b1d1d;
            --x1: 30%; --y1: 15%; --x3: 80%; --y3: 90%; }                    /* lac, sealing wax */
.p-haldi  { --c1: #fff3c4; --c2: #e3a018; --c3: #2f6f5e; --c4: #c9791a;
            --x1: 75%; --y1: 20%; --x2: 15%; --y2: 70%; }                    /* turmeric */
.p-maidan { --c1: #d9e4b5; --c2: #6f9a4b; --c3: #1d4a2f; --c4: #2e6b3f;
            --x1: 30%; --y1: 80%; --x2: 80%; --y2: 20%; --x3: 50%; --y3: 0%; } /* grass */
.p-lajvard { --c1: #eaf4fc; --c2: #7aa0c8; --c3: #1e50a2; --c4: #2b3a4f;
            --x1: 80%; --y1: 25%; --x2: 25%; --y2: 35%; }                    /* lajvard, lapis lazuli */
.p-kagaz  { --c1: #fbf7ea; --c2: #c9a54a; --c3: #3a3a38; --c4: #8a7a58;
            --x1: 25%; --y1: 30%; --x2: 80%; --y2: 70%; --x3: 60%; --y3: 0%; } /* paper, ink and gold: Brief */
.p-nabh   { --c1: #f4f8fb; --c2: #9cc7e8; --c3: #2f6fb5; --c4: #16345c; }   /* sky */
.p-kajal  { --c1: #d8f5d0; --c2: #58c27d; --c3: #1f6b4a; --c4: #111614; }   /* kohl, and a phosphor-green terminal */

/* Entry pages: a centred reading column with a full-bleed option for media.
   <main class="article"> children sit in the column; .bleed spans wider. */

main.article {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [content-start] min(var(--measure), 100% - 2 * var(--gutter))
    [content-end] minmax(var(--gutter), 1fr)
    [full-end];
  padding-block: clamp(3rem, 2rem + 6vh, 6rem) var(--section);
}

main.article > * { grid-column: content; }

main.article > .bleed {
  grid-column: full;
  width: min(64rem, 100% - 2 * var(--gutter));
  justify-self: center;
}

.film { margin: 0 0 2rem; }

.film video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #0e1330;
  border-radius: var(--radius);
}

.film figcaption {
  margin-top: 0.6rem;
  font-size: var(--step-small);
  color: var(--muted);
}

/* Facts: small label/value pairs under the media. */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 var(--section);
  padding: 1rem 0;
  border-block: 1px solid var(--rule);
}

.facts div { min-width: 0; }

.facts dt {
  font-size: 0.8125rem;
  color: var(--muted);
}

.facts dd {
  margin: 0.1rem 0 0;
  font-size: var(--step-small);
}

/* Prose */

.prose h2 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2.75rem 0 0.75rem;
}

.prose > :first-child { margin-top: 0; }

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.prose li { margin-bottom: 0.4rem; }

.prose li::marker { color: var(--muted); }

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  background: var(--hover);
  border-radius: 3px;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

.prose .transcript {
  list-style: none;
  padding-left: 0;
}

.prose .transcript li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.75rem;
}

.transcript time {
  font-size: var(--step-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

/* Download row */

.download {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.download:hover {
  background: var(--hover);
  border-color: var(--muted);
}

.download .i {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--muted);
}

.download strong {
  display: block;
  font-weight: 500;
}

.download span span {
  display: block;
  font-size: var(--step-small);
  color: var(--muted);
}

/* Links */

.links {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-block: 0.5rem;   /* ~44px touch target */
}

.links .i { color: var(--muted); }

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.25rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step-small);
}

.site-footer p { margin: 0; }


/* Visually hidden, still read by screen readers (table captions, live regions). */
.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;
}

/* Skip link */

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  border-radius: 4px;
  transform: translateY(-200%);
}

.skip:focus-visible { transform: none; }

/* Motion */

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

/* Windows High Contrast / forced colors */

@media (forced-colors: active) {
  .head,
  .rows li,
  .site-footer { border-color: CanvasText; }
  .cover { border: 1px solid CanvasText; }
  .mark { fill: CanvasText; }
}

/* Narrow screens: labels drop under the description. */

@media (max-width: 34rem) {
  .rows li,
  .rows-dated li { grid-template-columns: minmax(0, 1fr); }

  .rows .meta,
  .rows-dated .meta,
  .rows-dated .title {
    grid-column: 1;
    grid-row: auto;
  }

  .rows .meta { margin-top: 0.2rem; }
}

/* Charts: static inline SVG, single series, tokens only. */

.chart-figure { margin: 1.5rem 0 1rem; }

/* Lead image on entry pages. */
.lead-image { margin: 0 0 2rem; }
.lead-image img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.lead-image figcaption { margin-top: 0.6rem; font-size: var(--step-small); color: var(--muted); }

.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--sans);
}

.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart); }

.chart-figure figcaption {
  margin-top: 0.5rem;
  font-size: var(--step-small);
  color: var(--muted);
}

@media (forced-colors: active) {
  .chart .bar { fill: CanvasText; }
  .chart .axis, .chart .label { fill: CanvasText; }
}

/* Stat tiles: a headline comparison that doesn't need a chart. */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* before | after, always paired */
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.stat {
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.stat b {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem);
  font-weight: 450;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--step-small);
  color: var(--muted);
}

.stat.after b { color: var(--chart); }

/* Data tables */

details.data { margin: 0.5rem 0 1.5rem; }

details.data summary {
  cursor: pointer;
  font-size: var(--step-small);
  color: var(--muted);
  padding-block: 0.4rem;
}

details.data summary:hover { color: var(--text); }

.table-wrap { overflow-x: auto; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.prose th { font-weight: 500; color: var(--muted); }
.prose td:last-child, .prose th:last-child { text-align: right; padding-right: 0; }

/* Essay date line, under the page title. */
.meta-line {
  margin-top: -0.25rem;
  font-size: var(--step-small);
  color: var(--muted);
}

/* A lesson's link back to its experiment, above the title. */
.page-head .crumb {
  margin-bottom: 0.5rem;
  font-size: var(--step-small);
}
.page-head .crumb a { color: var(--muted); }
.page-head .crumb a::before { content: "← "; }

/* A short aside in the margin of an essay: indented, muted, italic. */
.prose .aside {
  margin: 1.25rem 0 1.25rem 1rem;
  color: var(--muted);
  font-style: italic;
}

/* A pull quote: one line, larger, in the display face. */
.prose .pull {
  margin: 2rem 0;
  padding: 0;
  border: 0;
  color: var(--text);
  font-family: var(--display);
  font-size: var(--step-lead);
  line-height: 1.28;
  letter-spacing: -0.018em;
}

/* SVG text scales with the chart; on phones the viewBox shrinks ~2x, so enlarge it. */
@media (max-width: 34rem) {
  .chart .axis { font-size: 19px; }
  .chart .label { font-size: 20px; }
}
