/* ============ TOKENS ============ */
:root {
  --background: #FFFDF5;
  --foreground: #1E293B;
  --muted: #F1F5F9;
  --muted-foreground: #64748B;
  --accent: #8B5CF6;
  --accent-foreground: #FFFFFF;
  --secondary: #F472B6;
  --tertiary: #FBBF24;
  --quaternary: #34D399;
  --border: #E2E8F0;
  --card: #FFFFFF;
  --ring: #8B5CF6;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --border-w: 2px;

  --shadow-hard: 4px 4px 0px 0px var(--foreground);
  --shadow-hard-hover: 6px 6px 0px 0px var(--foreground);
  --shadow-hard-active: 2px 2px 0px 0px var(--foreground);

  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Must come after the reset and before any component rule that sets its own
   `display` (e.g. .btn, .demo-loader). Without this, [hidden] loses to any
   author rule setting display:flex/inline-flex on the same element, since
   author styles always beat the browser's default [hidden]{display:none}. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, .logo-text, .gauge-score {
  font-family: "Outfit", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
a { color: inherit; }

/* ============ BACKGROUND DECOR ============ */
.bg-decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.dot-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--border) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: 0.5;
}
.blob { position: absolute; border-radius: 50%; }
.blob-violet { width: 420px; height: 420px; background: var(--accent); top: -160px; left: -160px; opacity: 0.14; }
.blob-yellow { width: 320px; height: 320px; background: var(--tertiary); top: 620px; right: -140px; opacity: 0.16; }

/* ============ HEADER ============ */
.site-header { padding: 24px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--accent); color: white;
  border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  font-weight: 800; box-shadow: var(--shadow-hard-active);
}
.logo-text { font-size: 22px; }
.header-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 700; text-decoration: none; color: var(--foreground);
  background: var(--card); border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-full); padding: 9px 16px 9px 14px;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s var(--ease-bounce);
}
.header-link i { width: 16px; height: 16px; stroke-width: 2.5; }
.header-link:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-active); }
.pill-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--muted); border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-full); padding: 6px 14px;
}

/* ============ HERO ============ */
.hero { padding: 40px 0 72px; }
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin-bottom: 12px;
}
.hero-copy h1 { font-size: clamp(32px, 4.5vw, 52px); line-height: 1.08; margin-bottom: 20px; }
.highlight { background: var(--tertiary); padding: 0 8px; border-radius: 6px; box-decoration-break: clone; }
.hero-sub { font-size: 17px; color: var(--muted-foreground); max-width: 46ch; margin-bottom: 28px; }

.hero-card {
  background: var(--card); border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  box-shadow: 8px 8px 0px var(--secondary); padding: 28px; transform: rotate(2deg);
}
.hero-card-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1.5px dashed var(--border); font-weight: 600; }
.hero-card-row:last-child { border-bottom: none; }
.hero-card-row i {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--muted); border-radius: 50%; flex-shrink: 0; stroke-width: 2.5; color: var(--accent);
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 15px;
  padding: 14px 26px; border-radius: var(--radius-full); border: var(--border-w) solid var(--foreground);
  cursor: pointer; text-decoration: none; min-height: 48px;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s var(--ease-bounce), background 0.25s, opacity 0.2s;
}
.btn-primary { background: var(--accent); color: var(--accent-foreground); box-shadow: var(--shadow-hard); }
.btn-primary:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-hover); }
.btn-primary:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: var(--shadow-hard-active); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-secondary { background: transparent; color: var(--foreground); box-shadow: none; }
.btn-secondary:hover { background: var(--tertiary); }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: white; border-radius: 50%; color: var(--accent);
}
.btn-icon i { width: 14px; height: 14px; stroke-width: 3; }

/* ============ SECTION HEADING ============ */
.section-heading { max-width: 60ch; margin-bottom: 28px; }
.section-heading h2 { font-size: clamp(24px, 3vw, 34px); margin: 8px 0 10px; }
.section-heading p { color: var(--muted-foreground); font-size: 16px; }

/* ============ DEMO LOADER ============ */
.demo-loader {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--muted); border: 1.5px dashed var(--border-w) solid var(--border);
  border-radius: var(--radius-md); padding: 12px 18px; margin-bottom: 24px; font-size: 13.5px;
}
.demo-loader label { font-weight: 700; color: var(--muted-foreground); }
.demo-loader select {
  font-family: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 12px;
  border-radius: var(--radius-sm); border: var(--border-w) solid var(--foreground); background: white; cursor: pointer;
}

/* ============ APP SHELL ============ */
.app-section { padding: 20px 0 90px; }
.app-shell {
  background: var(--card); border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-lg); box-shadow: 8px 8px 0px var(--border); padding: 40px;
}

/* Stepper */
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 36px; }
.step-dot {
  flex: 1; text-align: center; position: relative; padding-bottom: 14px;
  border-bottom: 4px solid var(--border); transition: border-color 0.3s;
}
.step-dot.active, .step-dot.done { border-color: var(--accent); }
.dot-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; border: var(--border-w) solid var(--foreground);
  background: var(--muted); font-weight: 700; font-size: 13px; margin-bottom: 6px;
}
.step-dot.active .dot-num, .step-dot.done .dot-num { background: var(--accent); color: white; }
.dot-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted-foreground); }
.step-dot.active .dot-label { color: var(--foreground); }

