/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #16202e;
  --text-muted: #57677d;
  --border: #dde3ec;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0ff;
  --good: #1a8a5f;
  --good-soft: #e4f7ee;
  --bad: #c0392b;
  --bad-soft: #fbe9e7;
  --warn: #b7791f;
  --warn-soft: #fff3dc;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --container: 1080px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(22, 32, 46, 0.06);
  --shadow-md: 0 8px 24px rgba(22, 32, 46, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d;
    --surface: #171f2b;
    --surface-2: #1e2836;
    --text: #eef1f6;
    --text-muted: #97a3b6;
    --border: #2a3444;
    --accent: #6fa1ff;
    --accent-ink: #0b1220;
    --accent-soft: #1a2740;
    --good: #3ecf8e;
    --good-soft: #113627;
    --bad: #ff7a68;
    --bad-soft: #3a1c19;
    --warn: #f0b64f;
    --warn-soft: #3a2c10;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  overflow-x: clip;
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.01em; font-family: var(--display); font-weight: 600; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--surface); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.badge {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .8rem; font-weight: 600; padding: .3em .75em;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.pill-year {
  display: inline-flex; align-items: center; gap: .35em;
  font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  padding: .25em .65em; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}

/* =============================================================
   4. Header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .9rem;
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  color: var(--text);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #6a3bd6));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .95rem;
  flex-shrink: 0;
}
.main-nav { display: none; }
.main-nav ul { display: flex; gap: 1.5rem; list-style: none; }
.main-nav a {
  font-size: .92rem; font-weight: 600; color: var(--text-muted);
  transition: color .2s var(--ease-out);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--accent); }
@media (min-width: 960px) { .main-nav { display: block; } }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 600; font-size: .9rem; padding: .5rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
@media (min-width: 960px) { .nav-toggle { display: none; } }

.mobile-nav {
  display: none; border-bottom: 1px solid var(--border); background: var(--surface);
}
.mobile-nav.is-open { display: block; }
.mobile-nav ul { list-style: none; padding: .5rem var(--gutter) 1rem; display: grid; gap: .25rem; }
.mobile-nav a {
  display: block; padding: .6rem .4rem; font-weight: 600; border-radius: var(--radius-sm);
}
.mobile-nav a:hover { background: var(--surface-2); }
@media (min-width: 960px) { .mobile-nav { display: none !important; } }

/* =============================================================
   5. Hero + tool layout
   ============================================================= */
.tool-hero { padding-block: clamp(1.75rem, 4vw, 3rem) 0; }
.tool-hero h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  max-width: 20ch;
  margin-bottom: .55rem;
}
.tool-hero .subtitle {
  color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; margin-bottom: 1.1rem;
}
.tool-hero .meta-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: clamp(1.1rem, 3vw, 1.9rem);
  margin-bottom: 1.25rem;
}

.field-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .field-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: .4rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .8rem; color: var(--text-muted); }
.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%; padding: .75rem .85rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 1rem; font-family: var(--sans); transition: border-color .2s var(--ease-out);
}
.field input:focus, .field select:focus { border-color: var(--accent); }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 2.6rem; }
.input-suffix span {
  position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-weight: 600; pointer-events: none;
}

.check-row {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .8rem .9rem; background: var(--surface-2); border-radius: var(--radius-sm);
}
.check-row input { margin-top: .2rem; width: 18px; height: 18px; accent-color: var(--accent); }
.check-row label { font-weight: 600; font-size: .92rem; }
.check-row .hint { display: block; font-weight: 400; margin-top: .15rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 1rem; transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; margin-top: .3rem; }

/* result */
.result {
  margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px dashed var(--border);
  display: none;
}
.result.is-visible { display: block; }
.result-headline {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem .9rem;
  margin-bottom: 1rem;
}
.result-headline .amount { font-family: var(--display); font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 700; }
.result-headline .amount.positive { color: var(--good); }
.result-headline .amount.negative { color: var(--bad); }
.result-note { color: var(--text-muted); font-size: .92rem; margin-bottom: 1rem; }

