:root {
  --bg: #0c1118;
  --surface: #141c27;
  --surface-2: #1c2735;
  --border: #27303d;
  --text: #e8edf3;
  --muted: #9aa7b8;
  --brand: #4cc2ff;
  --brand-ink: #04293d;
  --danger: #ff5c5c;
  --critical: #ff5c5c;
  --serious: #ff9f43;
  --moderate: #ffd23f;
  --minor: #8aa0b6;
  --ok: #38d39f;
  --radius: 12px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: 0 0 0.75rem; }
a { color: var(--brand); }

/* --- Accessibility helpers (we eat our own dog food) --- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--brand); color: var(--brand-ink); padding: 10px 16px;
  border-radius: 8px; font-weight: 700; text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 17, 24, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 800; font-size: 1.3rem; text-decoration: none; color: var(--text); }
.brand-mark { color: var(--brand); }
.brand-tld { color: var(--muted); }
nav[aria-label="Primary"] { display: flex; gap: 22px; align-items: center; }
nav[aria-label="Primary"] a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
nav[aria-label="Primary"] a:hover { color: var(--text); }
.nav-cta {
  background: var(--brand); color: var(--brand-ink) !important;
  padding: 8px 16px; border-radius: 8px;
}

/* --- Hero / scanner --- */
.hero { padding: 72px 0 56px; text-align: center; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem;
  font-weight: 700; color: var(--brand); margin: 0 0 1rem;
}
.lede { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }
.lede strong { color: var(--text); }

.scan-form {
  display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px; border-radius: 14px;
}
.scan-form input {
  flex: 1; background: transparent; border: 0; color: var(--text);
  font-size: 1.05rem; padding: 12px 14px; min-width: 0;
}
.scan-form input::placeholder { color: #6b7888; }
.scan-form input:focus { outline: none; }
.scan-form:focus-within { border-color: var(--brand); }
#scan-btn, #lead-submit, .plan-cta {
  background: var(--brand); color: var(--brand-ink);
  border: 0; font-weight: 700; font-size: 1rem;
  padding: 12px 22px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
#scan-btn:hover, .plan-cta:hover, #lead-submit:hover { filter: brightness(1.08); }
#scan-btn:disabled { opacity: 0.6; cursor: progress; }
.scan-hint { color: var(--muted); font-size: 0.9rem; margin: 0.9rem auto 0; max-width: 520px; }
.scan-status { margin-top: 1.5rem; color: var(--muted); min-height: 1.2em; font-weight: 600; }
.scan-status.error { color: var(--danger); }

/* --- Results --- */
.results { text-align: left; max-width: 820px; margin: 2.5rem auto 0; }
.score-row {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.score-ring {
  --pct: 0;
  width: 104px; height: 104px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--surface-2) 0);
}
.score-ring::before { content: ""; position: absolute; inset: 10px; background: var(--surface); border-radius: 50%; }
.score-ring span { position: relative; font-size: 1.8rem; font-weight: 800; }
.score-meta h3 { margin: 0 0 4px; }
.score-meta p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.score-meta .scanned-url { color: var(--text); font-weight: 600; word-break: break-all; }

.tallies { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.tally {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; flex: 1; min-width: 120px;
}
.tally .n { font-size: 1.6rem; font-weight: 800; display: block; }
.tally .l { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tally.critical .n { color: var(--critical); }
.tally.serious .n { color: var(--serious); }
.tally.moderate .n { color: var(--moderate); }
.tally.minor .n { color: var(--minor); }

.violation {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 12px;
}
.violation.critical { border-left-color: var(--critical); }
.violation.serious { border-left-color: var(--serious); }
.violation.moderate { border-left-color: var(--moderate); }
.violation.minor { border-left-color: var(--minor); }
.violation-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.violation-head h4 { margin: 0; font-size: 1.05rem; }
.badge {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.critical { background: rgba(255,92,92,0.18); color: var(--critical); }
.badge.serious { background: rgba(255,159,67,0.18); color: var(--serious); }
.badge.moderate { background: rgba(255,210,63,0.16); color: var(--moderate); }
.badge.minor { background: rgba(138,160,182,0.16); color: var(--minor); }
.violation p.desc { color: var(--muted); margin: 8px 0; font-size: 0.95rem; }
.violation .meta { font-size: 0.82rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.violation .wcag-tag { color: var(--brand); font-weight: 600; }
.violation pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; font-size: 0.82rem; margin: 8px 0 0;
  color: #c7d2e0;
}
.violation a.learn { font-size: 0.85rem; font-weight: 600; }

.results-cta {
  text-align: center; background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; margin-top: 8px;
}
.results-cta h3 { margin: 0 0 8px; }
.results-cta p { color: var(--muted); margin: 0 0 18px; }
.results-cta button { background: var(--brand); color: var(--brand-ink); border: 0; font-weight: 700; font-size: 1.05rem; padding: 14px 28px; border-radius: 10px; cursor: pointer; }
.clean-state { text-align: center; padding: 16px; color: var(--ok); font-weight: 600; }

/* --- Why section --- */
.why, .pricing, .faq { padding: 64px 0; border-top: 1px solid var(--border); }
.section-lede { color: var(--muted); max-width: 680px; margin: 0 0 2.5rem; font-size: 1.05rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card h3 { margin: 0 0 10px; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); }
.card strong { color: var(--text); }

/* --- Pricing --- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; align-items: start; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; position: relative; }
.plan.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-badge {
  position: absolute; top: -12px; left: 26px; background: var(--brand); color: var(--brand-ink);
  font-size: 0.75rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; margin: 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.plan h3 { margin: 0 0 6px; }
.price { font-size: 1rem; color: var(--muted); margin: 0 0 16px; }
.price span { font-size: 2.4rem; font-weight: 800; color: var(--text); }
.plan ul { list-style: none; padding: 0; margin: 0 0 22px; }
.plan li { padding: 7px 0 7px 26px; position: relative; color: var(--muted); font-size: 0.95rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.plan-cta { width: 100%; }
.plan:not(.featured) .plan-cta { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.pricing-note { color: var(--muted); font-size: 0.9rem; margin-top: 22px; text-align: center; }

/* --- FAQ --- */
.faq dl { max-width: 760px; }
.faq dt { font-weight: 700; font-size: 1.1rem; margin-top: 24px; }
.faq dd { margin: 8px 0 0; color: var(--muted); }
.faq dd strong { color: var(--text); }

/* --- Dialog --- */
dialog {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 16px; padding: 28px; max-width: 440px; width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(4, 8, 12, 0.7); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 6px; }
.lead-sub { color: var(--muted); margin: 0 0 18px; font-size: 0.95rem; }
dialog label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; }
dialog input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 11px 13px; border-radius: 9px; font-size: 1rem;
}
dialog input:focus { outline: none; border-color: var(--brand); }
.lead-status { min-height: 1.2em; margin-top: 12px; font-weight: 600; font-size: 0.9rem; }
.lead-status.error { color: var(--danger); }
.lead-status.ok { color: var(--ok); }
.lead-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 11px 18px; border-radius: 9px; font-weight: 600; cursor: pointer; }

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); }
.site-footer p { margin: 0 0 8px; }
.site-footer .fine { font-size: 0.85rem; max-width: 640px; }

@media (max-width: 520px) {
  .scan-form { flex-direction: column; }
  #scan-btn { width: 100%; }
  nav[aria-label="Primary"] a:not(.nav-cta) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
