/* WOBBI™ JURY (/survey) — the questionnaire behind the sampling QR.

   One situation only: somebody standing at a booth, one hand holding a sample, one thumb
   on a phone, on venue wifi. This asks around twenty questions where the Jelly Jury ballot
   asked one, so the whole job of this stylesheet is to stop a long form FEELING long —
   chunky tap targets, one bite per card, a visible step number, and enough colour and
   bounce that answering is mildly enjoyable rather than a chore.

   Two places the fun deliberately stops, because this form is a measuring instrument:

    · The 1–9 liking scale is NOT colour-ramped. Making the "like" end prettier than the
      "dislike" end would pull answers towards it, and the whole point of the exercise is an
      unbiased hedonic score. All nine cells are identical until one is chosen.
    · The middle of each just-about-right scale is marked, but in neutral grey, never green.
      A green "just right" reads as the correct answer and nudges people away from telling
      us the sample is too sweet — which is the single most useful thing they could say.

   The event layout's own frame lives here rather than in vote.css: only this stylesheet is
   loaded on /survey, so .event-body / .event-main would otherwise be unstyled and the form
   would run the full width of a desktop window. */

/* The `hidden` attribute has to beat the layout rules below. The UA stylesheet's
   [hidden] { display: none } loses to ANY author rule that sets display, whatever the
   specificity — so .survey-q { display: block } would otherwise leave the favourite
   question on screen for a one-flavour taster, and .survey-row { display: flex } would
   show flavours the person never tasted. survey.js toggles the attribute and nothing else,
   so this one line is what makes that work. */
[hidden] { display: none !important; }

/* ---- Page frame ------------------------------------------------------------------ */

.event-body {
    min-height: 100dvh;
    background:
        radial-gradient(900px 420px at 50% -10%, var(--focus-tint) 0%, transparent 70%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    background-attachment: fixed;
}

.event-main {
    max-width: 38rem;
    margin-inline: auto;
    /* Bottom padding clears the home indicator on a notched phone, so the submit button is
       never half-under it. */
    padding: var(--sp-5) var(--sp-4) calc(var(--sp-8) + env(safe-area-inset-bottom, 0px));
}

/* ---- Masthead -------------------------------------------------------------------- */

.survey-head { text-align: center; margin-bottom: var(--sp-5); position: relative; }
.survey-head .gl-lockup-img, .survey-head .gl-lockup { margin-inline: auto; }

.survey-head h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin: var(--sp-4) 0 var(--sp-2);
}

.survey-intro {
    color: var(--ink);
    font-size: clamp(1rem, 4.4vw, 1.2rem);
    font-weight: 500;
    line-height: 1.35;
    margin: 0 auto;
    max-width: 26rem;
}

/* The instruction the whole exercise depends on, set to be the loudest thing under the
   title. Its own line and its own element rather than a <br> inside the line above, so it
   can carry its own size without dragging that line's leading around. */
.survey-shout {
    margin: var(--sp-2) 0 0;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 7vw, 2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.01em;
    color: var(--ink);
}

/* Language toggle. Parked top-right rather than in the flow: a Chinese-first reader needs
   to find it in the first second, and an English reader should never trip over it. */
.survey-lang {
    position: absolute;
    top: 0;
    right: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0.3em 1em;
    border: 2px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 700;
    text-decoration: none;
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.survey-lang:hover { border-color: var(--ink); transform: translateY(-1px); }

/* Loud on purpose. A banner the owner stops noticing is how test rows reach a real event. */
.survey-testbanner {
    margin: 0 0 var(--sp-5);
    padding: var(--sp-3) var(--sp-4);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    background: var(--notice-bg);
    color: #7a5b12;
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    text-align: center;
}

/* ---- Cards ----------------------------------------------------------------------- */

/* Default accent. Each flavour card overrides --sku below, and every control inside picks
   its selected colour up from it — so one declaration per flavour themes an entire section
   instead of three near-identical rules per component. */
.survey-form { counter-reset: step; }

.survey-card {
    --sku:      var(--ink);
    --sku-deep: var(--ink);
    --sku-tint: var(--bg-soft);

    /* What a CHOSEN option is filled and framed with, and what colour its text goes.
       On the general cards that is the brand gradient at mid strength — solid ink read as
       a heavy brown slab next to the pale frames, which made every answered question look
       like an error state. Flavour cards override these three below to keep their own
       colour, because there the fill is carrying information. --grad-brand-border is
       noticeably stronger than the --grad-brand-soft used for hover, so "chosen" and "under
       the cursor" are still told apart — by weight and by the control's own marker, not by
       a second, louder colour. --grad-brand-border was tried as the fill first and read as
       a muddy pastel rainbow at pill size: compressing gold through violet to green across
       140px turns a sweep into a smear. The washed version stays clean because the hues are
       80% into white before they ever meet. */
    --pick-fill:  var(--grad-brand-soft);
    --pick-frame: var(--grad-brand-border);
    --pick-ink:   var(--ink);

    /* Card padding as variables so the header banner below can bleed out to the card's
       edge with one negative-margin rule instead of one per breakpoint. */
    --card-pad-y: var(--sp-5);
    --card-pad-x: var(--sp-4);

    counter-increment: step;
    position: relative;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--card-pad-y) var(--card-pad-x);
    margin-bottom: var(--sp-5);
}

