/* Copyright (c) Meta Platforms, Inc. and affiliates. */
:root {
  --cream: #f6efe1;
  --ink: #2a1f1a;
  --muted: rgb(42 31 26 / 0.7);
  --faint: rgb(42 31 26 / 0.15);
  --wine: #7a1f2b;
  --gold: #d9a03a;
  --copper: #b8602a;
  --content-width: 880px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);   /* iOS sheet/spring-like ease-out */
  --colour-fade: background-color 0.4s var(--ease-apple), color 0.4s var(--ease-apple),
                 border-color 0.4s var(--ease-apple);
}

* { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Paper: grain, soft mottling, and speckles laid over the cream. The tiles are balanced so
     the page keeps the same overall colour before and after they load. */
  background-color: var(--cream);
  background-image: url("assets/paper/speckles.png"), url("assets/paper/grain.png"), url("assets/paper/mottle.png");
  background-size: 600px, 96px, 640px;
  color: var(--ink);
  font: 1rem/1.6 system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

truchet-pattern { display: block; }
truchet-pattern svg { display: block; width: 100%; height: auto; }

main {
  width: min(var(--content-width), 100% - 32px);
  margin: 0 auto;
  /* 6rem on tall screens, shrinking with viewport height down to 1.25rem on short laptops. */
  padding-top: clamp(1.25rem, (100vh - 640px) / 4, 6rem);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}

h1 {
  font-family: "Passion One", sans-serif;
  font-weight: 400;
  font-size: 4rem;
  line-height: 1;
  margin: 0;
  color: var(--wine);
}

nav { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }

nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: var(--colour-fade);
}
nav a:hover { background: rgb(0 0 0 / 0.05); }

nav a.get { background: var(--wine); color: #fff; margin-left: 0.5rem; }
nav a.get:hover { background: #651823; }
nav a.get svg { width: 1em; height: 1em; }
nav a.get[aria-disabled="true"],
nav a.get[aria-disabled="true"]:hover { background: var(--faint); color: var(--muted); cursor: not-allowed; }

.panel {
  flex: 1;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 0 24px rgb(90 50 20 / 0.06);
  padding: 2rem;
}

section { scroll-margin-top: 1.5rem; }

/* ─── overview ─────────────────────────────────────────────────────── */

.teaser {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: var(--cream);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 34%;
  gap: 2rem;
  margin-top: 2.5rem;
}

h2 {
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.authors { margin: 0 0 0.25rem; font-size: 0.85rem; font-weight: 500; line-height: 1.5; }
.authors a { text-decoration: none; color: inherit; transition: var(--colour-fade); }
.authors a:hover { text-decoration: underline; color: var(--wine); }
.authors span { white-space: nowrap; }
.authors span:not(:last-child)::after { content: ","; }
.affiliations { margin: 0 0 1.25rem; font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
sup { font-size: 0.7em; line-height: 0; margin-left: 0.1em; }
.affiliations sup { margin: 0 0.2em 0 0; }

/* Key figures: tinted tiles, figure in a darker shade of the tile's tone. */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}
.stats li {
  --tone: var(--gold);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 0.85rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 16%, #fff);
}
.stats li.copper { --tone: var(--copper); }
.stats li.wine { --tone: var(--wine); }
.stats strong {
  font-family: "Passion One", sans-serif;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  color: color-mix(in srgb, var(--tone), #000 25%);
}
.stats em {
  font: 600 0.95rem/1 system-ui, -apple-system, sans-serif;
  font-style: normal;
}
.stats span { font-size: 0.8rem; line-height: 1.35; color: var(--ink); }

.links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.links a {
  padding: 0.4rem 0.95rem;
  border: 1.5px solid var(--faint);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--colour-fade);
}
.links a:hover { border-color: var(--wine); color: var(--wine); }
/* Release status in place of the links: a plain label, deliberately not shaped like a button. */
.links .soon {
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--muted);
  font-weight: 500;
}

/* Arc decorations: a snake pattern inside a clipped window. */
.deco { position: relative; overflow: hidden; pointer-events: none; }
.deco truchet-pattern { position: absolute; }

.deco-side {
  margin: -1rem -2rem -1rem 0;   /* bleed off the panel's right edge */
}
.deco-side truchet-pattern { left: 0; right: 0; top: 50%; translate: 0 -50%; }

.deco-band {
  margin: 4rem -2rem 0;
}
.deco-band truchet-pattern { position: relative; }

/* ─── content sections ─────────────────────────────────────────────── */

.block { margin-top: 4.5rem; }

h3 {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  text-wrap: balance;
}

/* Section headings get a short copper bar underneath. */
.block > h3::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.6rem;
  border-radius: 3px;
  background: var(--copper);
}

h4 { font-size: 1.05rem; margin: 0 0 0.35rem; }

.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 62ch; }

