/* Britney vote — the deck's Instagram-era look: pink paper, ink outlines,
   hard offset shadows. Phone page first; the 16:9 slide board at the bottom. */

@font-face { font-family: 'GT-Maru'; src: url('/fonts/GT-Maru-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'GT-Maru'; src: url('/fonts/GT-Maru-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'GT-Maru'; src: url('/fonts/GT-Maru-Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'GT-Maru-Mono'; src: url('/fonts/GT-Maru-Mono-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PP Mori'; src: url('/fonts/PPMori-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PP Mori'; src: url('/fonts/PPMori-Semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --hot-pink: #ff3399;
  --tint-pink: #fbd0e1;
  --tint-yellow: #fbf1a3;
  --teal: #00ffcc;
  --gray-7: #555b62;

  --display: 'GT-Maru', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'PP Mori', system-ui, sans-serif;
  --mono: 'GT-Maru-Mono', ui-monospace, Menlo, monospace;

  --ease-pop: cubic-bezier(0.25, 1, 0.5, 1);
  --line: 3px solid var(--ink);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body { margin: 0; background: var(--tint-pink); color: var(--ink); font: 400 17px/1.4 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--display); font-weight: 900; margin: 0; text-wrap: balance; }
.kicker { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--hot-pink); outline-offset: 2px; }

/* ── Phone vote page ─────────────────────────────────────────────────────── */
.vote-page {
  max-width: 34rem; margin-inline: auto;
  padding: max(28px, env(safe-area-inset-top)) 16px calc(120px + env(safe-area-inset-bottom));
  display: grid; gap: 24px;
  --search-h: 78px;
  scroll-padding-top: var(--search-h);
}
.masthead { display: grid; gap: 8px; }
.masthead h1 { font-size: clamp(1.9rem, 8.6vw, 2.6rem); line-height: 0.95; letter-spacing: -0.03em; }
.dek { margin: 0; color: var(--gray-7); max-width: 32ch; }
.cta {
  justify-self: start; margin-top: 6px; padding: 12px 18px;
  font-family: var(--display); font-weight: 900; font-size: 1.05rem; text-decoration: none;
  color: var(--paper); background: var(--hot-pink); border: var(--line); box-shadow: 5px 5px 0 var(--ink);
}
.cta:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.vote-page h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }

.live { display: grid; gap: 12px; }
.dot { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--hot-pink); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.picker { display: grid; gap: 14px; }
/* Search stays reachable while scrolling 165 songs. */
.search { position: sticky; top: 0; z-index: 2; height: var(--search-h); padding-block: 10px; margin-inline: -16px; padding-inline: 16px; background: var(--tint-pink); }
.search input {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 14px 16px;
  border: var(--line); border-radius: 0; background: var(--paper); color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}
.song-groups { display: grid; gap: 22px; }
.song-groups fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.song-groups legend {
  font-family: var(--display); font-weight: 900; font-size: 1.15rem; padding: 0; margin-bottom: 8px;
  padding-block: 6px;
}
.song-groups legend span { font-family: var(--mono); font-weight: 400; font-size: 0.8rem; color: var(--gray-7); margin-left: 6px; }
.song-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.watch {
  display: grid; place-items: center; width: 52px; min-height: 48px;
  background: var(--paper); border: var(--line); color: var(--ink); text-decoration: none; font-size: 1rem;
}
.watch:active { background: var(--tint-yellow); }
.song {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 48px;
  background: var(--paper); border: var(--line); cursor: pointer;
  transition: transform 160ms var(--ease-pop), box-shadow 160ms var(--ease-pop);
}
.song input {
  appearance: none; flex: none; width: 22px; height: 22px; margin: 0;
  border: var(--line); border-radius: 50%; background: var(--paper); display: grid; place-items: center;
}
.song input::after { content: '♥'; font-size: 14px; line-height: 1; color: var(--paper); transform: scale(0); transition: transform 220ms var(--ease-pop); }
.song:has(input:checked) { background: var(--hot-pink); color: var(--paper); box-shadow: 5px 5px 0 var(--ink); transform: translate(-2px, -2px); font-weight: 600; }
.song input:checked { background: var(--ink); border-color: var(--paper); }
.song input:checked::after { transform: scale(1); }
.song:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.loading, .no-match { margin: 0; font-family: var(--mono); font-size: 0.85rem; color: var(--gray-7); }