/* The same tri-hue gradient frame the product and ritual cards wear, from the shared
   --grad-brand-border token: the border itself goes transparent, a surface-coloured
   padding-box layer sits over a border-box gradient layer, and only the 2px frame shows —
   following the rounded corners, which a border-image cannot do.

   Behind @supports because the token is built from color-mix() in oklab. Where either is
   unsupported the declarations never apply and the plain --line border above stands, rather
   than the frame resolving to transparent and the cards losing their edges entirely. */
@supports (background: linear-gradient(in oklab, red, blue)) and (background: color-mix(in srgb, red 50%, #fff)) {
    .survey-card {
        border-color: transparent;
        background-color: transparent;
        background-image: linear-gradient(var(--surface), var(--surface)), var(--grad-brand-border);
        background-origin: padding-box, border-box;
        background-clip: padding-box, border-box;
    }
}

.survey-card legend,
.survey-sku-head {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 4.8vw, 1.35rem);
    font-weight: 800;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;

    /* A banner, not just a line of bold text. The heading bleeds out to the card's edges
       on a warm wash with a light-brown rule under it, so the eye reads "new section"
       before it reads the words — on a form this long, a heading that looks like just
       another bold label gets scrolled straight past. The rule is also what separates the
       section title from the first option beneath it, which all carry pale frames of their
       own. Margins are negative by exactly the card's padding, which is why that padding
       is a variable. */
    margin: calc(var(--card-pad-y) * -1) calc(var(--card-pad-x) * -1) var(--sp-5);
    padding: var(--sp-3) var(--card-pad-x);
    border-bottom: 2px solid var(--gold);
    border-radius: calc(var(--radius-lg) - 2px) calc(var(--radius-lg) - 2px) 0 0;
    background: rgb(217 179 106 / 0.10);                      /* --gold, 10% */
    background: color-mix(in srgb, var(--gold) 10%, transparent);
}

/* Step number. A CSS counter rather than a number in the markup, because cards for
   flavours the person did not taste are display:none and therefore do not increment it —
   so a one-flavour taster is counted 1, 2, 3, 4 with no gaps, and nobody is told they are
   on step 5 of a form that ends at 4. */
.survey-card > legend::before,
.survey-card > .survey-sku-head::before {
    content: counter(step);
    flex: none;
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background-color: var(--grad-brand-fallback);
    background-image: var(--grad-brand-soft);
    color: var(--step-ink);
    font-size: var(--text-lg);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transform: rotate(-6deg);
}

/* The step numbers run through the wordmark's own letter colours, W-O-B-B-I, so the badges
   carry the logo's rhythm down the page.
 *
 * Deepened versions of those letter colours, not the letters' own: #AC8ABF and #EAA83C on a
 * near-white wash sit around 2.6:1 and 1.9:1, under the 3:1 that large text needs, and a
 * step number you have to squint at is a step number that has stopped working. These are
 * the same hues carried to the palette's text-safe depths.
 *
 * A five-step cycle because the wordmark has five letters — and because it is the one
 * length that never collides here. Flavour cards the person did not tick are display:none,
 * so consecutive VISIBLE cards can sit up to four apart in the DOM; a four-step cycle would
 * hand two badges in a row the same colour the moment nothing was ticked. Five residues
 * also cover every position, so the cycle needs no knowledge of how many non-card elements
 * the form happens to start with. */
