@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(/fonts/archivo-latin.woff2) format('woff2');
}

:root {
  --ticket: #ffd500;      /* shelf-ticket yellow */
  --ticket-deep: #f2c200;
  --ink: #000;
  --paper: #fff;
  --rail: #eceeee;        /* gondola grey */
  --cut: #c8102e;         /* offer red: text on white only */
  --muted: #45474a;       /* 9:1 on white, 7:1 on yellow */
  --focus: #0047ff;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 68ch;
  --cond: 'Archivo', 'Arial Narrow', Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--cond);
  font-stretch: 100%;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--cut); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ticket); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- Shelf-edge header ---- */
.edge { background: var(--ink); color: var(--paper); border-bottom: 6px solid var(--ticket); }
.edge-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; padding: 10px var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--paper); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; background: var(--ticket); color: var(--ink); font-weight: 900; font-stretch: 75%; font-size: 2.1rem; line-height: 1; }
.brand-word { font-weight: 800; font-stretch: 80%; font-size: 1.5rem; letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.nav a { color: var(--paper); text-decoration: none; font-weight: 600; padding: 6px 0; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--ticket); }

main { display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--measure); }

h1, h2, h3 { font-weight: 900; font-stretch: 72%; line-height: 0.98; letter-spacing: -0.005em; margin: 0 0 0.4em; }
h1 { font-size: clamp(2.6rem, 8vw, 5.6rem); }
h2 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h3 { font-size: 1.5rem; font-stretch: 80%; }
.lede { font-size: 1.25rem; max-width: 46ch; margin: 0 0 1.5rem; }
.small { font-size: 0.9375rem; color: var(--muted); }
.num { font-variant-numeric: tabular-nums lining-nums; }

.page-head { padding: clamp(28px, 6vw, 64px) 0 24px; }
.section { padding: clamp(32px, 6vw, 72px) 0; }
.section + .section { border-top: 6px solid var(--ink); }
.rail { background: var(--rail); }