code { font-family: var(--mono); font-size: 0.88em; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--faint); }
thead th { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); vertical-align: bottom; }
tbody th { font-weight: 600; white-space: nowrap; }
.compare td { white-space: nowrap; text-align: center; }
.compare td.yes { color: var(--wine); font-weight: 600; }
.compare td.no { color: rgb(42 31 26 / 0.3); }
.compare tr.self { background: var(--cream); }
.compare tr.self th, .compare tr.self td { font-weight: 700; }

/* viewer */
.viewer-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.control-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }

/* iOS-style segmented control: a cream track with a white thumb that slides to the active option. */
.segmented {
  position: relative;
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 3px;
  border-radius: 999px;
  background: var(--cream);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 0.35rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--colour-fade);
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { color: var(--wine); }
.seg-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(90 50 20 / 0.15), 0 0 0 0.5px rgb(90 50 20 / 0.08);
  transition: transform 0.45s var(--ease-apple), width 0.45s var(--ease-apple);
}
/* Arrow buttons appear only when a track overflows (small screens), so the scroll is discoverable. */
.seg-wrap { display: flex; align-items: center; gap: 0.25rem; min-width: 0; }
.seg-wrap .segmented { min-width: 0; }
.seg-arrow {
  display: none;
  flex: none;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: var(--colour-fade), opacity 0.3s var(--ease-apple);
}
.seg-arrow svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.seg-arrow:hover { color: var(--wine); }
.seg-arrow:disabled { opacity: 0.35; cursor: default; }
.seg-wrap.overflowing .seg-arrow { display: grid; }
.seg-divider { flex: none; width: 1px; height: 1.1rem; margin: 0 0.3rem; background: var(--faint); }

.viewer-stage {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ink);
}
/* The video carries its own 16:9 box. (Sizing it with height: 100% inside an aspect-ratio
   parent breaks in Safari: the height falls back to the default 2:1 video size.) 4:3 and
   square clips letterbox inside. */
.viewer-stage video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.viewer-label {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font: 0.75rem var(--mono);
}
.viewer-caption { color: var(--muted); font-size: 0.9rem; margin: 0.75rem 0 0; }

/* Overview: clickable tiles over the 3×3 mosaic clip (RGB spans the top-left 2×2). The grid is
   as wide as the letterboxed video: the stage is 16:9, so width = aspect × 9/16 of the stage. */
.viewer-tiles {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: calc(var(--aspect, 1.7778) * 900% / 16);
  transform: translateX(-50%);
  display: none;
  grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr));
}
.viewer.overview .viewer-tiles { display: grid; }
.viewer.overview .viewer-label { display: none; }
.viewer-tiles .tile-big { grid-area: 1 / 1 / 3 / 3; }
.viewer-tiles button {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: inset 0 0 0 1.5px var(--ink);
  cursor: pointer;
}
.viewer-tiles span {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font: 0.75rem var(--mono);
  transition: var(--colour-fade);
}
.viewer-tiles button:hover span,
.viewer-tiles button:focus-visible span { background: var(--wine); }

