/* Aria phase 1 styles. Colour tokens live on :root and are redefined for dark mode. */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efece5;
  --text: #1b1e22;
  --muted: #5b6168;
  --border: #dcd7cc;
  --accent: #1f5c4a;
  --accent-text: #ffffff;
  --accent-soft: #dcebe4;
  --good: #1f7a4d;
  --good-soft: #e1f2e8;
  --watch: #9a5b0b;
  --watch-soft: #fbefd9;
  --steps: #2a5194;
  --steps-soft: #e2eaf8;
  --danger: #a3302a;
  --danger-soft: #f8e3e1;
  --banner-bg: #fff4c7;
  --banner-text: #4d3d00;
  --shadow: 0 1px 2px rgb(20 20 20 / 6%), 0 8px 24px rgb(20 20 20 / 6%);
  --radius: 14px;
  --gutter: 16px;
  --max: 1080px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --surface: #1a1d21;
    --surface-2: #22262b;
    --text: #eceae5;
    --muted: #a3a9b0;
    --border: #30353b;
    --accent: #6cc3a0;
    --accent-text: #0e1a15;
    --accent-soft: #1d3a30;
    --good: #7fd3a6;
    --good-soft: #1b3326;
    --watch: #f0b866;
    --watch-soft: #3a2c14;
    --steps: #93b4f0;
    --steps-soft: #1c2a42;
    --danger: #f19a92;
    --danger-soft: #3d1f1d;
    --banner-bg: #3a3214;
    --banner-text: #f5e7a8;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121417;
  --surface: #1a1d21;
  --surface-2: #22262b;
  --text: #eceae5;
  --muted: #a3a9b0;
  --border: #30353b;
  --accent: #6cc3a0;
  --accent-text: #0e1a15;
  --accent-soft: #1d3a30;
  --good: #7fd3a6;
  --good-soft: #1b3326;
  --watch: #f0b866;
  --watch-soft: #3a2c14;
  --steps: #93b4f0;
  --steps-soft: #1c2a42;
  --danger: #f19a92;
  --danger-soft: #3d1f1d;
  --banner-bg: #3a3214;
  --banner-text: #f5e7a8;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
}

/* Safe-area aware horizontal gutter (notches, rounded corners, landscape). */
.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw + 1rem, 3.4rem); letter-spacing: -.01em; }
h2 { font-family: var(--font-display); font-size: clamp(1.5rem, 2vw + 1rem, 2.1rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-text); padding: 8px 12px; z-index: 100; }
.skip:focus { left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Demo banner */
.demo-banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: .9rem;
  text-align: center;
  padding: 8px max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top));
}

.tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--banner-bg);
  color: var(--banner-text);
  vertical-align: middle;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a:not(.btn) { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.site-nav a:not(.btn):hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border: 0; background: transparent; color: var(--text); border-radius: 10px; cursor: pointer; }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; position: relative; margin: 0 auto; transition: transform .2s; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -7px; }
.nav-toggle .bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-7px) rotate(-45deg); }

.theme-toggle { width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; margin-left: 4px; }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; place-items: center; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px max(var(--gutter), env(safe-area-inset-right)) 16px max(var(--gutter), env(safe-area-inset-left));
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a:not(.btn) { padding: 12px 10px; }
  .site-nav .btn { margin-top: 8px; text-align: center; }
  .theme-toggle { align-self: flex-start; margin: 8px 0 0; }
}

/* Main */
main { flex: 1; padding-top: 40px; padding-bottom: 64px; outline: none; }
.page { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }

.section { margin-top: 56px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46rem; }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: .95rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }

/* Cards & grids */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin-bottom: .4em; }
.card ul { margin: 0; padding-left: 1.1em; }
.card li + li { margin-top: 6px; }

.notice { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: .95rem; }
.notice-ai { border-left: 4px solid var(--accent); }

/* Hero + first read */
.hero { display: grid; gap: 32px; grid-template-columns: 1.05fr 1fr; align-items: start; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

.first-read { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 22px; box-shadow: var(--shadow); }
.first-read label { display: block; font-weight: 600; margin-bottom: 8px; }
.first-read textarea {
  width: 100%; min-height: 132px; resize: vertical;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
}
.first-read textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.fr-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.fr-count { font-size: .85rem; color: var(--muted); }
.fr-count.over { color: var(--danger); font-weight: 600; }
.fr-fine { font-size: .82rem; color: var(--muted); margin: 12px 0 0; }
.turnstile-slot:empty { display: none; }
.turnstile-slot { margin-top: 12px; }

.fr-status { margin-top: 16px; border-radius: 10px; padding: 12px 14px; font-size: .95rem; }
.fr-status[hidden] { display: none; }
.fr-status.error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.fr-status.declined { background: var(--watch-soft); color: var(--watch); border: 1px solid color-mix(in srgb, var(--watch) 35%, transparent); }
.fr-status.loading { background: var(--surface-2); color: var(--muted); display: flex; align-items: center; gap: 10px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { margin-top: 32px; }
.results[hidden] { display: none; }
.results-title { font-family: var(--font-display); }
.read-card { border-top: 4px solid var(--border); }
.read-card .label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-bottom: 10px; }
.read-card.good { border-top-color: var(--good); }
.read-card.good .label { background: var(--good-soft); color: var(--good); }
.read-card.watch { border-top-color: var(--watch); }
.read-card.watch .label { background: var(--watch-soft); color: var(--watch); }
.read-card.steps { border-top-color: var(--steps); }
.read-card.steps .label { background: var(--steps-soft); color: var(--steps); }
.read-card ol { margin: 0; padding-left: 1.2em; }

/* Steps list (how it works) */
.how { counter-reset: how; display: grid; gap: 16px; padding: 0; list-style: none; }
.how li { counter-increment: how; position: relative; padding-left: 56px; }
.how li::before { content: counter(how); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }

/* Pricing */
.price { font-size: 2rem; font-weight: 700; margin: .2em 0; }
.price small { font-size: .95rem; color: var(--muted); font-weight: 400; }
.plan.featured { border: 2px solid var(--accent); }
.plan ul { padding-left: 1.1em; margin: 12px 0 20px; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style-position: outside; }
.faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }

/* Forms */
.form { display: grid; gap: 14px; max-width: 520px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--accent); }
.form-note { font-size: .9rem; color: var(--muted); }

/* Checkout */
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.summary-row:last-child { border-bottom: 0; font-weight: 700; }

/* Dashboard demo */
.dash { display: grid; gap: 16px; grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .dash { grid-template-columns: 1fr; } }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.task.done span { text-decoration: line-through; color: var(--muted); }
.stat { font-size: 2rem; font-weight: 700; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }

/* Terms */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; font-family: var(--font); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
  padding-top: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.site-footer p { margin: 0; }

.after-results { margin-top: 20px; }
.form-wide { max-width: none; }
.progress-label { margin: 6px 0 0; }

/* Pricing */
.billing-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.section-tight { margin-top: 20px; }
.local-price { margin: -4px 0 8px; font-size: .95rem; }
.fine-print { font-size: .9rem; }
