/* MD Salary Calculator - global design system */
:root {
  --ink: #14213D;
  --ink-soft: #4A5568;
  --bg: #FFFFFF;
  --surface: #F6F7FB;
  --line: #E3E6EE;
  --brand: #B8202E;
  --accent: #D4A017;
  --good: #1F7A4D;
  --chart-federal: #14213D;
  --chart-state: #B8202E;
  --chart-local: #D4A017;
  --chart-ss: #5B7DB1;
  --chart-medicare: #8FA8CF;
  --chart-deductions: #9AA3B2;
  --chart-takehome: #1F7A4D;
  --radius-card: 12px;
  --radius-input: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

h1, h2, h3 { font-weight: 700; line-height: 1.25; color: var(--ink); }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.45rem; margin: 2.4rem 0 0.7rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; z-index: 50;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.article { max-width: 760px; }
.article-wide { max-width: 900px; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 3px solid var(--brand);
  background: var(--bg);
}
.header-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.7rem 0;
}
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.12rem;
}
.logo svg { flex: none; }
.logo .logo-sub { display: block; font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }
.main-nav ul { display: flex; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.98rem; padding: 0.4rem 0.1rem; display: inline-block; }
.main-nav a:hover { color: var(--brand); text-decoration: underline; }
.nav-toggle {
  display: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-input); min-width: 44px; min-height: 44px;
  font-size: 1.2rem; cursor: pointer; color: var(--ink);
}

/* ---------- hub strip ---------- */
.hub-strip { background: var(--surface); border-bottom: 1px solid var(--line); }
.hub-strip .wrap { display: flex; gap: 0.6rem; align-items: center; padding-top: 0.55rem; padding-bottom: 0.55rem; overflow-x: auto; }
.hub-strip .hub-title { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.hub-strip a {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.3rem 0.8rem; color: var(--ink); text-decoration: none;
  font-size: 0.9rem; white-space: nowrap;
}
.hub-strip a:hover { border-color: var(--brand); color: var(--brand); }
[hidden] { display: none !important; }

/* ---------- breadcrumbs ---------- */
.crumbs { font-size: 0.88rem; color: var(--ink-soft); padding: 0.8rem 0 0; }
.crumbs a { color: var(--ink-soft); }
.crumbs span { margin: 0 0.3rem; }

/* ---------- hero ---------- */
.hero { padding: 1.6rem 0 0.4rem; }
.subhead { font-size: 1.12rem; color: var(--ink-soft); max-width: 760px; }
.trust-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; list-style: none;
  margin: 0.9rem 0 1.4rem; padding: 0; font-size: 0.92rem; font-weight: 600;
}
.trust-row li { display: inline-flex; align-items: center; gap: 0.4rem; }
.trust-row svg { flex: none; }

