/* ==========================================================================
   RightSpeed – Premium UK consumer guidance (IBM-inspired discipline)
   Design system: tokens, 8px grid, modular blocks, no regression to logic
   CHANGELOG: Production UX — hero-cta-column and hero-grid no longer hidden when in questionnaire/results
   so Start and QA/result stay in same panel. CTA min-height 44px; pointer-events on decor; reduce-motion.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   DESIGN TOKENS
   --------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Colours */
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F0F2F8;
  --surface-muted: #F8F9FC;

  --text: #1a2332;
  --text-muted: #5a6578;

  --border: #dce0e8;
  --border-light: #e8ecf2;

  --brand: #0b5fff;
  --brand-hover: #0047cc;
  --focus-ring: rgba(11, 95, 255, 0.45);
  --accent-2: #0d9488;

  --trust: #0d9488;

  /* Typography */
  --font: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-base: 16px;
  --text-sm: 14px;
  --text-xs: 12px;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-display: clamp(1.75rem, 4vw, 2.5rem);
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 1.75;

  /* Spacing scale (8px base) */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-80: 80px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 720px;
  --section-gap: var(--space-32);
  --section-gap-lg: var(--space-48);
  --card-pad: var(--space-24);
  --card-pad-sm: var(--space-18);
  --container-pad: var(--space-24);

  /* Radius & shadow */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --shadow: 0 2px 8px rgba(26, 35, 50, 0.06);
  --shadow-lg: 0 8px 24px rgba(26, 35, 50, 0.08);
  --shadow-primary: 0 4px 16px rgba(11, 95, 255, 0.2);

  /* Transitions */
  --ease: 0.2s ease;
  --ease-out: 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Ambient background (subtle blue/white, low intensity) */
  --ambient-opacity: 0.38;
  --ambient-blur: 80px;
  --ambient-size: 280px;
  --ambient-duration: 24s;
  --ambient-color-1: rgba(255, 255, 255, 0.65);
  --ambient-color-2: rgba(200, 220, 255, 0.45);
  --ambient-color-3: rgba(180, 210, 255, 0.35);
}

@media (max-width: 640px) {
  :root {
    --card-pad: var(--card-pad-sm);
    --container-pad: var(--space-16);
  }
}
@media (max-width: 414px) {
  :root { --container-pad: var(--space-12); }
}
@media (max-width: 375px) {
  :root { --container-pad: var(--space-12); }
}
@media (max-width: 320px) {
  :root { --container-pad: var(--space-8); }
  .stage { min-height: 180px; }
  .qa-card-wrap .card { padding: var(--space-16); }
}

/* ---------------------------------------------------------------------------
   BASE & SKIP LINK
   --------------------------------------------------------------------------- */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { body { overflow-y: scroll; } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* ---------------------------------------------------------------------------
   AMBIENT BACKGROUND (CSS-only, behind content, reduced on mobile/motion)
   --------------------------------------------------------------------------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 80% at 50% -20%, rgba(220, 235, 255, 0.18) 0%, transparent 50%);
  pointer-events: none;
}
.ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(200, 215, 240, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 215, 240, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.ambient-orb {
  position: absolute;
  width: var(--ambient-size);
  height: var(--ambient-size);
  border-radius: 50%;
  filter: blur(var(--ambient-blur));
  opacity: var(--ambient-opacity);
  animation: ambient-float var(--ambient-duration) ease-in-out infinite;
  will-change: transform;
  pointer-events: none;
}
.ambient-orb.o1 { background: var(--ambient-color-1); top: 5%; left: 10%; animation-delay: 0s; }
.ambient-orb.o2 { background: var(--ambient-color-2); top: 60%; left: 70%; animation-delay: -4s; }
.ambient-orb.o3 { background: var(--ambient-color-3); top: 30%; right: 15%; animation-delay: -8s; }
.ambient-orb.o4 { background: var(--ambient-color-2); bottom: 20%; left: 25%; animation-delay: -12s; }
.ambient-orb.o5 { background: var(--ambient-color-1); top: 70%; left: 50%; animation-delay: -16s; }
.ambient-orb.o6 { background: var(--ambient-color-3); top: 15%; left: 55%; animation-delay: -20s; }
@keyframes ambient-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  25% { transform: translate3d(1.5%, 2%, 0) scale(1.03); }
  50% { transform: translate3d(-1.5%, -1.5%, 0) scale(0.99); }
  75% { transform: translate3d(2%, -1%, 0) scale(1.01); }
}
@media (max-width: 768px) {
  .ambient-orb.o4,
  .ambient-orb.o5,
  .ambient-orb.o6 { display: none; }
  :root {
    --ambient-opacity: 0.3;
    --ambient-size: 200px;
    --ambient-blur: 60px;
  }
  body.is-in-questionnaire .hero-wrap { padding: var(--space-16) 0 var(--space-12); }
  .result-grid { grid-template-columns: 1fr; }
  .tier-ladder { position: relative; top: auto; }
  .result-metrics { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ambient-orb { animation: none; opacity: 0.2; }
  .ambient-bg::before { opacity: 0.5; }
}
.a11y-reduce-motion .ambient-orb { animation: none; opacity: 0.2; }
.a11y-reduce-motion .ambient-bg::before { opacity: 0.5; }

a { color: var(--brand); text-decoration: none; transition: color var(--ease); }
a:hover { text-decoration: underline; color: var(--brand-hover); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Pill-shaped CTAs keep round focus ring */
.btn-cta-primary:focus-visible,
.segmented .btn:focus-visible,
.next-steps-btn:focus-visible {
  border-radius: var(--radius-pill);
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 9999;
  padding: var(--space-12) var(--space-24);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-base);
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 2px solid transparent;
  transition: background var(--ease), color var(--ease);
}
.skip-link:focus {
  left: var(--space-16);
  top: var(--space-16);
  outline: 3px solid #fff;
  outline-offset: 2px;
  border-color: #fff;
}
.skip-link:hover { background: var(--brand-hover); color: #fff; text-decoration: none; }

.sr-only { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
   LAYOUT – CONTAINER, SHELL, STATE-BASED LAYOUT
   --------------------------------------------------------------------------- */
.shell {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 var(--section-gap-lg);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* Layout state: only one of is-prestart | is-in-questionnaire | is-results is active */
body.is-prestart .hero-compact { display: none; }
body.is-prestart .hero-full { display: block; }
body.is-in-questionnaire .hero-compact,
body.is-results .hero-compact { display: block; }
body.is-in-questionnaire .hero-full,
body.is-results .hero-full { display: none; }
/* Keep hero-cta-column and hero-grid visible so questionnaire/result stay in same panel slot */

/* Task mode: compact hero, questionnaire in right column */
body.is-in-questionnaire .hero-wrap {
  padding: var(--space-24) 0 var(--space-16);
  transition: padding 0.25s ease;
}
body.is-in-questionnaire .hero-compact {
  margin: 0;
  padding: var(--space-12) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}
body.is-in-questionnaire .hero-compact p { margin: 0; }
body.is-in-questionnaire .hero-compact a { font-weight: 600; }

/* Quick-guidance: hide title and module grid when in questionnaire so card sits high */
body.is-in-questionnaire #quick-guidance .section-title,
body.is-in-questionnaire #quick-guidance .section-intro,
body.is-in-questionnaire #quick-guidance .module-grid { display: none !important; }
body.is-in-questionnaire #quick-guidance .qa-card-wrap {
  margin-top: 0;
  margin-bottom: var(--space-24);
}

/* Results layout: reduce gaps, wider content feel */
body.is-results .hero-wrap { padding: var(--space-24) 0 var(--space-16); }
body.is-results .hero-compact { margin-bottom: var(--space-8); }
@media (prefers-reduced-motion: reduce) {
  body.is-in-questionnaire .hero-wrap { transition: none; }
}
.a11y-reduce-motion body.is-in-questionnaire .hero-wrap { transition: none; }

.stack { display: flex; flex-direction: column; gap: var(--section-gap); }
.section-stack { display: flex; flex-direction: column; gap: clamp(var(--space-24), 4vw, var(--section-gap-lg)); }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12); }
@media (max-width: 560px) {
  .actions-row { flex-direction: column; align-items: stretch; }
}

/* ---------------------------------------------------------------------------
   HEADER – STICKY TOP BAR
   --------------------------------------------------------------------------- */
.topbar {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-12) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
@media (max-width: 640px) {
  .topbar { padding: var(--space-16) 0; }
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; color: var(--text); }

.topbar-tagline {
  display: none;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
@media (min-width: 768px) {
  .topbar-tagline { display: block; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.btn-cta-primary {
  min-height: 44px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-12) var(--space-24);
  min-height: 44px;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: background var(--ease), box-shadow var(--ease), transform 0.1s ease;
}
.btn-cta-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  box-shadow: 0 6px 20px rgba(11, 95, 255, 0.28);
}
.btn-cta-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-cta-primary:disabled { opacity: 0.6; cursor: not-allowed; }
/* Header and hero CTAs stay prominent */
.topbar .btn-cta-primary { box-shadow: var(--shadow-primary); }
.start-cta-wrap .btn-cta-primary { box-shadow: var(--shadow-primary); }

/* ---------------------------------------------------------------------------
   HERO – TWO COLUMN (DESKTOP) / STACKED (MOBILE)
   --------------------------------------------------------------------------- */
.hero-wrap {
  padding: var(--space-64) 0 var(--space-48);
}
@media (max-width: 640px) {
  .hero-wrap { padding: var(--space-32) 0 var(--space-32); }
}

.hero-grid {
  display: grid;
  gap: var(--space-48);
  align-items: start;
}
@media (min-width: 1100px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: var(--space-48); align-items: start; }
}

.hero-content h1 {
  margin: 0 0 var(--space-20);
  font-size: var(--text-display);
  font-weight: 800;
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
  color: var(--text);
}
@media (min-width: 900px) {
  .hero-content h1 { margin-bottom: var(--space-24); }
}

.hero-content .lead {
  margin: 0 0 var(--space-20);
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 42ch;
  line-height: var(--leading-relaxed);
}

.hero-summary {
  margin: 0 0 var(--space-24);
  padding: var(--space-16) 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.hero-summary p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); max-width: 56ch; }
.hero-summary strong { color: var(--text); }

.trust-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-bottom: var(--space-24);
}
@media (max-width: 414px) {
  .trust-chips { gap: var(--space-8); margin-bottom: var(--space-20); }
  .trust-chips span { padding: var(--space-6) var(--space-10); font-size: var(--text-xs); }
}

.trust-chips span {
  display: inline-flex;
  align-items: center;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.hero-jumplinks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-16);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.hero-jumplinks a {
  color: var(--text-muted);
  padding: var(--space-8) 0;
  margin: calc(-1 * var(--space-8)) 0;
}
@media (max-width: 640px) {
  .hero-jumplinks a { padding: var(--space-12) 0; margin: calc(-1 * var(--space-12)) 0; min-height: 44px; display: inline-flex; align-items: center; }
}

/* ---------------------------------------------------------------------------
   HERO CTA BORDER WRAP (animated border, honour reduced-motion)
   --------------------------------------------------------------------------- */
