/* ============================================================
   ReviewFlow base — shared design system components.
   Loaded by styleguide.html now; index/setup adopt it in
   Phases 2–3. Requires tokens.css first.
   ============================================================ */

/* ---------- Reset & page ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

body {
  background: var(--surface-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
}

/* Grain overlay — atmosphere, 3% */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-bright); }

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

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

section { padding: var(--section-pad) 0; }

/* ---------- Typography ----------
   Uppercase display voice lives on H1/H2/labels/buttons ONLY.
   H3/H4 and card titles are sentence-case for the refined read. */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: 0.01em;
}
h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-3xl); }

h3, h4 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.25;
}
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

.lead {
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: 1.65;
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* Section label — safety-tape underline signature */
.section-label {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--orange);
  padding-bottom: var(--space-2);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--orange) 0 6px,
    transparent 6px 12px
  );
  background-repeat: no-repeat;
  background-size: 44px 3px;
  background-position: left bottom;
}

/* Key numbers (stats) */
.stat-figure {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ----------
   Primary = hi-vis: dark ink on orange (6.9:1). One per view. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--speed-fast) var(--ease-out),
              border-color var(--speed-fast) var(--ease-out),
              transform var(--speed-fast) var(--ease-out),
              box-shadow var(--speed-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--orange);
  color: var(--ink-on-orange);
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover {
  background: var(--orange-bright);
  color: var(--ink-on-orange);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--orange); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding-inline: var(--space-3);
}
.btn-ghost:hover { color: var(--text); }

.btn-lg { font-size: var(--text-lg); padding: 18px 40px; }
.btn-block { width: 100%; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
}
.card:hover { border-color: var(--border-strong); }

/* Accent card — orange wash, replaces glow-everywhere */
.card-accent {
  background: linear-gradient(180deg, var(--orange-soft), transparent 55%), var(--surface-1);
  border-color: rgba(255, 107, 0, 0.35);
}

.stat-card { text-align: center; padding: var(--space-6); }
.stat-card .stat-figure { font-size: var(--text-3xl); }
.stat-card .stat-label {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.stat-card--bad .stat-figure { color: var(--red); }
.stat-card--good .stat-figure { color: var(--green); }

.testimonial-card { display: flex; flex-direction: column; gap: var(--space-4); }
.testimonial-card blockquote {
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.65;
}
.testimonial-meta { display: flex; align-items: center; gap: var(--space-3); }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: var(--orange-soft);
  border: 1px solid rgba(255, 107, 0, 0.35);
  color: var(--orange);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  flex-shrink: 0;
}
.testimonial-name { font-weight: 700; font-size: var(--text-sm); }
.testimonial-trade { font-size: var(--text-xs); color: var(--text-muted); }

.stars { display: inline-flex; gap: 2px; color: var(--star-gold); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}
.badge-orange { border-color: rgba(255,107,0,0.4); background: var(--orange-soft); color: var(--orange); }
.badge-green  { border-color: rgba(34,197,94,0.4); background: var(--green-soft); color: var(--green); }
.badge-red    { border-color: rgba(239,68,68,0.4); background: var(--red-soft); color: var(--red); }

/* ---------- Forms ---------- */
.form-field { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.form-label .optional { color: var(--text-muted); font-weight: 400; }

.form-input, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 12px 14px;
  transition: border-color var(--speed-fast) var(--ease-out);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--orange);
}
.form-input[aria-invalid="true"] { border-color: var(--red); }
.form-error {
  font-size: var(--text-sm);
  color: var(--red);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.form-success { font-size: var(--text-sm); color: var(--green); }
.form-hint { font-size: var(--text-sm); color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 767px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Accordion (FAQ) ---------- */
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: var(--space-6) 0;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-md);
}
.accordion-trigger .chevron {
  flex-shrink: 0;
  color: var(--orange);
  transition: transform var(--speed-base) var(--ease-out);
}
.accordion-trigger[aria-expanded="true"] .chevron { transform: rotate(45deg); }
.accordion-panel {
  overflow: hidden;
  color: var(--text-secondary);
  line-height: 1.65;
}
.accordion-panel[hidden] { display: none; }
.accordion-panel-inner { padding: 0 0 var(--space-6); max-width: 62ch; }

/* ---------- Wizard progress ---------- */
.progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.progress-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--speed-base) var(--ease-out), color var(--speed-base) var(--ease-out);
}
.progress-dot--active { background: var(--orange); border-color: var(--orange); color: var(--ink-on-orange); }
.progress-dot--done   { background: var(--green); border-color: var(--green); color: var(--surface-0); }
.progress-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-track .fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width 400ms var(--ease-out);
}

/* ---------- Toggle ---------- */
.toggle { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 1; }
.toggle .track {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: background var(--speed-base) var(--ease-out);
}
.toggle .track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: var(--radius-pill);
  background: var(--text-secondary);
  transition: transform var(--speed-base) var(--ease-out), background var(--speed-base) var(--ease-out);
}
.toggle input:checked + .track { background: var(--orange); border-color: var(--orange); }
.toggle input:checked + .track::after { transform: translateX(20px); background: var(--ink-on-orange); }
.toggle input:focus-visible + .track { outline: var(--focus-ring); outline-offset: 2px; }

/* ---------- Comparison card (mobile replacement for table) ---------- */
.compare-card { padding: var(--space-6); }
.compare-card .compare-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  text-transform: uppercase;
}
.compare-card ul { list-style: none; margin-top: var(--space-4); display: grid; gap: var(--space-3); }
.compare-card li { display: flex; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.compare-card li .yes { color: var(--green); }
.compare-card li .no { color: var(--red); }

/* ---------- GBP review mock (kept light on purpose — it's "Google") ---------- */
.gbp-card {
  background: #FFFFFF;
  color: #1A1A1A;
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.gbp-card .gbp-name { font-weight: 700; }
.gbp-card .gbp-meta { color: #5F6368; font-size: var(--text-xs); }

/* ---------- Utilities ---------- */
.hazard-rule {
  height: 4px;
  border: none;
  background-image: repeating-linear-gradient(-45deg, var(--orange) 0 8px, transparent 8px 16px);
  opacity: 0.6;
}

@keyframes drHeartbeat{0%,100%{transform:scale(1)}14%,42%{transform:scale(1.2)}28%,70%{transform:scale(1)}}

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