/* ---------- calculator ---------- */
.calc-shell {
  display: grid; gap: 1.2rem; margin: 0 0 1.6rem;
}
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 1.1rem;
}
.calc-card { box-shadow: 0 10px 30px rgba(20, 33, 61, 0.10); }
.card h2 { margin-top: 0; font-size: 1.15rem; }
fieldset { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; }
.calc-shell > *, .field-row > *, .ded-row > * { min-width: 0; }
.card, select, input, textarea { min-width: 0; max-width: 100%; }
legend, .group-label { font-weight: 700; font-size: 1rem; margin-bottom: 0.6rem; padding: 0; }
label { display: block; font-weight: 600; font-size: 0.94rem; margin-bottom: 0.3rem; }
input[type="number"], input[type="text"], select {
  width: 100%; min-height: 44px; padding: 0.55rem 0.7rem;
  border: 1px solid #B9C0CF; border-radius: var(--radius-input);
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
}
input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--brand); flex: none; }
.field { margin-bottom: 0.9rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.hint { font-size: 0.85rem; color: var(--ink-soft); margin: 0.3rem 0 0; }
.inline-rate { font-weight: 700; color: var(--brand); }

.segmented { display: flex; border: 1px solid #B9C0CF; border-radius: var(--radius-input); overflow: hidden; margin-bottom: 0.9rem; }
.segmented button {
  flex: 1; min-height: 44px; border: 0; background: var(--surface);
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-soft);
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

details.advanced {
  border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 0.7rem 0.9rem; margin-bottom: 1rem; background: var(--surface);
}
details.advanced summary { font-weight: 700; cursor: pointer; min-height: 32px; }
details.advanced .adv-body { margin-top: 0.8rem; }

.ded-row { display: grid; grid-template-columns: 1fr 110px 96px; gap: 0.5rem; align-items: end; margin-bottom: 0.6rem; }
.ded-row label { margin-bottom: 0.3rem; }
.ded-row .unit-toggle { display: flex; }
.ded-row .unit-toggle button {
  flex: 1; min-height: 44px; border: 1px solid #B9C0CF; background: #fff;
  font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--ink-soft);
}
.ded-row .unit-toggle button:first-child { border-radius: var(--radius-input) 0 0 var(--radius-input); }
.ded-row .unit-toggle button:last-child { border-radius: 0 var(--radius-input) var(--radius-input) 0; border-left: 0; }
.ded-row .unit-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.check-row { display: flex; gap: 0.6rem; align-items: center; min-height: 44px; margin-bottom: 0.8rem; }
.check-row label { margin-bottom: 0; }
.check-row label { font-weight: 500; margin: 0; }
.warn {
  background: #FDF3E3; border: 1px solid var(--accent); border-radius: var(--radius-input);
  padding: 0.6rem 0.8rem; font-size: 0.92rem; margin: 0.6rem 0;
}
.calc-actions { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; }
.btn {
  min-height: 44px; padding: 0.6rem 1.3rem; border: 0; cursor: pointer;
  border-radius: var(--radius-input); background: var(--brand); color: #fff;
  font: inherit; font-weight: 700;
}
.btn:hover { background: #9C1B27; }
.btn-secondary { background: var(--ink); }
.link-btn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0.4rem; min-height: 44px; }

/* results */
.take-home-big { font-size: 2.2rem; font-weight: 700; color: var(--good); line-height: 1.15; margin: 0; }
.take-home-sub { color: var(--ink-soft); margin: 0.2rem 0 1rem; }
.period-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.period-tabs button {
  min-height: 44px; padding: 0.45rem 0.9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid #B9C0CF; background: #fff; font: inherit; font-weight: 600; color: var(--ink-soft);
}
.period-tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
table { border-collapse: collapse; width: 100%; margin: 0 0 1.2rem; font-size: 0.97rem; }
caption { text-align: left; font-weight: 700; padding-bottom: 0.45rem; }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
thead th { border-bottom: 2px solid var(--ink); }
tbody th { font-weight: 600; }
tr.total-row th, tr.total-row td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 520px; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--brand); }
tr.row-highlight { background: #FDF3E3; }
.donut-flex { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: 0.94rem; }
.donut-legend li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 0.7rem 0.8rem; }
.stat .stat-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .stat-value { font-size: 1.25rem; font-weight: 700; }
.result-note { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- content ---------- */
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 1rem 1.2rem; margin: 1.4rem 0; }
.toc h2 { margin-top: 0; font-size: 1.05rem; }
.toc ol { margin: 0; padding-left: 1.3rem; }
.toc li { margin-bottom: 0.25rem; }
.formula-line {
  background: var(--ink); color: #fff; border-radius: var(--radius-card);
  padding: 1rem 1.2rem; font-weight: 600; font-size: 1.02rem; margin-bottom: 1.2rem;
}
.formula-line .equals { color: var(--accent); }
details.faq { border: 1px solid var(--line); border-radius: var(--radius-card); padding: 0.8rem 1rem; margin-bottom: 0.7rem; }
details.faq summary { font-weight: 700; cursor: pointer; min-height: 30px; }
details.faq p { margin-top: 0.6rem; }
.author-box {
  display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 1.1rem; margin: 1.6rem 0; align-items: flex-start;
}
.author-box img { border-radius: 50%; flex: none; }
.author-box p { margin-bottom: 0.4rem; }
.disclaimer-box {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--ink-soft);
  border-radius: var(--radius-card); padding: 1rem 1.2rem; margin: 1.6rem 0; font-size: 0.95rem;
}
.ad-slot { min-height: 120px; }
.related-grid { display: grid; gap: 0.8rem; margin: 1rem 0 1.6rem; }
.related-grid a {
  border: 1px solid var(--line); border-radius: var(--radius-card); padding: 0.9rem 1rem;
  color: var(--ink); text-decoration: none; font-weight: 600; background: #fff;
}
.related-grid a:hover { border-color: var(--brand); color: var(--brand); }
.compare-out { margin-top: 1rem; }

/* ---------- forms ---------- */
.contact-form label { margin-top: 0.8rem; }
.contact-form textarea {
  width: 100%; border: 1px solid #B9C0CF; border-radius: var(--radius-input);
  font: inherit; padding: 0.55rem 0.7rem; min-height: 130px;
}
.hp-field { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #D8DEEA; margin-top: 3rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 1.4rem; padding: 2rem 0 1.2rem; }
.footer-grid h2, .footer-grid h3 { color: #fff; font-size: 1rem; margin: 0 0 0.6rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.4rem; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid #33415E; padding: 1rem 0 1.4rem; font-size: 0.9rem; }

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  h1 { font-size: 2.5rem; }
  .calc-shell { grid-template-columns: 1fr 1fr; align-items: start; }
  .results-card { position: sticky; top: 1rem; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}
@media (max-width: 700px) {
  .main-nav { display: none; }
  .main-nav.open { display: block; position: absolute; right: 1rem; top: 64px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: 0 10px 30px rgba(20,33,61,0.15); padding: 0.7rem 1rem; z-index: 40; }
  .main-nav.open ul { flex-direction: column; gap: 0.3rem; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .header-in { position: relative; }
  .ded-row { grid-template-columns: 1fr 92px 84px; }
  .take-home-big { font-size: 1.9rem; }
}
