/* ============================================================
   Fit'sin survey - brand tokens
   Swap these hex values to retheme the whole survey.
   ============================================================ */
:root {
  --brand-bg:        #ffffff;
  --brand-surface:   #fafafa;
  --brand-text:      #0a0a0a;
  --brand-muted:     #6b6b6b;
  --brand-border:    #e6e6e6;
  --brand-primary:   #000000;       /* CTAs, selected state */
  --brand-on-primary:#ffffff;
  --brand-accent:    #c9b8e0;       /* lavender from the storefront strip */
  --brand-accent-2:  #f6d6e3;       /* soft pink */
  --brand-danger:    #c0392b;

  --font-heading: "Archivo Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body:    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
}

/* ============================================================
   Reset-ish + base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
/* Author display rules below (display: flex on .done, .submit, etc.)
   override the UA [hidden] { display: none } stylesheet. Restore it. */
[hidden] { display: none !important; }
body {
  font-family: var(--font-body);
  color: var(--brand-text);
  background: var(--brand-bg);
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

/* ============================================================
   Layout
   ============================================================ */
.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 20px 56px;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

/* Accent stripe behind header - nods to the storefront banner */
.header {
  text-align: center;
  padding: 18px 0 26px;
  position: relative;
}
.header::before {
  content: "";
  position: absolute;
  inset: 0 -20px auto -20px;
  height: 8px;
  background: linear-gradient(
    90deg,
    var(--brand-accent) 0%,
    var(--brand-accent-2) 50%,
    var(--brand-accent) 100%
  );
}
.logo {
  height: 84px;
  width: auto;
  margin: 18px auto 10px;
  object-fit: contain;
}
.tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-muted);
  margin: 6px 0 0;
}

.intro {
  text-align: center;
  margin: 18px 0 28px;
}
.intro h1 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  text-transform: uppercase;
}
.intro p {
  color: var(--brand-muted);
  margin: 0;
  font-size: 15px;
}

/* ============================================================
   Form
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 22px; }

.q {
  border: none;
  margin: 0;
  padding: 18px;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
}
.q legend {
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.q .num {
  font-family: var(--font-heading);
  font-size: 11px;
  color: var(--brand-muted);
  letter-spacing: 0.1em;
}
.q .opt {
  font-family: var(--font-body);
  font-weight: 400;
  text-transform: none;
  color: var(--brand-muted);
  font-size: 13px;
  letter-spacing: 0;
}
.q .hint {
  margin: 4px 0 14px;
  color: var(--brand-muted);
  font-size: 13px;
}
.q.invalid {
  border-color: var(--brand-danger);
  background: #fff7f6;
}

/* Chips - grid keeps every pill the same width within its row */
.chips {
  display: grid;
  grid-template-columns: repeat(var(--chip-cols, 2), 1fr);
  gap: 10px;
  margin-top: 10px;
}
.chip {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid var(--brand-border);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  transition: transform 0.05s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border-color: var(--brand-primary);
}

/* Per-question column counts.
   Size has 6 short labels so 3 cols × 2 rows reads cleanest.
   Eras + channel have 5 items in 2 cols, so the 5th spans the full row
   to avoid a lonely orphan pill. */
.q[data-name="size"] .chips { --chip-cols: 3; }
.q[data-name="eras"] .chip:last-child,
.q[data-name="channel"] .chip:last-child {
  grid-column: 1 / -1;
}

/* Text inputs */
textarea,
input[type="text"] {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  font: inherit;
  color: var(--brand-text);
  background: #fff;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-sm);
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}
textarea { line-height: 1.4; min-height: 96px; }
textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--brand-primary);
}
textarea::placeholder,
input::placeholder { color: #a8a8a8; }

/* ============================================================
   Submit
   ============================================================ */
.submit {
  position: relative;
  min-height: 56px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-family: var(--font-heading);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.submit:active { transform: scale(0.99); }
.submit[disabled] { opacity: 0.6; cursor: progress; }

.submit-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: none;
}
.submit.is-loading .submit-spinner { display: inline-block; }
.submit.is-loading .submit-label { opacity: 0.75; }
@keyframes spin { to { transform: rotate(360deg); } }

.fineprint {
  text-align: center;
  font-size: 12px;
  color: var(--brand-muted);
  margin: 4px 0 0;
}

.error {
  background: #fff0ee;
  color: var(--brand-danger);
  border: 1px solid #f1c5bf;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
}

/* ============================================================
   Sending overlay (blocks page while POST is in-flight)
   ============================================================ */
.sending {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  animation: fade-in 0.18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sending-card {
  text-align: center;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.sending-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--brand-border);
  border-top-color: var(--brand-primary);
  animation: spin 0.8s linear infinite;
}
.sending-label {
  font-family: var(--font-heading);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  color: var(--brand-text);
}
.sending-sub {
  margin: 0;
  font-size: 14px;
  color: var(--brand-muted);
  line-height: 1.4;
}

/* ============================================================
   Success state
   ============================================================ */
.done {
  text-align: center;
  padding: 40px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.done-eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-text);
  background: var(--brand-accent);
  padding: 8px 14px;
  border-radius: 999px;
  margin: 0;
}
.done-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-size: 32px;
  line-height: 64px;
  font-weight: 700;
}
.done h2 {
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 28px;
  margin: 4px 0 0;
}
.done-sub,
.done-followup {
  color: var(--brand-muted);
  max-width: 320px;
  margin: 0;
  font-size: 14px;
}
.done-followup { margin-top: 4px; }
.back {
  margin-top: 12px;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  text-decoration: none;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 26px;
  border-radius: var(--radius);
  font-size: 14px;
}

/* Reward card (discount code + barcode) */
.reward {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1.5px solid var(--brand-primary);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  margin: 10px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
}
.reward-label {
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--brand-muted);
  margin: 0;
  text-transform: uppercase;
}
.reward-code {
  font-family: var(--font-heading);
  font-size: 30px;
  letter-spacing: 0.08em;
  margin: -2px 0 4px;
  text-transform: uppercase;
  color: var(--brand-text);
}
.reward-barcode {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
  background: #fff;
}
.reward-barcode canvas,
.reward-barcode img {
  max-width: 100%;
  height: auto;
  display: block;
}
.save-btn {
  border: 1.5px solid var(--brand-primary);
  background: #fff;
  color: var(--brand-primary);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  padding: 12px 22px;
  border-radius: var(--radius);
  min-height: var(--tap);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, background 0.12s ease, color 0.12s ease;
}
.save-btn:active { transform: scale(0.98); }
.save-btn.is-saved {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}
.reward-instructions {
  font-size: 12px;
  color: var(--brand-muted);
  margin: 0;
  text-align: center;
  max-width: 280px;
  line-height: 1.4;
}

/* ============================================================
   Small screen polish
   ============================================================ */
@media (max-width: 380px) {
  .shell { padding: 18px 14px 48px; }
  .q { padding: 16px; }
  .logo { height: 72px; }
}