/* Step panels */
.step-panel { display: none; animation: fadeSlide 0.35s var(--ease-bounce); }
.step-panel.active { display: block; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.step-panel h3 { font-size: 21px; margin-bottom: 6px; }
.step-hint { color: var(--muted-foreground); font-size: 14.5px; margin: 0 0 24px; }

/* Option cards (choice-based inputs) */
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.option-card {
  display: flex; flex-direction: column; gap: 4px; padding: 18px;
  border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
}
.option-card input { position: absolute; opacity: 0; }
.option-card:hover { border-color: var(--accent); }
.option-card:has(input:checked),
.option-card.selected { border-color: var(--accent); background: #F5F3FF; box-shadow: 3px 3px 0px var(--accent); }
.option-title { font-weight: 700; font-size: 15px; }
.option-sub { font-size: 12.5px; color: var(--muted-foreground); }

/* Number fields */
.number-field { display: flex; align-items: center; gap: 12px; max-width: 240px; }
.number-field input {
  width: 100%; font-family: "Outfit", sans-serif; font-weight: 700; font-size: 22px;
  padding: 12px 16px; border: var(--border-w) solid var(--foreground); border-radius: var(--radius-md);
  background: white; color: var(--foreground);
}
.number-field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-hard-active); }
.number-unit { font-weight: 700; color: var(--muted-foreground); font-size: 14px; }
.number-field-inline { margin-top: 18px; max-width: 160px; }

/* Quick chips */
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.chip {
  font-family: inherit; font-weight: 600; font-size: 13px; background: var(--muted);
  border: var(--border-w) solid var(--foreground); border-radius: var(--radius-full);
  padding: 7px 14px; cursor: pointer; transition: background 0.2s;
}
.chip:hover { background: var(--tertiary); }

/* Star rating */
.star-rating { display: flex; gap: 8px; }
.star {
  background: none; border: none; cursor: pointer; padding: 4px; color: var(--border);
  transition: transform 0.2s var(--ease-bounce), color 0.2s;
}
.star i { width: 34px; height: 34px; stroke-width: 2; fill: transparent; }
.star:hover { transform: scale(1.15); }
.star.filled { color: var(--tertiary); }
.star.filled i { fill: var(--tertiary); }

/* Review list */
.review-list { list-style: none; padding: 0; margin: 0; }
.review-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.review-item:last-child { border-bottom: none; }
.review-label { font-weight: 700; font-size: 14px; color: var(--muted-foreground); }
.review-value { font-weight: 700; font-size: 15px; }
.review-edit {
  font-size: 13px; font-weight: 700; color: var(--accent); background: none; border: none;
  cursor: pointer; text-decoration: underline;
}

/* Step nav */
/* Step nav — Back stays natural width; Next/Generate grow to fill the rest.
   (Previously #generateBtn used width:100% while sharing a flex row with
   #backBtn, which pushed it past the card's edge instead of just filling
   the remaining space — that was the overflow bug on the Review step.) */
.step-nav { display: flex; align-items: center; margin-top: 36px; gap: 12px; }
.step-nav .btn { flex-shrink: 0; }
#nextBtn, #generateBtn { flex: 1; }

/* ============ RESULTS (calm, credibility-first) ============ */
.results { padding: 20px 0 100px; }
.report-card {
  background: var(--card); border: var(--border-w) solid var(--foreground);
  border-radius: var(--radius-md); box-shadow: 6px 6px 0px var(--border); padding: 40px;
}
.report-top {
  display: flex; align-items: center; gap: 48px; flex-wrap: wrap;
  padding-bottom: 28px; border-bottom: 1.5px dashed var(--border); margin-bottom: 28px;
}
.gauge-wrap { position: relative; width: 220px; flex-shrink: 0; }
.gauge-svg { width: 100%; }
.gauge-track { fill: none; stroke: var(--muted); stroke-width: 14; stroke-linecap: round; }
.gauge-fill {
  fill: none; stroke: var(--quaternary); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 283; stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s var(--ease-bounce), stroke 0.4s;
}
.gauge-center { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); text-align: center; }
.gauge-score { font-size: 40px; display: block; line-height: 1; }
.gauge-max { font-size: 13px; color: var(--muted-foreground); font-weight: 600; }

.tier-block { flex: 1; min-width: 220px; }
.tier-badge {
  display: inline-block; font-weight: 700; font-size: 14px; padding: 8px 18px;
  border-radius: var(--radius-full); border: var(--border-w) solid var(--foreground);
  background: var(--muted); margin-bottom: 10px;
}
.tier-badge.tier-good { background: var(--quaternary); color: #063b2c; }
.tier-badge.tier-mid { background: var(--tertiary); color: #4a3200; }
.tier-badge.tier-low { background: var(--secondary); color: #4a0f2c; }
.tier-desc { color: var(--muted-foreground); font-size: 15px; max-width: 42ch; }

.breakdown h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 16px; }
.breakdown-list { list-style: none; margin: 0 0 28px; padding: 0; }
.breakdown-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.breakdown-item:last-child { border-bottom: none; }
.breakdown-reason { font-weight: 600; font-size: 14.5px; }
.breakdown-sub { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; }
.breakdown-points { font-family: "Outfit", sans-serif; font-weight: 700; color: var(--accent); white-space: nowrap; }

.report-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.report-actions .btn { flex: 1; min-width: 200px; }

/* ============ FOOTER ============ */
.site-footer { padding: 28px 0 40px; text-align: center; color: var(--muted-foreground); font-size: 13px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
  .hero-card { transform: none; }
  .app-shell, .report-card { padding: 22px; box-shadow: 4px 4px 0px var(--border); }
  .option-grid { grid-template-columns: 1fr; }
  .stepper { flex-wrap: wrap; }
  .dot-label { font-size: 9.5px; }
  .report-top { gap: 24px; }
  .blob { display: none; }
  .step-nav { flex-wrap: wrap; }
}
