/* Fonts are served from this site (web/fonts/, Latin subsets), so no visitor data goes to a font host. */
@font-face { font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/anton.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(fonts/fraunces.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 300 700; font-display: swap; src: url(fonts/fraunces-italic.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500 600; font-display: swap; src: url(fonts/inter.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #0a3320;          /* deep sandwich-shop green; the scratch canvas in app.js reads this */
  --fg: #fffbea;
  --muted: #a9c4b3;
  --line: rgba(255, 251, 234, 0.16);
  --hot: #ffc20d;         /* sandwich-shop yellow */
  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;   /* tiny uppercase labels only */
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 18px/1.5 var(--serif); font-variation-settings: "SOFT" 100, "WONK" 1; -webkit-font-smoothing: antialiased; overflow-x: hidden; overflow-x: clip; }   /* clip keeps the pinned photo working on phones */
main { max-width: 1500px; margin: 0 auto; padding-inline: clamp(20px, 4vw, 64px); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
h2, h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; margin: 0; text-wrap: balance; }

/* Intro: a pile of sandwiches hidden under the green; moving the pointer rubs it away */
.intro { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; position: relative; }
.pile, #scratch { position: absolute; top: 0; left: 50%; width: 100vw; height: 100%; transform: translateX(-50%); }
.pile { overflow: hidden; }
.pile img { position: absolute; height: auto; }
.intro-text { position: relative; display: flex; flex-direction: column; gap: 14px; pointer-events: none; }
.intro-text h1 { margin-bottom: 10px; }
h1 { font: 400 clamp(64px, 13vw, 210px)/0.88 var(--display); text-transform: uppercase; margin: 0; text-wrap: balance; text-shadow: 0 2px 30px rgba(6, 34, 21, 0.75); }
.intro p { font-size: clamp(19px, 1.7vw, 25px); line-height: 1.45; margin: 0; max-width: 34em; text-shadow: 0 1px 14px rgba(6, 34, 21, 0.95), 0 0 3px rgba(6, 34, 21, 0.9); }
/* The paragraph keeps a strip of green behind each line, so it stays readable once the pile is uncovered */
.intro p span { background: var(--bg); padding: 0.12em 0.35em; margin-left: -0.35em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.meter { position: absolute; bottom: 22px; right: calc(50% - 50vw + 22px); width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(var(--hot) calc(var(--p, 0) * 1%), rgba(255, 251, 234, 0.22) 0); box-shadow: 0 0 0 4px var(--bg); pointer-events: none; }
#scratch { transition: opacity 0.6s; }
.fx { pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; border: 3px solid var(--hot); translate: -50% -50%; pointer-events: none; opacity: 0; }
.intro.done #scratch { opacity: 0; }

/* Stage: photo floats on the left, the comparison scrolls on the right */
.stage { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
.left { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; justify-content: center; }
.plate { width: 100%; display: grid; place-items: center; }
.plate > * { grid-area: 1 / 1; }
.photo { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: contain; filter: drop-shadow(0 34px 26px rgba(0, 0, 0, 0.5)); }
.photo.whole { max-height: 62vh; width: min(92%, 760px); }

.stop { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 36px; }
.label { display: flex; align-items: center; gap: 12px; font: 600 13px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.label b { color: var(--hot); font-weight: 600; }
.label .emoji { font-size: 20px; letter-spacing: 0; }
.verdict { font-size: 11px; letter-spacing: 0.12em; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.verdict.same { color: var(--bg); background: var(--hot); border-color: var(--hot); }
.stop h2 { font-size: clamp(41px, 4.95vw, 85px); line-height: 0.92; margin-top: -12px; }

/* Who picked what: one row per ingredient, one column per model */
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
thead th { padding: 0 4px 14px; font: 500 12px var(--sans); color: var(--fg); text-align: center; vertical-align: bottom; }
thead th:first-child { width: 36%; }
thead th .logo { display: block; margin: 0 auto 8px; width: 22px; height: 22px; }
.logo { display: inline-block; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
tbody tr { border-top: 1px solid var(--line); cursor: pointer; }
tbody tr:focus-visible { outline: 2px solid var(--hot); outline-offset: -2px; }
tbody th { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 6px; font: 400 17px/1.2 var(--serif); color: var(--muted); text-align: left; }
tbody th img { flex: none; width: 64px; height: 30px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.4)); }
tbody td { padding: 12px 4px; text-align: center; font: 400 clamp(20px, 1.9vw, 28px)/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
tbody td.best { color: var(--hot); }
tbody td.fave { color: var(--fg); background: rgba(255, 251, 234, 0.05); }
tbody td.fave.best { color: var(--hot); }
tbody tr.on { background: rgba(255, 251, 234, 0.08); }
tbody tr.on th { color: var(--fg); }
tbody tr.pin { box-shadow: inset 3px 0 0 var(--hot); }

/* The agreed sandwich */
.final { gap: 24px; }
.final .inline { display: none; }
.final .list { font-size: 19px; line-height: 1.6; color: var(--muted); margin: 0; max-width: 30em; }

/* The vote */
.vote { padding-block: 16vh 20vh; display: flex; flex-direction: column; gap: 40px; border-top: 1px solid var(--line); }
.vote h2 { font-size: clamp(56px, 7.4vw, 124px); line-height: 0.9; }
.vote > p { font-size: clamp(18px, 1.5vw, 22px); color: var(--muted); margin: -20px 0 0; }
.ballots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 28px); align-items: stretch; }
@media (max-width: 1100px) { .ballots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Each card: label and title on top, the sandwich centred, ingredients in one run underneath */
.ballot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 26px 18px 30px; border-radius: 20px; border: 1.5px solid rgba(255, 251, 234, 0.3); transition: background 0.2s, transform 0.25s cubic-bezier(.2, .9, .25, 1.2); }
.voted .ballot:not(.chosen) { border-color: transparent; }
.ballot .side { display: contents; }
.ballot .cap { order: 1; display: inline-flex; align-items: center; gap: 10px; font: 500 15px var(--sans); min-height: 40px; color: var(--fg); }
.ballot .letter { font: 400 clamp(28px, 2.4vw, 38px)/1 var(--display); text-transform: uppercase; color: var(--hot); }
.ballot .kind { order: 2; font: italic 400 19px/1.3 var(--serif); color: var(--fg); min-height: 2.6em; margin-bottom: 10px; }
.ballot img { order: 3; width: calc(94% * var(--fit, 1)); height: auto; aspect-ratio: 1.95; object-fit: contain; filter: drop-shadow(0 20px 16px rgba(0, 0, 0, 0.45)); }
@media (hover: hover) { .ballot:hover { background: rgba(255, 251, 234, 0.06); transform: translateY(-6px); } }
.ballot .ings { order: 5; display: block; max-width: 21em; margin-top: 12px; }
.ballot .ing { display: inline; font-size: 16px; line-height: 1.5; color: var(--muted); }
.ballot .ing + .ing::before { content: " · "; }
.ballot.chosen { --fg: #0a3320; --muted: #5b7565; background: #fffbea; color: var(--fg); box-shadow: 0 0 0 4px var(--hot); }
.ballot.chosen .tally i { background: #e8aa00; }
.ballot.chosen img { filter: drop-shadow(0 9px 10px rgba(0, 0, 0, 0.15)); }
/* After the vote the model's name is the answer, so it is bigger than the title under it */
.voted .ballot .cap { font: 400 clamp(24px, 2vw, 30px)/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; gap: 12px; }
.voted .ballot .cap .logo { width: 26px; height: 26px; }
.voted .ballot:not(.chosen) img { opacity: 0.75; }
.voted .ballot { cursor: default; }
.voted .ballot:hover { transform: none; }
.voted .ballot:not(.chosen):hover { background: none; }
.ballot .tally { order: 4; display: flex; align-items: center; justify-content: center; width: 100%; gap: 10px; margin: 10px 0 0; min-height: 28px; }   /* holds its space while the totals load */
.ballot .tally .track { flex: 0 0 34%; height: 8px; display: flex; justify-content: flex-end; }   /* bars grow leftwards from the number */
.ballot .tally i { display: block; height: 100%; border-radius: 4px 0 0 4px; background: var(--muted); min-width: 2px; }
.ballot .tally b { font: 400 26px/1 var(--display); }
.ballot .tally small { font: 500 12px var(--sans); color: var(--muted); white-space: nowrap; }
.retry { color: var(--hot); text-decoration: underline; text-underline-offset: 4px; }
.ballot:focus-visible { outline: 2px solid var(--fg); outline-offset: 7px; }
/* Read by screen readers, not shown */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The research section: one finding per row, words on the left, evidence on the right */
.more { padding-block: 14vh 18vh; border-top: 1px solid var(--line); }
.more header { display: flex; flex-direction: column; gap: 28px; margin-bottom: 12vh; }
.more header h2 { font-size: clamp(48px, 7.4vw, 124px); line-height: 0.9; max-width: 14em; }
.more header p { font-size: clamp(19px, 1.6vw, 24px); color: var(--muted); margin: 0; max-width: 36em; }
.finding { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 104px); align-items: start; padding-block: 9vh; border-top: 1px solid var(--line); }
.more { counter-reset: finding; }
.finding h3 { font-size: clamp(34px, 3.8vw, 64px); line-height: 0.95; margin-bottom: 24px; }
.finding h3::before { counter-increment: finding; content: counter(finding) ". "; color: var(--hot); }
.finding .short, .finding .extra, .finding .more-btn, .deck-count { display: none; }   /* phone cards only */
.finding p { font-size: 19px; line-height: 1.55; color: var(--muted); margin: 0 0 1em; max-width: 31em; }
figure { margin: 0; display: flex; flex-direction: column; gap: 22px; }
figcaption { order: 2; font: italic 400 15px/1.45 var(--serif); color: var(--muted); max-width: 34em; }
.why { padding-block: 12vh 6vh; border-top: 1px solid var(--line); }
.why h2 { font-size: clamp(48px, 7.4vw, 124px); line-height: 0.9; margin-bottom: 40px; }
.why p { font-size: clamp(20px, 1.7vw, 26px); line-height: 1.5; margin: 0 0 1em; max-width: 34em; }
.nits { padding-block: 10vh 4vh; border-top: 1px solid var(--line); }
.nits h2 { font-size: clamp(34px, 3.8vw, 64px); line-height: 0.95; margin-bottom: 18px; }
.caveats summary { display: inline-flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; margin: 10px 0 0; padding: 12px 22px; border: 1.5px solid var(--hot); border-radius: 999px; color: var(--hot); font: 600 13px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; transition: background 0.2s, color 0.2s; }
.caveats summary::-webkit-details-marker { display: none; }
.caveats summary::after { content: "↓"; font-size: 16px; line-height: 1; transition: rotate 0.3s; }
.caveats[open] summary { background: var(--hot); color: var(--bg); }
.caveats[open] summary::after { rotate: 180deg; }
.caveats summary .open, .caveats[open] summary .shut { display: none; }
.caveats[open] summary .open { display: inline; }
.caveats summary:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
@media (hover: hover) { .caveats summary:hover { background: var(--hot); color: var(--bg); } }
.nit-group { font-size: clamp(26px, 2.4vw, 38px); line-height: 1; color: var(--fg); margin: 64px 0 22px; }
#pantry { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
#pantry b { display: inline-block; min-width: 7em; color: var(--fg); font-weight: 500; text-transform: capitalize; }
.nit-list { display: flex; flex-direction: column; }
.nit-list > div { display: grid; grid-template-columns: minmax(0, 15em) minmax(0, 46em); gap: 8px clamp(24px, 4vw, 64px); padding-block: 18px; border-top: 1px solid var(--line); }
.nit-list > div > p, .nit-list > div > h4 { grid-column: 2; }
.nit-list > div > h4 { grid-column: 1; grid-row: 1 / span 3; padding-top: 5px; }
.nit-list h4 { font: 600 12px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--hot); margin: 0 0 8px; }
.nit-list p { font-size: 17px; line-height: 1.55; color: var(--muted); margin: 0; }
.stop .note { font: italic 400 14px/1.4 var(--serif); color: var(--muted); margin: 12px 0 0; }

/* Charts */
.bars { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 18px; align-items: center; }
.bars .name { font-size: 18px; color: var(--fg); }
.bars .name small { display: block; font-size: 14px; color: var(--muted); }
.bars .track { position: relative; height: 34px; }
.bars .track::before { content: ""; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: var(--line); }
.bars .bar { position: absolute; top: 0; bottom: 0; background: var(--muted); border-radius: 0 4px 4px 0; }
.bars .bar.neg { border-radius: 4px 0 0 4px; }
.bars .bar.clear { background: var(--hot); }
.bars .val { position: absolute; top: 50%; transform: translateY(-50%); font: 400 20px/1 var(--display); padding-inline: 8px; white-space: nowrap; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 3vw, 44px); }
.duo div { display: flex; flex-direction: column; gap: 14px; }
.duo img { width: 100%; height: auto; filter: drop-shadow(0 18px 14px rgba(0, 0, 0, 0.45)); }
.duo b { font: 600 12px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--hot); }
.duo span { font-size: 17px; line-height: 1.45; color: var(--muted); }
.duo mark { background: none; color: var(--fg); border-bottom: 2px solid var(--hot); }
.matrix { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)); gap: 2px; align-items: stretch; max-width: 620px; }
.matrix .head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 12px; font: 500 13px var(--sans); }
.matrix .side { display: flex; align-items: center; gap: 10px; padding-right: 18px; font: 500 14px var(--sans); }
.matrix .cell { aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 4px; font: 400 clamp(24px, 2.6vw, 40px)/1 var(--display); background: rgba(255, 194, 13, var(--a)); }
.matrix .cell.ink { color: var(--bg); }
.matrix .cell.self { background: none; color: var(--line); }
.who-bars { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 18px; align-items: center; }
.who-bars .name { display: flex; align-items: center; gap: 10px; font: 500 14px var(--sans); }
.who-bars .track { height: 34px; display: flex; align-items: center; gap: 10px; }
.who-bars .bar { height: 100%; background: var(--muted); border-radius: 0 4px 4px 0; min-width: 2px; }
.who-bars .bar.clear { background: var(--hot); }
.who-bars .val { font: 400 22px/1 var(--display); white-space: nowrap; }
.slots { display: flex; align-items: flex-end; gap: 3px; height: 240px; border-bottom: 1px solid var(--line); }
.slots i { flex: 1; background: var(--muted); border-radius: 3px 3px 0 0; position: relative; }
.slots i:first-child { background: var(--hot); }
@media (hover: hover) { .slots i:hover { background: var(--fg); } }
.slots i b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 6px; font: 400 18px/1 var(--display); white-space: nowrap; }
.slots i:not(:first-child):not(:last-child):not(:hover) b { display: none; }
@media (hover: none) { .slots i:not(:first-child):not(:last-child) b { display: none; } }   /* no tap-to-see on touch screens */
.axis { display: flex; justify-content: space-between; font: 500 12px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: -12px; }

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .photo.in { animation: settle 0.6s cubic-bezier(.2, .9, .25, 1.12) 0.08s both; }
  .photo.out { animation: leave 0.32s ease-in both; }
  @keyframes leave { to { transform: translateY(9vh) rotate(2.5deg); opacity: 0; } }
  .intro.done .pile img { animation: jiggle 0.7s ease-in-out both; animation-delay: var(--d); }
  .pile img.wig, .intro.done .pile img.wig { animation: wig 0.6s ease-in-out both; animation-delay: 0s; }
  .ripple { animation: ripple 0.6s cubic-bezier(.2, .7, .3, 1) both; }
  @keyframes ripple { from { scale: 0.25; opacity: 0.95; } to { scale: 1.3; opacity: 0; } }
  @keyframes wig { 25% { translate: 0 -9px; rotate: 8deg; } 55% { translate: 0 4px; rotate: -6deg; } 80% { translate: 0 -2px; rotate: 3deg; } 100% { translate: 0 0; rotate: 0deg; } }
  @keyframes jiggle { 20% { translate: 0 -14px; rotate: 9deg; } 45% { translate: 0 6px; rotate: -7deg; } 70% { translate: 0 -4px; rotate: 4deg; } 100% { translate: 0 0; rotate: 0deg; } }
  .bars .bar, .who-bars .bar { transition: transform 0.9s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 90ms); transform-origin: left; }
  .bars .bar.neg { transform-origin: right; }
  .wait .bars .bar, .wait .who-bars .bar { transform: scaleX(0); }
  .bars .val, .who-bars .val { transition: opacity 0.4s; transition-delay: calc(var(--i, 0) * 90ms + 0.55s); }
  .wait .val { opacity: 0; }
  .slots i { transition: transform 0.7s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 18ms); transform-origin: bottom; }
  .wait .slots i { transform: scaleY(0); }
  .matrix .cell { transition: scale 0.5s cubic-bezier(.2, .9, .25, 1.3), opacity 0.4s; transition-delay: calc(var(--i, 0) * 45ms); }
  .wait .matrix .cell { scale: 0.5; opacity: 0; }
  .duo img, .final .inline { transition: translate 0.7s cubic-bezier(.2, .9, .25, 1.2), rotate 0.7s cubic-bezier(.2, .9, .25, 1.2), opacity 0.4s; transition-delay: calc(var(--i, 0) * 140ms); }
  .wait .duo img, .wait.final .inline { translate: 0 -34px; rotate: -4deg; opacity: 0; }
  tbody tr { transition: opacity 0.5s; transition-delay: calc(var(--i, 0) * 70ms); }
  tbody td, tbody th { transition: translate 0.5s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
  .wait tbody tr { opacity: 0; }
  .wait tbody td, .wait tbody th { translate: 0 12px; }
  .stacked .finding { transition: transform 0.45s cubic-bezier(.2, .85, .3, 1.1), opacity 0.3s; }
  .stacked .finding.drag { transition: none; }
  .finding.nudge { animation: nudge 1.1s ease-in-out 0.25s; }
  @keyframes nudge { 14% { transform: translateX(-45px) rotate(-5.5deg); } 32% { transform: translateX(38px) rotate(5deg); } 50% { transform: translateX(-25px) rotate(-3.5deg); } 68% { transform: translateX(15px) rotate(2deg); } 84% { transform: translateX(-6px) rotate(-0.7deg); } }
  /* The reveal after voting: the pick pops, names rise in one by one, tally bars grow */
  .reveal .ballot.chosen { animation: pick 0.55s cubic-bezier(.2, .9, .25, 1.25) both; }
  .reveal .ballot:not(.chosen) img { animation: dim 0.6s both; }
  .reveal .ballot .cap { animation: rise 0.5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--n, 0) * 110ms + 0.15s); }
  .reveal .ballot .tally i { transform-origin: right; animation: grow 0.8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--n, 0) * 110ms + 0.35s); }
  .reveal .ballot .tally b, .reveal .ballot .tally small { animation: rise 0.4s both; animation-delay: calc(var(--n, 0) * 110ms + 0.75s); }
  @keyframes pick { from { scale: 0.94; opacity: 0.35; box-shadow: 0 0 0 0 var(--hot); } }
  @keyframes dim { from { opacity: 1; } }
  @keyframes rise { from { opacity: 0; translate: 0 12px; } }
  @keyframes grow { from { transform: scaleX(0); } }
  @keyframes settle { from { transform: translateY(-9vh) rotate(-2.5deg); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Phones: the photo sticks to the top of the screen and each category scrolls underneath it */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .intro { min-height: 100vh; min-height: 100svh; }
  .intro p { font-size: 18px; }
  .meter { bottom: 16px; right: calc(50% - 50vw + 16px); }
  /* To drop the scratch cover on phones, uncomment:  #scratch, .meter { display: none; } */

  .stage { display: block; }
  .left { height: 30vh; height: 30svh; z-index: 2; background: linear-gradient(var(--bg) 86%, transparent); padding-block: 12px 26px; }
  .photo { max-height: 21vh; max-height: 21svh; filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.5)); }
  .photo.whole { max-height: 23vh; max-height: 23svh; width: auto; max-width: 92%; }
  .stop { min-height: 70vh; min-height: 70svh; justify-content: flex-start; gap: 22px; padding-block: 18px 48px; }
  .stop h2 { font-size: 36px; margin-top: -6px; }
  .stop:nth-last-child(2) { min-height: 0; padding-bottom: 28px; }
  .label { font-size: 12px; gap: 10px; }

  thead th { font-size: 10px; padding: 0 1px 10px; }
  thead th:first-child { width: 31%; }
  thead th .logo { width: 18px; height: 18px; margin-bottom: 6px; }
  tbody th { font-size: 15px; padding: 13px 4px 13px 2px; min-height: 44px; }
  tbody th img { display: none; }      /* the big photo above already shows it */
  tbody td { font-size: 19px; padding: 12px 1px; }
  .final .list { font-size: 17px; }
  /* The slop sandwich is not pinned: it slides over the pinned photo and scrolls with its text */
  .stop.final { position: relative; z-index: 3; min-height: 0; padding-block: 12px 72px; background: var(--bg); margin-inline: calc(-1 * clamp(20px, 4vw, 64px)); padding-inline: clamp(20px, 4vw, 64px); }
  .stop.final::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 48px; background: linear-gradient(transparent, var(--bg)); }
  .final .inline { display: block; align-self: center; width: auto; height: auto; max-width: 94%; max-height: 32vh; max-height: 32svh; object-fit: contain; filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.5)); margin-bottom: 8px; }
  /* Only the ingredient name is tappable, so a thumb brushing a row while scrolling does nothing */
  tbody tr { cursor: default; }
  tbody th span { text-decoration: underline dotted rgba(255, 251, 234, 0.35); text-underline-offset: 5px; }

  .vote { padding-block: 10vh 12vh; gap: 28px; }
  .vote h2 { font-size: 52px; }
  .vote > p { margin-top: -10px; }
  .ballots { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .ballot { padding: 18px 12px 24px; }
  .ballot .cap { min-height: 0; margin-bottom: 2px; }
  .ballot .letter { font-size: 30px; }
  .ballot .kind { font-size: 20px; min-height: 0; margin-bottom: 6px; }
  .ballot img { width: calc(64% * var(--fit, 1)); aspect-ratio: auto; }
  .ballot .ings { margin-top: 6px; }
  .ballot .ing { font-size: 15px; }

  .more { padding-block: 10vh 8vh; }
  .more header { margin-bottom: 6vh; gap: 18px; }
  .more header h2, .why h2 { font-size: 44px; }
  /* Findings: a stack of cream cards; throw the top one sideways to see the next (app.js places them) */
  .more { margin-inline: calc(-1 * clamp(20px, 4vw, 64px)); padding-inline: clamp(20px, 4vw, 64px); overflow: hidden; }   /* thrown cards must not widen the page */
  .deck { position: relative; touch-action: pan-y; }
  /* Until the script has set the stack up (or if it never runs), the findings are a plain list */
  .finding { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 6vh; }
  .finding h3 { font-size: 34px; }
  .finding p { font-size: 17px; }
  .stacked .finding { --fg: #0a3320; --muted: #5b7565; --line: rgba(10, 51, 32, 0.2); --hot: #e8aa00;
    position: absolute; top: 0; left: 0; right: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 22px 18px 20px;
    border: 0; border-radius: 22px; background: #fffbea; color: var(--fg); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
    transform-origin: 50% 100%; will-change: transform; user-select: none; -webkit-user-select: none; }
  .stacked .finding.drag { transition: none; }
  .stacked .finding .words { display: contents; }
  .stacked .finding h3 { font-size: 30px; margin-bottom: 22px; }
  .stacked .finding figure { order: 1; margin-bottom: 22px; gap: 14px; }
  .stacked .finding figcaption { font-size: 13px; }
  .stacked .finding p { order: 3; font-size: 16px; display: none; }
  .stacked .finding .short { order: 2; display: block; color: var(--fg); margin-bottom: 14px; }
  .stacked .finding.open .extra { display: block; }
  .stacked .finding .more-btn { order: 4; display: inline-flex; align-self: flex-start; padding: 8px 0; font: 600 12px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
  .stacked .finding h3::before { color: #b88500; }   /* 3:1 on cream; the page yellow is only 2:1 there */
  .stacked .finding button:focus-visible { outline-color: var(--fg); }
  .stacked .finding .duo b { color: var(--fg); }
  .stacked .finding .duo img { filter: drop-shadow(0 9px 9px rgba(0, 0, 0, 0.22)); }
  .stacked .finding .matrix .cell { background: rgba(10, 51, 32, var(--a)); }
  .stacked .finding .matrix .cell.ink { color: #fffbea; }
  .stacked .finding .matrix .cell.self { background: none; }
  .deck-count { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 22px 0 7vh; font: 400 22px/1 var(--display); letter-spacing: 0.04em; }
  .deck-count button { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--hot); color: var(--hot); font: 400 20px/1 var(--sans); }
  .deck-count button:disabled { opacity: 0.3; }
  .nits h2 { font-size: 34px; }
  .nit-group { margin: 40px 0 22px; }
  .why { padding-block: 8vh 4vh; }
  .why p { font-size: 18px; }
  .nit-list > div { grid-template-columns: minmax(0, 1fr); padding-block: 16px; }
  .nit-list > div > h4, .nit-list > div > p { grid-column: 1; grid-row: auto; }
  .nit-list p { font-size: 16px; }
  #pantry b { display: block; }

  .bars { grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr); gap: 12px 10px; padding-right: 16px; }
  .bars .name { font-size: 15px; line-height: 1.25; }
  .bars .name small { font-size: 12px; }
  .bars .track { height: 28px; }
  .bars .val { font-size: 17px; padding-inline: 5px; }
  .duo span { font-size: 15px; }
  .duo img { aspect-ratio: 2 / 1; object-fit: contain; }   /* keeps the two labels level */
  .matrix .side { padding-right: 10px; font-size: 12px; gap: 6px; }
  .matrix .head { font-size: 9.5px; }
  .who-bars { gap: 12px 12px; }
  .who-bars .name { font-size: 13px; }
  .slots { height: 180px; gap: 2px; padding-inline: 16px; }   /* room for the first and last labels */
  .axis { font-size: 10px; }
}

/* Tablets and small laptop windows: the table gets more of the row and loses its thumbnails so nothing collides */
@media (min-width: 761px) and (max-width: 1360px) {
  .stage { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); gap: clamp(20px, 3vw, 40px); }
  .stop h2 { font-size: clamp(36px, 5vw, 58px); }
  thead th { font-size: 10px; padding: 0 1px 12px; }
  thead th:first-child { width: 31%; }
  tbody th { font-size: 15px; padding: 12px 4px 12px 2px; }
  tbody th img { display: none; }
  tbody td { font-size: clamp(17px, 2vw, 22px); padding: 12px 1px; }
}