.survey-card { --step-ink: var(--focus-deep); }
.survey-card:nth-child(5n + 1) { --step-ink: var(--focus-deep); }   /* W — purple */
.survey-card:nth-child(5n + 2) { --step-ink: #3F5C96; }            /* O — the wordmark blue, deepened */
.survey-card:nth-child(5n + 3) { --step-ink: var(--flow-deep); }   /* B — text-safe gold */
.survey-card:nth-child(5n + 4) { --step-ink: var(--reset-deep); }  /* B — green */
.survey-card:nth-child(5n + 5) { --step-ink: var(--focus-deep); }  /* I — purple again */

/* A <legend> is painted ON its fieldset's top border by default: it punches a gap in the
   border and straddles it, which on a rounded, shadowed card reads as a heading sitting
   outside the card rather than its first line. Floating it full-width drops it back into
   normal flow, so it starts inside the padding box like the <h2> on every other card and
   the border runs unbroken behind it. The next element clears the float so the card still
   wraps its own height. Still a real fieldset + legend, so the three checkboxes keep being
   announced as one named group. */
.survey-card legend {
    float: left;
    /* The other card headings are blocks, so their auto width stretches with the banner's
       negative margins. A float has a specified width and does not, so 100% left the
       legend's banner a full padding short on the right — it has to be told the full
       padding-box width explicitly. */
    width: calc(100% + var(--card-pad-x) * 2);
}
.survey-card legend + * { clear: both; }

.survey-sku-taste {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--ink-soft);
    font-weight: 500;
}

.survey-hint {
    color: var(--ink-soft);
    font-size: var(--text-sm);
    line-height: 1.4;
    margin: 0 0 var(--sp-4);
}

.survey-q { display: block; margin-top: var(--sp-6); }

/* NOT :first-of-type. Every card ends with a <label class="survey-q"> for its comment box
   while the questions above it are <div>s, so :first-of-type matched that label — it is the
   first LABEL among its siblings — and collapsed the gap above the one field that most
   needed it. :first-child and an explicit "straight after the heading" rule say what was
   actually meant, and neither depends on the element names the markup happens to use. */
.survey-card > .survey-q:first-child { margin-top: 0; }
.survey-sku-head + .survey-q { margin-top: var(--sp-2); }

/* A question asked once per sample (would-buy, price): the question and hint sit once at the
   top, then one tight group per sample tasted, each led by that sample's badge. */
.survey-q-intro { margin-top: var(--sp-6); }
.survey-sku-head + .survey-q-intro { margin-top: var(--sp-2); }
.survey-q-intro .survey-hint { margin-bottom: 0; }
.survey-q.survey-per-sku { margin-top: var(--sp-4); }
.survey-per-sku-name { display: block; margin-bottom: var(--sp-2); }
.survey-per-sku-name .badge { font-size: 0.9rem; }

/* The question itself, in the rounded display face. This is the single biggest change in
   how the form feels: at --text-sm in the body face every question read as fine print. */
.survey-label {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1rem, 4.3vw, 1.125rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: var(--sp-3);
}

/* A question the person skipped. Colour alone would not carry it, so the rule and the
   indent do the work and the colour only reinforces them. */
.survey-q.is-missing,
.survey-card.is-missing {
    border-left: 4px solid var(--danger);
    padding-left: var(--sp-3);
    margin-left: calc(var(--sp-3) * -1);
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- Flavour picker --------------------------------------------------------------- */

.survey-pick { display: block; margin-bottom: var(--sp-3); cursor: pointer; }
.survey-pick input { position: absolute; opacity: 0; width: 0; height: 0; }

.survey-pick .pick {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 56px;
    padding: var(--sp-3) var(--sp-4);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                transform var(--dur) var(--ease);
}

/* Empty box that becomes a tick. The checkmark is drawn with a rotated border rather than
   a glyph, so it cannot be swallowed by a missing font on an older Android browser. */
.survey-pick .dot {
    position: relative;
    width: 1.6rem; height: 1.6rem; flex: none;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.survey-pick .dot::after {
    content: "";
    position: absolute;
    left: 0.45rem; top: 0.17rem;
    width: 0.32rem; height: 0.62rem;
    border: solid var(--surface);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--dur) var(--ease);
}
.survey-pick input:checked + .pick .dot::after { transform: rotate(45deg) scale(1); }

.survey-pick .txt { display: flex; flex-direction: column; gap: 2px; }
.survey-pick .name { font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); line-height: 1.15; }
.survey-pick .taste { font-size: var(--text-xs); color: var(--ink-soft); }

