/* PrizePop central stylesheet: fonts, base, layout and components.
   No colour, gradient, radius or shadow values here: use the tokens in themes.css. */

/* ---------- Fonts (self-hosted, see docs/SETUP.md) ---------- */
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/assets/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('/assets/fonts/nunito-sans-latin.woff2') format('woff2');
  font-weight: 200 1000; font-style: normal; font-display: swap;
}

/* ---------- Non-colour tokens ---------- */
:root {
  --font-body: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --wrap: 72rem;
  --tap: 44px;
  --focus-width: 3px;
  /* Height of the sticky header. nav.js replaces this with the measured height; this is the fallback. */
  --header-h: 3.5rem;
  /* Motion: page crossfade and scroll reveal (see "Motion" at the bottom). The count-up speed is in reveal.js. */
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --dur-page: .25s;
  --dur-reveal: .5s;
  --reveal-distance: 16px;
  --dur-fast: .15s;   /* hovers */
  --dur-press: .1s;   /* a button pressing in */
  --dur-state: .35s;  /* a card changing state, an FAQ answer opening */
  --dur-pop: .45s;    /* the "I've entered" tick popping */
  --press-scale: .97;
  /* The one hover transition for links, pills and tabs, so they all feel the same. */
  --t-hover: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* scroll-padding keeps anchor and skip-link targets from landing under the sticky header. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s4)); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0 0 var(--s4); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); }
h2 { font-size: 1.35rem; margin-top: var(--s2); }
p { margin: 0 0 var(--s4); }
a { color: var(--brand); text-underline-offset: 2px; transition: var(--t-hover); }
code, .mono { font-family: var(--font-mono); }

:focus-visible {
  outline: var(--focus-width) solid var(--info);
  outline-offset: 2px;
  box-shadow: 0 0 0 calc(var(--focus-width) + 4px) var(--ink);
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: var(--s2); }
.skip-link:focus {
  left: var(--s4); z-index: 200; padding: var(--s2) var(--s4);
  background: var(--surface); color: var(--ink); border-radius: var(--rs);
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s4); }
.page { padding-block: var(--s6) var(--s7); }
.narrow { max-width: 34rem; margin-inline: auto; }
.stack > * + * { margin-top: var(--s5); }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.form-width { max-width: 34rem; }
.mb-4 { margin-bottom: var(--s4) !important; }
.mt-4 { margin-top: var(--s4); }
.flex-grow-1 { flex-grow: 1; }
.gap-1 { gap: var(--s1); }
.justify-center { justify-content: center; }
.justify-evenly { justify-content: space-evenly; }
.inline-flex { display: inline-flex !important; }

/* ---------- Header and footer ---------- */
/* Sticky, not fixed: the header stays in the page flow, so the body needs no padding for it
   and a taller header (admin nav, open menu) never covers the content. */
.site-header { background: var(--hdr); box-shadow: var(--shadow-hover); color: var(--on-brand); position: sticky; top: 0; z-index: 100; }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s3); padding-block: var(--s1);
}
.brand {
  color: var(--on-brand); font-family: var(--font-head); font-size: 1.5rem; font-weight: 700;
  text-decoration: none; display: inline-flex; gap: var(--s2); flex-grow: 1; align-items: center; min-height: var(--tap);
}
.brand small { font-size: .9rem; font-weight: 600; margin-left: var(--s2); }
.brand img { filter: var(--img-filter); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-inline: -.75rem; }
.nav a, .nav-button {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s3);
  /* The underline is always there but transparent, so hovering fades it in. */
  color: var(--on-brand); font: inherit; font-weight: 600; text-decoration: underline transparent;
  background: none; border: 0; border-radius: var(--rs); cursor: pointer; transition: var(--t-hover);
}
.nav a:hover, .nav-button:hover { text-decoration: underline; }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
.nav form { margin: 0; }

/* Small screens: nav.js adds .has-menu and shows the Menu button; the nav opens below the header row.
   Without JavaScript the button stays hidden and the nav wraps as above. */