.hero-cta-column {
  position: relative;
  border-radius: var(--radius);
}
.hero-cta-column::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: inherit;
  background: radial-gradient(ellipse 90% 80% at 50% 40%, rgba(255,255,255,0.5) 0%, rgba(230,240,255,0.2) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.hero-cta-column::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: inherit;
  background-image: linear-gradient(rgba(11,95,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(11,95,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}
.hero-panel-shell {
  position: relative;
  min-height: 280px;
}
.hero-panel-shell .hero-cta-card-wrap,
.hero-panel-shell .qa-card-wrap,
.hero-panel-shell .hero-result-wrap { transition: opacity 0.2s ease; }
@media (prefers-reduced-motion: reduce) {
  .hero-panel-shell .hero-cta-card-wrap,
  .hero-panel-shell .qa-card-wrap,
  .hero-panel-shell .hero-result-wrap { transition: none; }
}
.hero-panel-shell.panel-state-qa .hero-cta-border-decor,
.hero-panel-shell.panel-state-result .hero-cta-border-decor { display: none !important; }

.hero-cta-card-wrap {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
}
#startCardBorderWrap[hidden],
.hero-cta-card-wrap[hidden] { display: none !important; }

.hero-cta-border-decor {
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius) + 3px);
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  box-shadow: 0 0 40px rgba(11, 95, 255, 0.08);
}
.hero-cta-border-decor::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from 0deg, var(--brand), rgba(255,255,255,0.9), rgba(200,220,255,0.8), var(--brand), var(--brand-hover), rgba(255,255,255,0.85), var(--brand));
  animation: hero-border-spin 12s linear infinite;
  pointer-events: none;
}
.hero-cta-border-decor:empty { display: none; }
#startCardBorderDecor[hidden],
.hero-cta-border-decor[hidden] { display: none !important; }
/* Hide decor when card wrap is hidden to prevent stray border line */
.hero-cta-column:has(.hero-cta-card-wrap[hidden]) .hero-cta-border-decor { display: none !important; }
@keyframes hero-border-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-cta-border-decor::before { animation: none; opacity: 0.85; }
}
.a11y-reduce-motion .hero-cta-border-decor::before { animation: none; opacity: 0.85; }

/* ---------------------------------------------------------------------------
   PRIMARY CARD – QUESTIONNAIRE CTA (RIGHT COLUMN / STANDALONE)
   --------------------------------------------------------------------------- */
.hero-cta-card-wrap .primary-card { position: relative; z-index: 1; }
.primary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary), var(--shadow-lg);
  padding: var(--space-32);
  position: relative;
}
@media (max-width: 640px) {
  .primary-card { padding: var(--space-24); }
  .primary-card .value-list { padding-top: var(--space-20); }
  .start-cta-wrap .btn { min-height: 52px; }
}
@media (min-width: 900px) {
  .primary-card { padding: var(--space-32); }
}

.primary-card h2 {
  margin: 0 0 var(--space-24);
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: var(--leading-snug);
  letter-spacing: -0.02em;
  color: var(--text);
}

.segmented {
  display: flex;
  gap: var(--space-8);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: var(--space-8);
  margin-bottom: var(--space-24);
}

.segmented .btn {
  flex: 1;
  min-height: 48px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-family: var(--font);
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}

.segmented .btn.segmented-selected {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
}

.start-cta-wrap { margin: var(--space-24) 0 var(--space-20); }
.start-cta-wrap .btn { width: 100%; min-height: 56px; font-size: var(--text-lg); font-weight: 700; }
.start-quick-link { margin: var(--space-12) 0 0; text-align: center; font-size: var(--text-sm); }
.start-quick-link a { font-weight: 600; }

.start-reassurance {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-24);
  line-height: var(--leading-normal);
}
.start-reassurance span { display: inline-block; margin-right: var(--space-20); }

.value-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-24);
}
.value-list li {
  position: relative;
  padding-left: var(--space-24);
  margin-bottom: var(--space-12);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}
.value-list li:last-child { margin-bottom: 0; }
.value-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--trust);
}

/* ---------------------------------------------------------------------------
   CONTENT MODULE GRID – FEATURE CARDS (Quick answers, About, Sources)
   --------------------------------------------------------------------------- */
.module-grid {
  display: grid;
  gap: var(--space-24);
  margin-top: 0;
  margin-bottom: var(--section-gap-lg);
}
@media (min-width: 640px) {
  .module-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-24); }
}
@media (min-width: 900px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-24); }
}

.module-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-24);
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease-out);
}
.module-card:hover {
  border-color: rgba(11, 95, 255, 0.35);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: inherit;
  transform: translateY(-2px);
}
.module-card:focus-visible {
  text-decoration: none;
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.module-card:active { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .module-card:hover, .module-card:active { transform: none; }
}

.module-card-icon {
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-16);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--brand);
}

.module-card h3 {
  margin: 0 0 var(--space-8);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--leading-snug);
  color: var(--text);
}

.module-card p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.module-card-arrow {
  margin-top: var(--space-16);
  font-size: 1.25rem;
  color: var(--brand);
  transition: transform var(--ease);
}
.module-card:hover .module-card-arrow { transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) {
  .module-card:hover .module-card-arrow { transform: none; }
}

/* ---------------------------------------------------------------------------
   HIDE DURING QUESTIONNAIRE (body.is-in-questionnaire / data-state="qa")
   --------------------------------------------------------------------------- */