/* ?layer=... shows one section alone, for checking a single state */
body.only .intro, body.only .stop:not(.shown), body.only .vote:not(.shown), body.only .more:not(.shown) { display: none; }
body.only:has(.vote.shown) .stage, body.only:has(.more.shown) .stage { display: none; }
body.only:has(.intro.shown) .intro { display: flex; }
body.one-finding .more header, body.one-finding .finding:not(.shown), body.one-finding .nits:not(.shown), body.one-finding .why:not(.shown) { display: none !important; }
body.one-finding .more { padding-block: 0; border: 0; }
body.only:has(.intro.shown) .stage, body.only:has(.intro.shown) .vote, body.only:has(.intro.shown) .more { display: none; }
@media (max-width: 380px) { tbody td { font-size: 17px; } }   /* small phones: keep "100%" columns from touching */
@media (max-width: 359px) {   /* the narrowest phones, 320 to 359px */
  tbody td { font-size: 15px; }
  thead th { font-size: 9px; }
  thead th:first-child { width: 27%; }
  tbody th { font-size: 13px; }
  tbody th span { min-width: 0; overflow-wrap: anywhere; }   /* a long name wraps instead of running into its number */
  .matrix .head { font-size: 8.5px; }
}
/* Tablets and small laptops: the renaming chart's label column must not squeeze the bars */
@media (min-width: 761px) and (max-width: 1280px) { .bars { grid-template-columns: minmax(0, 11em) minmax(0, 1fr); } }

/* Shown only when the page's script is off: a plain summary of the results */
.noscript { padding-block: 8vh; border-top: 1px solid var(--line); }
.noscript h2 { font-size: 40px; margin-bottom: 20px; }
.noscript td, .noscript tbody th { font: 400 16px/1.3 var(--serif); padding: 10px 6px; text-align: left; display: table-cell; }
.noscript thead th { text-align: left; padding: 0 6px 10px; }

/* If data.json never loads: say so, and hide the sections that would be empty */
.failed-note { font-size: 20px; padding-block: 8vh; border-top: 1px solid var(--line); }
.failed-note a { color: var(--hot); }
body.failed .stage, body.failed .vote, body.failed .more figure { display: none; }
@media (prefers-reduced-motion: reduce) { .ballot { transition: none; } }
/* Printing: nothing stays hidden waiting to be scrolled into view */
@media print {
  .wait, .wait * { transform: none !important; opacity: 1 !important; scale: 1 !important; translate: none !important; rotate: none !important; }
  #scratch, .meter { display: none; }
}
