/* Home: the page is the tier list. */
.home { display: grid; gap: var(--sp-7); }

/* ---------- first viewport: pitch left, tier rows right ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
/* below 1080px the pitch dissolves into the board so the witch's say-box can follow the tier list: the list is the first thing on a phone */
.pitch { display: contents; }
.board > .rows { order: 1; }
.pitch .say { order: 2; }
.pitch h1 span { display: block; }
.pitch h1 { font-size: var(--fs-display); line-height: 0.92; letter-spacing: -0.03em; }
.pitch .lede { color: var(--ink-2); font-size: var(--fs-lg); line-height: 1.42; max-width: 34ch; }
.search { display: flex; background: var(--accent); min-height: 60px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--accent-ink); padding: 0 var(--sp-4); font-weight: 600; }
.search input::placeholder { color: #55585f; opacity: 1; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search button { border: 0; background: var(--gold); color: var(--tier-ink); padding: 0 var(--sp-5); font-weight: 700; display: inline-flex; align-items: center; gap: var(--sp-2); }
.search button span { display: none; }
.pitch-count { color: var(--ink-3); font-size: var(--fs-sm); }
.pitch .say { margin-top: var(--sp-3); }

/* ---------- tier rows ---------- */
.rows { display: grid; gap: var(--gap); min-width: 0; align-content: start; }
.trow { display: grid; grid-template-columns: 56px minmax(0, 1fr); background: var(--surface); min-width: 0; }
.trow-label { border: 0; padding: 0; display: grid; place-items: center; align-content: center; gap: 2px; background: var(--tier-n); color: var(--tier-n-ink); font: 800 2.5rem/1 var(--font-display); transition: transform var(--dur-1) var(--ease-out); }
.trow-label small { font: 700 0.875rem/1 var(--font); letter-spacing: 0; }
/* the page's one authored press: the block bumps out and settles when it toggles */
.trow-label.pop { animation: label-pop 180ms var(--ease-out); }
@keyframes label-pop { from { transform: scale(1.06); } }
.trow[data-tier="S"] .trow-label { background: var(--tier-s); color: var(--tier-ink); }
.trow[data-tier="A"] .trow-label { background: var(--tier-a); color: var(--tier-ink); }
.trow[data-tier="B"] .trow-label { background: var(--tier-b); color: var(--tier-ink); }
.trow[data-tier="C"] .trow-label { background: var(--tier-c); color: var(--tier-ink); }
.trow[data-tier="D"] .trow-label { background: var(--tier-d); color: var(--tier-d-ink); }
/* the gap to the label is a margin OUTSIDE the scroller, so the first field always snaps cleanly at scroll position 0 */
.trow-track { display: flex; gap: var(--gap); margin-left: var(--gap); padding: var(--gap) var(--gap) var(--gap) 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior-x: contain; }
.trow-track > * { flex: none; width: 156px; scroll-snap-align: start; }
/* inside a row the fields are compact: the row label already carries the tier */
.trow-track .dfield-cover { aspect-ratio: auto; height: 62px; }
.trow-track .dfield-body { padding: 6px var(--sp-2) var(--sp-2); gap: 2px; }
.trow-track .dfield-title { font-size: 0.8125rem; line-height: 1.15; min-height: 2.3em; }
.trow-track .dfield-rate { font-size: 1.125rem; }
.trow-track .dfield-meta, .trow-track .chip.demo { display: none; }
.trow-track .dfield-crit .crit { gap: 3px; }
.trow-more { display: grid; align-content: center; gap: var(--sp-1); padding: var(--sp-3); background: transparent; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); box-shadow: inset 0 0 0 2px var(--line); }
.trow-more b { font: 800 var(--fs-2xl)/1 var(--font-display); color: var(--ink); }
.trow-empty { align-self: center; padding: var(--sp-4); color: var(--ink-3); font-size: var(--fs-sm); width: auto; }
@media (hover: hover) and (pointer: fine) { .trow-more:hover { background: var(--surface-2); color: var(--ink); } }

/* a pressed label opens its row into a grid and folds the others */
.rows.has-open .trow:not(.is-open) .trow-track { display: none; }
.rows.has-open .trow:not(.is-open) { grid-template-columns: 56px minmax(0, 1fr); }
.rows.has-open .trow:not(.is-open) .trow-label { min-height: 48px; font-size: 1.75rem; }
.rows.has-open .trow:not(.is-open) .trow-label small { display: none; }
.rows.has-open .trow:not(.is-open)::after { content: attr(data-count); align-self: center; padding: 0 var(--sp-4); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.trow.is-open .trow-track { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow: visible; }
.trow.is-open .trow-track > * { width: auto; }
.trow.is-open .dfield-cover { aspect-ratio: 16 / 10; height: auto; }
.trow.is-open .dfield-title { -webkit-line-clamp: 2; }
.trow.is-open .dfield-meta { display: block; }
.trow.is-open .dfield-title { min-height: 0; }
/* an opened tier shows every field's six criteria without hover (also on touch) */
.trow.is-open .dfield-crit { display: grid; padding: 0 var(--sp-3) var(--sp-3); }
.trow.is-open .dfield-crit .crit-bar i { background: var(--surface-3); }
.trow.is-open .dfield-crit .crit-bar i.on { background: var(--ink); }

/* one sweep when the board first appears; snapping is off while the fields move, or the scroller would snap to a moving target */
.rows.sweep .trow-track { scroll-snap-type: none; }
.rows.sweep .trow-track > * { animation: sweep var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--r, 0) * 60ms + var(--i, 0) * 28ms); }
@keyframes sweep { from { opacity: 0; transform: translateX(14px); } }

