/* Bouquet Picker. See design-system/bouquet-tournament/MASTER.md
   Principle: the photos carry all the colour. The UI is a near-neutral gallery wall so the
   chrome never nudges her colour judgement; one wine accent marks selection and primary actions. */

:root {
  --bg: oklch(0.972 0.002 350);
  --surface: oklch(0.992 0.002 350);
  --ink: oklch(0.24 0.012 350);
  --ink-2: oklch(0.47 0.012 350);
  --line: oklch(0.9 0.004 350);
  --accent: oklch(0.41 0.11 355);
  --on-accent: oklch(0.985 0.006 355);
  --accent-soft: oklch(0.945 0.016 355);
  --good: oklch(0.46 0.08 160);
  --on-good: oklch(0.985 0.006 160);
  --e1: 0 1px 2px oklch(0.24 0.012 350 / 0.06), 0 2px 8px oklch(0.24 0.012 350 / 0.05);
  --e2: 0 10px 30px oklch(0.24 0.012 350 / 0.14);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --r-card: 18px;
  --r-thumb: 12px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
  --t-fast: 160ms;
  --t-pick: 220ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: oklch(0.17 0.005 350);
    --surface: oklch(0.215 0.006 350);
    --ink: oklch(0.95 0.005 350);
    --ink-2: oklch(0.76 0.01 350);
    --line: oklch(0.32 0.008 350);
    --accent: oklch(0.8 0.08 355);
    --on-accent: oklch(0.24 0.05 355);
    --accent-soft: oklch(0.27 0.03 355);
    --good: oklch(0.8 0.09 160);
    --on-good: oklch(0.22 0.04 160);
    --e1: 0 1px 2px oklch(0 0 0 / 0.4);
    --e2: 0 10px 30px oklch(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 650; }
h2 { font-size: 1.375rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -48px; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: 550 1rem/1 var(--font); cursor: pointer; text-decoration: none;
  border: 1px solid transparent; color: var(--ink); background: transparent;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in oklch, var(--accent), var(--ink) 12%); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover, .btn-quiet:hover { background: var(--accent-soft); }
.btn-quiet { color: var(--ink-2); min-height: 44px; padding: 0 14px; }
.btn-quiet:hover { color: var(--ink); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Welcome ---------- */
.welcome {
  min-height: 100dvh; display: grid; align-content: center; gap: 28px;
  padding: max(32px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  max-width: 34rem; margin: 0 auto;
}
.fan { position: relative; height: 200px; width: 100%; max-width: 300px; margin-bottom: 8px; }
.fan img {
  position: absolute; top: 18px; left: calc(50% - 64px); width: 128px; height: 160px; object-fit: cover;
  border-radius: 14px; box-shadow: var(--e2); background: var(--line); border: 3px solid var(--surface);
}
.fan img:nth-child(1) { transform: translateX(-74px) rotate(-8deg); }
.fan img:nth-child(2) { transform: translateY(-12px); z-index: 1; }
.fan img:nth-child(3) { transform: translateX(74px) rotate(8deg); }
.eyebrow { font-size: 0.875rem; font-weight: 550; color: var(--accent); }
.welcome h1 { font-size: 2.25rem; margin-top: 6px; }
.welcome .lede { font-size: 1.0625rem; color: var(--ink-2); max-width: 40ch; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.facts li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; align-items: baseline; }
.facts li b { font-weight: 600; }
.facts li span { color: var(--ink-2); }

/* ---------- Pick ---------- */
.pick {
  --chrome: 214px;
  --card: min(calc(100vw - 32px), calc((100dvh - var(--chrome) - env(safe-area-inset-bottom) - env(safe-area-inset-top)) / 2), 460px);
  min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  max-width: 1040px; margin: 0 auto;
}
.progress { display: grid; gap: 8px; padding: 4px 0 6px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.875rem; color: var(--ink-2); }
.progress-top b { font-weight: 600; color: var(--ink); }
.bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transition: transform 300ms var(--ease); }
.prompt { font-size: 1.25rem; font-weight: 600; text-align: center; padding: 6px 0 12px; }

.pair { display: grid; justify-content: center; align-content: center; gap: 12px; grid-template-columns: var(--card); transition: opacity var(--t-fast) var(--ease); }
.pair.fade { opacity: 0; transition-duration: 110ms; transition-timing-function: ease-in; }
@media (min-width: 640px), (orientation: landscape) {
  .pick { --card: min(calc((100vw - 56px) / 2), calc(100dvh - 200px), 460px); }
  .pair { grid-template-columns: var(--card) var(--card); gap: 24px; }
}

.card {
  position: relative; width: var(--card); aspect-ratio: 1; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--r-card); overflow: hidden; background: var(--line); box-shadow: var(--e1);
  transition: transform var(--t-pick) var(--ease), opacity var(--t-pick) var(--ease), box-shadow var(--t-pick) var(--ease);
}
.card img { width: 100%; height: 100%; object-fit: cover; }
.card .fallback { display: grid; place-items: center; height: 100%; padding: 20px; text-align: center; color: var(--ink-2); font-size: 0.9375rem; }
.card:active { transform: scale(0.985); }
.card .badge {
  position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  opacity: 0; transform: scale(0.6); transition: opacity var(--t-pick) var(--ease), transform var(--t-pick) var(--ease);
}
.card .badge .icon { width: 20px; height: 20px; }
.card .badge svg { stroke-width: 2.6; }
.card.chosen { transform: scale(1.02); box-shadow: var(--e2), 0 0 0 3px var(--accent); }
.card.chosen .badge { opacity: 1; transform: scale(1); }
.card.dimmed, .pair.neither .card { opacity: 0.3; }
.pair.both .card { box-shadow: var(--e2), 0 0 0 3px var(--accent); }
.pair.busy .card { cursor: default; }

.actions {
  display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 0 max(16px, env(safe-area-inset-bottom));
}
.actions .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.actions .btn-quiet { padding: 0 12px; }
@media (max-width: 400px) { .actions { gap: 2px; } .actions .sep { display: none; } }
.hint-keys { font-size: 0.8125rem; color: var(--ink-2); text-align: center; padding-bottom: 12px; }
@media (hover: none) { .hint-keys { display: none; } }

/* ---------- Pause screens (phase change, hand-back) ---------- */
.pause {
  min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 20px; text-align: center;
  padding: 32px 16px; max-width: 30rem; margin: 0 auto;
  animation: enter 240ms var(--ease) both;
}
.pause p { color: var(--ink-2); max-width: 36ch; }
.pause .btn-row { justify-content: center; margin-top: 8px; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.champion-photo {
  width: min(78vw, 340px); aspect-ratio: 1; object-fit: cover;
  border-radius: 22px; box-shadow: var(--e2); background: var(--line);
}

/* ---------- Results ---------- */
.results { max-width: 1000px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 72px; display: grid; gap: 64px; }
.results > section { display: grid; gap: 18px; align-content: start; }
.hero { display: grid; gap: 24px; align-items: center; }
@media (min-width: 760px) { .hero { grid-template-columns: minmax(0, 400px) 1fr; gap: 44px; } }
.hero img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 22px; box-shadow: var(--e2); background: var(--line); }
.hero .meta { display: grid; gap: 12px; justify-items: start; }
.hero h1 { font-size: 2.25rem; }
.hero .btn-row { margin-top: 10px; }
.florist { color: var(--ink-2); }

.headline { font-size: 1.5rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; max-width: 32ch; }
.trust { display: grid; gap: 10px; max-width: 65ch; color: var(--ink-2); }
.trust .lead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--ink); }

