/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --ink:       #111827;
  --ink-2:     #374151;
  --ink-3:     #6b7280;
  --ink-4:     #9ca3af;
  --line:      #e5e7eb;
  --line-2:    #d1d5db;
  --surface:   #f9fafb;
  --white:     #ffffff;
  --teal:      #0d9488;
  --teal-lt:   #ccfbf1;
  --teal-dk:   #0f766e;
  --amber:     #d97706;
  --amber-lt:  #fef3c7;
  --red:       #dc2626;
  --red-lt:    #fee2e2;
  --ff-head:   'Playfair Display', Georgia, serif;
  --ff-body:   'Source Sans 3', system-ui, sans-serif;
  --r4: 4px; --r8: 8px; --r12: 12px; --r16: 16px;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── PAGE ────────────────────────────────────────────────── */
.page { max-width: 860px; margin: 0 auto; padding: 40px 20px 80px; }

/* ── HERO ─────────────────────────────────────────────────  */
.hero { margin-bottom: 28px; }
.hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--teal);
  margin-bottom: 8px;
}
.hero-title {
  font-family: var(--ff-head);
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 15px;
  color: var(--ink-3);
  max-width: 580px;
  line-height: 1.6;
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r16);
  padding: 28px;
  margin-bottom: 20px;
}

/* ── FORM ────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) {
  .form-row, .form-row-2 { grid-template-columns: 1fr; }
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-3);
}
.form-input, .form-select {
  padding: 9px 12px;
  font-family: var(--ff-body);
  font-size: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r8);
  background: var(--white);
  color: var(--ink);
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

/* ── COMPOUND TOGGLE ─────────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.mode-btn {
  flex: 1;
  padding: 8px;
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--r8);
  border: 1px solid var(--line-2);
  background: var(--white);
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.mode-btn.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

/* ── STATE NOTE ──────────────────────────────────────────── */
.state-note {
  display: none;
  background: var(--teal-lt);
  border-left: 3px solid var(--teal);
  padding: 10px 14px;
  border-radius: 0 var(--r8) var(--r8) 0;
  font-size: 13px;
  color: var(--teal-dk);
  margin-bottom: 20px;
  line-height: 1.5;
}
.state-note.visible { display: block; }
.state-note strong { font-weight: 600; }

/* ── YEAR-BY-YEAR TABLE ──────────────────────────────────── */
.breakdown-wrap {
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r12);
  overflow: hidden;
}
.breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.breakdown-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-3);
}
.breakdown-chevron {
  width: 14px; height: 14px;
  transition: transform 0.2s;
}
.breakdown-wrap.open .breakdown-chevron { transform: rotate(180deg); }
.breakdown-body { display: none; }
.breakdown-wrap.open .breakdown-body { display: block; }

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.breakdown-table th {
  background: var(--surface);
  padding: 7px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.breakdown-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.breakdown-table tr:last-child td { border-bottom: none; }
.breakdown-table td:last-child { font-weight: 600; color: var(--teal-dk); }

/* ── RESULTS ─────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 500px) { .results-grid { grid-template-columns: 1fr; } }

.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r12);
  padding: 14px 16px;
  text-align: center;
}
.result-card.highlight {
  background: var(--teal-lt);
  border-color: rgba(13,148,136,0.3);
}
.result-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-4);
  margin-bottom: 4px;
}
.result-card.highlight .result-label { color: var(--teal-dk); opacity: 0.7; }
.result-value {
  font-family: var(--ff-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.result-card.highlight .result-value { color: var(--teal-dk); }

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline-wrap { margin-bottom: 24px; }
.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 500;
  margin-bottom: 6px;
}
.timeline-track {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.timeline-fill {
  height: 100%;
  background: linear-gradient(to right, var(--teal), var(--teal-dk));
  border-radius: 3px;
  width: 0%;
  transition: width 0.6s ease;
}
.timeline-progress-label {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 4px;
  text-align: right;
}

/* ── ACTIONS ─────────────────────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 480px) { .actions-grid { grid-template-columns: 1fr; } }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r8);
  border: 1px solid var(--line-2);
  background: var(--white);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: var(--line); }
.btn-ink { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--r16);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform 0.15s;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.modal-title { font-family: var(--ff-head); font-size: 18px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
  line-height: 1;
}
.modal-close:hover { background: var(--line); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
}

.letter-box {
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r8);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--ink-2);
  margin: 14px 0;
  max-height: 360px;
  overflow-y: auto;
}

/* ── GUIDE STEPS ─────────────────────────────────────────── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media (max-width: 640px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px)  { .guide-grid { grid-template-columns: 1fr; } }

.guide-step { text-align: center; }
.step-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-family: var(--ff-head);
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.step-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.step-desc  { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ── ARTICLE ─────────────────────────────────────────────── */
.article { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); }
.article-eyebrow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--teal); margin-bottom: 8px;
}
.article-h1 {
  font-family: var(--ff-head);
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 14px;
}
.article-lead {
  font-size: 15px; color: var(--ink-2); line-height: 1.7;
  padding-left: 14px; border-left: 3px solid var(--teal);
  margin-bottom: 28px;
}
.article-body { color: var(--ink-2); line-height: 1.75; }
.article-body h2 {
  font-family: var(--ff-head);
  font-size: 20px; font-weight: 700;
  margin: 28px 0 8px; color: var(--ink);
}
.article-body h3 {
  font-size: 15px; font-weight: 600;
  margin: 18px 0 6px; color: var(--ink);
}
.article-body p { margin-bottom: 12px; font-size: 14px; }
.article-body ul { padding-left: 18px; margin-bottom: 12px; }
.article-body li { margin-bottom: 6px; font-size: 14px; }
.article-body strong { color: var(--ink); font-weight: 600; }

.state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 20px;
}
.state-table th {
  background: var(--surface);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.state-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.state-table tr:last-child td { border-bottom: none; }
.rate-badge {
  display: inline-block;
  background: var(--teal-lt);
  color: var(--teal-dk);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 12px;
}

.faq-item { border-top: 1px solid var(--line); padding: 14px 0; }
.faq-q { font-size: 14px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.faq-a { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: var(--r8);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }