/* Platform features (2026-11-22): the newsletter form (footer and /newsletter) and the wine club (/club). Built from
   the theme's tokens like shop.css, so every look draws them in its own colours, type and corners. Labels and help
   line up with the field's text (--field-inset, design-and-ux.md); tier cards share rows across a row (subgrid). */
@layer themes {
  /* ---- Newsletter form ------------------------------------------------------------------------------------ */
  .nl-form {
    --field-pad: var(--look-field-pad, calc(0.8 * var(--step-0)));
    --field-inset: min(var(--field-pad) + var(--border-width, 1px), var(--radius-control, 0px));
    display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3xs, 0.25rem); margin: 0; max-inline-size: 32rem;
  }
  /* minmax(0, 1fr): the field's own default width (about 20 characters) set the form's column, so in a 216px footer
     column at 960-1024px the field ran 60px past the screen and the page scrolled sideways (Neil, 2026-11-23). */
  .nl-form > * { margin: 0; }
  .nl-form :is(.form-label, .form-help) { padding-inline-start: var(--field-inset); }
  .nl-form__row { display: flex; flex-wrap: wrap; gap: var(--space-2xs, 0.4rem); align-items: stretch; }
  .nl-form__input {
    flex: 1 1 13rem; min-inline-size: 0; inline-size: auto; block-size: auto; min-block-size: 3rem; margin: 0;
    padding-block: 0; padding-inline: var(--field-pad);
  }
  /* Field and button share one height: the row stretches the field to the button, which keeps each look's own
     padding (and so its optical centring of the label). */
  .nl-form__go { flex: 0 0 auto; min-block-size: 3rem; margin: 0; }
  .nl-form__go[data-busy] { cursor: progress; opacity: 0.7; }
  .nl-form__msg { min-block-size: 1lh; }
  .nl-form__msg:empty { min-block-size: 0; }
  .nl-form__msg.is-error { font-weight: 700; color: var(--color-error, #b3261e); }
  .nl-form__turnstile:empty { display: none; }
  .nl-form__turnstile { max-inline-size: 100%; overflow: hidden; }
  /* The honeypot: out of sight and out of the accessibility tree (aria-hidden), but not display:none, which some bots skip. */
  .nl-form__hp { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  /* In the dark footer: the field keeps the footer's own surface and ink; the error colour is lightened to stay readable. */
  .site-footer .nl-form__label { font-size: var(--step--1); font-weight: 700; }
  .site-footer .nl-form__input { background: color-mix(in oklab, currentColor 8%, transparent); color: inherit; border-color: color-mix(in oklab, currentColor 45%, transparent); }
  .site-footer .nl-form__input::placeholder { color: color-mix(in oklab, currentColor 62%, transparent); font-style: italic; }
  .site-footer .nl-form__msg.is-error { color: color-mix(in oklab, var(--color-error, #b3261e) 35%, #ffffff); }
  .site-footer__newsletter p:not(.form-help) { margin: 0 0 var(--space-xs); }

  /* ---- /newsletter ---------------------------------------------------------------------------------------- */
  .newsletter-page__inner { max-inline-size: 46rem; }
  .newsletter-page__form { margin-block-start: var(--space-m); }
  .newsletter-page .nl-form { max-inline-size: 36rem; }
  .newsletter-page .nl-form__input { min-block-size: 3.25rem; font-size: var(--step-0); }
  .newsletter-page .nl-form__go { min-block-size: 3.25rem; }
  .newsletter-page__actions { margin: var(--space-m) 0 0; }
  .newsletter-privacy h2 { font-size: var(--step-1); }
  .newsletter-privacy h3 { font-size: var(--step-0); margin-block-start: var(--space-m); }
  .newsletter-privacy__text { font-size: var(--step--1); color: var(--color-text-muted, inherit); }
  .newsletter-privacy__text a { overflow-wrap: anywhere; }

  /* ---- /club ---------------------------------------------------------------------------------------------- */
  .club__testnote { margin-block: 0 var(--space-m); max-inline-size: 48rem; }
  .club-tiers {
    display: grid; gap: var(--space-m); margin: 0 0 var(--space-s); padding: 0; list-style: none;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  }
  /* Seven shared rows (head, cadence, price, meta, shipping, description, button): a short description never moves
     another card's price or button off the line (design-and-ux.md "Cards and grids line up"). */
  .club-tier {
    display: grid; gap: var(--space-2xs, 0.4rem); align-content: start;
    padding: clamp(var(--space-s), 2.5vw, var(--space-m));
    background: var(--color-surface); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-card, 0);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }
  /* As .wine-grid does (site.css): the list has no row gap of its own (a gap would be shared into the cards' tracks
     and squash them), each card's bottom margin is the gap between rows of cards. */
  @supports (grid-template-rows: subgrid) {
    html:root .club-tiers { row-gap: 0; }
    .club-tier { grid-row: span 7; grid-template-rows: subgrid; row-gap: var(--space-2xs, 0.4rem); margin-block-end: var(--space-m); }
  }
  .club-tier > * { margin: 0; min-inline-size: 0; }
  /* Every look sizes its own h2 (sk2's display capitals reach 5.6rem), which spilled the tier names and buttons out of
     the cards (Neil, 2026-11-23). The name is capped to the card's width, with a selector that outranks any look's
     bare h2 rule. The size container is the card's head row, not the card: a size container cannot be a subgrid
     (site/README.md Gotchas), and on the card it switched the shared rows off, so prices and buttons stopped lining
     up across the tiers (full QA, 2026-11-23). */
  .club-tier { min-inline-size: 0; }
  .club-tier__head { container-type: inline-size; }
  :root .club-tiers .club-tier .club-tier__name {
    font-size: min(var(--step-2), 11.5cqi); line-height: 1.05; overflow-wrap: break-word; hyphens: manual;
  }
  :root .club-tiers .club-tier .club-tier__action .button { white-space: normal; max-inline-size: 100%; }
  .club-tier[data-picked] { border-color: var(--accent, currentColor); box-shadow: 0 0 0 1px var(--accent, currentColor); }
  /* The name, then its badge under it, in every card: with a wrapping row the badge sat beside a short name ("Full
     Moon") and under a long one, so the names stood at different heights across the row (full QA, 2026-11-23). */
  .club-tier__head { display: flex; flex-direction: column; align-items: flex-start; justify-content: end; gap: var(--space-3xs, 0.25rem); }
  .club-tier__name { font-size: var(--step-1); line-height: 1.1; margin: 0; }
  .club-tier__cadence { font-weight: 700; }
  .club-tier__price { display: flex; flex-wrap: wrap; column-gap: 0.35em; align-items: last baseline; gap: 0 0.35em; padding-block-start: var(--space-2xs, 0.4rem); border-block-start: var(--border-width) solid var(--color-border); }
  .club-tier__amount { font-family: var(--font-heading); font-size: var(--step-3); line-height: 1; font-variant-numeric: tabular-nums; }
  .club-tier__per { font-size: var(--step--1); }
  .club-tier__meta { display: flex; flex-wrap: wrap; gap: 0 var(--space-xs); font-size: var(--step--1); font-variant-numeric: tabular-nums; color: var(--color-text-muted, inherit); }
  .club-tier__meta s { text-decoration-thickness: 1px; }
  .club-tier__ship { font-size: var(--step--1); font-weight: 600; }
  .club-tier__desc { font-size: var(--step--1); }
  .club-tier__desc:empty { display: none; }
  .club-tier__action { align-self: end; padding-block-start: var(--space-2xs, 0.4rem); }
  .club-tier__action .button { inline-size: 100%; }
  .club__how { max-inline-size: 48rem; margin-block: 0 var(--space-l); padding-inline-start: 0; }
  .club__join { max-inline-size: 34rem; }
  .club__join:focus { outline: none; }
  .club__form {
    padding: clamp(var(--space-s), 3vw, var(--space-m));
    background: var(--color-surface); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-card, 0);
  }
  .club__form-title { font-size: var(--step-1); margin: 0; }
  .club__form select { inline-size: 100%; }
  .club-welcome .order-done__title { margin-block-start: 0; }
}
@layer themes {
  /* sk centres its footer: the form sits centred as a block, its label and help still start at the field's text. */
  [data-look="sk"] .site-footer .nl-form { margin-inline: auto; text-align: start; }
  [data-look="sk"] .site-footer .nl-form__row { justify-content: center; }
}
@layer themes {
  /* Panel titles ("Order", "Join", "Payment") fit their panel in every look: sk2 sizes a bare h2 to 1/12.2 of the
     nearest size container, which was the page, so "ORDER" at 5.6rem ran 63px past the cart box and the page
     scrolled sideways (full QA, 2026-11-23). The panels are size containers (none of them is a subgrid). */
  .cart__summary, .club__form, .cart__pay-head { container-type: inline-size; }
  /* Forms in a narrow panel: every grid track is minmax(0, 1fr), so a field's default width (about 20 characters, wide
     in Courier Prime and Dela Gothic) never sets the column. At 320 the cart and club fields ran 2px past their box in
     zine, glyph and fog (full QA, 2026-11-23). */
  .cart__summary, .cart__checkout, .cart__ship, .cart__checkout .form-group, .club__form { grid-template-columns: minmax(0, 1fr); }
  /* The full-width "Continue to payment" button: at 320 the looks' wide button padding (zine, glyph, fog: 1.7em) left
     less room than the words, which ran into the right padding (13px right, 30px left). A full-width button needs no
     wide sides; its label may wrap in balanced lines rather than overflow. */
  :root .cart__go { padding-inline: 1em; white-space: normal; text-wrap: balance; }
}