body.is-in-questionnaire .page-summary,
body.is-in-questionnaire .module-grid,
body.is-in-questionnaire #quick-guidance .section-title,
body.is-in-questionnaire #quick-guidance .section-intro,
body.is-in-questionnaire #household-presets,
body.is-in-questionnaire #factors,
body.is-in-questionnaire #explainers,
body.is-in-questionnaire #quick-answers,
body.is-in-questionnaire #method,
body.is-in-questionnaire #faq,
body.is-in-questionnaire #sources,
body.is-in-questionnaire #next-steps,
body.is-in-questionnaire .footer-details-wrap,
body[data-state="qa"] .page-summary,
body[data-state="qa"] .module-grid,
body[data-state="qa"] #quick-guidance .section-title,
body[data-state="qa"] #quick-guidance .section-intro,
body[data-state="qa"] #household-presets,
body[data-state="qa"] #factors,
body[data-state="qa"] #explainers,
body[data-state="qa"] #quick-answers,
body[data-state="qa"] #method,
body[data-state="qa"] #faq,
body[data-state="qa"] #sources,
body[data-state="qa"] #next-steps,
body[data-state="qa"] .footer-details-wrap { display: none !important; }

/* ---------------------------------------------------------------------------
   QUESTIONNAIRE CARD (qaCardWrap / qaCard)
   --------------------------------------------------------------------------- */
.fx-wrap {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius);
  overflow: hidden;
}

.fx-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(11, 95, 255, 0.03) 23px, rgba(11, 95, 255, 0.03) 24px),
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(11, 95, 255, 0.03) 23px, rgba(11, 95, 255, 0.03) 24px);
  pointer-events: none;
}

.fx-wrap::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 95, 255, 0.05) 0%, transparent 70%);
  top: 20%;
  left: -80px;
  z-index: 0;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .fx-wrap::after { animation: none; } }
.a11y-reduce-motion .fx-wrap::after { animation: none; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(60px, 20px); }
}

.fx-wrap .card,
.fx-wrap .qa,
.fx-wrap .result-card { position: relative; z-index: 1; }

.qa-card-wrap .card {
  padding: var(--card-pad);
  max-width: var(--container-narrow);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Task layout: questionnaire card stable height and position */
body.is-in-questionnaire .qa-card-wrap {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
}
body.is-in-questionnaire .qa-card-wrap .card {
  max-width: var(--container-narrow);
}
@media (min-width: 768px) {
  .stage { min-height: 260px; }
}
@media (min-width: 1024px) {
  .stage { min-height: 280px; }
}

.stepper { display: flex; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-24); flex-wrap: wrap; }
@media (max-width: 640px) {
  .qa-card-wrap .card { padding: var(--space-24); }
}
.stepper-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background var(--ease), transform var(--ease);
}
.stepper-dot.is-current { background: var(--brand); transform: scale(1.25); box-shadow: 0 0 0 2px var(--surface); }
.stepper-dot.is-done { background: var(--accent-2); }

.stepper-labels {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-6);
  font-size: 0.7rem;
  color: var(--text-muted);
  max-width: 100%;
}
.stepper-labels span { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; }

.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  margin-top: var(--space-12);
  margin-bottom: var(--space-28);
  padding-top: var(--space-12);
  border-top: 1px solid var(--border-light);
}
.bar {
  flex: 1;
  max-width: 200px;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent-2));
  transition: width 0.25s ease;
}

.q-title-row { display: flex; align-items: flex-start; gap: var(--space-12); margin-bottom: var(--space-8); }
.q-title-row .q-title { margin: 0; flex: 1; }
.q-help-trigger {
  flex-shrink: 0;
  width: 2rem; min-width: 2rem; height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.q-help-trigger:hover, .q-help-trigger:focus-visible { border-color: var(--brand); color: var(--brand); background: rgba(11, 95, 255, 0.08); }
.q-help-trigger[aria-expanded="true"] { border-color: var(--brand); background: rgba(11, 95, 255, 0.12); color: var(--brand); }
.q-help-panel {
  margin: var(--space-12) 0 var(--space-24);
  padding: var(--space-16);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text);
}
.q-help-panel p { margin: 0 0 var(--space-8); }
.q-help-panel p:last-child { margin-bottom: 0; }
.q-help-panel ul { margin: var(--space-8) 0 0; padding-left: var(--space-20); }
.q-help-panel li { margin-bottom: var(--space-4); }

.q-title { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 800; margin: 0 0 var(--space-8); line-height: var(--leading-snug); letter-spacing: -0.02em; color: var(--text); }
.q-help { margin: 0 0 var(--space-28); padding-top: var(--space-4); border-top: none; color: var(--text-muted); font-size: var(--text-base); line-height: var(--leading-relaxed); }

.qa .q { margin-bottom: var(--space-8); }

.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-16); }
@media (max-width: 560px) {
  .opts { grid-template-columns: 1fr; gap: var(--space-12); }
  .opt { min-height: 56px; padding: var(--space-20) var(--space-20) var(--space-20) 48px; }
}

.opt {
  position: relative;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-18) var(--space-20) var(--space-18) 44px;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.opt:hover { border-color: rgba(11, 95, 255, 0.45); box-shadow: var(--shadow); }
.opt:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.opt:active { transform: none; }
.opt[aria-checked="true"],
.opt.is-selected { border-color: var(--brand); background: rgba(11, 95, 255, 0.08); box-shadow: 0 0 0 1px var(--brand); }
@media (prefers-reduced-motion: reduce) { .opt { transition: none; } }
.a11y-reduce-motion .opt:hover { transform: none; }

.opt::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: border-color var(--ease), background var(--ease);
}
.opt[aria-checked="true"]::before,
.opt.is-selected::before {
  border-color: var(--brand);
  background: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 12px;
  background-repeat: no-repeat;
  background-position: center;
}

