/* See Why Math: warm paper palette shared with the videos (src/visual_math/theme.py "warm"). */
:root {
  --paper: #E9C29B;      /* caramel paper, the video background */
  --paper-soft: #F4DDBF;
  --cream: #FFF6E8;
  --ink: #32251F;
  --muted: #5E4A39;
  --teal: #236F70;
  --clay: #A54932;
  --gold: #D9A747;
  --line: #D9B48C;
  --radius: 14px;
  --measure: 42rem;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 18px/1.6 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--clay); }
h1, h2, .brand, .kicker, .card-title, button, .guess, summary, nav, .meta, figcaption, .crumbs {
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin: 2rem 0 .8rem; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.mark {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 1.1rem;
}
nav { display: flex; gap: 1.2rem; font-size: .98rem; }
nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
nav a:hover { color: var(--clay); }

main { padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 72rem; margin: 0 auto; }
.intro, .question, .puzzle > p, .reveal, .turn, .pitch { max-width: var(--measure); }
.intro { padding-top: 2rem; }

.hero, .puzzle { padding-top: 2.2rem; }
.hero {
  margin: 0 calc(-1 * clamp(1rem, 4vw, 2.5rem));
  padding: 2.6rem clamp(1rem, 4vw, 2.5rem) 2.2rem;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-soft) 100%);
}
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2.4rem; align-items: center; }
.hero .question, .hero h1 { max-width: var(--measure); }
.hero-pic img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(50, 37, 31, .22); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; gap: 1.2rem; } .hero-pic { order: -1; } }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--clay); }
.question { font-size: 1.15rem; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 0; }
.crumbs a { color: var(--muted); }

.guesses { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.2rem 0 .6rem; }
.guess {
  appearance: none; border: 2px solid var(--ink); background: var(--cream); color: var(--ink);
  padding: .65rem 1.15rem; border-radius: 999px; font-size: 1rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .12s ease, background .12s ease;
}
.guess:hover { transform: translateY(-1px); background: #fff; color: var(--ink); }
.guess[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.guess:focus-visible, .yt:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.guessed { font-family: "Avenir Next", Avenir, system-ui, sans-serif; color: var(--ink); font-weight: 600; margin: 0 0 .8rem; }

.watch { margin: 1.8rem 0 1rem; }
.video { margin: 0; max-width: 56rem; }
.video.tall { max-width: 22rem; }
.yt {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--radius); overflow: hidden; background: var(--ink);
  box-shadow: 0 10px 30px rgba(50, 37, 31, .18);
}
.video.wide .yt, .video.wide iframe { aspect-ratio: 16 / 9; }
.video.tall .yt, .video.tall iframe { aspect-ratio: 9 / 16; }
.yt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play {
  position: absolute; inset: 50% auto auto 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; background: rgba(50, 37, 31, .82);
}
.play::after {
  content: ""; position: absolute; left: 30px; top: 22px;
  border-left: 26px solid var(--cream); border-top: 16px solid transparent; border-bottom: 16px solid transparent;
}
.yt:hover .play { background: var(--clay); }
.video iframe { width: 100%; border: 0; border-radius: var(--radius); display: block; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: .5rem; display: flex; gap: .7rem; flex-wrap: wrap; }
.len { font-variant-numeric: tabular-nums; }

details.reveal {
  margin: 1.6rem 0; padding: 0 1.3rem; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line);
}
details.reveal summary {
  cursor: pointer; padding: 1rem 0; font-weight: 700; font-size: 1.05rem; list-style: none; color: var(--teal);
}
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary::before { content: "+"; display: inline-block; width: 1.3rem; font-weight: 700; }
details.reveal[open] summary::before { content: "\2013"; }
details.reveal[open] { padding-bottom: 1rem; }
details.reveal.small { background: var(--cream); }
.answer { font-size: 1.2rem; font-weight: 700; font-family: "Avenir Next", Avenir, system-ui, sans-serif; }

.lab h2 { margin-top: 1.4rem; }
.lab .hint { color: var(--muted); font-size: .95rem; margin-top: -.4rem; }
.lab-frame { width: 100%; max-width: 40rem; border-radius: var(--radius); overflow: hidden; background: var(--paper-soft); }
.lab-frame { position: relative; }
.lab-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.lab-frame.sized .lab-size { display: none; }
.lab-frame.sized iframe { position: static; }