.breakdown { display: grid; gap: .55rem; margin-bottom: 1rem; }
.breakdown-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .6rem .8rem; background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: .95rem;
}
.breakdown-row.total { background: var(--accent-soft); font-weight: 700; }
.breakdown-row .label { color: var(--text-muted); }
.breakdown-row.total .label { color: var(--text); }

.compare-grid { display: grid; gap: 1rem; margin-top: .5rem; }
@media (min-width: 720px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-col {
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.1rem;
}
.compare-col.is-winner { border-color: var(--good); background: var(--good-soft); }
.compare-col h3 { font-size: 1.05rem; margin-bottom: .7rem; display: flex; align-items: center; gap: .4rem; }
.compare-col .total-tax { font-family: var(--display); font-size: 1.7rem; font-weight: 700; margin: .3rem 0 .8rem; }
.compare-line { display: flex; justify-content: space-between; font-size: .88rem; padding-block: .3rem; border-bottom: 1px dashed var(--border); color: var(--text-muted); }
.compare-line:last-child { border-bottom: 0; }
.winner-tag {
  display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--good); background: #fff; border: 1px solid var(--good);
  padding: .15em .55em; border-radius: 999px; margin-bottom: .5rem;
}

.error-state {
  display: none; padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--bad-soft); color: var(--bad); font-weight: 600; margin-top: 1rem;
}
.error-state.is-visible { display: block; }

.privacy-badge {
  display: flex; align-items: flex-start; gap: .6rem; font-size: .88rem;
  color: var(--text-muted); padding: .9rem 1rem; background: var(--surface-2);
  border-radius: var(--radius-sm); margin-bottom: 1.5rem;
}
.privacy-badge svg { flex-shrink: 0; margin-top: .1rem; color: var(--good); }

/* =============================================================
   6. Ad slots
   ============================================================= */
.ad-slot {
  min-height: 100px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--text-muted); font-size: .78rem;
  letter-spacing: .06em; text-transform: uppercase; margin-block: 1.75rem;
  background: var(--surface-2);
}

/* =============================================================
   7. Content sections
   ============================================================= */
.content-section { padding-block: 1.5rem; }
.content-section h2 { font-size: 1.4rem; margin-bottom: .8rem; }
.content-section p { color: var(--text-muted); margin-bottom: 1rem; max-width: 68ch; }
.content-section ul, .content-section ol { color: var(--text-muted); padding-left: 1.2rem; margin-bottom: 1rem; display: grid; gap: .4rem; }

.steps { display: grid; gap: 1rem; margin-block: 1.25rem; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem;
}
.step .step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: .85rem; margin-bottom: .6rem;
}
.step h3 { font-size: 1rem; margin-bottom: .3rem; }
.step p { font-size: .9rem; margin: 0; }

.faq-list { display: grid; gap: .6rem; margin-block: 1.25rem; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .2rem .2rem;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: .9rem 1rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); flex-shrink: 0; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item .faq-answer { padding: 0 1rem 1rem; color: var(--text-muted); font-size: .93rem; }

.tools-grid { display: grid; gap: 1rem; margin-block: 1.25rem; }
@media (min-width: 720px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
.tool-link-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.tool-link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.tool-link-card .icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: .7rem;
}
.tool-link-card h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.tool-link-card p { font-size: .88rem; color: var(--text-muted); margin: 0; }

/* =============================================================
   8. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; margin-top: 2.5rem; }
.site-footer .container { display: grid; gap: 1.25rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: .88rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: .82rem; color: var(--text-muted); max-width: 70ch; }

/* =============================================================
   9. Legal pages
   ============================================================= */
.legal-page { padding-block: 2.5rem; }
.legal-page h1 { font-size: 1.9rem; margin-bottom: 1.2rem; }
.legal-page h2 { font-size: 1.15rem; margin-block: 1.4rem .5rem; }
.legal-page p, .legal-page li { color: var(--text-muted); margin-bottom: .7rem; max-width: 70ch; }
.legal-page ul { padding-left: 1.2rem; }

/* =============================================================
   10. Reveal (subtle, no GSAP needed)
   ============================================================= */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}
