/* =========================================================
   CarValue Optimizer — style.css
   1 Tokens  2 Base  3 Header  4 Buttons & forms  5 Landing
   6 App     7 Account  8 Dialog & toast  9 Footer  10 Responsive
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #111418;
  --muted: #667085;
  --line: #e6e8ec;
  --brand: #2457f5;
  --brand-dark: #1a3fc0;
  --brand-soft: #eef2ff;
  --good: #12a594;
  --warn: #c27c0e;
  --bad: #d93d42;
  --font: "Geist", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --r-s: 8px;
  --r-m: 14px;
  --wrap: 1200px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.4rem, 1.5rem + 3.8vw, 4.2rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); }
h3 { font-size: 1.1rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 64ch; }
a { color: var(--brand); text-underline-offset: 3px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: #fff; padding: .5rem 1rem; border-radius: var(--r-s); z-index: 100; }
.skip-link:focus { top: 1rem; }

/* ---------- 3. Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgb(247 247 245 / .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand img { width: 28px; height: 28px; }
.nav-links { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: .45rem .8rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav-links a:hover { background: rgb(17 20 24 / .06); }
.nav-links a[aria-current="page"] { background: var(--ink); color: #fff; }
.plan-pill { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; background: var(--surface); text-decoration: none; }
.plan-pill b { color: var(--ink); font-weight: 600; }

/* ---------- 4. Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: 500 .95rem/1 var(--font); padding: .8rem 1.2rem; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2a2f37; color: #fff; }
.btn-line { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); }
.btn-sm { padding: .5rem .85rem; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: .3rem .4rem; color: var(--brand); font: 500 .85rem var(--font); cursor: pointer; border-radius: 6px; }
.link-btn:hover { background: var(--brand-soft); }
.link-btn.danger { color: var(--bad); }
.link-btn.danger:hover { background: #fdecec; }

label, .label { font-size: .82rem; font-weight: 500; color: var(--ink); }
input, select { font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: .6rem .7rem; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgb(36 87 245 / .15); }
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); padding: 0; }
input[type="range"] { padding: 0; border: 0; accent-color: var(--brand); background: none; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.hint { font-size: .78rem; color: var(--muted); }
.err { font-size: .78rem; color: var(--bad); min-height: 0; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 400; cursor: pointer; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }

.seg { display: inline-flex; background: #eceef1; border-radius: 999px; padding: 3px; gap: 2px; border: 0; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { padding: .42rem .9rem; border-radius: 999px; cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--muted); }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(17 20 24 / .12); }
.seg input:focus-visible + label { outline: 3px solid var(--brand); }

/* ---------- 5. Landing ---------- */
.hero { padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { max-width: 13ch; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.75rem 0 1rem; }
.hero-note { font-size: .85rem; color: var(--muted); }

.demo-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; box-shadow: 0 30px 60px -30px rgb(17 20 24 / .25); }
.demo-card .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.1rem; }
.demo-card .top span { font-size: .8rem; color: var(--muted); }
.demo-row { display: grid; grid-template-columns: 1fr 48px; gap: .35rem 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line); }
.demo-row .name { font-weight: 500; font-size: .95rem; }
.demo-row .name small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.demo-row .score { font: 600 1.35rem var(--mono); text-align: right; grid-row: span 2; }
.bar { height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.best-tag { display: inline-block; font-size: .72rem; font-weight: 600; background: #e3f6f3; color: #0b7a6d; padding: .1rem .5rem; border-radius: 5px; margin-left: .4rem; vertical-align: 2px; }

.photo-band { position: relative; min-height: 380px; border-radius: 22px; overflow: hidden; display: flex; align-items: end; color: #fff; background: #1b2130; }
.photo-band img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(10 12 16 / 0) 30%, rgb(10 12 16 / .78)); }
.photo-band > div { position: relative; z-index: 1; padding: clamp(1.5rem, 4vw, 3rem); }
.photo-band h2 { max-width: 20ch; }
.photo-band p { color: rgb(255 255 255 / .82); margin: 0; }

.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-head { max-width: 640px; margin-bottom: 2.5rem; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.factor-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.factor-list li { display: grid; grid-template-columns: 180px 90px 1fr; gap: 1.5rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.factor-list h3 { margin: 0; }
.factor-list .w { font: 600 1.1rem var(--mono); }
.factor-list .w .bar { margin-top: .5rem; }
.factor-list p { color: var(--muted); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--ink); color: #fff; font: 600 .9rem var(--mono); position: absolute; top: .75rem; left: .75rem; z-index: 1; }
.steps img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-m); margin-bottom: 1.1rem; background: #e6e8ec; }
.steps p { color: var(--muted); }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
.price-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.75rem; display: flex; flex-direction: column; }
.price-card.featured { border: 2px solid var(--brand); }
.price-card .amount { font: 600 2.4rem/1 var(--font); letter-spacing: -0.03em; margin: .75rem 0 .25rem; }
.price-card .amount small { font-size: .95rem; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.price-card ul { list-style: none; padding: 0; margin: 1.25rem 0 1.5rem; flex: 1; }
.price-card li { padding: .45rem 0; border-top: 1px solid var(--line); font-size: .93rem; }

.privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; background: var(--ink); color: #fff; border-radius: 22px; padding: clamp(2rem, 5vw, 3.5rem); }
.privacy p { color: rgb(255 255 255 / .75); }
.privacy .big { font: 600 clamp(3.5rem, 8vw, 6rem)/1 var(--mono); letter-spacing: -0.04em; }
.privacy .big small { font: 500 1rem var(--font); color: rgb(255 255 255 / .7); display: block; margin-top: .6rem; letter-spacing: 0; }

.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 1.1rem 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.3rem/1 var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); padding-bottom: 1rem; }

