/* =========================================================================
   Quriov G2 survey — standalone storefront-matched styling.
   Tokens, @font-face, and component patterns are lifted VERBATIM from the live
   theme (quriov-storefront/snippets/quriov-head.liquid) so this standalone page
   reads as part of the real quriov.com storefront:
     - Fonts:  Fraunces (serif display) + Hanken Grotesk (body/UI)  [self-hosted]
     - Colour: bone paper (--q-bone) / warm ink / amber accent
   No Inter. No teal. Body text Hanken on bone; headings Fraunces.
   ========================================================================= */

/* ---- Self-hosted brand faces (woff2 already copied to ./assets) ---- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 450;
  font-display: swap;
  src: url(./assets/quriov-fraunces-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 400;
  font-display: swap;
  src: url(./assets/quriov-fraunces-italic-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url(./assets/quriov-hanken-latin.woff2) format("woff2");
}

:root {
  color-scheme: light;

  /* Brand tokens — verbatim from quriov-head.liquid :root */
  --q-bone: #f4eee6;
  --q-bone-2: #ebe3d6;
  --q-ink: #1c1a18;
  --q-ink-2: #23201d;
  --q-ink-soft: #2c2823;
  --q-graphite: #736a5e;
  --q-graphite-2: #8a8175;
  --q-line: rgba(28, 26, 24, 0.12);
  --q-line-d: rgba(244, 238, 230, 0.15);
  --q-amber: #c2702a;
  --q-amber-bright: #d98e45;
  --q-amber-ink: #8f4e16;
  --q-paper: #f4eee6;
  --q-muted: rgba(244, 238, 230, 0.62);
  --q-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --q-grotesk: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --q-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --q-page: min(1240px, 92vw);

  /* ---- Survey-facing aliases (old --paper/--ink/etc. names map onto the
     brand tokens so the existing survey markup needs no class churn) ---- */
  --paper: var(--q-bone);
  --sand: var(--q-bone-2);
  --paper-card: #faf6ef; /* a hair lifted from bone, for cards/inputs */
  --bg: var(--q-bone);
  --panel: #fbf9f3;
  --ink: var(--q-ink);
  --graphite: var(--q-graphite);
  --muted: var(--q-graphite); /* warm graphite reads AA on bone */
  --line: var(--q-line);
  --accent: var(--q-amber);
  --accent-dark: var(--q-amber-ink);
  --accent-soft: #f3e7d4;
  --accent-ring: rgba(194, 112, 42, 0.45);
  --accent-border: rgba(143, 78, 22, 0.5);
  --warn: var(--q-amber-ink);
  --error: #b42318;
  --shadow: 0 16px 42px rgba(28, 26, 24, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--q-bone);
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  color: var(--q-ink);
  font-family: var(--q-serif);
  font-weight: 420; /* Fraunces optical display weight */
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

/* ---- Links (Amber-ink on bone = AA) ---- */
a {
  color: var(--q-amber-ink);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--q-amber);
}

/* =========================================================================
   Brand components — verbatim patterns from quriov-head.liquid
   ========================================================================= */

/* Eyebrow: "— MEET QURIOV" look (amber rule + uppercase grotesk).
   Container paragraph rules (.respondent-intro p / .privacy-page p) exclude
   .q-eyebrow via :not(), so this amber-ink colour always wins. */
.q-eyebrow,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: 0 0 8px;
  font-family: var(--q-grotesk);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--q-amber-ink);
}

.q-eyebrow::before,
.eyebrow::before {
  content: "";
  width: 1.6em;
  height: 1px;
  background: var(--q-amber);
}

/* Primary button: Ink fill, grotesk 500, lifts on hover */
.q-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  background: var(--q-ink);
  color: var(--q-bone);
  font-family: var(--q-grotesk);
  font-weight: 500;
  font-size: 0.98rem;
  line-height: 1;
  padding: 1.05em 2em;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.16s var(--q-ease),
    background 0.25s var(--q-ease);
}