.qa-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-16);
  margin-top: var(--space-28);
  padding-top: var(--space-24);
  border-top: 1px solid var(--border-light);
}
.qa-nav .btn-cta-primary { margin-left: auto; min-width: 140px; }
.qa-nav .btn-cta-primary:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
@media (max-width: 560px) {
  .qa-nav { flex-direction: column; align-items: stretch; gap: var(--space-12); margin-top: var(--space-24); padding-top: var(--space-20); }
  .qa-nav .btn-cta-primary { margin-left: 0; width: 100%; min-width: 0; }
  .qa-nav .btn-ghost,
  .qa-nav .btn-link { align-self: flex-start; min-height: 44px; }
}
@media (max-width: 480px) {
  .qa-nav { flex-direction: column; align-items: stretch; }
  .qa-nav .btn-cta-primary { margin-left: 0; width: 100%; }
}

.stage { overflow: clip; min-height: 200px; }

.slide-out-up { animation: slideOutUp 0.22s ease forwards; }
.slide-in-up { animation: slideInUp 0.28s var(--ease-out) 0.02s forwards; }
@keyframes slideOutUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-10px); opacity: 0; } }
@keyframes slideInUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .slide-out-up, .slide-in-up { animation: none; } }
.a11y-reduce-motion .slide-out-up, .a11y-reduce-motion .slide-in-up { animation: none; }

.qa-enter { animation: qaEnter 0.22s ease forwards; }
@keyframes qaEnter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.a11y-reduce-motion .qa-enter { animation: none; }

.usecase.pulse { animation: pulse 1.2s ease 2; }
@keyframes pulse { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.2); } }
.a11y-reduce-motion .usecase.pulse { animation: none; }

/* ---------------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: var(--radius-pill);
  padding: var(--space-12) var(--space-20);
  min-height: 44px;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font);
  transition: background var(--ease), border-color var(--ease), transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline { background: transparent; color: var(--brand); border-color: rgba(11, 95, 255, 0.4); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-link { background: transparent; border: 0; color: var(--brand); font-weight: 700; cursor: pointer; font-family: var(--font); }
.btn-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   RESULTS
   --------------------------------------------------------------------------- */
.result-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: var(--section-gap); align-items: start; }
.result-main { min-width: 0; }
.result-lead { margin: 0 0 var(--space-12); color: var(--text-muted); font-weight: 700; font-size: var(--text-sm); line-height: var(--leading-normal); }
.result-tier { margin: 0 0 var(--space-20); font-size: clamp(1.6rem, 2.5vw, 2rem); font-weight: 900; letter-spacing: -0.02em; line-height: var(--leading-tight); color: var(--text); }
.tier-selection-line { margin: 0 0 var(--space-20); color: var(--text-muted); font-size: var(--text-sm); line-height: var(--leading-normal); }
.tier-selection-line strong { color: var(--text); }

.result-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-16); margin-bottom: var(--space-24); }
.result-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-20);
}
.result-stat strong { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-8); line-height: var(--leading-normal); }
.result-stat span { font-size: 1.25rem; font-weight: 900; color: var(--text); line-height: var(--leading-tight); }

.result-drivers h4 { margin: 0 0 var(--space-12); color: var(--text-muted); font-size: var(--text-sm); font-weight: 700; line-height: var(--leading-normal); }
.result-drivers ul { margin: 0; padding-left: 1.25rem; line-height: var(--leading-relaxed); }
.why-panel {
  margin-top: var(--space-24);
  padding: var(--space-20);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.why-panel strong { display: block; margin-bottom: var(--space-12); font-size: var(--text-sm); }
.why-panel p { margin: 0; line-height: var(--leading-relaxed); }
.nudge { color: var(--text-muted); margin-top: var(--space-12); font-size: var(--text-sm); line-height: var(--leading-normal); }

.explain-panel {
  margin-top: var(--space-24);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--space-20);
}
.explain-panel summary { cursor: pointer; font-weight: 700; list-style: none; padding: var(--space-8) 0; min-height: 44px; display: flex; align-items: center; }
.explain-panel summary::-webkit-details-marker { display: none; }
.explain-panel div { margin-top: var(--space-12); line-height: var(--leading-relaxed); }

.cta-block { display: flex; flex-wrap: wrap; gap: var(--space-12); margin-top: var(--space-24); }
.cta-block .btn { min-height: 48px; }
.result-links { margin-top: var(--space-16); font-size: var(--text-sm); }
.result-links .btn-link { margin-right: var(--space-20); padding: var(--space-8) 0; min-height: 44px; display: inline-flex; align-items: center; }
.fair-note { margin-top: var(--space-24); color: var(--text-muted); font-size: var(--text-sm); line-height: var(--leading-relaxed); }

.tier-ladder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-24);
  position: sticky;
  top: var(--space-24);
}
.tier-title { margin: 0 0 var(--space-16); font-size: var(--text-sm); font-weight: 700; color: var(--text-muted); line-height: var(--leading-normal); }
.tier-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-8); }
.tier-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-16);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.tier-item span { font-weight: 800; font-size: var(--text-sm); }
.tier-item em { font-style: normal; color: var(--text-muted); font-size: var(--text-sm); }
.tier-item.is-active { border-color: rgba(11, 95, 255, 0.5); background: rgba(11, 95, 255, 0.06); }
.tier-note { margin: var(--space-20) 0 0; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--leading-relaxed); }

@media (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr; }
  .tier-ladder { position: relative; top: auto; }
  .result-metrics { grid-template-columns: 1fr; }
}

/* Results layout: avoid giant blank areas */
body.is-results #resultCardWrap {
  margin-top: 0;
  margin-bottom: var(--section-gap);
}
body.is-results #resultCard .result-card {
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------------------------------------------------------
   SECTIONS – QUICK ANSWERS, ABOUT METHOD, REFERENCES (DETAILS / CARDS)
   --------------------------------------------------------------------------- */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--card-pad);
}
/* Section containers: consistent vertical rhythm */
section.container {
  margin-bottom: var(--section-gap-lg);
}
section.container:last-of-type { margin-bottom: 0; }