.survey-pick input:focus-visible + .pick { outline: 3px solid var(--ink); outline-offset: 2px; }

.survey-pick.opt-focus { --sku: var(--focus); --sku-tint: var(--focus-tint); }
.survey-pick.opt-reset { --sku: var(--reset); --sku-tint: var(--reset-tint); }
.survey-pick.opt-flow  { --sku: var(--flow);  --sku-tint: var(--flow-tint); }

.survey-pick input:checked + .pick {
    border-color: var(--sku, var(--ink));
    background: var(--sku-tint, var(--bg-soft));
}
.survey-pick input:checked + .pick .dot {
    background: var(--sku, var(--ink));
    border-color: var(--sku, var(--ink));
}

/* ---- Per-flavour card theming ------------------------------------------------------ */

/* One declaration each; every control inside the card reads --sku for its selected state,
   so a person scrolling a long form always knows which sample they are rating. */
.survey-sku.sku-focus { --sku: var(--focus); --sku-deep: var(--focus-deep); --sku-tint: var(--focus-tint); }
.survey-sku.sku-reset { --sku: var(--reset); --sku-deep: var(--reset-deep); --sku-tint: var(--reset-tint); }
.survey-sku.sku-flow  { --sku: var(--flow);  --sku-deep: var(--flow-deep);  --sku-tint: var(--flow-tint); }

/* Inside a flavour card a chosen answer stays solid flavour colour rather than taking the
   brand gradient: here the fill is carrying information — which of the three you are
   rating — and three cards full of identical gradient picks would throw that away. */
.survey-sku {
    --pick-fill:  linear-gradient(var(--sku), var(--sku));
    --pick-frame: linear-gradient(var(--sku), var(--sku));
    --pick-ink:   var(--surface);
}

/* A tinted band behind the heading, fading out before the first question — enough to
   colour the card without tinting the answer controls underneath it. With the gradient
   frame applied below, this band plus the step badge, the flavour badge and every
   selected control are what tell you which sample you are rating; the frame itself is
   the same brand gradient on every card. */
.survey-sku {
    border-color: var(--sku);
    background:
        linear-gradient(180deg, var(--sku-tint) 0%, var(--surface) 7rem),
        var(--surface);
}

/* Same two-layer trick as .survey-card, but the padding-box layer is the flavour's tint
   fade instead of flat surface, so the card keeps its colour AND wears the brand frame. */
