/* ==========================================================================
   Win For Good — "ticket booth" design system
   Tokens, base, layout and components. Every component renders at
   /admin/styleguide. A raffle colours its own parts by setting --roll and
   --roll-ink on an ancestor (see raffle_vars() in lib/ui.php).
   ========================================================================== */

@layer tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    --ink: #22152F;
    --ink-2: #3B2550;
    --paper: #F3F0F5;
    --card: #FFFFFF;
    --muted: #5E5368;
    --line: #E7E1EC;
    --line-2: #CFC6D8;
    --marigold: #F5B731;
    --live: #2F8F5B;
    --ok-ink: #23704A;
    --alert: #D9462B;
    --alert-ink: #B83A22;   /* the alert red for text: 5:1 on paper and white */
    --danger: #B3261E;
    --warn-bg: #FFF6DD;

    /* the current raffle's ticket colour; overridden per raffle */
    --roll: var(--marigold);
    --roll-ink: var(--ink);
    --roll-alt: #FFFFFF;
    /* what shows through perforation holes and notches */
    --notch: var(--paper);

    --font-display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
    --font-body: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'Atkinson Hyperlegible Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    --radius-lg: 24px;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 28px 52px -32px rgb(34 21 47 / .42);
    --shadow-lift: 0 34px 56px -30px rgb(34 21 47 / .5);
    --wrap: 1248px;
    --gutter: clamp(16px, 4vw, 24px);
  }
}

/* -------------------------------------------------------------------------- */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 17px/1.55 var(--font-body);
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
  img, svg { display: block; max-width: 100%; }
  a { color: inherit; text-underline-offset: 3px; }
  a:hover { color: var(--ink-2); }
  button, input, select, textarea { font: inherit; color: inherit; }
  strong { font-weight: 700; }
  code { font-family: var(--font-mono); font-size: .9em; }
  ::selection { background: var(--marigold); color: var(--ink); }
  :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

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

/* -------------------------------------------------------------------------- */
@layer layout {
  .wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
  .stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
  .spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap, 12px 24px); }
  .grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 340px), 100%), 1fr));
    gap: var(--gap, 28px);
  }
  .section { padding-top: clamp(64px, 8vw, 104px); }
}

