/* ── Brand tokens ─────────────────────────────────────────────────────────── */
:root {
  --ink:     #020617;
  --signal:  #d7b46a;
  --bg:      #020617;
  --surface: #0f172a;
  --border:  #1e293b;
  --muted:   #64748b;
  --text:    #f1f5f9;
  --danger:  #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --font:    "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--font);
  margin:      0;
  min-width:   320px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--signal); color: var(--ink); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden       { display: none !important; }
.show-flex    { display: flex !important; }

/* ── Free badge ───────────────────────────────────────────────────────────── */
.free-badge {
  align-items:   center;
  background:    rgba(52, 211, 153, 0.12);
  border:        1px solid rgba(52, 211, 153, 0.3);
  border-radius: 999px;
  color:         #34d399;
  display:       inline-flex;
  font-size:     0.78rem;
  font-weight:   700;
  gap:           0.45rem;
  padding:       0.35rem 0.85rem;
}

.free-badge-dot {
  background:    #34d399;
  border-radius: 999px;
  display:       inline-block;
  height:        0.45rem;
  width:         0.45rem;
}

/* ── Input fields ─────────────────────────────────────────────────────────── */
.input-field {
  width: 100%;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 0.625rem;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  padding: 0.75rem 1rem;
  transition: border-color 180ms ease;
  box-sizing: border-box;
}

.input-field:focus {
  border-color: var(--signal);
}

.input-field::placeholder {
  color: #475569;
}

.input-error {
  border-color: var(--danger) !important;
}