/* tasks: three themed rows (motion, geometry, bodies and objects), tinted like the stats */
.task-themes { display: grid; grid-template-columns: 8.5rem 1fr 1fr; gap: 0.75rem; }
.t-wine { --tone: var(--wine); }
.t-gold { --tone: var(--gold); }
.t-copper { --tone: var(--copper); }
.task-theme {
  grid-column: 1;
  align-self: center;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: color-mix(in srgb, var(--tone), #000 25%);
}
.task {
  display: grid;
  grid-template-columns: 3rem 1fr;
  column-gap: 0.9rem;
  align-content: start;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 16%, #fff);
}
.task-icon { grid-row: span 3; width: 3rem; height: 3rem; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-icon .ac { stroke: color-mix(in srgb, var(--tone), #000 15%); stroke-width: 2.2; }
.task-icon .dot { fill: var(--ink); stroke: none; }
.task-icon .trail { stroke-width: 2; stroke-dasharray: 0 3.4; }
.task-icon .solid { fill: color-mix(in srgb, var(--tone), #000 15%); stroke: none; }
.task-icon .fill { fill: color-mix(in srgb, var(--tone) 30%, #fff); stroke: var(--ink); }
.task-icon .hidden { stroke-dasharray: 2 2.2; stroke-width: 1.2; opacity: 0.6; }
.task-icon .layers { stroke: color-mix(in srgb, var(--tone), #000 15%); stroke-width: 2.6; }   /* depth: outlined stack */
.task-icon .boxes { fill: color-mix(in srgb, var(--tone) 16%, #fff); stroke: color-mix(in srgb, var(--tone), #000 15%); stroke-width: 2.4; }   /* outlined; filled with the card colour so front boxes hide back edges */
.task-icon .figure { fill: color-mix(in srgb, var(--tone), #000 15%); stroke: none; }        /* person, arms open */
.task-icon .figure .limbs { fill: none; stroke: color-mix(in srgb, var(--tone), #000 15%); stroke-width: 3.6; }
.task h4 { margin: 0 0 0.15rem; }
.task strong { font-size: 0.9rem; font-weight: 600; line-height: 1.35; color: color-mix(in srgb, var(--tone), #000 25%); }
.task p { grid-column: 2; margin: 0.3rem 0 0; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }

/* method */
.method-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-top: 2rem;
}
.method-row p { margin: 0; color: var(--muted); }
.method-row img { display: block; width: 100%; border-radius: 8px; }
.funnel-card { padding: 1.25rem 1.25rem 1.1rem; border-radius: 10px; background: var(--cream); }
.funnel { display: block; width: 100%; height: auto; overflow: visible; }
.funnel-label { font-size: 13px; font-weight: 600; fill: var(--ink); }
.funnel-detail { font-size: 11px; fill: var(--muted); }
.funnel-count { font-family: "Passion One", sans-serif; font-size: 22px; fill: var(--wine); dominant-baseline: central; }
.actor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.actor-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

/* method: a pinned step-through on wide screens, stacked steps behind a fold on phones.
   Wide: once the step-through is centred the whole page freezes in place while scrolling
   advances the steps; caption and figure crossfade, and the stage dots fill as you go.
   Phones: steps stack, figure above caption; the first shows, the rest wait behind a button. */
.sc-toggle {
  display: flex;
  width: 100%;
  border: 0;
  font: inherit;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--wine);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: var(--colour-fade);
}
.sc-toggle:hover { background: #651823; }
.sc-toggle[hidden] { display: none; }
.sc-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--ease-apple); }
.sc-fold.open .sc-toggle svg { transform: rotate(180deg); }
.sc-toggle-close, .sc-fold.open .sc-toggle-open { display: none; }
.sc-fold.open .sc-toggle-close { display: inline; }
@media (max-width: 720px) {
  .sc-fold.folded:not(.open) .sc-step:nth-child(n + 2) { display: none; }
}
.sc-step { margin-bottom: 2.5rem; }
.sc-step h4 { margin: 1rem 0 0.35rem; }
.sc-step p { margin: 0; color: var(--muted); max-width: 60ch; }
.sc-stage-label { margin: 0 0 0.6rem; font-size: 0.75rem; font-weight: 600; color: var(--wine); }
.sc-dots, .sc-figure { display: none; }
@media (min-width: 721px) {
  .sc-toggle { display: none; }
  main { position: sticky; }   /* the whole page freezes while stepping; top and spacer set by main.js */
  .sc-pin {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.7fr);
    column-gap: 2.5rem;
  }
  .sc-text { display: flex; flex-direction: column; }
  .sc-steps { display: grid; }
  .sc-step {
    grid-area: 1 / 1;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-apple), visibility 0s linear 0.3s;
  }
  .sc-step.active { opacity: 1; visibility: visible; transition-delay: 0s; }
  .sc-step > .mc-panels, .sc-stage-label { display: none; }
  .sc-step h4 { margin-top: 0; }
  .sc-figure { display: block; }
  .sc-stage { display: grid; }
  .sc-fig {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-apple), visibility 0s linear 0.3s;
  }
  .sc-fig.active { opacity: 1; visibility: visible; transition-delay: 0s; }
  /* stage dots: one group per stage, at the bottom of the caption column */
  .sc-dots { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; margin-top: auto; padding-top: 1.25rem; }
  .sc-dot-group { display: flex; flex-direction: column; gap: 0.35rem; }
  .sc-dot-label { font-size: 0.75rem; font-weight: 500; color: var(--muted); white-space: nowrap; transition: var(--colour-fade); }
  .sc-dot-group.active .sc-dot-label { color: var(--wine); }
  .sc-dot-row { display: flex; align-items: center; gap: 0.45rem; height: 0.7rem; }
  .sc-dot {
    position: relative;
    width: 0.7rem;
    height: 0.7rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--faint);
    cursor: pointer;
    transition: background-color 0.3s var(--ease-apple), width 0.3s var(--ease-apple);
  }
  .sc-dot.done { background: color-mix(in srgb, var(--wine) 35%, #fff); }
  .sc-dot.active { width: 2.2rem; background: var(--wine); }
  /* progress through the current step: a translucent pill filling the active dot (--p from main.js) */
  .sc-dot::after {
    content: "";
    position: absolute;
    inset: 2px auto 2px 2px;
    min-width: calc(0.7rem - 4px);
    width: calc((100% - 4px) * var(--p, 0));
    border-radius: inherit;
    background: rgb(255 255 255 / 0.45);
    opacity: 0;
    transition: opacity 0.3s var(--ease-apple);
  }
  .sc-dot.active::after { opacity: 1; }
}
.mc-panels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 340px;
  padding: 1.25rem;
  border-radius: 10px;
  background: var(--cream);
}
.mc-panels img { display: block; min-width: 0; max-height: 100%; }
.mc-single img { height: 100%; width: auto; max-width: 100%; }
.mc-pair img { flex: 1 1 0; width: 0; max-width: 44%; }
/* Filmstrips: no gaps, little side padding. The conditioning frames (first and last) were
   already shown on the step before, so they shrink and the generated frames overlap them. */
.mc-panels.mc-strip { gap: 0; padding-inline: 0.5rem; }
/* Each frame is rendered at its zoomed size and scaled down at rest, so it is already sharp
   when it grows on hover (scaling up a small render looks soft until the browser re-renders). */
.mc-f { position: relative; z-index: 1; flex: 1 1 0; min-width: 0; aspect-ratio: 202.987 / 116.19; }
.mc-f img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160%;
  max-height: none;
  transform: translate(-50%, -50%) scale(0.625);
  transition: transform 0.55s var(--ease-apple), filter 0.55s var(--ease-apple);
}
.mc-f:first-child img { left: 0; transform-origin: left center; transform: translateY(-50%) scale(0.625); }
.mc-f:last-child img { left: auto; right: 0; transform-origin: right center; transform: translateY(-50%) scale(0.625); }
.mc-f.mc-key { flex-grow: 1.35; }
.mc-f.mc-cond { flex-grow: 0.72; z-index: 0; }
.mc-f.mc-cond:first-child { margin-right: -2.5%; }
.mc-f.mc-cond:last-child { margin-left: -2.5%; }
.mc-f.mc-dim img { filter: contrast(0.45) brightness(1.3); }   /* faded but opaque, so overlaps stay clean */
@media (hover: hover) {
  .mc-f:hover { z-index: 3; }
  .mc-f:hover img { transform: translate(-50%, -50%) scale(1); filter: none; }
  .mc-f:first-child:hover img, .mc-f:last-child:hover img { transform: translateY(-50%) scale(1); }
}
.mc-arrow { flex: none; width: 1.4rem; height: 1.4rem; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sym-hat { position: relative; display: inline-block; }
.sym-hat::before { content: "^"; position: absolute; left: 50%; top: -0.4em; transform: translateX(-50%); font-weight: 400; }
.sym-star { font-size: 1em; line-height: 0; }
@media (max-width: 720px) {
  .mc-panels { height: 230px; padding: 0.9rem; flex-wrap: wrap; align-content: center; }
  .mc-panels.mc-strip { gap: 0.4rem; }
  .mc-f { flex: 0 0 calc(50% - 0.2rem); }
  .mc-f.mc-key { flex-grow: 0; }
  .mc-f.mc-cond { flex-grow: 0; margin: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-step, .sc-fig, .sc-dot, .sc-dot::after { transition: none; }
}

/* cameras */
.details-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; align-items: start; }
.facts { margin: 0 0 1.5rem; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.facts li { margin-bottom: 0.3rem; }

/* get */
.code-card { margin-top: 1.5rem; }

/* Multi-select checklist: three groups side by side, a tick box per option. */
.picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--faint);
  border-radius: 10px;
}
.picker fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.picker legend {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.toggle-all {
  padding: 0;
  border: 0;
  background: none;
  color: var(--copper);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.toggle-all:hover { color: var(--wine); }
.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.2rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.check code { font-size: 0.82rem; }
.check small { color: var(--muted); font-size: 0.75rem; }
.check.locked { color: var(--muted); cursor: default; }
.check input {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  border: 1.5px solid rgb(42 31 26 / 0.3);
  border-radius: 5px;
  background: #fff;
  cursor: inherit;
  transition: var(--colour-fade);
}
.check input::after {
  content: "";
  width: 0.55rem;
  height: 0.3rem;
  margin-top: -0.12rem;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.3s var(--ease-apple);
}
.check input:checked { background: var(--wine); border-color: var(--wine); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check:hover input:not(:disabled) { border-color: var(--wine); }
.check input:disabled { background: rgb(42 31 26 / 0.3); border-color: transparent; }
.check input:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }

.code-block { position: relative; }
.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--faint);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.85);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--colour-fade);
}
.copy:hover { color: var(--wine); border-color: var(--wine); }
.copy.done { background: var(--wine); border-color: var(--wine); color: #fff; }
.copy svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.code-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 1rem; margin-bottom: 0.5rem; }
.code-head span { font-size: 0.85rem; color: var(--muted); }
.code-head a { color: inherit; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 2px; transition: var(--colour-fade); }
.code-head a:hover { color: var(--wine); text-decoration-color: currentColor; }
pre {
  margin: 0 0 0.75rem;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  background: var(--cream);
  overflow-x: auto;
  font: 0.8rem/1.6 var(--mono);
}
pre code { font-size: inherit; }
.code-card p { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.tok-kw { color: var(--wine); }
.tok-fn { color: var(--copper); }
.tok-str { color: #8a6412; }
.tok-num { color: #a0522d; }
.tok-cls { color: #6b3a1f; font-weight: 600; }
.tok-com { color: rgb(42 31 26 / 0.45); }

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--faint);
  font-size: 0.85rem;
  color: var(--muted);
}
footer a { color: inherit; text-decoration: none; transition: var(--colour-fade); }
footer a:hover { color: var(--wine); }

@media (max-width: 720px) {
  .hero, .method-row, .details-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .picker { grid-template-columns: 1fr 1fr; }
  .task-themes { grid-template-columns: 1fr 1fr; }
  .task-theme { grid-column: 1 / -1; margin-top: 0.5rem; }
  .deco-side { display: none; }
}

@media (max-width: 480px) {
  /* The white panel spans the full screen width; the header keeps the 16px inset on its own. */
  main { width: 100%; padding-top: 1rem; }
  .masthead { padding-inline: 16px; }
  .viewer-controls { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .control-label:not(:first-child) { margin-top: 0.4rem; }
  .viewer-tiles span { left: 0.25rem; bottom: 0.25rem; padding: 0.05rem 0.35rem; font-size: 0.6rem; }
  nav { flex-wrap: nowrap; gap: 0; margin-left: -0.6rem; }
  nav a { padding: 0.45rem 0.6rem; font-size: 0.95rem; }
  nav a.get { margin-left: 0.25rem; }
  .panel { padding: 1rem; }
  .deco-band { margin-inline: -1rem; }
  h2 { font-size: 1.4rem; }
  .task-themes { grid-template-columns: 1fr; }
  .picker { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:last-child { grid-column: span 2; }
}