/* -------------------------------------------------------------------------- */
@layer components {

  /* ---- type ---------------------------------------------------------------- */
  .display {
    font-family: var(--font-display);
    font-weight: 850;
    font-stretch: 115%;
    letter-spacing: -.025em;
    line-height: 1.02;
    text-wrap: balance;
  }
  .display--xl { font-size: clamp(56px, 8.5vw, 108px); font-weight: 900; font-stretch: 122%; letter-spacing: -.045em; line-height: .9; }
  .display--lg { font-size: clamp(38px, 5vw, 64px); font-stretch: 118%; letter-spacing: -.03em; line-height: .98; }
  .display--md { font-size: clamp(30px, 2.8vw, 38px); }
  .display--sm { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.02em; line-height: 1.05; }
  .display--xs { font-size: 22px; font-weight: 800; font-stretch: 108%; letter-spacing: -.01em; line-height: 1.15; }
  .lbl {
    font-family: var(--font-display);
    font-stretch: 72%;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: 13px;
    line-height: 1.3;
  }
  .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  .muted { color: var(--muted); }
  .lead { font-size: clamp(18px, 1.7vw, 20px); color: var(--muted); max-width: 46ch; }
  .fine { font-size: 14px; color: var(--muted); line-height: 1.45; }
  .ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
  .countdown { white-space: nowrap; }

  /* ---- buttons ------------------------------------------------------------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 26px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
  }
  .btn:hover { background: var(--ink-2); color: #FFFFFF; transform: translateY(-1px); }
  .btn:disabled, .btn[aria-disabled="true"] { background: #B7AEC2; color: #FFFFFF; cursor: not-allowed; transform: none; }
  .btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
  .btn--ghost:hover { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
  .btn--roll { background: var(--roll); color: var(--roll-ink); }
  .btn--roll:hover { background: var(--roll); color: var(--roll-ink); box-shadow: inset 0 0 0 2px var(--roll-ink); }
  .btn--lg { min-height: 58px; padding: 0 30px; font-size: 18px; }
  .btn--sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
  .btn--block { display: flex; width: 100%; }
  .link-arrow { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; }

  /* ---- forms --------------------------------------------------------------- */
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field__label { font-weight: 600; font-size: 15px; }
  .field__label small, .field__hint { font-weight: 400; font-size: 14px; color: var(--muted); }
  .field__error { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--danger); }
  .input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    font-size: 16px;
  }
  textarea.input { min-height: 128px; resize: vertical; line-height: 1.5; }
  select.input {
    appearance: none;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322152F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
  }
  .input::placeholder { color: #6F6479; }
  .input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(245 183 49 / .55); }
  .input[aria-invalid="true"] { border-color: var(--danger); }
  .check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
  .check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex-shrink: 0; }

  .chip {
    min-width: 56px;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font: 700 16px var(--font-mono);
    cursor: pointer;
  }
  .chip[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }

  .stepper { display: flex; align-items: center; gap: 8px; }
  .stepper__btn {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1.5px solid var(--line-2);
    border-radius: 14px;
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
  }
  .stepper__btn:hover:not(:disabled) { background: var(--paper); }
  .stepper__btn:disabled { opacity: .35; cursor: not-allowed; }
  .stepper__input {
    width: 86px;
    height: 52px;
    border: 1.5px solid var(--line-2);
    border-radius: 14px;
    background: var(--card);
    color: var(--ink);
    text-align: center;
    font: 700 24px var(--font-mono);
    -moz-appearance: textfield;
  }
  .stepper__input::-webkit-inner-spin-button, .stepper__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  .stepper__input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(245 183 49 / .55); }

  /* ---- status chip ----------------------------------------------------------- */
  .status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-family: var(--font-display);
    font-stretch: 72%;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--muted)); flex-shrink: 0; }
  .status--plain { padding: 0; background: transparent; }
  .status--live { --dot: var(--live); }
  .status--soon { --dot: #7A9AE6; }
  .status--draw { --dot: var(--alert); }
  .status--won { --dot: var(--ink); }
  .status--closed::before { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
  .status--hidden { background: var(--ink); color: #FFFFFF; --dot: #B9A3E8; }
  .status--hidden.status--plain { padding: 7px 12px; }

  /* ---- notices (flash messages, inline callouts) ----------------------------- */
  .notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--card);
    box-shadow: inset 0 0 0 1.5px var(--line);
    font-weight: 600;
  }
  .notice .ic { margin-top: 2px; }
  .notice--success .ic { color: var(--live); }
  .notice--error { box-shadow: inset 0 0 0 1.5px var(--danger); }
  .notice--error .ic { color: var(--danger); }
  .notice--warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1.5px var(--marigold); }

  /* ---- meter: tickets sold, as a roll of segments ---------------------------- */
  .meter {
    position: relative;
    height: var(--h, 14px);
    background: var(--line);
    overflow: hidden;
    -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n, 30) - 2px), transparent 0 calc(100% / var(--n, 30)));
            mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n, 30) - 2px), transparent 0 calc(100% / var(--n, 30)));
  }
  .meter > span { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
  .meter-text { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 15px; color: var(--muted); }
  .meter-text strong { color: var(--ink); font-family: var(--font-mono); }

  /* ---- photo placeholder ------------------------------------------------------ */
  .placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 16px;
    text-align: center;
    color: color-mix(in srgb, var(--roll) 28%, var(--ink));
    background-color: color-mix(in srgb, var(--roll) 30%, #FFFFFF);
    background-image: repeating-linear-gradient(135deg, rgb(34 21 47 / .05) 0 14px, transparent 14px 28px);
  }
  .placeholder--neutral { color: var(--muted); background-color: #ECE7F1; }
  .placeholder__note { font-size: 13px; }

  /* ---- perforation: holes along a tear line, notches at each end -------------- */
  .perf {
    position: relative;
    height: 12px;
    background:
      radial-gradient(circle, var(--notch) 2.6px, transparent 3px) center / 13px 12px repeat-x,
      linear-gradient(var(--perf-top, var(--card)) 50%, var(--roll) 50%);
  }
  .perf::before, .perf::after {
    content: "";
    position: absolute;
    top: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--notch);
  }
  .perf::before { left: -14px; }
  .perf::after { right: -14px; }

  /* ---- ticket: the core component (raffle cards, the hero, the booth) -------- */
  .ticket {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* clips the notches to half-circles cut into the edge */
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .ticket:has(.ticket__title a:hover, .ticket__media:hover) { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .ticket__top { display: flex; flex-direction: column; flex: 1; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
  .ticket__media { display: block; aspect-ratio: 16 / 10; text-decoration: none; background: color-mix(in srgb, var(--roll) 30%, #FFFFFF); }
  .ticket__media img { width: 100%; height: 100%; object-fit: cover; }
  .ticket__body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 24px 28px 22px; }
  .ticket__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .ticket__no { font-family: var(--font-mono); font-size: 14px; color: var(--muted); }
  .ticket__title { font-size: 30px; }
  .ticket__title a { text-decoration: none; }
  .ticket__sub { font-size: 18px; color: var(--muted); max-width: 40ch; }
  .ticket__cause { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; color: var(--muted); }
  .ticket__cause .ic { color: var(--alert); margin-top: 2px; }
  .ticket__cause strong { color: var(--ink); }
  .ticket__progress { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
  .ticket__stub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 28px;
    padding: 14px 28px 20px;
    background: var(--roll);
    color: var(--roll-ink);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .ticket__stub .btn { margin-left: auto; }
  .stub-stat { display: flex; flex-direction: column; gap: 2px; }
  .stub-stat .lbl { font-size: 12px; }
  .stub-stat__value { font: 700 22px/1.2 var(--font-mono); white-space: nowrap; }
  .stub-stat__text { font-size: 17px; font-weight: 700; line-height: 1.6; }

  /* hero: photo beside the details, larger type */
  .ticket--hero .ticket__top { flex-direction: row; flex-wrap: wrap; }
  .ticket--hero .ticket__media { flex: 1 1 420px; aspect-ratio: auto; min-height: 440px; }
  .ticket--hero .ticket__body { flex: 1.35 1 460px; min-width: 0; gap: 20px; padding: 40px 44px 34px; }
  .ticket--hero .ticket__title { font-size: clamp(38px, 4.6vw, 62px); font-stretch: 118%; letter-spacing: -.03em; line-height: .98; }
  .ticket--hero .ticket__stub { gap: 18px 48px; padding: 16px 44px 24px; }
  .ticket--hero .stub-stat__value { font-size: 30px; line-height: 1.1; }
  .ticket--hero .meter { --h: 18px; }
  @media (max-width: 640px) {
    .ticket--hero .ticket__media { min-height: 240px; }
    .ticket--hero .ticket__body { padding: 26px 22px 24px; }
    .ticket--hero .ticket__stub { gap: 14px 28px; padding: 14px 22px 22px; }
    .ticket--hero .stub-stat__value { font-size: 24px; }
    .ticket__body { padding: 22px 22px 20px; }
    .ticket__stub { padding: 14px 22px 20px; }
    .ticket__stub .btn { margin-left: 0; width: 100%; }
  }

  /* dashed "blank ticket" for invitations (e.g. hear about the next raffle) */
  .ticket-blank {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 36px 34px;
    border: 2px dashed var(--line-2);
    border-radius: var(--radius-lg);
  }

  /* ---- little stubs that stack up as you pick a quantity --------------------- */
  .stubs { display: flex; align-items: center; padding-left: 12px; color: var(--ink); }
  .stubs .ticket-glyph { margin-left: -12px; }
  .stubs .ticket-glyph path:first-child { stroke: var(--card); stroke-width: 2; }

  /* ---- receipt: the published draw proof ---------------------------------------- */
  .receipt { filter: drop-shadow(0 26px 30px rgb(34 21 47 / .16)); }
  .receipt__edge { height: 12px; background: radial-gradient(circle at 7px 0, transparent 6px, var(--card) 6.5px) 0 0 / 14px 12px repeat-x; }
  .receipt__body { background: var(--card); padding: 22px 30px 26px; }
  .receipt__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 12px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
  .receipt__lines { list-style: none; padding: 0; }
  .receipt__lines > li { display: flex; gap: 16px; padding: 18px 0; }
  .receipt__lines > li + li { border-top: 1px dashed #DCD4E3; }
  .receipt__mark { flex: 0 0 26px; height: 26px; margin-top: 1px; display: grid; place-items: center; }
  .receipt__mark::before { content: ""; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); }
  .receipt__lines > li[data-state="checking"] .receipt__mark::before { box-shadow: none; background: var(--marigold); animation: pulse .7s ease-in-out infinite; }
  .receipt__lines > li[data-state="ok"] .receipt__mark::before {
    box-shadow: none;
    background: var(--live) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 15px no-repeat;
  }
  .receipt__lines > li[data-state="fail"] .receipt__mark::before { box-shadow: none; background: var(--danger); }
  .receipt__key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
  .receipt__key strong { font-weight: 700; }
  .receipt__key span { font-size: 14px; color: var(--muted); }
  .receipt__value { margin-top: 4px; font: 15px/1.65 var(--font-mono); word-spacing: 5px; overflow-wrap: anywhere; }
  .receipt__total {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 30px;
    background: var(--roll);
    color: var(--roll-ink);
    border-top: 2px dashed rgb(34 21 47 / .3);
  }
  .receipt__total .mono { font-size: 40px; font-weight: 700; line-height: 1; }
  .receipt__edge--bottom { background: radial-gradient(circle at 7px 12px, transparent 6px, var(--roll) 6.5px) 0 0 / 14px 12px repeat-x; }
  @keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }

  /* ---- strip: tickets as they come off the roll (confirmation) --------------- */
  .strip { list-style: none; padding: 0; border-radius: 0 0 18px 18px; overflow: hidden; box-shadow: var(--shadow); }
  .strip > li { display: flex; min-height: 156px; background: var(--card); }
  .strip > li + li { border-top: 2px dashed rgb(34 21 47 / .28); }
  .strip__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 24px 26px; }
  .strip__title { font-size: 26px; }
  .strip__stub {
    flex: 0 0 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px;
    background: var(--roll);
    color: var(--roll-ink);
    border-left: 2px dashed rgb(34 21 47 / .35);
  }
  .strip__no { font: 700 40px/1.1 var(--font-mono); }
  @media (max-width: 620px) {
    .strip__stub { flex-basis: 124px; }
    .strip__no { font-size: 28px; }
    .strip__title { font-size: 20px; }
  }

  /* ---- swatches: the admin's raffle-colour picker ------------------------------ */
  .swatches { display: flex; flex-wrap: wrap; gap: 12px; }
  .swatch { position: relative; cursor: pointer; }
  .swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
  .swatch__face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 88px;
    padding: 10px 10px 8px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    font-size: 13px;
    font-weight: 600;
  }
  .swatch input:checked + .swatch__face { border-color: var(--ink); }
  .swatch input:focus-visible + .swatch__face { outline: 2px solid var(--ink); outline-offset: 3px; }
}

/* -------------------------------------------------------------------------- */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #FFFFFF; font-weight: 700; }
  .skip-link:focus { top: 16px; color: #FFFFFF; }
  .nowrap { white-space: nowrap; }
}

/* -------------------------------------------------------------------------- */
/* Site chrome: admin strip, header, flash notices, footer                     */
@layer components {
  /* Responsible play: a quiet strip on top of every public page, and again in
     the footer. "Need help?" drops off on phones to keep it to a line or two. */
  .play-strip { margin: 0; background: var(--ink); color: #CFC6D8; font-size: 13px; line-height: 1.4; }
  .play-strip .play-line { padding-block: 7px; justify-content: center; text-align: center; }
  .play-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
  .play-line a { font-weight: 700; }
  .play-strip a { color: #F3F0F5; }
  .play-strip a:hover { color: var(--marigold); }
  .play-strip :focus-visible { outline-color: var(--marigold); }
  /* Signed-in admins get their own ink strip straight after it: a hairline keeps the two apart. */
  .play-strip + .admin-strip { border-top: 1px solid rgb(243 240 245 / .16); }
  @media (max-width: 560px) { .play-line__ask { display: none; } }

  .admin-strip { background: var(--ink); color: #E9E4EE; font-size: 14px; }
  .admin-strip__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; min-height: 40px; }
  .admin-strip .lbl { color: var(--marigold); }
  .admin-strip a { color: #E9E4EE; font-weight: 600; text-decoration: none; }
  .admin-strip a:hover { color: #FFFFFF; text-decoration: underline; }
  .admin-strip__end { margin-left: auto; }
  .admin-strip .link-button { color: #E9E4EE; font-weight: 600; text-decoration: none; min-height: 0; }
  .admin-strip .link-button:hover { color: #FFFFFF; text-decoration: underline; }

  .site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; padding-block: 22px; }
  .brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
  .brand:hover { color: var(--ink); }
  .brand__name { font-family: var(--font-display); font-size: 23px; font-weight: 800; font-stretch: 112%; letter-spacing: -.015em; white-space: nowrap; }
  .brand--on-ink, .brand--on-ink:hover { color: #FFFFFF; }
  .site-nav { display: flex; flex-wrap: wrap; gap: 4px 28px; font-weight: 600; font-size: 16px; }
  .site-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
  .site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; }
  /* Donate sits apart from the raffle links: after them on a wide screen, beside the logo on a phone. */
  .site-nav { margin-left: auto; }
  .site-header__donate { gap: 8px; }
  .site-header__donate[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--ink); }
  @media (max-width: 840px) {
    .site-nav { order: 3; width: 100%; margin-left: 0; }
  }
  @media (max-width: 560px) {
    .site-header__inner { padding-block: 14px 4px; column-gap: 12px; }
    .site-nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; gap: 4px 12px; font-size: 15px; }
    .site-header__donate { min-height: 40px; padding: 0 12px; }
  }
  @media (max-width: 400px) {
    .site-header__donate .ic { display: none; }
  }
  /* The smallest phones: keep the four nav items on one line (the headings
     are sized for them in the utilities layer, at the end). */
  @media (max-width: 359px) {
    .site-nav { flex-wrap: nowrap; gap: 4px 8px; font-size: 14px; }
  }

  .flash-stack { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }

  .site-footer { margin-top: clamp(80px, 10vw, 120px); background: var(--ink); color: #CFC6D8; }
  .site-footer a { color: #F3F0F5; text-decoration: none; }
  .site-footer a:hover { color: var(--marigold); text-decoration: underline; }
  .site-footer :focus-visible { outline-color: var(--marigold); }
  .site-footer__grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px 72px; padding-block: 60px 44px; }
  .site-footer__about { flex: 1 1 320px; max-width: 480px; display: flex; flex-direction: column; gap: 16px; }
  .site-footer__org { font-size: 15px; }
  .site-footer__org strong { color: #FFFFFF; }
  .site-footer__contact { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 15px; }
  .site-footer__contact a { display: inline-flex; align-items: center; gap: 8px; color: var(--marigold); min-height: 32px; }
  .site-footer__social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
  .site-footer__social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgb(243 240 245 / .24); transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
  .site-footer__social a:hover { color: var(--ink); background: var(--marigold); border-color: var(--marigold); }
  .site-footer__nav { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 4px 56px; align-content: start; font-weight: 600; }
  .site-footer__nav a { display: inline-flex; align-items: center; min-height: 40px; }
  .site-footer__trust { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 15px; }
  .site-footer__trust li { display: flex; align-items: center; gap: 10px; }
  .site-footer__trust .ic { color: var(--marigold); }
  /* The NLC logo is on white, so it sits on its own white tile. */
  .nlc-badge { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 14px 12px; border-radius: var(--radius-sm); background: #FFFFFF; color: var(--ink); font-size: 13px; line-height: 1.3; }
  .nlc-badge img { display: block; width: 96px; height: 96px; }
  .site-footer__trust .nlc-badge { gap: 2px; align-self: flex-start; }
  .site-footer__base { border-top: 1px solid rgb(243 240 245 / .16); font-size: 14px; color: #B7AEC2; }
  .site-footer__base .wrap { padding-block: 18px; }
  .site-footer__base .site-footer__play { margin-block: 0; padding-block: 18px 0; color: #CFC6D8; }
  .site-footer__base .site-footer__play a { min-height: 0; color: #F3F0F5; }
  .site-footer__base a { display: inline-flex; align-items: center; min-height: 32px; color: #B7AEC2; }
  .site-footer__legal { display: flex; flex-wrap: wrap; gap: 4px 22px; }
}

/* -------------------------------------------------------------------------- */
/* Pages                                                                       */
@layer components {
  /* home */
  .home-hero { display: flex; flex-direction: column; gap: 22px; padding-top: 8px; }
  .home-grid { margin-top: 28px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
  .ticket-blank--hero { padding: clamp(32px, 5vw, 56px); gap: 20px; }
  .ticket-blank--hero .lead { max-width: 52ch; }
  .interest-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; max-width: 520px; }
  .interest-form .field { flex: 1 1 220px; }

  .steps { list-style: none; padding: 0; margin-top: 36px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
  .step { display: flex; flex-direction: column; gap: 12px; padding: 30px; background: var(--card); border-radius: var(--radius); }

  .cause-grid { --min: 460px; margin-top: 36px; }
  .cause-card { display: flex; flex-wrap: wrap; overflow: hidden; background: var(--card); border-radius: var(--radius); }
  .cause-card__photo { flex: 1 1 200px; min-height: 240px; }
  .cause-card__photo img { width: 100%; height: 100%; object-fit: cover; }
  .cause-card__body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 12px; padding: 30px; }
  .cause-card__funders { list-style: none; padding: 0; margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }
  .cause-card__funders li { display: flex; align-items: center; gap: 10px; }
  .cause-card__funders .ticket-glyph { color: var(--ink); }
  .cause-card__photo--logo { display: flex; align-items: center; justify-content: center; padding: 28px; }
  .cause-card__photo--logo img { width: 100%; height: auto; max-height: 190px; object-fit: contain; }
  .cause-card h3 a { text-decoration: none; }
  .cause-card h3 a:hover { text-decoration: underline; }
  .cause-card__none { margin-top: auto; font-size: 15px; color: var(--muted); }
  .cause-card__none a { font-weight: 600; color: var(--ink); }

  .impact { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; margin: 0; }
  .impact > div { display: flex; flex-direction: column-reverse; gap: 6px; padding: 24px 26px; background: var(--card); border-radius: var(--radius); }
  .impact dt { color: var(--muted); }
  .impact dd { margin: 0; font-size: clamp(30px, 3.4vw, 40px); font-weight: 700; line-height: 1.1; }
}

/* -------------------------------------------------------------------------- */
/* Raffle page                                                                 */
@layer components {
  .raffle-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    grid-template-areas: "head side" "media side" "story side";
    column-gap: 56px;
    row-gap: 36px;
    align-items: start;
    padding-top: 4px;
  }
  .raffle-head { grid-area: head; display: flex; flex-direction: column; gap: 16px; }
  .raffle-title { font-size: clamp(40px, 4.4vw, 60px); font-stretch: 118%; letter-spacing: -.03em; line-height: .96; }
  .back-link { align-self: flex-start; color: var(--muted); text-decoration: none; font-weight: 600; }
  .raffle-media { grid-area: media; min-height: 460px; overflow: hidden; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--roll) 30%, #FFFFFF); }
  .raffle-media img { width: 100%; height: 100%; max-height: 680px; object-fit: cover; }
  .raffle-media .placeholder .ticket-glyph { opacity: .55; }
  .raffle-side { grid-area: side; position: sticky; top: 24px; display: flex; flex-direction: column; gap: 18px; }
  .raffle-story { grid-area: story; display: flex; flex-direction: column; gap: 64px; padding-top: 16px; }
  .raffle-prose { max-width: 62ch; font-size: 18px; }
  @media (max-width: 980px) {
    .raffle-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "media" "side" "story"; row-gap: 28px; }
    .raffle-side { position: static; }
    .raffle-media { min-height: 260px; }
  }

  .booth { overflow: hidden; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
  .booth__body { display: flex; flex-direction: column; gap: 22px; padding: 28px 30px 26px; }
  .booth__price { font-size: 26px; font-weight: 700; }
  .booth__stubs { display: flex; align-items: center; gap: 14px; min-height: 32px; }
  .booth__stub { display: flex; flex-direction: column; gap: 14px; padding: 16px 30px 26px; background: var(--roll); color: var(--roll-ink); }
  .booth__total { font-size: 34px; font-weight: 700; line-height: 1.1; }
  .booth__fine { font-size: 14px; line-height: 1.45; }
  .booth__admin { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); }
  .booth .stepper__input { flex: 0 0 auto; }
  @media (max-width: 480px) {
    .booth__body { padding: 24px 20px 22px; }
    .booth__stub { padding: 14px 20px 22px; }
  }

  .panel { display: flex; flex-direction: column; gap: 14px; padding: 28px 30px; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
  .panel--warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1.5px var(--marigold); }
  .share-field { display: flex; flex-wrap: wrap; gap: 8px; }
  .share-field .input { flex: 1 1 200px; min-height: 44px; font-size: 13px; }
  .link-button { padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; }

  .rules { list-style: none; padding: 0 6px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
  .rules li { display: flex; align-items: flex-start; gap: 10px; }
  .rules .ic { margin-top: 2px; }
  .share-button { align-self: flex-start; }

  .spec-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 10px; }
  .spec-list li { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--card); border-radius: 14px; }

  .cause-panel { display: flex; flex-direction: column; gap: 14px; padding: 32px 34px; background: var(--card); border-radius: var(--radius-lg); }
  .cause-panel__label { display: inline-flex; align-items: center; gap: 8px; color: var(--alert-ink); }
  .cause-panel__lead { font-size: 19px; font-weight: 600; }
  .cause-panel__note { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
  .cause-panel__causes { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); }
  .cause-panel__causes li { display: flex; gap: 10px; align-items: flex-start; }
  .cause-panel__causes .ic { color: var(--alert); margin-top: 4px; flex-shrink: 0; }
  .cause-panel__causes a, .cause-panel__causes strong { font-weight: 700; color: var(--ink); }
  .cause-panel > .link-arrow { align-self: flex-start; }
  .cause-story { max-width: 900px; }
  .cause-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; padding-bottom: 6px; }
  .cause-logos img { height: 80px; width: auto; max-width: 240px; object-fit: contain; }

  /* a cause's page: its name with the logo beside it (above it on phones) */
  .cause-head { display: flex; flex-wrap: wrap-reverse; align-items: center; justify-content: space-between; gap: 24px 48px; }
  .cause-head__text { flex: 1 1 440px; display: flex; flex-direction: column; gap: 16px; }
  .cause-head__logo { flex: 0 1 280px; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--card); border-radius: var(--radius); }
  .cause-head__logo img { width: 100%; height: auto; max-height: 200px; object-fit: contain; }
  @media (max-width: 520px) { .cause-head__logo { flex-basis: 100%; } .cause-head__logo img { max-height: 140px; } }

  .commit { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; background: var(--card); border: 1.5px dashed var(--line-2); border-radius: 18px; }
  .commit__hash { font: 16px/1.7 var(--font-mono); word-spacing: 6px; overflow-wrap: anywhere; }

  .mbar { display: none; }
  @media (max-width: 980px) {
    .mbar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
      background: var(--ink);
      color: #FFFFFF;
      box-shadow: 0 -10px 30px -12px rgb(34 21 47 / .5);
      transition: transform .2s ease;
    }
    .mbar[data-away] { transform: translateY(110%); }
    .mbar__info { display: flex; flex-direction: column; line-height: 1.25; }
    .mbar__price { font-size: 18px; font-weight: 700; }
    .mbar__closes { font-size: 13px; color: #CFC6D8; }
    .page-raffle .site-footer { padding-bottom: 76px; }
  }
}

/* -------------------------------------------------------------------------- */
/* Payment result pages                                                        */
@layer components {
  .result { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 900px; padding-top: 24px; }
  .result__head { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
  .result__head .lead { max-width: 48ch; }
  .printer { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 760px; margin-top: 48px; }
  .printer__slot { position: relative; z-index: 2; width: 100%; height: 22px; overflow: hidden; border-radius: 999px; background: var(--ink); box-shadow: 0 8px 18px -8px rgb(34 21 47 / .6); }
  .printer__slot--feeding::after { content: ""; position: absolute; top: 7px; bottom: 7px; left: 0; width: 40%; border-radius: 999px; background: var(--marigold); animation: feed 1.3s ease-in-out infinite; }
  .printer__out { width: calc(100% - 56px); margin-top: -11px; overflow: hidden; padding: 0 18px 48px; }
  .printer .strip { text-align: left; }
  .printing { animation: print 1.5s cubic-bezier(.22, .9, .3, 1) .2s both; }
  .strip__when { margin-top: auto; }
  .result__after { display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 620px; animation: rise .6s ease-out 1.4s both; }
  @keyframes print { from { transform: translateY(-102%); } to { transform: none; } }
  @keyframes feed { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @media (max-width: 520px) {
    .printer__out { width: calc(100% - 24px); padding-inline: 6px; }
  }
}

/* -------------------------------------------------------------------------- */
/* Draw verification                                                           */
@layer components {
  .receipt__lines > li[data-state="warn"] .receipt__mark::before { box-shadow: none; background: var(--marigold); }
  .receipt__result { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--ok-ink); }
  .receipt__result:empty { display: none; }
  .receipt__lines > li[data-state="fail"] .receipt__result { color: var(--danger); overflow-wrap: anywhere; }
  .receipt__lines > li[data-state="warn"] .receipt__result { color: var(--muted); }
  .receipt__lines > li[data-state="note"] .receipt__mark::before { box-shadow: inset 0 0 0 2px var(--muted); background: transparent; }
  .receipt__lines > li[data-state="note"] .receipt__result { color: var(--muted); font-weight: 400; }
  .verify-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; }
  .verify-status { font-weight: 600; }
  .verify-status:empty { display: none; }
}

/* -------------------------------------------------------------------------- */
/* Trust pages: how it works, FAQ, winners, our impact, contact                */
@layer components {
  .page-head { display: flex; flex-direction: column; gap: 16px; padding-block: 28px 40px; max-width: calc(var(--wrap)); }
  .page-head .lead { max-width: 54ch; }
  .page-head .display--xl { font-size: clamp(40px, 5vw, 64px); }
  /* The page head's own bottom padding is the gap to what follows: a section
     straight after it (Our impact with the stats band off) adds none of its own. */
  .page-head + .section { padding-top: 0; }

  .steps--four { margin-top: 0; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }

  .fairness { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px 64px; align-items: start; }
  .fairness__intro { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; position: sticky; top: 24px; }
  @media (max-width: 900px) { .fairness { grid-template-columns: minmax(0, 1fr); } .fairness__intro { position: static; } }
  .fair-steps { list-style: none; padding: 0; margin: 0; counter-reset: fair; display: flex; flex-direction: column; gap: 14px; }
  .fair-steps li { counter-increment: fair; position: relative; display: flex; flex-direction: column; gap: 8px; padding: 24px 26px 24px 74px; background: var(--card); border-radius: var(--radius); }
  .fair-steps li::before {
    content: counter(fair);
    position: absolute;
    left: 24px;
    top: 22px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--marigold);
    color: var(--ink);
    font: 700 16px var(--font-mono);
  }

  .cta-ticket { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; padding: 32px 36px; border: 2px dashed var(--line-2); border-radius: var(--radius-lg); }
  .cta-ticket .muted { margin-top: 6px; }

  .faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
  .faq-item { background: var(--card); border-radius: var(--radius); }
  .faq-item summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; padding: 16px 24px; font-weight: 700; font-size: 18px; cursor: pointer; list-style: none; }
  .faq-item summary::-webkit-details-marker { display: none; }
  .faq-item summary .ic { transition: transform .2s ease; }
  .faq-item[open] summary .ic { transform: rotate(45deg); }
  .faq-item p { padding: 0 24px 22px; max-width: 70ch; color: var(--muted); }
  .faq-item p a { color: var(--ink); font-weight: 600; }

  .ledger { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px; }
  .ledger__row { display: flex; flex-wrap: wrap; overflow: hidden; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
  .ledger__stub { flex: 0 0 210px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 22px 26px; background: var(--roll); color: var(--roll-ink); border-right: 2px dashed rgb(34 21 47 / .3); }
  .ledger__no { font-size: 44px; font-weight: 700; line-height: 1.05; }
  .ledger__body { flex: 1 1 380px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding: 24px 28px; }
  .ledger__body h2 a { text-decoration: none; }
  @media (max-width: 560px) { .ledger__stub { flex-basis: 100%; border-right: 0; border-bottom: 2px dashed rgb(34 21 47 / .3); } }

  .contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; }
  @media (max-width: 860px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
  .contact-grid .panel { box-shadow: none; }
  .contact-line { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-size: 18px; font-weight: 700; text-decoration: none; }
  .contact-grid form.panel .btn { align-self: flex-start; }

  /* donate: the gift form (a ticket booth) beside where the money goes */
  .donate-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
  @media (max-width: 860px) { .donate-grid { grid-template-columns: minmax(0, 1fr); } }
  .donate-notes { display: flex; flex-direction: column; gap: 16px; }
  .donate-notes .panel { box-shadow: none; }
  .amount-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .amount-grid .chip { min-width: 0; padding: 0 4px; }
  @media (max-width: 420px) { .amount-grid { gap: 6px; } .amount-grid .chip { padding: 0 2px; font-size: 14px; } }
  .money-input { position: relative; max-width: 240px; }
  .money-input__sym { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font: 700 20px var(--font-mono); pointer-events: none; }
  .money-input .input { padding-left: 40px; font: 700 20px var(--font-mono); }
  .booth__fx { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 8px; margin-top: -10px; text-align: right; font-size: 15px; }
  .booth__fx[hidden] { display: none; }
  .booth__fx [data-fx-text] { font-weight: 700; }
  .booth__fx-when { font-size: 13px; }

  .prose-block { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; font-size: 18px; }
  .prose-block h3 { font-family: var(--font-display); font-weight: 800; font-stretch: 108%; font-size: 24px; letter-spacing: -.01em; margin-top: 18px; }
  .prose-block h3:first-child { margin-top: 0; }
  .prose-block ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
  .prose-block p, .prose-block li { color: var(--muted); }
}

@layer components {
  /* cause photos on a raffle page: one big, the rest alongside */
  .cause-photos { display: grid; gap: 4px; margin: -32px -34px 10px; overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .cause-photos img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
  .cause-photos--1 { grid-template-columns: 1fr; height: 320px; }
  .cause-photos--2 { grid-template-columns: 2fr 1fr; height: 300px; }
  .cause-photos--3, .cause-photos--4 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; height: 320px; }
  .cause-photos--3 img:first-child, .cause-photos--4 img:first-child { grid-row: 1 / span 2; }
  .cause-photos--4 { grid-template-columns: 2fr 1fr 1fr; }
  .cause-photos--4 img:nth-child(4) { grid-column: 2 / span 2; }
  @media (max-width: 520px) { .cause-photos { height: 220px !important; } }
}

@layer components {
  /* a button sitting on a raffle-coloured stub inverts with the stub's text colour */
  .ticket__stub .btn, .booth__stub .btn { background: var(--roll-ink); color: var(--roll-alt); }
  .ticket__stub .btn:hover, .booth__stub .btn:hover { background: var(--roll-ink); color: var(--roll-alt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--roll-ink) 30%, transparent); }
}

@layer components {
  /* ---- raffle rules: who runs it beside the numbered clauses ----------------- */
  .rules-page { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 24px 48px; align-items: start; }
  .rules-page__facts { position: sticky; top: 24px; }
  @media (max-width: 860px) { .rules-page { grid-template-columns: minmax(0, 1fr); } .rules-page__facts { position: static; } }

  /* label/value pairs, separated like perforations */
  .facts > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-top: 2px dashed var(--line-2); }
  .facts > div:first-child { border-top: 0; padding-top: 0; }
  .facts dt { font-size: 14px; color: var(--muted); }
  .facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

  .rules-list { list-style: none; padding: 0; counter-reset: rule; max-width: 70ch; }
  .rules-list > li { counter-increment: rule; display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 6px 12px; padding: 22px 0; border-top: 2px dashed var(--line-2); }
  .rules-list > li:first-child { border-top: 0; padding-top: 4px; }
  .rules-list > li::before { content: counter(rule, decimal-leading-zero); grid-row: 1 / span 2; font: 700 20px/1.15 var(--font-mono); color: var(--muted); }
  .rules-list > li > * { grid-column: 2; }
  .rules-list p { font-size: 18px; color: var(--muted); }
  .rules-list a { color: var(--ink); font-weight: 600; }

  /* the back of the ticket: what the law says every ticket states */
  .ticket-back { width: 100%; padding: 16px 22px; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--card); text-align: left; font-size: 15px; }
  .ticket-back > div { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 2px 14px; padding: 8px 0; border-top: 1px solid var(--line); }
  .ticket-back > div:first-child { border-top: 0; }
  .ticket-back dt { color: var(--muted); }
  .ticket-back dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
  @media (max-width: 480px) { .ticket-back > div { grid-template-columns: minmax(0, 1fr); } }
}

/* -------------------------------------------------------------------------- */
/* A raffle's promotion kit (views/kit.php), and the QR code it shares with the editor */
@layer components {
  .qr-card { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 28px; }
  .qr-card__code { flex: 0 0 200px; aspect-ratio: 1; overflow: hidden; background: #FFFFFF; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-2); }
  .qr-card__code svg { display: block; width: 100%; height: 100%; }
  .qr-card > .stack { flex: 1 1 260px; min-width: 0; }

  .kit-head { padding-bottom: 24px; }
  .kit-toc { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
  .kit-toc a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line-2); font-size: 15px; font-weight: 600; text-decoration: none; }
  .kit-toc a:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
  .kit-section { display: flex; flex-direction: column; gap: 14px; padding-top: clamp(48px, 6vw, 80px); scroll-margin-top: 16px; }
  .kit-section > .lead { max-width: 62ch; }
  /* columns stay a card wide when a section has only one or two */
  .kit-grid { --min: 340px; --gap: 24px; margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(min(var(--min), 100%), 1fr)); }
  .kit-tip { display: flex; align-items: flex-start; gap: 10px; padding-top: 28px; }
  .kit-tip .ic { margin-top: 1px; }

  .kit-link { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
  @media (max-width: 900px) { .kit-link { grid-template-columns: minmax(0, 1fr); } }
  .kit-link .panel { box-shadow: none; }
  .kit-link .qr-card__code { flex-basis: 160px; }
  .kit-link__all { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 6px; padding-top: 18px; border-top: 2px dashed var(--line-2); }

  /* each picture is a ticket: the preview above the perforation, the download on the stub */
  .kit-card__media { display: flex; align-items: center; justify-content: center; height: 300px; padding: 20px; background: color-mix(in srgb, var(--roll) 14%, var(--paper)); }
  .kit-card__media img { width: auto; height: auto; max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 12px 24px -14px rgb(34 21 47 / .6); }
  .kit-card .ticket__body { gap: 8px; padding: 20px 24px 18px; }
  .kit-card__use { color: var(--muted); font-size: 15px; }
  .kit-card__stub { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 24px 20px; }
  .kit-card__stub .btn { margin-left: 0; }
  .kit-card__get { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .kit-card__facts { font-size: 13px; }
  .kit-card__hi { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; font-size: 14px; }
  .kit-card__hi a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-weight: 700; }
  @media (max-width: 640px) {
    .kit-card__media { height: 280px; }
    .kit-card .ticket__body, .kit-card__stub { padding-inline: 20px; }
  }

  .kit-post { box-shadow: none; }
  .kit-post__text { min-height: 280px; background: var(--paper); font-size: 14px; }
  .kit-post .btn { align-self: flex-start; }

  .kit-grid--logos { --min: 300px; }
  .kit-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; height: 100%; padding: 18px; background: var(--card); border-radius: var(--radius); }
  /* a checkerboard behind the logos shows which ones are transparent */
  .kit-logo__media { display: flex; align-items: center; justify-content: center; align-self: stretch; height: 140px; margin-bottom: 6px; padding: 16px; border-radius: 12px; background: repeating-conic-gradient(#ECE7F1 0 25%, #FFFFFF 0 50%) 0 0 / 16px 16px; }
  .kit-logo__media img { width: auto; max-width: 100%; max-height: 100%; }
  .kit-logo .btn { margin-top: auto; }

  .kit-brand { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
  .kit-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
  .kit-swatch { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 18px 6px 6px; border: 0; border-radius: 999px; background: var(--card); font-size: 15px; cursor: pointer; }
  .kit-swatch:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
  .kit-swatch__chip { width: 36px; height: 36px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgb(34 21 47 / .18); }
  .kit-brand a { color: var(--ink); font-weight: 600; }

  .kit-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }
  .kit-rules .panel { box-shadow: none; }
  .kit-rules__list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .kit-rules__list li { display: flex; align-items: flex-start; gap: 10px; }
  .kit-rules__list .ic { margin-top: 3px; color: var(--live); }
  .kit-rules__list--dont .ic { color: var(--alert); }
}

/* -------------------------------------------------------------------------- */
/* The smallest phones (320px): big headings stay inside the screen.            */
@layer utilities {
  @media (max-width: 359px) {
    .display--xl, .page-head .display--xl { font-size: 40px; }
    .display--lg { font-size: 34px; }
  }
}