.nav-toggle {
  display: none; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s3);
  margin-left: auto; color: var(--on-brand); font: inherit; font-weight: 600; cursor: pointer;
  background: none; border: 2px solid var(--line); border-radius: var(--rs);
  transition: var(--t-hover), transform var(--dur-press) var(--ease-out);
}
.nav-toggle:active { transform: scale(var(--press-scale)); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 1.1rem; height: 2px; background: var(--line); border-radius: var(--pill);
}
.nav-toggle-bars { position: relative; transition: background .25s ease-in-out; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; transition: transform .25s ease-in-out, top .5s ease-in-out; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.menu-open .nav-toggle-bars { background: none; }
.menu-open .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.menu-open .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }
@media (max-width: 47.99rem) {
  .has-menu .nav-toggle { display: inline-flex; }
  /* The closed nav still sits on its own (empty) row, so drop the row gap; the open nav's top padding replaces it. */
  .has-menu .header-inner { row-gap: 0; }
  /* Closed: zero height and hidden (so its links can't be tabbed to). Kept laid out so it can animate. */
  .has-menu .nav {
    /* nowrap matters: with the desktop "wrap", a zero-height column puts every link in its own column (a row). */
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0;
    width: 100%; margin-inline: 0; padding-block: 0;
    max-height: 0; overflow: hidden; opacity: 0; visibility: hidden;
  }
  /* Open: grows to its measured height (--nav-open-h, set by nav.js). The header is sticky,
     so a long menu (admin) is capped at the screen height and scrolls inside itself. */
  .has-menu.menu-open .nav {
    padding-block: var(--s3);
    max-height: min(calc(var(--nav-open-h, 100vh) + 2 * var(--s3)), calc(100vh - var(--tap) - var(--s3)));
    overflow-y: auto; opacity: 1; visibility: visible;
  }
  /* Transitions switch on only after nav.js has applied the closed state, so the page doesn't animate on load.
     On close, visibility waits for the slide to finish; on open it changes at once. */
  .has-menu.menu-ready .nav {
    transition: max-height .25s ease, padding .25s ease, opacity .2s ease, visibility 0s linear .25s;
  }
  .has-menu.menu-ready.menu-open .nav { transition-delay: 0s; }
  .has-menu .nav a, .has-menu .nav-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .has-menu.menu-ready .nav { transition: none; }
}