.q-btn:hover {
  background: #000;
  transform: translateY(-2px);
}

.q-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

/* Site-wide visible keyboard focus (WCAG 2.4.7) — themes strip this. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--q-amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.q-btn:focus-visible {
  outline-color: var(--q-amber-bright);
  outline-offset: 3px;
}

/* The question card is given tabindex="-1" and programmatically focused after
   each step (scroll/AT target, not an interactive control), so suppress the
   generic [tabindex]:focus-visible amber ring on it — controls keep theirs. */
.question-card:focus,
.question-card:focus-visible,
.respondent-stage:focus,
.respondent-stage:focus-visible,
.privacy-page:focus,
.privacy-page:focus-visible {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 60;
  padding: 10px 14px;
  background: var(--q-ink);
  color: var(--q-bone);
  border-radius: 8px;
  font-family: var(--q-grotesk);
  font-weight: 500;
}

.skip-link:focus {
  top: 16px;
}

/* =========================================================================
   Site HEADER — clean sticky bar matching the storefront
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--q-bone);
  border-bottom: 1px solid var(--q-line);
}

/* Sticky-header scroll offset: each step focuses its card (scrollIntoView); leave
   room for the sticky header so the question title isn't tucked under it. */
html {
  scroll-padding-top: 88px;
}
.question-card,
.respondent-stage {
  scroll-margin-top: 88px;
}
@media (max-width: 560px) {
  html {
    scroll-padding-top: 124px;
  }
  .question-card,
  .respondent-stage {
    scroll-margin-top: 124px;
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 40px);
  width: 100%;
  max-width: var(--q-page);
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
}

.site-header__brand {
  font-family: var(--q-serif);
  font-weight: 450;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--q-ink);
  text-decoration: none;
  line-height: 1;
}

.site-header__brand:hover {
  color: var(--q-ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
  margin-left: auto;
}

.site-nav__link {
  font-family: var(--q-grotesk);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--q-ink);
  text-decoration: none;
  transition: color 0.2s var(--q-ease);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  color: var(--q-amber);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: clamp(6px, 1.5vw, 14px);
}

.site-actions__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--q-ink);
  border-radius: 8px;
  transition:
    color 0.2s var(--q-ease),
    background 0.2s var(--q-ease);
}

.site-actions__link:hover,
.site-actions__link:focus-visible {
  color: var(--q-amber);
  background: rgba(28, 26, 24, 0.05);
}

.site-actions__link svg {
  width: 21px;
  height: 21px;
}

@media (max-width: 560px) {
  .site-header__inner {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px clamp(14px, 4vw, 20px);
  }
  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 18px;
  }
  .site-actions {
    margin-left: auto;
  }
  .site-nav__link {
    font-size: 0.9rem;
  }
}

/* =========================================================================
   Page scaffold
   ========================================================================= */
.respondent-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--q-bone-2) 0, rgba(235, 227, 214, 0) 340px),
    var(--q-bone);
}

.respondent-stage {
  flex: 1 0 auto;
  width: min(100%, 880px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(14px, 4vw, 32px) 56px;
}

/* Survey intro hero */
.respondent-intro,
.step-shell,
.respondent-complete {
  border: 1px solid var(--q-line);
  border-radius: 14px;
  background: var(--paper-card);
  box-shadow: var(--shadow);
}

.respondent-intro {
  display: grid;
  gap: 20px;
  padding: clamp(24px, 5vw, 48px);
}

.respondent-intro h2 {
  max-width: 18ch;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.04;
}

/* Amber italic serif emphasis on ONE word (storefront hero mirror) */
.respondent-intro h2 em,
.intro-emphasis {
  font-style: italic;
  color: var(--q-amber);
}

.respondent-intro p:not(.q-eyebrow) {
  max-width: 64ch;
  margin-bottom: 0;
  color: var(--q-graphite);
  font-size: 1.05rem;
}

/* Step shell (mid-survey) */
.respondent-form {
  display: block;
}

.step-shell {
  padding: clamp(18px, 3.5vw, 30px);
}

.step-top {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.step-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 6px;
  font-family: var(--q-grotesk);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--q-amber-ink);
}