.turn { margin-top: 2.2rem; padding: 1.2rem 1.4rem; border-left: 5px solid var(--gold); background: var(--paper-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.turn h2 { margin-top: 0; }
.more { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 2rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.2rem; }
.card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(50, 37, 31, .14); color: var(--ink); }
.thumb { display: flex; justify-content: center; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper); }
.thumb img { height: 100%; width: 100%; object-fit: cover; display: block; }
.thumb.tall img { width: auto; aspect-ratio: 9 / 16; }  /* a Short's cover sits in the middle of a wider frame */
.card-title { font-weight: 650; padding: .75rem .9rem .2rem; line-height: 1.3; }
.meta { font-size: .82rem; color: var(--muted); padding: 0 .9rem .8rem; }
.shelf { margin-top: 2.4rem; }
.all { margin: .9rem 0 0; font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-weight: 600; }
.feature { padding: 1.4rem 1.6rem; background: var(--paper-soft); border-radius: var(--radius); max-width: var(--measure); }
.feature h2 { margin-top: 0; }
.pitch { font-size: 1.15rem; color: var(--muted); margin-top: 2rem; }

.timeline { list-style: none; padding: 0; margin: 2rem 0; counter-reset: step; }
.timeline .step { margin: 0 0 2.4rem; padding-left: 3rem; position: relative; max-width: 50rem; }
.timeline .step::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font: 700 1rem "Avenir Next", Avenir, system-ui, sans-serif;
}

.foot { padding: 2rem clamp(1rem, 4vw, 2.5rem); background: var(--paper); border-top: 1px solid var(--line); font-size: .95rem; }
.foot a { color: var(--ink); font-weight: 600; }

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

.dice { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 .4rem; }
.die { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.die-name { display: block; font: 700 .85rem "Avenir Next", Avenir, system-ui, sans-serif; color: var(--clay); margin-bottom: .35rem; }
.faces { display: grid; grid-template-columns: repeat(3, 2.2rem); gap: .3rem; }
.face {
  display: grid; place-items: center; height: 2.2rem; border-radius: 8px; background: var(--paper-soft);
  border: 1.5px solid var(--ink); font: 700 1.05rem "Avenir Next", Avenir, system-ui, sans-serif;
}
.guess.think { border-style: dashed; }

.promise { font-size: clamp(1.6rem, 3.6vw, 2.2rem); margin: 0 0 .4rem; color: var(--ink); }
.pitch { max-width: 60rem; }
.pitch > p { max-width: var(--measure); }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.shelf-link {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius);
  font-size: .98rem; transition: transform .14s ease, box-shadow .14s ease;
}
.shelf-link strong { font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: 1.1rem; }
.shelf-link span { color: var(--muted); }
.shelf-link:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(50, 37, 31, .14); color: var(--ink); }
.shelf-intro { color: var(--muted); margin: -.4rem 0 1rem; max-width: var(--measure); }
.turn-note { font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-weight: 600; margin: 0 0 .6rem; }

