/* ==========================================================================
   Design tokens
   Ink/paper neutrals do the quiet work. One accent — amber, referencing an
   old calculator's LED readout — is reserved ONLY for calculated results
   and primary actions. It never appears anywhere else, so it stays special.
   ========================================================================== */

:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #EAEDF3;
  --ink: #10192B;
  --ink-muted: #4A5468;
  --ink-faint: #8891A6;
  --border: #E1E5EC;

  --accent: #F5A623;
  --accent-ink: #10192B;
  --accent-soft: #FDEFD6;

  --link: #3B5FCC;

  --danger: #C4432E;
  --success: #2E8B57;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-card: 0 1px 2px rgba(16, 25, 43, 0.04), 0 8px 24px rgba(16, 25, 43, 0.06);

  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0A0F1C;
  --surface: #121A2B;
  --surface-2: #182238;
  --ink: #EEF1F7;
  --ink-muted: #A2ACC2;
  --ink-faint: #6B7690;
  --border: #232D42;

  --accent: #F5A623;
  --accent-ink: #10192B;
  --accent-soft: #2E2007;

  --link: #7FA0FF;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0F1C;
    --surface: #121A2B;
    --surface-2: #182238;
    --ink: #EEF1F7;
    --ink-muted: #A2ACC2;
    --ink-faint: #6B7690;
    --border: #232D42;
    --accent-soft: #2E2007;
    --link: #7FA0FF;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

/* ==========================================================================
   Reset + base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.9rem, 5vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; color: var(--ink-muted); }

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Visible keyboard focus, always */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
}
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  min-height: 48px; /* mobile tap target */
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Category cards (homepage + hubs)
   ========================================================================== */

.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 620px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

.calc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--ink);
}
.calc-card:hover { border-color: var(--accent); text-decoration: none; }
.calc-card .name { font-weight: 700; font-family: var(--font-display); }
.calc-card .desc { font-size: .875rem; color: var(--ink-muted); margin: 2px 0 0; }
.calc-card .arrow { color: var(--ink-faint); flex-shrink: 0; }

.calc-card.soon {
  opacity: .55;
  pointer-events: none;
}

section.category { margin: 40px 0; }

/* ==========================================================================
   Accordion — one per tax category. Native <details>/<summary>: no JS,
   works everywhere, accessible by default. Chevron is the only motion.
   ========================================================================== */

.accordion-group {
  margin: 48px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.acc {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.acc summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::marker { content: ""; }

.acc__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

.acc__count {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-faint);
  white-space: nowrap;
}

.acc__chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  transition: transform .18s ease;
  flex-shrink: 0;
}
.acc[open] > summary .acc__chevron { transform: rotate(180deg); }

.acc__body {
  padding: 6px 22px 24px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.acc__body .card-grid { margin-top: 16px; }

/* ==========================================================================
   Calculator form
   ========================================================================== */

.calc-page__intro { margin: 24px 0 28px; }

.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: 6px;
}
.field .hint {
  font-size: .8rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

.input, select.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  min-height: 48px;
}
.input:focus { border-color: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row label { font-weight: 600; font-size: .95rem; }

/* iOS-style switch */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px;
  transition: background-color .15s ease; cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px;
  background: var(--surface); border-radius: 50%; transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(19px); }

/* ==========================================================================
   Result readout — the signature element.
   Big tabular numerals, amber, like a calculator's LED display.
   ========================================================================== */

.readout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  margin: 28px 0;
  box-shadow: var(--shadow-card);
}

.readout__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.readout__value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.readout__value small {
  font-size: .38em;
  font-weight: 700;
  color: var(--ink-muted);
  margin-left: 6px;
}

.readout__breakdown {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 8px;
}
.readout__breakdown .row {
  display: flex;
  justify-content: space-between;
  font-size: .92rem;
}
.readout__breakdown .row .k { color: var(--ink-muted); }
.readout__breakdown .row .v {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ==========================================================================
   Disclaimer + content blocks
   ========================================================================== */

.disclaimer {
  font-size: .85rem;
  color: var(--ink-faint);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 16px 0 32px;
}
.disclaimer strong { color: var(--ink-muted); }

.prose { margin: 32px 0; }
.prose h2 { margin-top: 1.4em; }

.stat-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 40px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-strip .stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
}
.stat-strip .stat span {
  font-size: .78rem;
  color: var(--ink-faint);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 32px 0 60px;
}
.site-footer p { font-size: .82rem; color: var(--ink-faint); }