.step-kicker::before {
  content: "";
  width: 1.6em;
  height: 1px;
  background: var(--q-amber);
}

.step-top h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.step-badge {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  background: var(--q-bone-2);
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.8rem;
  font-weight: 500;
}

.step-progress {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.86rem;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--q-bone-2);
}

#respondent-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--q-amber);
  transition: width 220ms var(--q-ease);
}

.question-stage {
  min-height: 420px;
}

/* Question card */
.question-card {
  border-radius: 12px;
  background: transparent;
}

.question-card.respondent-card {
  box-shadow: none;
}

.question-card.has-error {
  border-radius: 12px;
  outline: 1px solid rgba(180, 35, 24, 0.45);
  outline-offset: 4px;
}

.respondent-card h3 {
  max-width: 24ch;
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  line-height: 1.16;
}

.helper {
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 1rem;
}

/* Options */
.option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 50px;
  padding: 13px 14px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--paper-card);
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
  cursor: pointer;
  transition:
    border-color 0.18s var(--q-ease),
    background 0.18s var(--q-ease);
}

.option:hover {
  border-color: var(--q-graphite-2);
}

.option.is-selected {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.option input {
  flex: 0 0 auto;
  width: 18px;
  /* Clamp BOTH height and min-height: the generic `input { min-height: 46px }`
     rule below would otherwise inflate these checkboxes/radios to 46px and blow
     up the option row height. */
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--q-amber);
}

.option-label {
  min-width: 0;
}

/* Text inputs */
textarea {
  width: 100%;
  min-height: 96px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--paper-card);
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
  resize: vertical;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--paper-card);
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--q-amber);
}

.follow-up {
  display: block;
  margin-top: 14px;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.95rem;
}

details {
  margin-top: 12px;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.88rem;
}

summary {
  cursor: pointer;
}

.error {
  margin: 14px 0 0;
  color: var(--error);
  font-family: var(--q-grotesk);
  font-weight: 600;
}

/* Step controls */
.step-controls {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr) minmax(130px, auto);
  gap: 12px;
  align-items: center;
  margin-top: 22px;
}

.step-hint {
  margin: 0;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.86rem;
  text-align: center;
}

/* =========================================================================
   Buttons — primary adopts the .q-btn Ink pattern; secondary = outline
   ========================================================================= */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--q-grotesk);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.16s var(--q-ease),
    background 0.25s var(--q-ease),
    border-color 0.25s var(--q-ease);
}

.button.large {
  width: fit-content;
  min-width: 180px;
  min-height: 54px;
  padding: 1.05em 2em;
  font-size: 0.98rem;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

/* Primary = Ink fill (brand §4), lifts on hover — the .q-btn look. */
.button.primary {
  background: var(--q-ink);
  border-color: var(--q-ink);
  color: var(--q-bone);
}

.button.primary:hover:not(:disabled) {
  background: #000;
  border-color: #000;
  transform: translateY(-2px);
}

.button.secondary {
  background: transparent;
  border-color: var(--q-ink);
  color: var(--q-ink);
}

.button.secondary:hover:not(:disabled) {
  background: var(--q-bone-2);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--q-amber-ink);
}

.button.ghost.danger {
  color: var(--error);
}

/* =========================================================================
   Completion + consent + retry
   ========================================================================= */
.completion-panel {
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--q-line);
  border-radius: 14px;
  background: var(--paper-card);
  box-shadow: var(--shadow);
}

.completion-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.completion-panel p {
  margin-bottom: 0;
  max-width: 62ch;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
}

.consent-block {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--q-bone-2);
}