.my-pick {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); translate: -50% 0;
  width: min(34rem - 32px, calc(100% - 32px));
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'label move' 'title move' 'standing jump';
  gap: 2px 12px; padding: 12px 16px;
  background: var(--paper); border: var(--line); box-shadow: 6px 6px 0 var(--hot-pink);
  z-index: 2;
}
.my-pick .label { grid-area: label; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--gray-7); }
.my-pick .title { grid-area: title; font-family: var(--display); font-weight: 900; font-size: 1.2rem; line-height: 1.1; min-width: 0; overflow-wrap: anywhere; }
.my-pick .standing { grid-area: standing; font-variant-numeric: tabular-nums; }
.my-pick .jump { grid-area: jump; align-self: end; justify-self: end; font-family: var(--mono); font-size: 0.75rem; color: var(--ink); text-underline-offset: 3px; padding: 6px 0; }
.my-pick .move { grid-area: move; align-self: start; justify-self: end; font-family: var(--display); font-weight: 900; font-size: 1.6rem; padding: 4px 10px; border: var(--line); }
.my-pick .move.up { background: var(--teal); }
.my-pick .move.down { background: var(--paper); color: var(--gray-7); font-size: 1.1rem; }
.my-pick.celebrate { animation: celebrate 900ms var(--ease-pop); }
.my-pick.celebrate .move { animation: pop 900ms var(--ease-pop); }
@keyframes celebrate { 20% { translate: -50% -10px; box-shadow: 10px 12px 0 var(--hot-pink); } }
@keyframes pop { 0% { transform: scale(0.4) rotate(-12deg); } 40% { transform: scale(1.25) rotate(4deg); } }
.noscript { font-family: var(--mono); background: var(--paper); border: var(--line); padding: 12px; }

