:root {
  --ink: #102320;
  --muted: #55665f;
  --bg: #ffffff;
  --bg-alt: #f4f8f6;
  --card: #ffffff;
  --line: #dfe8e4;
  --brand: #0d7a5f;
  --brand-dark: #095c47;
  --brand-soft: #e3f3ed;
  --high: #c2362b;
  --high-soft: #fbe9e7;
  --medium: #a86410;
  --medium-soft: #fbf0df;
  --low: #5b6b66;
  --low-soft: #eef2f0;
  --healthy: #1a7f45;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 35, 32, 0.05), 0 8px 24px rgba(16, 35, 32, 0.06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
img { max-width: 100%; }
code { background: var(--low-soft); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.92em; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: 0.75em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  font: 600 1rem/1 var(--font); padding: 0.95em 1.4em; border-radius: 10px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-small { font-size: 0.875rem; padding: 0.6em 1em; }
.btn-outline { background: transparent; color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-alt); }

/* Nav */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; height: 32px; width: auto; }
.nav-links { display: none; gap: 28px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--ink); }

/* Hero */
.hero { padding: 72px 0 56px; background: radial-gradient(1200px 400px at 50% -10%, var(--brand-soft), transparent 70%); }
.hero-inner { max-width: 760px; text-align: center; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); font-weight: 800; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0 auto 2em; }
.checkup-form {
  display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 0 auto;
  padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.checkup-form input {
  flex: 1; min-width: 0; font: 500 1.05rem var(--font); padding: 0.85em 1em;
  border: none; border-radius: 10px; color: var(--ink); background: transparent;
}
.checkup-form input:focus { outline: 2px solid var(--brand-soft); }
.form-note { font-size: 0.9rem; color: var(--muted); margin-top: 1em; }
.status { min-height: 1.6em; font-weight: 500; color: var(--muted); }
.status[data-tone='error'] { color: var(--high); }

/* Report */
.report { padding: 24px 0 64px; }
.report-head { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 28px; text-align: center; }
.report-head h2 { font-size: 1.8rem; }
.score-ring {
  --score: 0;
  --ring: var(--high);
  width: 132px; height: 132px; flex: none; border-radius: 50%;
  display: flex; align-items: baseline; justify-content: center; padding-top: 42px;
  background:
    radial-gradient(closest-side, #fff 78%, transparent 79%),
    conic-gradient(var(--ring) calc(var(--score) * 1%), var(--line) 0);
}
.score-ring[data-health='healthy'] { --ring: var(--healthy); }
.score-ring[data-health='needs-attention'] { --ring: var(--medium); }
.score-ring span { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.score-ring small { color: var(--muted); font-weight: 600; }
.report-heading { margin: 40px 0 16px; font-size: 1.3rem; }

.issue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.issue { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.issue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.issue-head h4 { margin: 0; font-size: 1.05rem; flex: 1 1 200px; }
.issue-count { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.issue-why { color: var(--muted); margin-bottom: 0.5em; }
.issue-fix { margin-bottom: 0.5em; }
.issue details summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 0.9rem; }
.affected { margin: 10px 0 0; padding-left: 20px; columns: 1; font-size: 0.92rem; }
.affected li { margin-bottom: 4px; break-inside: avoid; }

.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.3em 0.6em; border-radius: 6px; }
.tag-high { background: var(--high-soft); color: var(--high); }
.tag-medium { background: var(--medium-soft); color: var(--medium); }
.tag-low { background: var(--low-soft); color: var(--low); }

.product-list { display: grid; gap: 12px; }
.product { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.product-row { display: flex; align-items: flex-start; gap: 14px; }
.thumb { width: 60px; height: 60px; flex: none; border-radius: 10px; object-fit: cover; background: var(--bg-alt); border: 1px solid var(--line); }
.thumb-empty { display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--muted); text-align: center; }
.product-main { flex: 1; min-width: 0; }
.product-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.product-title:hover { color: var(--brand); text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 0.78rem; padding: 0.2em 0.6em; border-radius: 999px; border: 1px solid; }
.chip-high { color: var(--high); border-color: var(--high-soft); background: var(--high-soft); }
.chip-medium { color: var(--medium); border-color: var(--medium-soft); background: var(--medium-soft); }
.chip-low { color: var(--low); border-color: var(--low-soft); background: var(--low-soft); }
.product-score { flex: none; font-weight: 800; font-size: 1.2rem; color: var(--high); }
.product-score[data-health='healthy'] { color: var(--healthy); }
.product-score[data-health='needs-attention'] { color: var(--medium); }
.product > .btn { margin-top: 12px; }
.rewrite:not(:empty) { margin-top: 14px; padding: 14px; background: var(--bg-alt); border-radius: 10px; }
.rewrite-field + .rewrite-field { margin-top: 12px; }
.rewrite-label { display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
.rewrite-description { white-space: pre-line; }
.rewrite-note { margin: -8px 0 16px; }

/* Sections */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); text-align: center; }
.section-lede { text-align: center; color: var(--muted); max-width: 560px; margin: 0 auto 32px; }

.steps { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 16px; }
.steps li { padding: 24px; }
.step-number {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 12px;
}
.steps h3 { font-size: 1.1rem; }
.steps p { color: var(--muted); margin: 0; }

.check-grid { display: grid; gap: 12px; }
.check-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.check-card h3 { font-size: 1rem; margin: 10px 0 6px; }
.check-card p { color: var(--muted); font-size: 0.92rem; margin: 0; }

.plans { display: grid; gap: 16px; max-width: 760px; margin: 32px auto 0; }
.plan { padding: 28px; display: flex; flex-direction: column; }
.plan h3 { font-size: 1.1rem; color: var(--muted); }
.price { font-size: 2rem; font-weight: 800; margin-bottom: 0.6em; }
.plan ul { padding-left: 1.2em; margin: 0 0 24px; flex: 1; }
.plan li { margin-bottom: 6px; }
.plan-pro { border-color: var(--brand); }

.faq { max-width: 760px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 12px 0 0; color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 32px 0; font-size: 0.9rem; }
.footer-inner p { margin: 0 0 6px; }
.form-note a { font-weight: 600; margin-left: 0.4em; white-space: nowrap; }
.form-note a::after { content: ' →'; }

/* Before / after rewrite example */
.compare { display: grid; gap: 16px; max-width: 920px; margin: 32px auto 0; }
.compare-card { padding: 24px; }
.compare-head { margin-bottom: 14px; }
.tag-ok { background: var(--brand-soft); color: var(--brand); }
.compare-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 2px; }
.compare-title { font-weight: 700; font-size: 1.1rem; }
.compare-note { font-size: 0.85rem; margin: 0; }
.compare-source { text-align: center; font-size: 0.85rem; margin: 16px 0 0; }
.placeholder { background: var(--medium-soft); color: var(--medium); border-radius: 4px; padding: 0 0.25em; font-weight: 600; }

/* Hero product preview */
.hero-preview { max-width: 640px; margin: 48px auto 0; padding: 24px; text-align: left; }
.preview-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.preview-head .eyebrow { margin-bottom: 0.25em; }
.preview-verdict { font-size: 1.3rem; font-weight: 800; margin: 0 0 0.2em; }
.preview-summary { font-size: 0.92rem; margin: 0; }
.score-ring-small { width: 92px; height: 92px; padding-top: 28px; }
.score-ring-small span { font-size: 1.7rem; }
.score-ring-demo { --score: 72; }
.preview-issues { list-style: none; margin: 0; padding: 0; }
.preview-issues li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.preview-issue { flex: 1 1 180px; font-weight: 600; }

/* Closing call to action */
.cta-band { background: var(--brand); color: #fff; text-align: center; padding: 72px 0; }
.cta-band h2 { color: #fff; font-size: clamp(1.7rem, 4vw, 2.3rem); }
.cta-band p { color: rgba(255, 255, 255, 0.85); margin-bottom: 1.5em; }
.btn-light { background: #fff; color: var(--brand); border-color: #fff; }
.btn-light:hover { background: var(--brand-soft); }

/* Motion. Registering --score lets the score rings fill smoothly instead of jumping. */
@property --score { syntax: '<number>'; inherits: true; initial-value: 0; }
.score-ring { transition: --score 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes flag { 50% { box-shadow: 0 0 0 4px var(--medium-soft); background: #f6d9a8; } }

/* Hero preview: a fake address bar, then the checkup plays out (driven by demo.js) */
.preview-url {
  display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 18px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-alt); font-weight: 500;
}
.preview-url-icon { position: relative; flex: none; width: 13px; height: 13px; border: 2px solid var(--muted); border-radius: 50%; margin-right: 4px; }
.preview-url-icon::after { content: ''; position: absolute; right: -5px; bottom: -5px; width: 2px; height: 6px; background: var(--muted); transform: rotate(-45deg); }
.preview-caret { width: 2px; height: 1.1em; background: var(--brand); opacity: 0; }
.hero-preview.is-typing .preview-caret { opacity: 1; animation: blink 0.8s steps(1) infinite; }
.preview-summary { min-height: 3em; }

.motion .score-ring-demo { --score: 0; }
.motion .preview-verdict,
.motion .preview-issues li { opacity: 0; transform: translateY(8px); transition: opacity 0.45s ease, transform 0.45s ease; }
.motion .hero-preview.is-scored .score-ring-demo { --score: 72; }
.motion .hero-preview.is-scored .preview-verdict,
.motion .hero-preview.is-listed .preview-issues li { opacity: 1; transform: none; }
.motion .hero-preview.is-listed .preview-issues li:nth-child(2) { transition-delay: 0.15s; }
.motion .hero-preview.is-listed .preview-issues li:nth-child(3) { transition-delay: 0.3s; }
/* Safety net from motion-init.js: show the finished preview if the demo never ran. */
.motion-done .score-ring-demo { --score: 72; }
.motion-done .preview-verdict,
.motion-done .preview-issues li { opacity: 1; transform: none; }

/* Real report: cards rise in one after another (class added by app.js) */
.report.is-revealing .issue,
.report.is-revealing .product { animation: rise 0.45s ease both; }
.report.is-revealing :is(.issue, .product):nth-child(2) { animation-delay: 0.07s; }
.report.is-revealing :is(.issue, .product):nth-child(3) { animation-delay: 0.14s; }
.report.is-revealing :is(.issue, .product):nth-child(4) { animation-delay: 0.21s; }
.report.is-revealing :is(.issue, .product):nth-child(5) { animation-delay: 0.28s; }
.report.is-revealing :is(.issue, .product):nth-child(n + 6) { animation-delay: 0.35s; }

/* Rewrite example: the title types itself, then lines appear and placeholders get flagged (demo.js) */
.rw-line { display: inline-block; }
.rw-writing .compare-title[data-demo='rewrite-title']::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 2px; background: var(--brand); vertical-align: -2px; animation: blink 0.8s steps(1) infinite; }
.rw-pending .rw-line,
.rw-pending .compare-note { opacity: 0; transform: translateY(4px); transition: opacity 0.35s ease, transform 0.35s ease; }
.rw-pending.rw-play .rw-line,
.rw-pending.rw-play .compare-note { opacity: 1; transform: none; }
.rw-play .rw-line:nth-child(2) { transition-delay: 0.2s; }
.rw-play .rw-line:nth-child(3) { transition-delay: 0.4s; }
.rw-play .rw-line:nth-child(4) { transition-delay: 0.6s; }
.rw-play .rw-line:nth-child(5) { transition-delay: 0.8s; }
.rw-play .rw-line:nth-child(6) { transition-delay: 1s; }
.rw-play .rw-line:nth-child(7) { transition-delay: 1.2s; }
.rw-pending.rw-play .compare-note { transition-delay: 1.5s; }
.rw-play .placeholder { animation: flag 0.9s ease 1.6s 2; }

/* Wider screens */
@media (min-width: 640px) {
  .checkup-form { flex-direction: row; }
  .compare { grid-template-columns: 1fr 1fr; }
  .report-head { flex-direction: row; text-align: left; }
  .affected { columns: 2; }
  .plans { grid-template-columns: 1fr 1fr; }
  .check-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .check-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .score-ring { transition: none; }
  .report.is-revealing .issue,
  .report.is-revealing .product,
  .preview-caret { animation: none; }
}