.site-footer { border-top: 1px solid var(--line); padding-block: var(--s2); color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.footer-inner p { margin: 0; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: var(--s5);
}
.panel > :last-child { margin-bottom: 0; }
.band { background: var(--grad-2); border-radius: var(--r); padding: var(--s6) var(--s5); }
.band .panel { box-shadow: none; }

/* ---------- Forms ---------- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s4); }
label, .label { font-weight: 600; }
.hint { color: var(--muted); font-size: .92rem; margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3);
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--muted); border-radius: var(--rs);
}
textarea { resize: vertical; line-height: 1.45; }
input[type="file"] { font: inherit; min-height: var(--tap); }
input[type="radio"] { width: 1.25rem; height: 1.25rem; margin: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--danger); }
fieldset { margin: 0 0 var(--s5); min-width: 0; }
fieldset:not(.panel) { border: 0; padding: 0; }
legend { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; padding: 0 var(--s2); }
/* A group of checkboxes inside a form (prize types): the legend looks like a field label. */
fieldset.field > legend { font-family: inherit; font-size: inherit; font-weight: 600; padding: 0; margin-bottom: var(--s1); }
.row.check-group { flex-wrap: wrap; column-gap: var(--s4); row-gap: 0; }
.sub-label { font-weight: 400; color: var(--muted); font-size: .92rem; margin-top: var(--s2); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 var(--s4); }
.field-actions { justify-content: flex-end; flex-direction: row; align-items: flex-end; gap: var(--s2); }
.radio-row { display: flex; flex-direction: column; gap: var(--s2); }
.radio-row label { display: flex; gap: var(--s2); align-items: center; font-weight: 400; min-height: var(--tap); }
.flag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--s4); }
.input-short { max-width: 6rem; }
.form-actions { margin-top: var(--s2); }
.field-error { color: var(--danger); font-weight: 600; margin: 0; }
.field-error::before { content: "Error: "; }
.check { display: flex; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s4); }
.check input { width: 1.4rem; height: 1.4rem; margin: .15rem 0 0; flex: none; }
.code-input { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: .3em; max-width: 12rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: var(--rs);
  transition: var(--t-hover), filter var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
/* Pressing a button pushes it in slightly. */
.btn:active:not(:disabled):not(.is-disabled) { transform: scale(var(--press-scale)); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-accent { background: var(--accent-grad) !important; border-color: var(--accent-edge) !important; color: var(--ink) !important; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-small { padding: 0 var(--s3); font-size: .92rem; }
.btn-join { padding: var(--s1) !important; min-height: unset !important; border: 1px solid var(--accent-edge) !important; text-decoration: none !important; }
.btn-block { width: 100%; }
.btn:hover { filter: brightness(.96); }
.btn-accent:hover { filter: brightness(1.15); transform: scale(1.03); box-shadow: var(--accent-glow); background: var(--accent-grad-hover); border-color: color-mix(in oklab, var(--accent-edge) 80%, var(--darken) 20%);}
.btn-primary:hover { filter: brightness(1.15); box-shadow: var(--brand-glow); border-color: color-mix(in oklab, var(--brand) 80%, var(--darken) 20%); }

/* ---------- Notices ---------- */
.alert {
  margin-bottom: var(--s4); padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-left-width: 6px; border-radius: var(--rs);
  background: var(--surface);
}
.alert-ok { background: var(--ok-bg); border-color: var(--ok-edge); }
.alert-error { background: var(--danger-bg); border-color: var(--danger); }
.alert-info { border-color: var(--brand); }
.alert strong { margin-right: var(--s1); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 0 var(--s2); border-radius: var(--pill);
  font-size: .82rem; font-weight: 700; background: var(--off); color: var(--ink); text-align: center;
}
.badge-ok { background: var(--avail); }
.badge-warn { background: var(--prize); }
.badge-bad { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info); color: var(--ink); }
.badge-social { background: var(--prize); color: var(--ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; vertical-align: top; padding: var(--s2) var(--s3); white-space: nowrap;
}
#pricing-table.table tr th:not(:first-child) { width: 90px; }
.table th, .table td.border-bottom { border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.table td.wrap-anywhere { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

/* ---------- Theme switch ---------- */
/* Theme switch: a 44px tap target per theme, drawn as a small round swatch of that theme's colours. */
.theme-switch { flex-grow: 1; display: flex; justify-content: end; align-items: center; gap: 0; flex-wrap: wrap; font-size: .92rem; }
.theme-switch > span { margin-right: var(--s1); }
.swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0;
  background: none; border: 0; border-radius: var(--pill); cursor: pointer;
}
.swatch::before {
  content: ""; width: 24px; height: 24px; border-radius: var(--pill);
  border: 2px solid var(--surface); box-shadow: var(--swatch-ring);
  transition: var(--t-hover), transform var(--dur-press) var(--ease-out);
}
.swatch:active::before { transform: scale(.9); }
.swatch-lucky::before { background: var(--swatch-lucky); }
.swatch-pop::before { background: var(--swatch-pop); }
.swatch-calm::before { background: var(--swatch-calm); }
.swatch:hover::before { box-shadow: var(--swatch-ring-on); }
.swatch[aria-pressed="true"]::before { box-shadow: var(--swatch-ring-on); }

/* ---------- Filters and paging (admin) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.tabs a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.tabs a:hover { border-color: var(--brand); }
.tabs a[aria-current="page"] { border-color: var(--brand); font-weight: 700; }
.pager { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s4); }

.secret-box {
  font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: .08em; word-break: break-all;
  background: var(--off); border-radius: var(--rs); padding: var(--s3) var(--s4);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s4); }
.stat {
  display: block; background: var(--surface); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--rs); padding: var(--s4);
}
a.stat:hover { border-color: var(--brand); }
.stat strong { display: block; font-size: 1.8rem; font-family: var(--font-head); }

/* ---------- Contest card ----------
   The graphic fills the media area; until one is uploaded the theme gradient fills it instead.
   With a graphic present, the same gradient shows as a thin strip along the top of the card. */
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--rs); box-shadow: var(--shadow);
  /* Hover lifts quickly; a change of state (entered, ended) fades more slowly. */
  transition: box-shadow var(--dur-fast) var(--ease-out), translate var(--dur-fast) var(--ease-out),
    background-color var(--dur-state) var(--ease-out);
}
.card-grad-1 { --card-grad: var(--grad-1); }
.card-grad-2 { --card-grad: var(--grad-2); }
.card-grad-3 { --card-grad: var(--grad-3); }
.card-media { aspect-ratio: 16 / 10; background: var(--card-grad); border-bottom: 1px solid var(--line); padding: .75rem .15rem .15rem;
  transition: filter var(--dur-state) var(--ease-out), opacity var(--dur-state) var(--ease-out); }
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-media); }
.card-body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); height: 100%; }
.card-body p { margin: 0; }
.card-title { font-size: 1.1rem; margin: 0; overflow-wrap: anywhere; }
.card-value { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.card-ends { color: var(--muted); font-size: .92rem; }
.card-badges { display: flex; flex-wrap: wrap; gap: var(--s2); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s2); }
.card-check { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); }
.card-box { width: 1.3rem; height: 1.3rem; border: 2px solid var(--muted); border-radius: var(--rs); background: var(--surface); }
.card-link { color: var(--brand); text-decoration: underline; }
.card-preview { max-width: 22rem; margin-bottom: var(--s3); }
.card:hover { box-shadow: var(--shadow-hover); translate: 0 -2px; }