/* ---- Calculator ---- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.pack {
  position: relative;
  border: 0; margin: 0;
  background: var(--ticket);
  padding: 16px 16px 18px;
  box-shadow: 0 4px 0 var(--ink);
  min-width: 0;
}
.pack legend { float: left; width: 100%; padding: 0; margin: 0 0 10px; font-weight: 900; font-stretch: 75%; font-size: 1.4rem; line-height: 1; }
.pack > .field, .pack > .row2 { clear: both; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label, .field .lab { font-weight: 700; font-size: 0.9375rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pack input, .pack select, .ctl select {
  width: 100%; min-width: 0;
  font: inherit; font-size: 1.0625rem;
  padding: 9px 10px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper); color: var(--ink);
}
.pack input[aria-invalid="true"] { border-color: var(--cut); box-shadow: inset 0 0 0 2px var(--cut); }
.money { position: relative; }
.money span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-weight: 700; pointer-events: none; }
.money input { padding-left: 24px; }
.err { color: var(--ink); background: var(--paper); border-left: 4px solid var(--cut); padding: 4px 8px; font-size: 0.875rem; font-weight: 600; margin: 2px 0 0; }
.remove { position: absolute; top: 10px; right: 10px; font: inherit; font-weight: 700; font-size: 0.875rem; background: none; border: 2px solid var(--ink); padding: 3px 8px; cursor: pointer; }
.remove:hover { background: var(--ink); color: var(--ticket); }
.add {
  font: inherit; font-weight: 800; font-stretch: 80%; font-size: 1.3rem;
  min-height: 140px; width: 100%;
  border: 3px dashed var(--ink); background: var(--paper); cursor: pointer;
}
.add:hover { background: var(--rail); }
.btn { font: inherit; font-weight: 700; padding: 10px 16px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn:hover { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.ctl { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 18px; margin: 22px 0 0; }
.ctl label { font-weight: 700; display: grid; gap: 4px; }
.ctl select { width: auto; }
.source { margin-top: 10px; }

/* Results: the ticket is the moment */
.results { margin-top: 34px; }
.results h2 { margin-bottom: 14px; }
.winner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: end;
  background: var(--ticket); padding: 18px 20px 16px; box-shadow: 0 6px 0 var(--ink);
  border-top: 10px solid var(--ink);
}
.winner .who { font-weight: 800; font-stretch: 85%; font-size: 1.35rem; line-height: 1.15; }
.winner .why { margin: 6px 0 0; }
.big { font-weight: 900; font-stretch: 62%; font-size: clamp(4.5rem, 16vw, 9.5rem); line-height: 0.82; letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums; text-align: right; }
.big small { display: block; font-size: 1.05rem; font-stretch: 100%; font-weight: 700; letter-spacing: 0; text-align: right; margin-top: 0.3em; }
.ranks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.ranks li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 12px 14px; border: 2px solid var(--ink); background: var(--paper); }
.ranks .pos { font-weight: 900; font-stretch: 70%; font-size: 1.7rem; line-height: 1; }
.ranks .name { font-weight: 700; }
.ranks .ppu { font-weight: 900; font-stretch: 70%; font-size: 1.7rem; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.ranks .meta { grid-column: 2 / -1; font-size: 0.9375rem; color: var(--muted); }
.dearer { color: var(--cut); font-weight: 800; }
.flag { display: inline-block; background: var(--cut); color: var(--paper); font-weight: 800; font-size: 0.8125rem; padding: 2px 7px; margin-right: 6px; }
.flag.tie { background: var(--ink); }
.flag.meh { background: var(--muted); }
.empty { border: 3px dashed var(--ink); padding: 18px; font-weight: 600; }
.shared { min-height: 1.5em; font-weight: 600; }

/* ---- Category shelf ---- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0; border-top: 6px solid var(--ink); }
.label-card { display: grid; gap: 6px; align-content: start; padding: 18px 18px 22px; border-bottom: 2px solid var(--ink); text-decoration: none; background: var(--paper); }
.label-card:hover { background: var(--ticket); }
.label-card h3 { margin: 0; }
.label-card .from { font-weight: 900; font-stretch: 65%; font-size: 3rem; line-height: 0.9; font-variant-numeric: tabular-nums; }
.label-card .from small { font-size: 1rem; font-stretch: 100%; font-weight: 700; }
@media (min-width: 560px) { .label-card { border-right: 2px solid var(--ink); } }

.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 2px solid var(--ink); max-width: 860px; }
.guide-list a { display: block; padding: 16px 0; border-bottom: 2px solid var(--ink); text-decoration: none; }
.guide-list a:hover .gt { text-decoration: underline; text-decoration-color: var(--cut); }
.guide-list .gt { display: block; font-weight: 800; font-stretch: 85%; font-size: 1.4rem; line-height: 1.15; }

/* ---- League tables ---- */
.checked { display: inline-block; background: var(--ticket); padding: 6px 10px; font-weight: 700; margin: 0 0 18px; }
.tools { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; margin: 0 0 14px; }
.tools label { font-weight: 700; display: grid; gap: 4px; max-width: 100%; }
.tools label { grid-template-columns: minmax(0, 1fr); }
.tools select { width: 100%; max-width: 100%; }
.tools select { font: inherit; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 0; background: var(--paper); }
table.league { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.league caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
.league th, .league td { text-align: left; padding: 10px 10px; border-bottom: 2px solid var(--ink); vertical-align: top; }
.league thead th { border-bottom: 6px solid var(--ink); font-size: 0.9375rem; white-space: nowrap; }
.league th button { font: inherit; font-weight: 800; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.league th button::after { content: ' ↕'; color: var(--muted); }
.league th[aria-sort="ascending"] button::after { content: ' ↑'; color: var(--ink); }
.league th[aria-sort="descending"] button::after { content: ' ↓'; color: var(--ink); }
.league .r { text-align: right; }
.league td.ppu { font-weight: 900; font-stretch: 70%; font-size: 1.55rem; line-height: 1; white-space: nowrap; }
.league tbody tr:first-child td.ppu { background: var(--ticket); }
.league .prod a { font-weight: 700; }
.league .notes { font-size: 0.9375rem; max-width: 30ch; }
.league .notes p { margin: 0 0 4px; }
.retailer { font-weight: 600; }
@media (min-width: 761px) { .league td[data-l="Pack"], .league td[data-l="Shop"] { white-space: nowrap; } }
.league tr.is-trap td:first-child { box-shadow: inset 6px 0 0 var(--cut); }

@media (max-width: 760px) {
  .league thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .league, .league tbody, .league tr, .league td { display: block; width: 100%; }
  .league tr { position: relative; border-bottom: 2px solid var(--ink); padding: 12px 0 12px 44px; }
  .league tr.is-trap { box-shadow: inset 6px 0 0 var(--cut); padding-left: 52px; }
  .league tr.is-trap td:first-child { box-shadow: none; }
  .league td { border: 0; padding: 2px 0; }
  .league td.pos { position: absolute; left: 0; top: 12px; width: auto; font-weight: 900; font-stretch: 70%; font-size: 1.6rem; }
  .league tr.is-trap td.pos { left: 14px; }
  .league td[data-l]::before { content: attr(data-l) ': '; font-weight: 700; }
  .league td.ppu { font-size: 2.1rem; margin: 4px 0; }
  .league td.ppu::before { content: none; }
  .league tbody tr:first-child td.ppu { display: inline-block; width: auto; padding: 4px 8px; }
  .league .notes { max-width: none; }
  .league .r { text-align: left; }
}

/* ---- Prose pages ---- */
.prose h2 { margin-top: 1.6em; font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.prose p, .prose li { max-width: var(--measure); }
.prose li { margin-bottom: 0.4em; }
.callout { background: var(--ticket); padding: 14px 18px; box-shadow: 0 4px 0 var(--ink); margin: 1.4em 0; max-width: var(--measure); }
.callout p { margin: 0.3em 0; }
.sources { font-size: 0.9375rem; border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 2.4em; }
.ex { border-collapse: collapse; margin: 1em 0 1.6em; font-variant-numeric: tabular-nums; width: 100%; max-width: 720px; }
.ex th, .ex td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 2px solid var(--ink); vertical-align: top; }
.ex td.r, .ex th.r { text-align: right; }

/* ---- Footer ---- */
.foot { background: var(--ink); color: var(--paper); margin-top: 60px; border-top: 6px solid var(--ticket); }
.foot-in { max-width: 1180px; margin: 0 auto; padding: 28px var(--gutter) 40px; display: grid; gap: 10px; }
.foot a { color: var(--paper); }
.foot p { margin: 0; max-width: 70ch; }
.foot .small { color: #d0d0d0; display: flex; flex-wrap: wrap; gap: 6px 20px; }

@media (max-width: 560px) {
  .winner { grid-template-columns: 1fr; }
  .big, .big small { text-align: left; }
  .ranks li { grid-template-columns: 2rem minmax(0, 1fr); }
  .ranks .ppu { grid-column: 2; text-align: left; }
}
@media (prefers-reduced-motion: no-preference) {
  .winner.pop { animation: pop 260ms cubic-bezier(.2,.9,.3,1.3); }
  @keyframes pop { from { transform: translateY(6px) rotate(-0.6deg); } to { transform: none; } }
}