@supports (background: linear-gradient(in oklab, red, blue)) and (background: color-mix(in srgb, red 50%, #fff)) {
    .survey-sku {
        border-color: transparent;
        background-color: transparent;
        background-image:
            linear-gradient(180deg, var(--sku-tint) 0%, var(--surface) 7rem),
            var(--grad-brand-border);
        background-origin: padding-box, border-box;
        background-clip: padding-box, border-box;
    }
}

/* ---- 1–9 liking strip --------------------------------------------------------------- */

.scale { display: flex; }
.scale input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ONE framed strip with hairline dividers, not nine separately bordered boxes. Nine
   gradient frames side by side would compress the whole brand sweep into every 33px cell
   and read as noise; one frame around the set reads as a single control, and the dividers
   keep the cells legible. All nine stay on one row — a 1–9 scale the thumb has to scroll
   is a 1–9 scale half of which gets ignored. */
.scale-9 {
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.scale-9 .scale-dot { flex: 1 1 0; cursor: pointer; min-width: 0; }

.scale-9 .scale-dot span {
    display: grid;
    place-items: center;
    height: 48px;
    border-left: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.scale-9 .scale-dot:first-child span { border-left: 0; }

/* The chosen cell fills. No scale-up any more: a cell bursting out of the strip's frame
   undoes the tidiness the frame buys. Deliberately the ONLY colour anywhere on this
   scale — see the note at the top of the file about not ramping it. */
.scale-9 .scale-dot input:checked + span {
    background: var(--sku, var(--ink));
    color: var(--surface);
}
.scale-9 .scale-dot input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: -3px; }

/* The numbers are meaningless without their anchors, so the anchors are not optional. */
.scale-ends {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-top: var(--sp-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-soft);
}
.scale-ends span:last-child { text-align: right; }

/* ---- Just-about-right ladder --------------------------------------------------------- */

/* A grid, not wrapped flex. Flex gave every option its own natural width and stretched
   whatever landed on the last row, so the five options ended up three-then-two at two
   different widths and nothing lined up with anything. Equal columns put every option on
   the same grid as the chips below, and a partial last row still starts at column one. */
.scale-jar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: var(--sp-2);
}
.scale-jar .jar-opt { cursor: pointer; }
.scale-jar .jar-opt span {
    display: grid;
    place-items: center;
    text-align: center;
    height: 100%;
    min-height: 54px;
    padding: var(--sp-2) var(--sp-2);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.25;
    transition: background var(--dur) var(--ease),
                color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
}
/* The midpoint is marked so the scale reads as a scale, in neutral grey — never green.
   Colour-coding "just right" as the good answer is how you stop hearing that it is too
   sweet, which is the one thing this question exists to find out. */
.scale-jar .jar-opt.is-jar span { border-style: dashed; border-color: var(--ink-faint); }

.scale-jar .jar-opt input:checked + span {
    background: var(--sku, var(--ink));
    border-color: var(--sku, var(--ink));
    border-style: solid;
    color: var(--surface);
    transform: scale(1.04);
    box-shadow: var(--shadow);
}
.scale-jar .jar-opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---- Chips ---------------------------------------------------------------------------- */

/* Same equal-column grid as the just-about-right options above. Pills of natural width
   wrapped into a ragged block where no two rows shared an edge; equal columns give every
   answer the same footprint, which is also the honest way to show options that are
   supposed to be equally weighted. */
.survey-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: var(--sp-2);
}
.survey-chip { cursor: pointer; }
.survey-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.survey-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 48px;
    /* Sized so the longest option in any chip group — "A few times a month" — sits on one
       line inside a two-column grid on a 375px phone. At --text-sm with 1em of side padding
       it needed 142px in a 125px box, so three of the six frequency answers wrapped to two
       lines while the other three did not, and the row heights went ragged. Trimming the
       type one step and the side padding to 0.7em leaves roughly 6px of slack on the
       longest label; anything longer than that belongs in a shorter label, not a smaller
       font, because this is read at arm's length at a booth. */
    padding: 0.45em 0.6em;
    border: 2px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 600;
    transition: background var(--dur) var(--ease),
                color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
}
/* A chip has no tick or radio dot of its own, so once "chosen" and "under the cursor" share
   a fill colour, the weight is what separates them. 800 against the 600 of every other chip
   is a difference you read without looking for it, and it survives being colour-blind,
   being on a sunlit phone, or having hover disabled entirely. */
.survey-chip input:checked + span {
    background: var(--sku, var(--ink));
    border-color: var(--sku, var(--ink));
    color: var(--surface);
    font-weight: 800;
    transform: scale(1.04);
    box-shadow: var(--shadow-sm);
}
.survey-chip input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Top-3 ranking: a sample already placed 1st cannot also be 2nd, so survey.js disables it
   in the other places. Faded and struck through rather than removed, so the rows do not
   reflow under the person's thumb as they pick. Not in the admin's read-only view, where
   the whole form sits in a disabled fieldset and every chip would read as struck out. */
.survey-form:not(.is-readonly) .survey-chip input:disabled + span { opacity: 0.35; text-decoration: line-through; cursor: not-allowed; }

/* ---- Top-3 ranking ---------------------------------------------------------------------- */

.survey-rank + .survey-rank { margin-top: var(--sp-4); }
.survey-rank-place {
    display: block;
    margin-bottom: var(--sp-2);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ---- Radio rows ------------------------------------------------------------------------ */

.survey-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.survey-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 54px;
    padding: var(--sp-3) var(--sp-4);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--text-base);
    cursor: pointer;
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                transform var(--dur) var(--ease);
}
.survey-row input {
    accent-color: var(--sku, var(--ink));
    width: 1.25rem; height: 1.25rem; flex: none;
}
.survey-row:has(input:checked) {
    border-color: var(--sku, var(--ink));
    background: var(--sku-tint, var(--bg-soft));
    font-weight: 700;
}
.survey-row:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---- Gradient frames on the options -------------------------------------------------------- */