/* Learning paths */
:root { --blue: #174D7C; --orange: #883406; }
.path-step .meta, .pager .meta { padding: 0; }
.needs { font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: .95rem; color: var(--muted); margin: -.2rem 0 1rem; }
.path-steps { list-style: none; padding: 0; margin: 1.5rem 0 0; max-width: var(--measure); display: grid; gap: .8rem; }
.path-step { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.path-step:not(.written) { background: transparent; border-style: dashed; }
.path-step .num { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--ink); color: var(--cream); font: 700 1rem "Avenir Next", Avenir, system-ui, sans-serif; }
.path-step:not(.written) .num { background: var(--line); color: var(--ink); }
.path-step p { margin: 0; }
.step-title { font: 700 1.1rem/1.3 "Avenir Next", Avenir, system-ui, sans-serif; }
.step-title a { color: var(--ink); text-decoration: none; }
.step-title a:hover { color: var(--clay); text-decoration: underline; }
.step-idea { color: var(--muted); }
.symbols h2 { margin-top: 1.6rem; }
.note-card { background: #FFFBEA; border: 1px solid #E6D48A; border-radius: 6px; padding: 1.1rem 1.3rem .6rem; margin: .4rem 0 1rem;
  box-shadow: 2px 3px 0 rgba(50, 37, 31, .08); }
.formula { font: 500 1.2rem/1.5 "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--blue); margin: 0 0 .7rem; }
.seg { display: inline-block; max-width: 100%; margin-right: .35em; vertical-align: middle; }
.formula.rule { color: var(--ink); border-top: 1.5px dashed #D8C56F; padding-top: .7rem; }
.frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin: 0 .25em; line-height: 1.15; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .3em .05em; }
.frac > span:last-child { padding: .05em .3em 0; }
.pow sup { font-size: .7em; vertical-align: 1.5em; line-height: 0; margin-left: .1em; }
.paren { font-size: 2em; font-weight: 300; vertical-align: middle; line-height: 1; }
.pow .frac { margin: 0 .05em; }
.keep { margin: 1.2rem 0 .2rem; padding: .8rem 1rem; background: var(--paper-soft); border-radius: var(--radius); }
.pic { margin: 1.2rem 0; }
.pic .key { font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
.socks { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem; background: var(--paper-soft); border-radius: var(--radius); }
.dice-grid { border-collapse: separate; border-spacing: 4px; font: 600 1.05rem "Avenir Next", Avenir, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.dice-grid caption { caption-side: bottom; text-align: left; font-weight: 400; font-size: .9rem; color: var(--muted); padding-top: .5rem; }
.dice-grid th, .dice-grid td { width: 2.4rem; height: 2.4rem; text-align: center; border-radius: 6px; }
.dice-grid tbody td { background: var(--paper-soft); }
.dice-grid th.blue { background: var(--blue); color: #FFF5E8; }
.dice-grid th.orange { background: var(--orange); color: #FFF5E8; }
.dice-grid td.seven, .swatch.seven { background: var(--teal); color: #FFF5E8; }
.dice-grid td.eight, .swatch.eight { background: var(--gold); color: var(--ink); }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: -.1rem; margin: 0 .3rem 0 .8rem; }
.swatch:first-child { margin-left: 0; }
.flips { display: flex; flex-wrap: wrap; gap: .6rem; }
.flip { font: 700 1.1rem "Avenir Next", Avenir, system-ui, sans-serif; padding: .5rem .9rem; border-radius: 999px; background: var(--paper-soft); border: 2px solid var(--line); }
.flip.miss { border-color: var(--clay); color: var(--clay); background: #fff; }
.bar { display: flex; margin-top: 1.2rem; border-radius: 8px; overflow: hidden; font: 600 .9rem "Avenir Next", Avenir, system-ui, sans-serif; }
.bar span { padding: .6rem .7rem; min-width: 0; }
.bar .hit { background: var(--teal); color: #FFF5E8; }
.bar .none { background: var(--line); color: var(--ink); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.4rem; max-width: var(--measure); }
.pager-link { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-family: "Avenir Next", Avenir, system-ui, sans-serif; }
.pager-link:last-child { text-align: right; }
.pager-link.soon { border-style: dashed; background: transparent; }
a.pager-link:hover { border-color: var(--clay); color: var(--ink); }
@media (max-width: 520px) { .formula { font-size: 1.05rem; } .note-card { padding: .9rem .9rem .4rem; } .dice-grid th, .dice-grid td { width: 2rem; height: 2rem; } .pager { grid-template-columns: 1fr; } .pager-link:last-child { text-align: left; } }
.path-section h2 { margin: 1.2rem 0 0; }
.path-section:first-child h2 { margin-top: 0; }
.turn-q + .turn-q { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.everyday h2, .sim h2 { margin-top: 1.6rem; }
.sim { margin: 1.4rem 0; padding: 0 1.1rem 1rem; background: var(--paper-soft); border-radius: var(--radius); }
.sim h2 { padding-top: 1rem; margin-bottom: .6rem; }
.sim-dots { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .9rem; min-height: 1.4rem; }
.dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; display: inline-grid; place-items: center; }
.dot.hit { background: var(--teal); } .dot.miss { background: var(--line); }
.sim[data-sim="socks"] .dot.hit { background: var(--blue); } .sim[data-sim="socks"] .dot.miss { background: var(--orange); }
.dot.num { width: 1.9rem; height: 1.9rem; border-radius: 6px; background: var(--cream); font: 600 .85rem "Avenir Next", Avenir, system-ui, sans-serif; }
.dot.num.seven { background: var(--teal); color: #FFF5E8; } .dot.num.eight { background: var(--gold); }
.sim-out { font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-weight: 600; margin: .8rem 0 0; min-height: 1.6em; }
.pairs { display: grid; grid-template-columns: repeat(2, max-content); gap: .6rem; }
.pair { display: flex; gap: .4rem; padding: .6rem .8rem; border-radius: 10px; background: var(--paper-soft); border: 2px solid var(--line); }
.pair.both { border-color: var(--teal); background: #fff; }
.pair i { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: block; }
.pair i.G { background: #2E8B57; } .pair i.R { background: #B03A2E; }
.tiles { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; width: min(100%, 16rem); margin-top: 1.2rem; }
.tiles i { aspect-ratio: 1; border-radius: 3px; background: var(--paper-soft); display: block; }
.tiles i.first { background: #BFD5E6; } .tiles i.second { background: #E7C9B6; } .tiles i.both { background: var(--teal); }