.section-head { margin-bottom: var(--space-24); }
.section-head h2 { margin: 0 0 var(--space-12); font-size: var(--text-xl); font-weight: 800; line-height: var(--leading-snug); letter-spacing: -0.02em; color: var(--text); }
.section-head p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); max-width: 60ch; line-height: var(--leading-relaxed); }

/* Page summary (AEO / machine-readable context) */
.page-summary { margin-bottom: var(--section-gap-lg); }
.page-summary > h2 { margin: 0 0 var(--space-24); font-size: var(--text-xl); font-weight: 800; line-height: var(--leading-snug); color: var(--text); }
.summary-grid { display: grid; gap: var(--space-24); }
@media (min-width: 640px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .summary-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-32); } }
.summary-block { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: var(--space-24); }
.summary-block h3 { margin: 0 0 var(--space-12); font-size: var(--text-lg); font-weight: 700; color: var(--text); }
.summary-block p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }
.summary-block ul { margin: var(--space-12) 0 0; padding-left: 1.25rem; font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }

/* Section title and intro (reusable) */
.section-title { margin: 0 0 var(--space-12); font-size: var(--text-xl); font-weight: 800; line-height: var(--leading-snug); letter-spacing: -0.02em; color: var(--text); }
.section-intro { margin: 0 0 var(--space-24); font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); max-width: 72ch; }

#factors,
#explainers,
.faq-section,
#method,
.refs-card,
#next-steps,
footer { content-visibility: auto; contain-intrinsic-size: auto 200px; }

/* Quick guidance section */
#quick-guidance .section-title { margin-bottom: var(--space-16); }
#quick-guidance .section-intro { margin-bottom: var(--space-24); }

/* Household speed presets */
.presets-grid { display: grid; gap: var(--space-24); grid-template-columns: 1fr; }
@media (min-width: 640px) { .presets-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .presets-grid { grid-template-columns: repeat(3, 1fr); } }
.preset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-24);
  box-shadow: var(--shadow);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.preset-card:hover { border-color: var(--border); box-shadow: var(--shadow-lg); }
.preset-card h3 { margin: 0 0 var(--space-12); font-size: var(--text-lg); font-weight: 700; line-height: var(--leading-snug); color: var(--text); }
.preset-card p { margin: 0 0 var(--space-12); font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }
.preset-card p:last-of-type { margin-bottom: var(--space-16); }
.preset-range { color: var(--text) !important; font-size: var(--text-base) !important; }
.preset-upload { font-size: var(--text-xs) !important; color: var(--text-muted) !important; }
.preset-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--space-8);
  padding: var(--space-8) 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  transition: color var(--ease);
}
.preset-cta:hover { color: var(--brand-hover); text-decoration: underline; }
.preset-cta:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

/* What affects your speed needs (factors) */
.factors-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  list-style: none;
  margin: 0;
  padding: 0;
}
.factors-list li {
  display: inline-flex;
  align-items: center;
  padding: var(--space-8) var(--space-16);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  color: var(--text);
  line-height: var(--leading-normal);
}
#factors .section-intro { margin-bottom: var(--space-20); }

/* Core explainers */
.explainers-grid { display: grid; gap: var(--space-24); grid-template-columns: 1fr; }
@media (min-width: 640px) { .explainers-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .explainers-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-32); } }
.explainer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-24);
  box-shadow: var(--shadow);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.explainer-card:hover { border-color: var(--border); box-shadow: var(--shadow-lg); }
.explainer-icon { font-size: 1.5rem; display: block; margin-bottom: var(--space-12); }
.explainer-card h3 { margin: 0 0 var(--space-12); font-size: var(--text-lg); font-weight: 700; line-height: var(--leading-snug); color: var(--text); }
.explainer-card p { margin: 0 0 var(--space-12); font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }
.explainer-card p:last-child { margin-bottom: 0; }
.explainer-card a {
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-8) 0;
  line-height: var(--leading-normal);
}

/* Next steps */
.next-steps-wrap { margin-bottom: var(--section-gap-lg); }
.next-steps-panel {
  background: var(--surface-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-32);
}
.next-steps-list { margin: 0 0 var(--space-24); padding-left: 1.5em; font-size: var(--text-base); line-height: var(--leading-relaxed); color: var(--text); }
.next-steps-list li { margin-bottom: var(--space-12); }
.next-steps-list li:last-child { margin-bottom: 0; }
.next-steps-trust { margin: 0 0 var(--space-24); font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-normal); }
.next-steps-cta { display: flex; flex-wrap: wrap; gap: var(--space-16); align-items: center; }
.next-steps-cta .btn-cta-primary { min-width: 220px; }
.next-steps-btn { display: inline-block; text-decoration: none; text-align: center; min-height: 48px; line-height: 48px; padding: 0 var(--space-24); }
.next-steps-btn:hover { text-decoration: none; color: #fff; }
.next-steps-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

#quick-answers.card details,
#method.card,
#sources.card,
.refs-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-24);
  transition: border-color var(--ease), box-shadow var(--ease);
}
#quick-answers.card details:hover,
#method.card:hover,
.refs-card:hover { border-color: var(--border); }
#quick-answers summary:focus-visible,
#method summary:focus-visible,
#sources summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
#quick-answers summary,
#method summary,
#sources summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding: var(--space-16) var(--space-24);
  min-height: 44px;
  display: block;
}
@media (max-width: 640px) {
  #quick-answers summary,
  #method summary,
  #sources summary { padding: var(--space-20) var(--space-24); min-height: 52px; }
}
#quick-answers summary::-webkit-details-marker,
#method summary::-webkit-details-marker,
#sources summary::-webkit-details-marker { display: none; }