/* ---------- below the board: the same row grammar for everything else ---------- */
.band { display: grid; gap: var(--gap); }
.band > h2 { margin-bottom: var(--sp-2); }
.band-lede { color: var(--ink-2); max-width: 60ch; margin-bottom: var(--sp-3); }
/* shelves: one row per category, the label block is the category (neutral: colour only ever means a tier) */
.shelves { display: grid; gap: var(--gap); }
.shelf .trow-label { background: var(--surface-3); color: var(--ink); text-decoration: none; font-size: 1.75rem; padding: var(--sp-2); text-align: center; }
.shelf .trow-label small { font-weight: 600; color: var(--ink-2); font-size: 0.75rem; line-height: 1.2; }
/* phones: the 56px block must hold the whole category word, never split it */
.shelf .trow-label { padding: var(--sp-2) 2px; }
.shelf .trow-label small { overflow-wrap: normal; word-break: keep-all; font-size: 0.625rem; }
@media (min-width: 720px) { .shelf .trow-label small { font-size: 0.75rem; } }
@media (hover: hover) and (pointer: fine) { .shelf .trow-label:hover { background: var(--accent); color: var(--accent-ink); } .shelf .trow-label:hover small { color: var(--accent-ink); } }
.shelf-empty { display: grid; align-content: center; justify-items: start; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); color: var(--ink-2); font-size: var(--fs-sm); width: auto; }

/* six criteria shown on one real, rated design: weight block, name, the design's value as bars */
.crit-example { display: grid; gap: var(--gap); }
.crit-example > .dfield { max-width: 320px; }
.criteria { display: grid; gap: var(--gap); }
.criterion { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: stretch; background: var(--surface); }
.criterion-key { display: grid; place-items: center; background: var(--surface-3); font: 800 1.25rem/1 var(--font-display); }
.criterion-body { padding: var(--sp-3) var(--sp-4); display: grid; gap: 2px; align-content: center; min-width: 0; }
.criterion-body strong { font-weight: 700; }
.criterion-body span { color: var(--ink-2); font-size: var(--fs-sm); }
.criterion-value { display: grid; justify-items: end; align-content: center; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4) var(--sp-3) 0; }
.criterion-value b { font: 800 var(--fs-xl)/1 var(--font-display); }
.criterion-value .crit-bar { grid-template-columns: repeat(5, 12px); }
.criterion-value .crit-bar i { height: 8px; background: var(--surface-3); }
.criterion-value .crit-bar i.on { background: var(--ink); }
.band-actions { display: flex; flex-wrap: wrap; gap: var(--gap); margin-top: var(--sp-3); }

.cta { display: grid; gap: var(--sp-4); background: var(--surface); padding: var(--sp-5) var(--sp-4) 0; overflow: hidden; }
.cta-text { display: grid; gap: var(--sp-3); align-content: center; padding-bottom: var(--sp-5); }
.cta-text p { color: var(--ink-2); max-width: 48ch; }
.cta .witch { justify-self: center; align-self: end; }

@media (min-width: 720px) {
  .trow, .rows.has-open .trow:not(.is-open) { grid-template-columns: 88px minmax(0, 1fr); }
  .criterion { grid-template-columns: 88px minmax(0, 1fr) auto; }
  .trow-label { font-size: 3.5rem; }
  .trow-track > * { width: 172px; }
  .search button span { display: inline; }
  .cta { grid-template-columns: minmax(0, 1fr) auto; padding: var(--sp-6) var(--sp-6) 0; }
}
@media (min-width: 1080px) {
  .board { grid-template-columns: 430px minmax(0, 1fr); column-gap: var(--sp-6); align-items: start; margin-right: calc(var(--gutter) * -1); }
  .pitch { display: grid; gap: var(--sp-4); align-content: start; grid-template-columns: minmax(0, 1fr); position: sticky; top: calc(var(--header-h) + var(--sp-4)); min-height: min(calc(100dvh - var(--header-h) - var(--sp-7)), 800px); grid-template-rows: auto auto auto auto 1fr; }
  .pitch .say { order: 0; align-self: end; margin-top: var(--sp-5); }
  .board > .rows { order: 0; }
  .trow, .rows.has-open .trow:not(.is-open) { grid-template-columns: 118px minmax(0, 1fr); }
  .trow-label { font-size: 4.625rem; }
  .trow-label small { font-size: 0.75rem; }
  .shelf .trow-label { font-size: 2.25rem; }
  .crit-example { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
  .crit-example > .dfield { max-width: none; }
  .criterion { grid-template-columns: 118px minmax(0, 1fr) auto; }
}