/* Every unanswered option wears the same tri-hue frame as the cards, from the shared
   --grad-brand-border token: transparent border, surface-coloured padding-box layer over a
   border-box gradient layer, so the 2px frame follows each rounded corner.

   Placed after all the component rules above on purpose. The selected states below have to
   win, and several of them tie on specificity with the rules they override, so source order
   is what decides — moving this block earlier would leave chosen options wearing the
   unselected frame.

   A chosen option drops the gradient and goes solid in the flavour's colour. That is the
   whole point: when everything wears the brand sweep, "picked" has to be a different KIND
   of edge, not a louder version of the same one. Solid colour is expressed as a one-stop
   gradient so the layer count matches and nothing has to be unset. */
@supports (background: linear-gradient(in oklab, red, blue)) and (background: color-mix(in srgb, red 50%, #fff)) {
    .scale-9,
    .survey-pick .pick,
    .survey-chip span,
    .survey-row,
    /* The just-about-right midpoint keeps its neutral dashed grey marker: a dashed border
       cannot show through a border-box gradient, and that marker is doing real work. */
    .scale-jar .jar-opt:not(.is-jar) span {
        border-color: transparent;
        background-color: transparent;
        background-image: linear-gradient(var(--surface), var(--surface)), var(--grad-brand-border);
        background-origin: padding-box, border-box;
        background-clip: padding-box, border-box;
    }

    /* The flavour picker keeps its own tint-plus-colour: there the fill IS the answer. */
    .survey-pick input:checked + .pick {
        background-image:
            linear-gradient(var(--sku-tint), var(--sku-tint)),
            linear-gradient(var(--sku), var(--sku));
    }

    /* Picked, via the --pick-* trio: the brand gradient on the general cards, solid flavour
       colour inside a flavour card. background-color has to be cleared explicitly — the
       shorthand in the non-@supports rule these override also sets a colour, and it would
       paint across the whole border box and bury the frame. */
    .survey-row:has(input:checked),
    .survey-chip input:checked + span {
        /* border-color too, not just the background. The non-@supports rules these override
           set a solid border in --sku, which outranks the transparent border on the
           unselected frame rule — so a chosen option was drawing a hard dark line straight
           over its own gradient frame layer. */
        border-color: transparent;
        background-color: transparent;
        background-image: var(--pick-fill), var(--pick-frame);
        color: var(--pick-ink);
    }

    /* Just-about-right lives only inside flavour cards, so it is always solid flavour. */
    .scale-jar .jar-opt:not(.is-jar) input:checked + span {
        background-image:
            linear-gradient(var(--sku), var(--sku)),
            linear-gradient(var(--sku), var(--sku));
    }

    /* The nine-point strip is one control, so only its outer frame is gradient — the cells
       inside keep their hairline dividers and paint their fill over the padding-box layer. */
    .scale-9 .scale-dot input:checked + span {
        background: var(--sku, var(--ink));
    }
}

/* ---- Pointer feedback ----------------------------------------------------------------------- */

/* The option under the cursor fills with --grad-brand-soft: the same tri-hue sweep as the
   frames, washed ~80% into white. Faint enough that it never competes with a chosen answer
   (solid flavour colour), strong enough to say "this is the one you are about to click".

   Gated on (hover: hover) and (pointer: fine) for a reason this form cannot afford to get
   wrong. Most people meet it on a phone, where a tap leaves :hover stuck on the last thing
   touched — so an option they did NOT choose would sit there looking tinted next to one
   they did. A real cursor gets the feedback; a thumb gets nothing but the actual answer. */
@media (hover: hover) and (pointer: fine) {
    .survey-pick:hover .pick,
    .survey-chip:hover span,
    .survey-row:hover { transform: translateY(-2px); }

    /* :not(:checked) throughout — hover must never repaint an answer already given. */
    .scale-9 .scale-dot input:not(:checked) + span:hover,
    .scale-jar .jar-opt input:not(:checked) + span:hover,
    .survey-pick input:not(:checked) + .pick:hover,
    .survey-chip input:not(:checked) + span:hover,
    .survey-row:not(:has(input:checked)):hover {
        background-color: var(--grad-brand-fallback);
        background-image: var(--grad-brand-soft);
    }

    /* Where the option carries a gradient frame, the wash replaces only the padding-box
       layer; the border-box layer stays put so the frame does not vanish on hover. */
    @supports (background: linear-gradient(in oklab, red, blue)) and (background: color-mix(in srgb, red 50%, #fff)) {
        .survey-pick input:not(:checked) + .pick:hover,
        .survey-chip input:not(:checked) + span:hover,
        .scale-jar .jar-opt:not(.is-jar) input:not(:checked) + span:hover,
        .survey-row:not(:has(input:checked)):hover {
            background-color: transparent;
            background-image: var(--grad-brand-soft), var(--grad-brand-border);
        }
    }
}

/* ---- Free text --------------------------------------------------------------------------- */

/* font: inherit keeps this at 1rem — anything under 16px makes iOS zoom the whole page in
   when the field takes focus, and the person never finds their way back out. */
.survey-q .textarea,
.survey-q .input {
    border-width: 2px;
    border-radius: var(--radius);
    padding: var(--sp-3) var(--sp-4);
}
/* The "tell me when it drops" address sits under a hint line; both need room to breathe
   inside the question rather than butting up against the field. */
.survey-q .input + .survey-hint { margin: var(--sp-2) 0 0; }

/* ---- Submit ------------------------------------------------------------------------------- */

.survey-submit { text-align: center; margin-top: var(--sp-6); }
.survey-submit .btn {
    width: 100%;
    min-height: 56px;
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 800;
    border-radius: var(--radius-pill);
}
.survey-submit .survey-hint { margin: var(--sp-4) 0 0; }

.survey-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Closed / thank-you -------------------------------------------------------------------- */

.survey-closed { text-align: center; padding-block: var(--sp-7); }
.survey-closed .gl-lockup-img, .survey-closed .gl-lockup { margin-inline: auto; }
.survey-closed h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1.05;
}
.survey-closed .btn { min-height: 52px; border-radius: var(--radius-pill); font-weight: 700; }

/* ---- Wider screens ------------------------------------------------------------------------- */

/* The phone layout is the real one; this only stops it looking stranded on a laptop. */
@media (min-width: 40rem) {
    .survey-card { --card-pad-y: var(--sp-6); --card-pad-x: var(--sp-5); }
    .scale-9 .scale-dot span { height: 56px; font-size: var(--text-lg); }
    .survey-submit .btn { width: auto; min-width: 18rem; }
}

/* Very narrow phones (iPhone SE and older Androids). Buy back horizontal room for the nine
   cells from the card's side padding, which is the only place left to take it from. */
@media (max-width: 23.5rem) {
    .event-main  { padding-inline: var(--sp-3); }
    .survey-card { --card-pad-x: var(--sp-3); }
    .scale-9 .scale-dot span { height: 48px; font-size: var(--text-base); }
}

/* Honour a system request for less movement: every transform here is decoration, and the
   selected state still reads from its colour and border alone. */
@media (prefers-reduced-motion: reduce) {
    .survey-lang,
    .survey-pick .pick,
    .survey-pick .dot::after,
    .scale-9 .scale-dot span,
    .scale-jar .jar-opt span,
    .survey-chip span,
    .survey-row {
        transition: none;
    }
    .survey-pick:hover .pick,
    .survey-chip:hover span,
    .survey-row:hover,
    .survey-lang:hover,
    .scale-9 .scale-dot input:checked + span,
    .scale-jar .jar-opt input:checked + span,
    .survey-chip input:checked + span {
        transform: none;
    }
    .survey-pick input:checked + .pick .dot::after { transform: rotate(45deg) scale(1); }
}

/* ---- Dark mode ------------------------------------------------------------------------------ */

/* The palette itself (page, cards, ink, tints, brand gradients) is site-wide now and lives in
   assets/css/theme.css, switched by <html data-theme> from the corner toggle or the phone's
   own setting. What stays here is specific to this form.

   The flavour colours are the same in both modes, so a picked answer is the same purple,
   green or gold. Only the text ON those fills changes: light mode puts the page surface
   (white) on them, which in dark mode would be near-black on purple. --on-sku says what goes
   on a flavour fill, and gold takes dark text because white on gold is unreadable anyway. */
[data-theme="dark"] .survey-form { --on-sku: #FFFFFF; }
[data-theme="dark"] .survey-sku.sku-flow,
[data-theme="dark"] .survey-pick.opt-flow { --on-sku: #1E160A; }

[data-theme="dark"] .survey-sku { --pick-ink: var(--on-sku); }
[data-theme="dark"] .scale-9 .scale-dot input:checked + span,
[data-theme="dark"] .scale-jar .jar-opt input:checked + span,
[data-theme="dark"] .survey-sku .survey-chip input:checked + span { color: var(--on-sku); }
[data-theme="dark"] .survey-pick .dot::after { border-color: var(--on-sku); }

/* The one step colour that is a literal rather than a token: the wordmark blue, deepened for
   a light page, lifted for a dark one. */
[data-theme="dark"] .survey-card:nth-child(5n + 2) { --step-ink: #9DB4E6; }

[data-theme="dark"] .survey-testbanner { color: var(--flow-deep); }
[data-theme="dark"] .flash-success     { background: var(--reset-tint); color: var(--reset-deep); }
[data-theme="dark"] .survey-q .input::placeholder,
[data-theme="dark"] .survey-q .textarea::placeholder { color: var(--ink-faint); }

/* The light/dark toggle is pinned to the window's top-right corner on this layout, which on
   a phone is exactly where the language switch sits — and there is no room to step it left,
   because the centred lockup takes the middle. So on a phone the language switch moves to
   the top-left corner instead; both stay one thumb-reach from the top. */
@media (max-width: 40rem) {
    .survey-lang { right: auto; left: 0; }
}

/* ---- PDPA notice ------------------------------------------------------------------------- */

/* Quiet but legible, and deliberately not inside a card: it is a statement about the form,
   not another question in it. Still full --ink-soft rather than a faded grey, because a
   consent notice nobody can read is not a consent notice. */
.survey-privacy {
    margin-top: var(--sp-6);
    padding: var(--sp-5) var(--card-pad-x, var(--sp-4));
    border: 2px dashed var(--line);
    border-radius: var(--radius-lg);
    color: var(--ink-soft);
    font-size: var(--text-xs);
    line-height: 1.55;
}
.survey-privacy h2 {
    margin: 0 0 var(--sp-2);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--ink);
}
.survey-privacy p { margin: 0 0 var(--sp-2); }
.survey-privacy p:last-child { margin-bottom: 0; }
.survey-privacy a { color: var(--ink); }

/* The wordmark inside running copy must not drag the line height around. */
.survey-privacy .brand-mark,
.survey-label .brand-mark,
.survey-hint .brand-mark { font-size: 1em; }

/* ---------- Admin read-only viewer (admin/survey/response) ----------------------------
   The same form, inside a disabled fieldset. Reset the fieldset box so the cards lay out
   exactly as for a customer, and stop the browser greying out the text fields: the point is
   to read the answers, not to show that they are locked. */
.survey-lock { border: 0; padding: 0; margin: 0; min-width: 0; }
/* No hover either: a hovered chip lights up almost like a ticked one, which misleads when
   reading answers out to someone. Text areas keep pointer events so a long comment scrolls. */
.survey-lock { pointer-events: none; }
.survey-lock textarea { pointer-events: auto; }
.survey-form.is-readonly label,
.survey-form.is-readonly .survey-chip span { cursor: default; }
.survey-form.is-readonly .input:disabled,
.survey-form.is-readonly .textarea:disabled {
    color: var(--ink);
    -webkit-text-fill-color: var(--ink);
    opacity: 1;
    background: var(--bg-soft);
}
/* Respondent's own read-only copy (/survey/mine), and the "already answered" hint on the form. */
.survey-mine {
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: var(--sp-5, 24px);
    background: var(--bg-soft);
}
.survey-mine h2 { margin: 0 0 6px; font-size: 1.2rem; }
.survey-mine p { margin: 0 0 8px; }
.survey-mine-link { width: 100%; font-size: .8rem; }
.survey-mine-note {
    margin: 0 0 var(--sp-4, 16px);
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-soft);
    font-size: .9rem;
}
.survey-viewer {
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: var(--sp-5, 24px);
    background: var(--bg-soft);
    font-size: .9rem;
}
.survey-viewer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.survey-viewer-row .select { width: auto; max-width: 100%; flex: 1 1 260px; }
.survey-viewer-nav { display: flex; gap: 12px; margin-left: auto; }
.survey-viewer-meta { margin: 8px 0 0; }