/* Quick answers – grid and topic chips */
#quick-answers .section-intro { margin-bottom: var(--space-20); }
.quick-topics { display: flex; flex-wrap: wrap; gap: var(--space-8); margin-bottom: var(--space-24); }
.topic-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color var(--ease), color var(--ease);
}
.topic-chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

.quick-answers-grid { display: grid; gap: var(--space-24); grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .quick-answers-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .quick-answers-grid { grid-template-columns: repeat(3, 1fr); } }
.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-24);
  box-shadow: var(--shadow);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.qa-card:hover { border-color: var(--border); box-shadow: var(--shadow-lg); }
.qa-card h3 { margin: 0 0 var(--space-8); font-size: var(--text-lg); font-weight: 700; line-height: var(--leading-snug); color: var(--text); }
.qa-card p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); max-width: 72ch; line-height: var(--leading-relaxed); }
.qa-card a { font-weight: 600; }

.method-content { margin-top: var(--space-8); }
.method-lead { margin: 0 0 var(--space-24); max-width: 72ch; color: var(--text); font-size: var(--text-base); line-height: var(--leading-relaxed); }
.method-steps { margin: 0 0 var(--space-24); padding-left: 1.5em; max-width: 72ch; color: var(--text); font-size: var(--text-base); line-height: var(--leading-relaxed); }
.method-steps li { margin-bottom: var(--space-12); }
.method-notice { margin: 0 0 var(--space-24); padding: var(--space-16); background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }
.method-notice strong { color: var(--text); }
.glossary-block { margin: 0 0 var(--space-24); }
.glossary-block h4 { font-size: var(--text-base); font-weight: 700; margin: 0 0 var(--space-12); color: var(--text); }
.glossary-list { margin: 0; font-size: var(--text-sm); line-height: var(--leading-relaxed); color: var(--text-muted); }
.glossary-list dt { font-weight: 600; color: var(--text); margin-top: var(--space-12); }
.glossary-list dt:first-of-type { margin-top: 0; }
.glossary-list dd { margin: var(--space-4) 0 0; padding-left: 0; }
.method-card .method-content + p { margin: 0; max-width: 72ch; }
.method-card p { margin: 0; max-width: 72ch; color: var(--text); font-size: var(--text-base); line-height: var(--leading-relaxed); }
.details-heading-inline { display: inline; }
.nudge[hidden] { display: none !important; }

.refs-intro { margin: 0 0 var(--space-16); font-size: var(--text-sm); color: var(--text); line-height: var(--leading-relaxed); max-width: 72ch; }
.ref-meta-block { margin-bottom: var(--space-24); }
.refs .ref-meta { font-size: var(--text-sm); color: var(--text-muted); margin: var(--space-12) 0 var(--space-16); line-height: var(--leading-normal); }
.refs .ref-meta-block .ref-meta { margin: var(--space-4) 0; }
.refs ol { margin: 0; padding-left: 1.5em; line-height: var(--leading-loose); }
.refs li { margin-bottom: var(--space-8); }
.refs-groups { display: flex; flex-direction: column; gap: var(--space-24); }
.refs-group { margin: 0; }
.refs-group-title { margin: 0 0 var(--space-12); font-size: var(--text-base); font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.refs-list { list-style: decimal; }
.refs-disclaimer { margin: var(--space-24) 0 0; font-size: var(--text-xs); color: var(--text-muted); line-height: var(--leading-normal); }

/* ---------------------------------------------------------------------------
   FAQ SECTION
   --------------------------------------------------------------------------- */
.faq-section {
  margin-top: var(--space-64);
  padding-top: var(--space-48);
  border-top: 1px solid var(--border-light);
}

.faq-section .section-head { margin-bottom: var(--space-24); }

.faq-disclaimer { text-align: center; font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-24) 0 0; line-height: var(--leading-normal); }

.faq-search { margin-bottom: var(--space-24); }
.faq-search:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
#faqSearchLabel { display: block; margin-bottom: var(--space-8); font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.faq input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  font-family: var(--font);
  line-height: var(--leading-normal);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.faq input[type="search"]:hover { border-color: var(--border); }
.faq input[type="search"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 95, 255, 0.12); }
.faq input[type="search"]:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.faq-search-result { color: var(--text-muted); margin: var(--space-8) 0 0; font-size: var(--text-sm); line-height: var(--leading-normal); }
.faq-search-hints { margin: var(--space-8) 0 0; font-size: var(--text-xs); color: var(--text-muted); line-height: var(--leading-normal); }
.faq-category-chips { display: flex; flex-wrap: wrap; gap: var(--space-8); margin-bottom: var(--space-24); }
.faq-category-chip {
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.faq-category-chip:hover { border-color: var(--brand); color: var(--brand); }
.faq-category-chip:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.faq-category-chip.is-active,
.faq-category-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.faq-category-chip.is-active:hover,
.faq-category-chip[aria-pressed="true"]:hover { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 0.95; }

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0;
  margin-bottom: var(--space-16);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.faq details:hover { border-color: var(--border); background: var(--surface-2); }
.faq details[open] {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.faq details summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  padding: var(--space-20) var(--space-24);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  color: var(--text);
  transition: color var(--ease);
}
.faq details summary:hover { color: var(--brand); }
.faq details summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.faq details summary::-webkit-details-marker { display: none; }
.faq details summary::after {
  content: '';
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") no-repeat center;
  background-size: 20px;
  transition: transform var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(90deg); }
.faq details[open] summary { border-bottom: 1px solid var(--border-light); }
.faq details p {
  margin: 0;
  padding: var(--space-20) var(--space-24) var(--space-24);
  max-width: 72ch;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.65;
}

/* ---------------------------------------------------------------------------
   FOOTER
   --------------------------------------------------------------------------- */
footer {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-48) var(--container-pad) var(--space-32);
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-64);
}