/* ── <vote-board> ────────────────────────────────────────────────────────── */
vote-board { display: grid; gap: 10px; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-list li {
  position: relative; display: grid; grid-template-columns: 2.2em 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--paper); border: var(--line); overflow: hidden;
}
.board-list .bar {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--share) * 100%);
  background: var(--tint-yellow); z-index: 0; transition: width 500ms var(--ease-pop);
}
.board-list li > :not(.bar) { position: relative; z-index: 1; }
.board-list .rank { font-family: var(--display); font-weight: 900; font-size: 1.4em; font-variant-numeric: tabular-nums; }
.board-list .name { display: grid; min-width: 0; }
.board-list .name b { font-family: var(--display); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .name small { font-family: var(--mono); font-size: 0.72em; color: var(--gray-7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .votes { grid-column: 4; font-family: var(--mono); font-size: 0.8em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.board-list .count { font-family: var(--display); font-weight: 900; font-size: 1.3em; }
.board-list li.mine { border-color: var(--hot-pink); box-shadow: 4px 4px 0 var(--hot-pink); }
.board-list li.mine .bar { background: var(--tint-pink); }
.board-list li.climbed { box-shadow: 5px 5px 0 var(--teal); }
.board-list li.mine.climbed { box-shadow: 5px 5px 0 var(--hot-pink); }
.board-list .climb {
  grid-column: 3; grid-row: 1;
  font-family: var(--display); font-weight: 900; font-size: 0.75em;
  background: var(--teal); border: 2px solid var(--ink); padding: 1px 8px;
  animation: flag 1.8s var(--ease-pop) forwards;
}
.board-list li.bumped .count { display: inline-block; animation: pop 600ms var(--ease-pop); }
@keyframes flag { 0% { transform: scale(0.4) rotate(-12deg); } 15%, 80% { transform: none; } 100% { transform: translateY(-60%); opacity: 0; } }
.board-empty { margin: 0; padding: 14px; border: 3px dashed var(--ink); font-family: var(--mono); font-size: 0.85rem; text-align: center; }
.board-total { margin: 0; font-family: var(--mono); font-size: 0.75rem; color: var(--gray-7); text-align: right; font-variant-numeric: tabular-nums; }

/* Only the board rows move during a reorder; the rest of the page holds still. */
:root { view-transition-name: none; }
::view-transition-group(*) { animation-duration: 550ms; animation-timing-function: var(--ease-pop); }

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

/* ── Slide board (16:9, sized off the viewport so it scales in the iframe) ── */
.board-page {
  height: 100vh; overflow: hidden; display: grid; grid-template-columns: 38fr 62fr; gap: 4vw;
  padding: 4.5vw 5.5vw; font-size: 1.35vw;
}
.board-page .ask { display: flex; flex-direction: column; justify-content: center; gap: 1.6vw; min-width: 0; }
.board-page .kicker { font-size: 1.05vw; }
.board-page h1 { font-size: 5.6vw; line-height: 0.92; letter-spacing: -0.04em; }
.board-page .qr { width: 15vw; aspect-ratio: 1; padding: 0.6vw; background: var(--paper); border: var(--line); box-shadow: 0.6vw 0.6vw 0 var(--hot-pink); }
.board-page .url { margin: 0; font-family: var(--mono); font-size: 1.6vw; }
.board-page .url b { font-weight: 400; color: var(--hot-pink); }
.board-page .live { align-content: center; gap: 1vw; min-width: 0; }
.board-page h2 { font-size: 1.9vw; display: flex; align-items: center; gap: 0.7vw; }
.board-page .board-list { gap: 0.55vw; }
.board-page .board-list li { padding: 0.55vw 1vw; gap: 1vw; }
.board-page .board-list .name { grid-template-columns: auto 1fr; align-items: baseline; gap: 1vw; }
.board-page .board-empty { font-size: 1.2vw; padding: 2vw; }
.board-page .board-total { font-size: 0.95vw; }

/* ── Slide card (iframe on deck slides) ──────────────────────────────────────
   Sized off its own frame so one page fits every embed: ?top=3 or ?top=5 sets
   the rows, and a frame taller than wide stacks the QR above the list. */
.card-page {
  --rows: 5;
  height: 100vh; overflow: hidden; display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: 4vh 6vh; padding: 5.5vh 6.5vh; background: var(--paper);
  font-size: calc(100vh / (var(--rows) * 2.4 + 4));
}
.card-page .ask { display: flex; flex-direction: column; align-items: center; gap: 0.5em; }
.card-page .qr { height: calc(100vh - 11vh - 2.4em); aspect-ratio: 1; }
.card-page .url { margin: 0; font-family: var(--mono); font-size: 0.62em; white-space: nowrap; }
.card-page .url b { font-weight: 400; color: var(--hot-pink); }
.card-page .live { align-content: center; gap: 0.35em; min-width: 0; }
.card-page h2 { font-size: 1.15em; display: flex; align-items: center; gap: 0.35em; }
.card-page .board-list { gap: 0.25em; }
.card-page .board-list li { padding: 0.05em 0.55em; border-width: 2px; gap: 0.5em; }
/* Just the number: the song title gets the room. */
.card-page .board-list .votes { font-size: 0; }
.card-page .board-list .count { font-size: 22px; font-size: calc(100vh / (var(--rows) * 2.4 + 4) * 1.1); }
.card-page .board-list .name small { display: none; }
.card-page .board-total { display: none; }
.card-page .board-empty { padding: 0.8em 0.5em; font-size: 0.75em; }

@media (orientation: portrait) {
  .card-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-content: center; padding: 5vw 6vw; gap: 4vw; font-size: 4.2vw; }
  .card-page .qr { height: auto; width: 42vw; }
  .card-page .board-list .count { font-size: 4.6vw; }
  .card-page .live { align-content: start; }
}