.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
}

.consent-line input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--q-amber);
  cursor: pointer;
}

.consent-block.has-error {
  border-color: rgba(180, 35, 24, 0.55);
  background: #f7ebe2;
}

.privacy-note {
  margin: 6px 0 0;
  color: var(--q-graphite);
  font-family: var(--q-grotesk);
  font-size: 0.85rem;
  line-height: 1.5;
}

.privacy-note a {
  font-weight: 600;
}

.retry-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--q-line);
  border-radius: 12px;
  background: var(--q-bone-2);
}

.retry-block p {
  margin: 0;
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
  font-size: 0.95rem;
}

/* =========================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--q-ink);
  color: var(--q-bone);
  font-family: var(--q-grotesk);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms var(--q-ease),
    transform 160ms var(--q-ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--error);
}

.toast.success {
  background: var(--q-ink);
}

/* =========================================================================
   Site FOOTER — calm brand footer (dark ink)
   ========================================================================= */
.site-footer {
  flex-shrink: 0;
  background: var(--q-ink);
  color: var(--q-bone);
  border-top: 1px solid var(--q-line-d);
}

.site-footer__inner {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: var(--q-page);
  margin: 0 auto;
  padding: clamp(36px, 6vw, 56px) clamp(16px, 4vw, 32px);
}

.site-footer__brand {
  font-family: var(--q-serif);
  font-weight: 450;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
  color: var(--q-bone);
  text-decoration: none;
  line-height: 1;
}

.site-footer__brand:hover {
  color: var(--q-bone);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
}

.site-footer__links a {
  font-family: var(--q-grotesk);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--q-muted);
  text-decoration: none;
  transition: color 0.2s var(--q-ease);
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
  color: var(--q-amber-bright);
}

.site-footer__meta {
  display: grid;
  gap: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--q-line-d);
}

.site-footer__meta p {
  margin: 0;
  font-family: var(--q-grotesk);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--q-muted);
}

.site-footer a:focus-visible {
  outline-color: var(--q-amber-bright);
}

/* =========================================================================
   Privacy page
   ========================================================================= */
.privacy-page {
  flex: 1 0 auto;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 56px) clamp(16px, 4vw, 32px) 64px;
}

.privacy-page h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.06;
}

.privacy-page h2 {
  margin: 32px 0 8px;
  font-size: 1.35rem;
}

.privacy-page p:not(.q-eyebrow),
.privacy-page li {
  max-width: 68ch;
  color: var(--q-ink-soft);
  font-family: var(--q-grotesk);
}

.privacy-page ul {
  padding-left: 20px;
}

.privacy-page .back-link {
  display: inline-block;
  margin-top: 30px;
  font-family: var(--q-grotesk);
  font-weight: 600;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 760px) {
  .step-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .step-badge {
    margin-top: 4px;
  }
  .step-controls {
    grid-template-columns: 1fr;
  }
  .step-hint {
    order: 3;
    text-align: left;
  }
}

/* Phones: make option rows compact so a 6–9 option question fits with little
   scrolling. Tap target stays at the 44px a11y floor (min-height); only the
   padding/gap/font tighten. Desktop spacing is untouched. */
@media (max-width: 560px) {
  .question-stage {
    min-height: 0;
  }
  .respondent-card h3 {
    margin-bottom: 6px;
    font-size: clamp(1.3rem, 6vw, 1.6rem);
    line-height: 1.18;
  }
  .helper {
    font-size: 0.92rem;
  }
  .option-grid {
    gap: 7px;
    margin-top: 12px;
  }
  .option {
    min-height: 44px;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 0.95rem;
    line-height: 1.3;
  }
  .option input {
    width: 17px;
    height: 17px;
    min-height: 17px;
    margin-top: 1px;
  }
}

@media (max-width: 420px) {
  .respondent-intro h2 {
    font-size: clamp(1.85rem, 9vw, 2.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