/* ---------- Admin editor and lists ---------- */
.row-between { justify-content: space-between; }
.row-between h1 { margin: 0; }
.editor { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 64rem) {
  .editor { grid-template-columns: minmax(0, 1fr) 22rem; }
  .editor-side {
    position: sticky; top: calc(var(--header-h) + var(--s4));
    /* A side column taller than the space below the header scrolls on its own. */
    max-height: calc(100vh - var(--header-h) - 2 * var(--s4)); overflow-y: auto;
  }
}
.editor-side > .panel + .panel { margin-top: var(--s4); }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 var(--s3); }
.filter-bar .field { margin-bottom: var(--s2); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.province-table td { text-align: center; }
.province-table td, .province-table th { padding-block: var(--s1); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0 var(--s3); margin: 0 0 var(--s4); }
@media (max-width: 64rem) {
  .panel[aria-labelledby="eligibility-heading"] > .facts { grid-template-columns: 1fr; }
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0 0 var(--s3); }
.wrap-anywhere { overflow-wrap: anywhere; }
.log-context { margin: var(--s2) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.compare { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.note-list { margin: var(--s2) 0 0; padding-left: var(--s5); }

/* Modal (native <dialog>; the ingest log's details). Padding sits on the inner parts so a
   click on the dialog element itself is a click on the backdrop (admin.js closes it). */
.modal {
  width: min(48rem, calc(100vw - 2 * var(--s4))); max-height: calc(100vh - 2 * var(--s6));
  padding: 0; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.modal::backdrop { background: var(--backdrop); }
.modal-head {
  display: flex; gap: var(--s3); align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: var(--s4) var(--s5) var(--s5); overflow-wrap: anywhere; }
.modal-body .note-list { margin-top: 0; }
.modal-body li + li { margin-top: var(--s2); }
.input-action { display: flex; gap: var(--s2); align-items: center; }
.input-action input { flex: 1 1 auto; min-width: 0; }
.input-action .btn { flex: none; }
.contest-buttons { display: flex; justify-content: center; position: sticky; bottom: 0; background: var(--grad-2); padding: var(--s3) var(--s1); }
.graphic-preview { display: block; width: 100%; height: auto; border-radius: var(--rs); margin-bottom: var(--s4); }

/* ---------- Billing (subscribe, plan, locked) ---------- */
.quote { background: var(--off); border-radius: var(--rs); padding: var(--s4); margin-bottom: var(--s4); }
.quote h2 { margin-top: 0; }
.quote-table td, .quote-table th { border-bottom-color: var(--line); }
.quote-table tfoot th, .quote-table tfoot td { border-bottom: 0; font-size: 1.1rem; }
.num { text-align: right; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.terms-note { border-left: 4px solid var(--accent-edge); padding-left: var(--s3); }
.countdown [data-countdown] { font-weight: 700; }

/* ---------- Public pages (Phase 4) ---------- */
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); width: 100%; }
.footer-nav a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink); }

.hero { margin-bottom: var(--s6); max-width: 46rem; }
/* Home: hero text with the logo beside it; the logo wraps below on narrow screens. */
.hero-split { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); margin-bottom: var(--s6); }
.hero-split .hero { flex: 1 1 26rem; margin-bottom: 0; }
.hero-logo { flex: 0 1 26rem; width: 26rem; max-width: 100%; height: auto; filter: var(--img-filter); }
.lead { font-size: 1.15rem; color: var(--muted); }
:where(.site-page > section + section, .site-page > section + article, .site-page > article + section,
  .site-page > section + p, .site-page > p + section) { margin-top: var(--s6); }