/* ── Check item (for checklist results) ───────────────────────────────────── */
.check-item {
  align-items: flex-start;
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.check-item:last-child {
  border-bottom: none;
}

.check-icon {
  border-radius: 50%;
  display: flex;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 900;
  height: 1.6rem;
  width: 1.6rem;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: 0.1rem;
}

.icon-pass { background: rgba(52,211,153,0.15); color: #34d399; }
.icon-warn { background: rgba(251,191,36,0.15); color: #fbbf24; }
.icon-fail { background: rgba(248,113,113,0.15); color: #f87171; }

.check-content {
  flex: 1;
}

.check-title {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.check-desc {
  color: #94a3b8;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0;
}

.check-score {
  font-size: 0.8rem;
  font-weight: 800;
  margin-top: 0.35rem;
}

/* ── Score ring ───────────────────────────────────────────────────────────── */
.ring-container {
  display:         flex;
  justify-content: center;
  margin:          0 auto 1.5rem;
  position:        relative;
  width:           220px;
}

.ring-svg { display: block; }

.ring-track {
  fill:         none;
  stroke:       #1e293b;
  stroke-width: 12;
}

#score-ring {
  fill:               none;
  stroke:             var(--signal);
  stroke-linecap:     round;
  stroke-width:       12;
  transform:          rotate(-90deg);
  transform-origin:   50% 50%;
  transition:         stroke 300ms ease;
}

.ring-label {
  align-items:   center;
  display:       flex;
  flex-direction: column;
  inset:         0;
  justify-content: center;
  position:      absolute;
}

.ring-number {
  font-size:     3.25rem;
  font-weight:   900;
  letter-spacing: -0.04em;
  line-height:   1;
}

.ring-total {
  color:       var(--muted);
  font-size:   1rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Score band label ─────────────────────────────────────────────────────── */
.score-band {
  border-radius: 999px;
  display:       inline-block;
  font-size:     0.85rem;
  font-weight:   800;
  padding:       0.3rem 1rem;
}

.band-critical    { background: rgba(248,113,113,0.15); color: #f87171; }
.band-needs-work  { background: rgba(251,191,36,0.15);  color: #fbbf24; }
.band-good        { background: rgba(52,211,153,0.15);  color: #34d399; }
.band-excellent   { background: rgba(215,180,106,0.15); color: #d7b46a; }

/* Ring stroke colour per band */
.ring-critical  #score-ring { stroke: #f87171; }
.ring-needs-work #score-ring { stroke: #fbbf24; }
.ring-good      #score-ring { stroke: #34d399; }
.ring-excellent #score-ring { stroke: #d7b46a; }

/* ── Fix list ─────────────────────────────────────────────────────────────── */
.fix-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fix-item {
  align-items: flex-start;
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.fix-item:last-child {
  border-bottom: none;
}

.fix-priority {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.15rem;
}

.priority-high {
  background: rgba(248,113,113,0.15);
  color: #f87171;
}

.priority-medium {
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
}

.priority-low {
  background: rgba(52,211,153,0.15);
  color: #34d399;
}

.fix-text {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* ── Email gate ───────────────────────────────────────────────────────────── */
#email-spinner {
  align-items:     center;
  gap:             0.75rem;
  justify-content: center;
  padding:         0.75rem 0;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.animate-spin { animation: spin 700ms linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background:    var(--signal);
  border:        none;
  border-radius: 0.75rem;
  color:         var(--ink);
  cursor:        pointer;
  display:       block;
  font-family:   var(--font);
  font-size:     1rem;
  font-weight:   800;
  padding:       0.9rem 1.5rem;
  text-align:    center;
  transition:    background 160ms ease, transform 160ms ease;
  width:         100%;
}

.btn-primary:hover  { background: #e4c47f; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background:    transparent;
  border:        1.5px solid #334155;
  border-radius: 0.75rem;
  color:         var(--text);
  cursor:        pointer;
  display:       block;
  font-family:   var(--font);
  font-size:     0.95rem;
  font-weight:   700;
  padding:       0.75rem 1.5rem;
  text-align:    center;
  transition:    border-color 160ms ease, background 160ms ease;
  width:         100%;
}

.btn-secondary:hover {
  border-color: var(--signal);
  background: rgba(215, 180, 106, 0.08);
}

/* ── FAQ accordion ────────────────────────────────────────────────────────── */
details.faq-item {
  border:        1px solid var(--border);
  border-radius: 0.875rem;
  margin-bottom: 0.625rem;
  overflow:      hidden;
}

details.faq-item[open] { border-color: #334155; }

details.faq-item summary {
  cursor:          pointer;
  display:         flex;
  font-size:       0.975rem;
  font-weight:     600;
  gap:             1rem;
  justify-content: space-between;
  list-style:      none;
  padding:         1.1rem 1.25rem;
  user-select:     none;
}

details.faq-item summary::-webkit-details-marker { display: none; }

.faq-chevron {
  color:      var(--muted);
  flex:       0 0 auto;
  font-size:  1.1rem;
  transition: transform 240ms ease;
}

details.faq-item[open] .faq-chevron { transform: rotate(180deg); }

.faq-body {
  color:       #94a3b8;
  font-size:   0.9rem;
  line-height: 1.75;
  padding:     0 1.25rem 1.25rem;
}

/* ── Conversion CTA ───────────────────────────────────────────────────────── */
@keyframes conversion-cta-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(215, 180, 106, 0.35),
      0 0 0 3px rgba(215, 180, 106, 0.08),
      0 28px 56px -18px rgba(0, 0, 0, 0.6),
      0 0 120px -24px rgba(215, 180, 106, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(215, 180, 106, 0.55),
      0 0 0 5px rgba(215, 180, 106, 0.14),
      0 32px 64px -14px rgba(0, 0, 0, 0.65),
      0 0 140px -20px rgba(215, 180, 106, 0.48);
  }
}

.conversion-cta {
  animation:     conversion-cta-pulse 3.2s ease-in-out infinite;
  background:    linear-gradient(155deg, rgba(215, 180, 106, 0.22) 0%, rgba(15, 23, 42, 0.98) 38%, #070b14 100%);
  border:        3px solid rgba(215, 180, 106, 0.75);
  border-radius: 1.5rem;
  box-shadow:
    0 0 0 1px rgba(215, 180, 106, 0.35),
    0 0 0 3px rgba(215, 180, 106, 0.08),
    0 28px 56px -18px rgba(0, 0, 0, 0.6),
    0 0 120px -24px rgba(215, 180, 106, 0.32);
  margin-bottom: 3rem;
  padding:       3rem 1.75rem;
  position:      relative;
  text-align:    center;
}

@media (min-width: 480px) {
  .conversion-cta { padding: 3.25rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .conversion-cta,
  .conversion-cta-btn { animation: none; }
}

.conversion-cta::before {
  background:      radial-gradient(ellipse 80% 55% at 50% -20%, rgba(215, 180, 106, 0.35), transparent 65%);
  border-radius:   inherit;
  content:         "";
  inset:           0;
  pointer-events:  none;
  position:        absolute;
}

.conversion-cta > * { position: relative; z-index: 1; }

.conversion-cta-eyebrow {
  color:          #f0d78a;
  font-size:      0.78rem;
  font-weight:    900;
  letter-spacing: 0.22em;
  margin:         0 0 0.75rem;
  text-shadow:    0 0 24px rgba(215, 180, 106, 0.45);
  text-transform: uppercase;
}

.conversion-cta-title {
  color:           #fff;
  font-size:       clamp(1.55rem, 5.2vw, 2rem);
  font-weight:     900;
  letter-spacing:  -0.03em;
  line-height:     1.18;
  margin:          0 0 1rem;
  text-shadow:     0 2px 24px rgba(0, 0, 0, 0.35);
}

.conversion-cta-body {
  color:       #e2e8f0;
  font-size:   1.05rem;
  line-height: 1.65;
  margin:      0 auto 2rem;
  max-width:   460px;
}

@keyframes conversion-cta-btn-pulse {
  0%, 100% {
    box-shadow:
      0 5px 0 rgba(15, 23, 42, 0.45),
      0 10px 32px rgba(215, 180, 106, 0.5),
      0 0 0 0 rgba(215, 180, 106, 0.35);
  }
  50% {
    box-shadow:
      0 5px 0 rgba(15, 23, 42, 0.45),
      0 14px 40px rgba(215, 180, 106, 0.62),
      0 0 0 6px rgba(215, 180, 106, 0.12);
  }
}

.conversion-cta-btn {
  align-items:     center;
  background:      linear-gradient(180deg, #f5e2a8 0%, var(--signal) 38%, #b8892e 100%);
  border-radius:   999px;
  box-shadow:
    0 5px 0 rgba(15, 23, 42, 0.45),
    0 10px 32px rgba(215, 180, 106, 0.5),
    0 0 0 0 rgba(215, 180, 106, 0.35);
  color:           var(--ink);
  display:         inline-flex;
  font-size:       1.125rem;
  font-weight:     900;
  gap:             0.35rem;
  justify-content: center;
  letter-spacing:  0.01em;
  min-height:      3.65rem;
  padding:         1rem 2.6rem;
  text-decoration: none;
  transition:      transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  animation:       conversion-cta-btn-pulse 2.6s ease-in-out infinite;
}

.conversion-cta-btn:hover {
  animation: none;
  box-shadow:
    0 5px 0 rgba(15, 23, 42, 0.4),
    0 16px 44px rgba(215, 180, 106, 0.65),
    0 0 0 5px rgba(215, 180, 106, 0.2);
  filter:    brightness(1.07);
  transform: translateY(-3px);
}

.conversion-cta-btn:active {
  box-shadow: 0 2px 0 rgba(15, 23, 42, 0.45), 0 6px 20px rgba(215, 180, 106, 0.4);
  transform:  translateY(0);
}

.conversion-cta-btn:focus-visible {
  outline:        3px solid rgba(215, 180, 106, 0.65);
  outline-offset: 3px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  backdrop-filter:         blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ── Header primary CTA ───────────────────────────────────────────────────── */
.header-cta-btn {
  background:      linear-gradient(180deg, #f0dc9a 0%, var(--signal) 42%, #c49a40 100%);
  border:          none;
  border-radius:   999px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 2px 0 rgba(15, 23, 42, 0.5),
    0 6px 20px rgba(215, 180, 106, 0.55);
  color:           var(--ink);
  cursor:          pointer;
  font-family:     var(--font);
  font-size:       0.8125rem;
  font-weight:     900;
  letter-spacing:  0.02em;
  padding:         0.5rem 1.05rem;
  text-decoration: none;
  transition:      transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  white-space:     nowrap;
}

.header-cta-btn:hover {
  filter:    brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 3px 0 rgba(15, 23, 42, 0.45),
    0 10px 28px rgba(215, 180, 106, 0.65);
}

.header-cta-btn:active {
  filter:    brightness(0.98);
  transform: translateY(0);
}

.header-cta-btn:focus-visible {
  outline:        3px solid rgba(215, 180, 106, 0.75);
  outline-offset: 2px;
}

/* ── Result sections ──────────────────────────────────────────────────────── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.result-card-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* ── Loading steps ────────────────────────────────────────────────────────── */
.loading-step {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.loading-step.active {
  color: var(--text);
}

.loading-step.done {
  color: #34d399;
}

.step-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #334155;
  flex-shrink: 0;
}

.loading-step.active .step-dot {
  background: var(--signal);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.loading-step.done .step-dot {
  background: #34d399;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Gated breakdown ──────────────────────────────────────────────────────── */
.breakdown-wrapper {
  margin-top: 1rem;
  position: relative;
}

.breakdown-locked {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.breakdown-overlay {
  align-items: center;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid var(--border);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  inset: 0;
  justify-content: center;
  padding: 1.5rem;
  position: absolute;
  text-align: center;
  z-index: 10;
}