.chip {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 550; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.chip.strong, .chip.high { background: var(--good); border-color: var(--good); color: var(--on-good); }
.chip.likely, .chip.medium { border-color: var(--ink-2); color: var(--ink); }
.chip.hint, .chip.low { border-style: dashed; }

.axes { display: grid; gap: 32px; }
@media (min-width: 760px) { .axes { grid-template-columns: 1fr 1fr; column-gap: 56px; } }
.axis { display: grid; gap: 10px; align-content: start; }
.axis h3 { color: var(--ink-2); font-weight: 550; font-size: 0.875rem; }
.taste { display: grid; grid-template-columns: minmax(0, 1fr) 96px 7.5rem; gap: 12px; align-items: center; }
.taste .label::first-letter { text-transform: uppercase; }
.taste .chip { justify-self: start; }
.diverge { position: relative; height: 6px; background: var(--line); border-radius: 6px; }
.diverge::after { content: ''; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1.5px; background: var(--ink-2); }
.diverge > i { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); }
.diverge > i.neg { background: var(--ink-2); }
.empty { color: var(--ink-2); max-width: 55ch; }

.ranked { list-style: none; margin: 0; padding: 0; display: grid; }
@media (min-width: 760px) { .ranked { grid-template-columns: 1fr 1fr; column-gap: 40px; } }
.ranked li { display: grid; grid-template-columns: 1.5rem 72px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ranked .pos { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ranked img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-thumb); background: var(--line); }
.ranked .name { font-weight: 600; color: var(--ink); text-decoration: none; }
.ranked .name:hover { text-decoration: underline; text-underline-offset: 3px; }
.ranked .sub { font-size: 0.875rem; color: var(--ink-2); }
.tag { color: var(--accent); font-weight: 550; }

.strip { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }
.tile { display: grid; gap: 6px; text-decoration: none; color: inherit; align-content: start; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: var(--line); transition: transform var(--t-fast) var(--ease); }
.tile:hover img { transform: translateY(-2px); }
.tile .name { font-weight: 600; line-height: 1.3; }
.tile .sub { font-size: 0.875rem; color: var(--ink-2); }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: var(--line); }

.rounds { display: grid; gap: 14px; padding-top: 28px; border-top: 1px solid var(--line); }
.rounds p { color: var(--ink-2); max-width: 60ch; }
.round-list { list-style: none; margin: 0; padding: 0; display: grid; }
.round-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 0.9375rem; z-index: 40;
  animation: enter 200ms var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .card.chosen, .card:active, .btn:active, .tile:hover img { transform: none !important; }
}