/* Statistics strip: a gradient strip along the top (like a card), text on the surface for contrast. */
.stats-strip {
  position: relative; overflow: hidden;
  background: var(--grad-3); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: calc(var(--s5) + 8px) var(--s5) var(--s5);
}
.stats-strip::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--grad-1); }
.stats-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s3); margin: 0 0 var(--s4); }
.stats-item { background: var(--surface); border-radius: var(--rs); padding: var(--s3) var(--s4); display: flex; flex-direction: column-reverse; justify-content: start; align-items: center; }
.stats-item dt { color: var(--muted); font-size: .8rem; }
.stats-item dd { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.7rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats-foot { color: var(--muted); font-size: .92rem; margin: 0; }
.stat-big { font-family: var(--font-head); font-weight: 700; font-size: 2rem; margin: 0; }

.step-list { padding-left: var(--s5); }
.step-list li + li { margin-top: var(--s2); }
.tick-list { list-style: none; padding: 0; margin: 0 0 var(--s4); }
.tick-list li { position: relative; padding-left: var(--s5); }
.tick-list li + li { margin-top: var(--s2); }
.tick-list li::before { content: "✓"; position: absolute; left: 0; font-weight: 700; color: var(--brand); }

/* Sneak Peek band: dark text sits on the light end of --grad-1 in both themes. */
.sneak-band { background: var(--grad-1); border-radius: var(--r); padding: var(--s5); color: var(--ink); }
.sneak-band > h2 { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s4); }
.card-sponsor { color: var(--muted); font-size: .92rem; }

.link-lists { display: grid; gap: var(--s5); }
.link-lists h2 { font-size: 1.15rem; }
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
/* Each link is a pill. */
.link-list a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s4);
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--pill);
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.link-list a:hover { background: var(--off); border-color: var(--brand); }
.link-list a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
/* Province pages: a count inside a prize-type pill, and this province's row in the comparison table. */
.link-count { margin-left: var(--s2); color: var(--muted); font-weight: 400; }
.province-table tr.is-current td { background: var(--off); font-weight: 700; }

.cta { text-align: left; }
.prose { max-width: 60rem; }
.prose h2 { margin-top: var(--s6); }
.prose ul { padding-left: var(--s5); }
.prose li + li { margin-top: var(--s2); }
.guide > :first-child { margin-top: 0; }

.works-split { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; }
.works { flex: 1 1 26rem; }
.works-lucky { flex: 0 1 15rem; width: 15rem; height: auto; filter: var(--img-filter); }

.price-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-bottom: var(--s5); }
.price { font-family: var(--font-head); font-weight: 700; font-size: 2.2rem; margin-bottom: var(--s2); }
.price span { font-family: var(--font-body); font-size: 1rem; font-weight: 400; color: var(--muted); }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rs); margin-bottom: var(--s2); }
.faq summary { cursor: pointer; font-weight: 700; padding: var(--s3) var(--s4); min-height: var(--tap); display: flex; align-items: center; }
.faq details p { padding: 0 var(--s4) var(--s3); margin: 0; }
/* Answers slide open in browsers that can animate to "auto" height (Chrome/Edge 131+).
   Everywhere else the whole block is skipped and answers open at once, as before. */
@supports (interpolate-size: allow-keywords) {
  .faq details { interpolate-size: allow-keywords; }
  .faq details::details-content {
    block-size: 0; overflow-y: clip;
    transition: block-size var(--dur-state) var(--ease-out), content-visibility var(--dur-state) allow-discrete;
  }
  .faq details[open]::details-content { block-size: auto; }
}