footer .copyright { margin-bottom: var(--space-12); font-size: var(--text-sm); line-height: var(--leading-relaxed); }
footer .footer-author { margin: 0 0 var(--space-12); font-size: var(--text-sm); line-height: var(--leading-relaxed); }
footer .footer-author a { color: var(--text-muted); }
footer .footer-author a:hover { color: var(--brand); }
footer .version-line { margin-top: var(--space-12); font-size: var(--text-sm); line-height: var(--leading-relaxed); }

.footer-details-wrap { margin-top: var(--space-32); text-align: left; }
.footer-details-wrap summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
  font-size: var(--text-base);
  padding: var(--space-12) 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color var(--ease);
}
.footer-details-wrap summary:hover { color: var(--brand-hover); }

.footer-groups {
  display: grid;
  gap: var(--space-32);
  margin-top: var(--space-24);
  padding-top: var(--space-24);
  border-top: 1px solid var(--border-light);
}
@media (min-width: 600px) {
  .footer-groups { grid-template-columns: repeat(3, 1fr); gap: var(--space-32); }
}

.footer-group h4 {
  margin: 0 0 var(--space-12);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: var(--leading-normal);
}
.footer-group ul { margin: 0; padding: 0; list-style: none; }
.footer-group li { margin-bottom: var(--space-8); }
.footer-group a {
  display: inline-block;
  padding: var(--space-8) 0;
  min-height: 44px;
  line-height: var(--leading-normal);
  transition: color var(--ease);
}
.footer-group a:hover { color: var(--brand); }

.footer-more-btn {
  display: none;
  width: 100%;
  margin-top: var(--space-16);
  padding: var(--space-16);
  min-height: 48px;
  font-size: var(--text-base);
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font);
  transition: border-color var(--ease), background var(--ease);
}
.footer-more-btn:hover { background: var(--surface-2); border-color: var(--brand); }
.footer-more-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
@media (max-width: 900px) {
  .footer-groups { grid-template-columns: 1fr; gap: var(--space-24); }
  #footGroupMore { display: none; }
  #footGroupMore.is-open { display: block; margin-top: var(--space-16); }
  .footer-more-btn { display: block; }
}

/* ---------------------------------------------------------------------------
   ACCESSIBILITY PANEL
   --------------------------------------------------------------------------- */
.a11y-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  padding: var(--space-24);
  z-index: 1000;
  max-width: 360px;
  width: calc(100% - 32px);
}
.a11y-panel h3 { margin: 0 0 var(--space-16); font-size: 1.1rem; }
.a11y-panel .toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-12); }
.a11y-panel .toggle-row label { font-size: 0.9375rem; }
.a11y-panel .a11y-actions { display: flex; flex-wrap: wrap; gap: var(--space-12); align-items: center; margin-top: var(--space-16); }
.a11y-panel .btn { margin-top: 0; }
.a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
  pointer-events: auto;
}
.a11y-backdrop[hidden] {
  pointer-events: none;
  display: none !important;
}

.a11y-text-large { font-size: 18px; }
.a11y-text-large .q-title { font-size: 1.35rem; }
.a11y-text-large .opt { font-size: 1.05rem; padding: 18px 20px 18px 48px; }

.a11y-contrast { --text: #0a0f1a; --text-muted: #475569; --border: #cbd5e1; }

.a11y-underline-links a { text-decoration: underline; }
.a11y-underline-links a:hover { text-decoration: underline; }

.a11y-strong-focus a:focus-visible,
.a11y-strong-focus button:focus-visible,
.a11y-strong-focus input:focus-visible,
.a11y-strong-focus [tabindex="0"]:focus-visible { outline: 4px solid var(--brand); outline-offset: 3px; }

.a11y-larger-controls .opt { min-height: 56px; padding: var(--space-20) var(--space-24) var(--space-20) 52px; }
.a11y-larger-controls .btn,
.a11y-larger-controls button:not(.opt) { min-height: 48px; padding: var(--space-12) var(--space-24); }
.a11y-larger-controls input[type="search"],
.a11y-larger-controls input[type="text"],
.a11y-larger-controls input[type="email"] { min-height: 48px; padding: var(--space-12) var(--space-16); }
.a11y-larger-controls .faq-category-chip,
.a11y-larger-controls .topic-chip { min-height: 44px; padding: var(--space-12) var(--space-20); }

.a11y-simplify-visuals .card,
.a11y-simplify-visuals .qa-card,
.a11y-simplify-visuals .module-card,
.a11y-simplify-visuals .preset-card { box-shadow: none; }
.a11y-simplify-visuals .hero-cta-border-decor::before { opacity: 0.5; }

.a11y-dyslexia-friendly { letter-spacing: 0.05em; word-spacing: 0.2em; line-height: 1.7; }
.a11y-dyslexia-friendly p,
.a11y-dyslexia-friendly li { line-height: 1.75; }

.a11y-reduce-transparency .ambient-orb { filter: blur(20px); opacity: 0.15; }
.a11y-reduce-transparency .ambient-bg::before { opacity: 0.25; }
.a11y-reduce-transparency .hero-cta-border-decor::before { opacity: 0.6; }
.a11y-reduce-transparency .hero-cta-column::before,
.a11y-reduce-transparency .hero-cta-column::after { opacity: 0.5; }
.a11y-reduce-transparency .fx-wrap::after { opacity: 0.02; }

.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