/* ---------- 6. App ---------- */
.app-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; padding-block: 2rem 1.25rem; }
.app-head h1 { font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.5rem); margin: 0; }
.notice { display: flex; justify-content: space-between; gap: 1rem; align-items: center; background: #fff8eb; border: 1px solid #f3dcb0; color: #6b4a0e; border-radius: var(--r-s); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }

.app-grid { display: grid; grid-template-columns: 380px 1fr; gap: 1.5rem; align-items: start; padding-bottom: 4rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.35rem; }
.panel + .panel { margin-top: 1rem; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.panel-title h2 { font-size: 1.15rem; margin: 0; }
.form-panel { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; }
.fgroup { border: 0; padding: 0; margin: 0 0 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.fgroup legend { font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: .6rem; padding: 0; }
.fgroup .full { grid-column: 1 / -1; }
.range-row { display: flex; justify-content: space-between; }
.limit-box { text-align: center; padding: 1rem 0 .25rem; }

.weights { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; margin-top: 1rem; }
.recall-note { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.recall-note a { color: var(--muted); }
.weights .field label { display: flex; justify-content: space-between; }
.weights .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .35rem; }

.verdict { display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: center; }
.ring { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font: 600 1.6rem var(--mono); background: conic-gradient(var(--c) calc(var(--p) * 1%), #eef0f3 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; }
.verdict h2 { font-size: 1.35rem; margin: 0 0 .2rem; }
.verdict p { margin: 0; color: var(--muted); font-size: .93rem; }

.car-list { list-style: none; margin: 0; padding: 0; }
.car-item { display: grid; grid-template-columns: 34px 1fr auto; gap: .9rem; padding: 1rem 0; border-top: 1px solid var(--line); align-items: start; }
.car-item:first-child { border-top: 0; padding-top: 0; }
.car-item .rank { font: 600 .9rem var(--mono); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #eef0f3; }
.car-item.top .rank { background: var(--ink); color: #fff; }
.car-item h3 { margin: 0 0 .15rem; font-size: 1rem; }
.car-meta { font-size: .83rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.car-score { text-align: right; }
.car-score b { font: 600 1.5rem/1 var(--mono); display: block; }
.car-score small { font-size: .75rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.tag { font-size: .75rem; padding: .18rem .5rem; border-radius: 5px; background: #eef0f3; color: #3c4350; }
.tag.good { background: #e3f6f3; color: #0b7a6d; }
.tag.warn { background: #fff3dc; color: #7a4f06; }
.tag.stop { background: #fde8e8; color: #a3262b; }
.car-actions { display: flex; gap: .25rem; margin-top: .4rem; justify-content: flex-end; }

.chart-card h2 { font-size: 1.05rem; margin: 0 0 .2rem; }
.chart-card .note { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.chart { width: 100%; overflow-x: auto; }

.report-cta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.report-cta p { margin: 0; color: var(--muted); font-size: .9rem; }
.empty { text-align: center; padding: 3rem 1rem; }
.empty p { margin-inline: auto; color: var(--muted); }

/* ---------- 7. Account ---------- */
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; padding-bottom: 4rem; }
.acct-grid .wide { grid-column: 1 / -1; }
.kv { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); font-size: .93rem; }
.kv li span:first-child { color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.retention-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.retention-table th, .retention-table td { text-align: left; padding: .65rem .5rem .65rem 0; border-bottom: 1px solid var(--line); }
.retention-table th { font-size: .78rem; color: var(--muted); font-weight: 500; }
.demo-note { font-size: .82rem; color: var(--muted); background: #f1f3f6; border-radius: var(--r-s); padding: .6rem .8rem; margin-top: 1rem; }

/* ---------- 8. Dialog & toast ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 420px); color: var(--ink); box-shadow: 0 30px 80px rgb(17 20 24 / .3); }
dialog::backdrop { background: rgb(17 20 24 / .5); }
.dialog-body { padding: 1.6rem; }
.dialog-body h2 { font-size: 1.3rem; }
.dialog-body .amount { font: 600 2.2rem var(--mono); margin: .5rem 0 1rem; }
.dialog-body .btn-row { margin-top: 1.25rem; }
.dialog-body .btn-row .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 160%); background: var(--ink); color: #fff; padding: .75rem 1.15rem; border-radius: 999px; font-size: .92rem; z-index: 200; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- 9. Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; font-size: .85rem; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-row a { color: var(--muted); margin-left: 1rem; }
.footer-row span:last-child { display: flex; flex-wrap: wrap; gap: .25rem 0; }

.disclaimer { font-size: .8rem; color: var(--muted); max-width: 90ch; margin: 0 0 1.25rem; }

/* Legal pages */
.legal { max-width: 760px; padding-block: 3rem 5rem; }
.legal h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); }
.legal h2 { font-size: 1.25rem; margin-top: 2.25rem; }
.legal h3 { font-size: 1rem; margin-top: 1.25rem; }
.legal p, .legal li { color: #2b3038; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .45rem; }
.legal .updated { color: var(--muted); font-size: .9rem; }
.legal .callout { background: #fff8eb; border: 1px solid #f3dcb0; border-radius: var(--r-s); padding: 1rem 1.1rem; color: #4a3508; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 1020px) {
  .hero-grid, .privacy, .app-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; }
  .pricing, .steps { grid-template-columns: 1fr; }
  .weights { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .nav-links a { padding: .45rem .55rem; font-size: .88rem; }
  .plan-pill { display: none; }
  .factor-list li { grid-template-columns: 1fr 70px; gap: .5rem 1rem; }
  .factor-list p { grid-column: 1 / -1; }
  .acct-grid { grid-template-columns: 1fr; }
  .weights { grid-template-columns: 1fr 1fr; }
  .verdict { grid-template-columns: auto 1fr; }
  .verdict .btn { grid-column: 1 / -1; }
  .car-item { grid-template-columns: 30px 1fr auto; }
  .fgroup { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