/* Contact form honeypot: off-screen for people, still in the form for bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Admin contact inbox */
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--off); border-radius: var(--rs); padding: var(--s3) var(--s4); }
.stats-list-admin { margin-bottom: var(--s2); }

/* ---------- Member area (Phase 5) ---------- */
/* Header profile switcher: the select sits on the surface colour so its text keeps full contrast. */
.profile-switch { display: flex; align-items: center; gap: var(--s2); color: var(--on-brand); }
.profile-switch label { font-weight: 600; }
.profile-switch select { width: auto; min-width: 9rem; }
.profile-note { color: var(--muted); font-size: .92rem; margin-bottom: var(--s4); }

.filters { margin-bottom: var(--s5); padding-block: var(--s1); }
.filter-search { grid-column: 1 / -1; }
.inline-check { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); font-weight: 400; }
.inline-check input, .tracker-check input[type="checkbox"] { width: 1.3rem; height: 1.3rem; margin: 0; flex: none; }
.result-count { color: var(--muted); font-weight: 600; }
.breadcrumb { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }

/* Tracker: Enter button, "I've entered" box, status line, prompt. */
.tracker { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.tracker[aria-busy="true"] { opacity: .7; }
.tracker-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.tracker-check { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); }
.tracker-check label { cursor: pointer; }
.tracker-status { color: var(--muted); font-size: .92rem; margin: 0; }
.tracker-status:empty { display: none; }
.tracker-prompt {
  background: var(--off); border: 2px solid var(--accent-edge); border-radius: var(--rs);
  padding: var(--s2); display: flex; flex-direction: column; gap: var(--s2);
}
.tracker-prompt p { margin: 0; }
.card-body .tracker-prompt { position: absolute; }
/* Feedback after a change (app.js adds the classes to the redrawn tracker, never on page load):
   the tick pops when a contest is marked entered, and the status line and prompt rise in. */
@keyframes tick-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  70% { transform: scale(.9); }
  100% { transform: scale(1); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.tracker.just-entered input[name="entered"] { animation: tick-pop var(--dur-pop) var(--ease-out); }
.tracker.is-redrawn .tracker-status, .tracker.is-redrawn .tracker-prompt { animation: rise-in var(--dur-state) var(--ease-out); }
.btn.is-disabled { cursor: not-allowed; filter: grayscale(1); opacity: .6; }
.card-details { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap); }

/* Card states. Each state also has words in the status line, so colour is never the only signal. */
.card[data-state="done"], .card[data-state="ended"] { background: var(--done-bg); }
.card[data-state="done"] .card-media, .card[data-state="ended"] .card-media { filter: grayscale(.85); opacity: .75; }
.card[data-state="wait"] .tracker-status { color: var(--ink); font-weight: 600; }

/* Details page */
.detail { display: flex; flex-direction: column; gap: var(--s5); }
.prize-banner {
  background: var(--card-grad); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow);
  display: grid; gap: 8px;
}
.prize-banner-media img { display: block; width: 100%; height: auto; border-radius: var(--rs); }
.prize-banner-text { background: var(--surface); border-radius: var(--rs); padding: var(--s5); }
.prize-banner-text h1 { margin-bottom: var(--s2); overflow-wrap: anywhere; }
.prize-banner-text > :last-child { margin-bottom: 0; }
.detail-sponsor { color: var(--muted); }
.detail-prize { font-weight: 700; font-size: 1.1rem; margin-bottom: var(--s2); }
.detail-value { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; }
.detail-actions {
  position: sticky; top: calc(var(--header-h) + var(--s1)); width: fit-content; z-index: 600;
  background: var(--grad-1); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s4); box-shadow: var(--shadow);
}
.detail-actions .tracker { margin-top: 0; }
@media (max-width: 47.99rem) {
  .detail-actions2 { position: sticky; bottom: 0; z-index: 5; border-radius: var(--rs) var(--rs) 0 0; }
}
.notes { white-space: pre-line; overflow-wrap: anywhere; }
.rules-warning { border-left: 4px solid var(--accent-edge); padding-left: var(--s3); }
.rules-copy summary { padding: 12px 0; cursor: pointer; font-weight: 700; min-height: var(--tap); }
.rules-text {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30rem; overflow-y: auto;
  background: var(--off); border-radius: var(--rs); padding: var(--s3) var(--s4); font-size: .92rem;
}
.history-list { padding-left: var(--s5); margin: 0; }

/* ---------- Stars (Account page) ---------- */
.stars-balance { margin: 0 0 var(--s2); }
.stars-balance strong { font-family: var(--font-head); font-size: 2rem; margin-right: var(--s1); }
.stars-meter {
  display: block; width: 100%; max-width: 24rem; height: 1rem; margin-bottom: var(--s3);
  appearance: none; -webkit-appearance: none; border: 1px solid var(--line);
  border-radius: var(--pill); background: var(--off); overflow: hidden;
}
.stars-meter::-webkit-progress-bar { background: var(--off); border-radius: var(--pill); }
.stars-meter::-webkit-progress-value { background: var(--grad-1); border-radius: var(--pill); }
.stars-meter::-moz-progress-bar { background: var(--grad-1); border-radius: var(--pill); }
.copy-field { flex: 1 1 16rem; width: auto; font-family: var(--font-mono); }
.code-text { font-family: var(--font-mono); letter-spacing: .12em; }

/* ---------- Blog ---------- */
.post-card-media { aspect-ratio: 640 / 336; }
.post-card .card-title a { color: var(--ink); text-decoration: underline transparent; }
.post-card .card-title a:hover, .post-card .card-title a:focus-visible { text-decoration: underline; }
.post-meta { color: var(--muted); font-size: .92rem; margin: 0 0 var(--s2); }
.tag-link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s3); text-decoration: underline transparent; }
.tag-link:hover { text-decoration: underline; }
.post { max-width: 46rem; margin-inline: auto; }
.post-header { margin-bottom: var(--s5); }
.post-header h1 { overflow-wrap: anywhere; }
.post-hero { margin: 0 0 var(--s5); padding-top: 6px; background: var(--grad-1); border-radius: var(--r); overflow: hidden; }
.post-hero img { display: block; width: 100%; height: auto; }
.post-body { font-size: 1.08rem; overflow-wrap: anywhere; }
.prose h3 { margin-top: var(--s5); }
.prose h4 { font-size: 1.05rem; margin: var(--s5) 0 var(--s3); }
.prose ol { padding-left: var(--s5); }
.prose blockquote {
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  background: var(--off); border-left: 4px solid var(--brand); border-radius: var(--rs);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose figure { margin: 0 0 var(--s5); }
.prose img { display: block; max-width: 100%; height: auto; border-radius: var(--rs); }
.prose figcaption { color: var(--muted); font-size: .92rem; margin-top: var(--s2); }
.post-nav { max-width: 46rem; margin: var(--s6) auto; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.post-nav-link {
  display: flex; flex-direction: column; gap: var(--s1); min-height: var(--tap); padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--rs); color: var(--ink); overflow-wrap: anywhere;
}
.post-nav-older { text-align: right; }

/* Admin editor */
.editorial-rule { margin-bottom: var(--s4); }
.rte-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--s1); padding: var(--s2);
  background: var(--off); border: 1px solid var(--muted); border-bottom: 0; border-radius: var(--rs) var(--rs) 0 0;
}
.rte-area {
  min-height: 24rem; max-width: none; padding: var(--s3) var(--s4); overflow-wrap: anywhere;
  background: var(--surface); color: var(--ink); border: 1px solid var(--muted); border-radius: 0 0 var(--rs) var(--rs);
}
.rte-area[aria-invalid="true"] { border: 2px solid var(--danger); }
.rte-area:focus-visible { outline-offset: 0; }
.rte-status:empty { display: none; }

/* ---------- Motion ---------- */
/* Page-to-page crossfade, in browsers with cross-document view transitions (others just load the page). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: var(--dur-page); animation-timing-function: var(--ease-out);
}
/* The header is its own layer, so it holds still while the page under it crossfades. */
.site-header { view-transition-name: site-header; }

/* Scroll reveal (reveal.js, public pages). Only reveal.js adds these classes, and only to elements
   below the fold, so without JavaScript nothing is ever hidden. */
.reveal-hidden { opacity: 0; transform: translateY(var(--reveal-distance)); }
.reveal-in {
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
@media print {
  .reveal-hidden { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
