/* CobaltMedicare product styles. Brand tokens come from /css/tokens.css (the
   Cobalt brand contract; never edited here). Product-specific decisions below:
   larger base type for a 55+ audience, tables as the visual centerpiece,
   answer-first callout, print stylesheet. */

:root {
  --measure: 60rem;
  --text-body: 18px;   /* product override: 55+ eyes; brand base is 15px for apps */
  --text-body-lg: 20px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.65;
  background: var(--color-white);
  color: var(--color-navy);
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--color-cobalt);
  color: var(--color-white);
  padding: 8px 16px;
}
.skip-link:focus { left: 8px; top: 8px; z-index: 10; }

/* ── Header / brand lockup (HTML text per brand contract) ─────────── */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.brand-mark { height: 26px; width: 26px; display: block; }
.brand-name {
  font-family: var(--font-display);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--tracking-tight);
  font-size: 22px;
  line-height: 1;
}
.brand-prefix { color: var(--color-cobalt); }
.brand-suffix { color: var(--color-navy); }

.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-medium);
  font-size: 16px;
  color: var(--color-navy);
  text-decoration: none;
  padding: 12px 6px;
  display: inline-block;
}
.site-nav a:hover { color: var(--color-cobalt); }

/* ── Typography ───────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
  line-height: 1.2;
}
h1 { font-size: var(--text-3xl); font-weight: var(--font-weight-extrabold); margin: 28px 0 8px; }
h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 44px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-cobalt);
  display: inline-block;
}
h3 { font-size: 21px; font-weight: 700; margin: 28px 0 8px; }
p { margin: 0 0 16px; }
a { color: var(--color-cobalt); }
a:hover { color: var(--color-cobalt-dark); }
strong { font-weight: var(--font-weight-bold); }

.page-head { margin-bottom: 20px; }
.page-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--color-muted);
  font-size: 15px;
  margin: 4px 0 0;
}
.updated time { font-weight: var(--font-weight-medium); }

/* ── Answer-first block ───────────────────────────────────────────── */
.answer-first {
  background: var(--color-cobalt-pale);
  border-left: 4px solid var(--color-cobalt);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 20px 0 28px;
  font-size: var(--text-body-lg);
}
.answer-first p { margin: 0 0 10px; }
.answer-first p:last-child { margin-bottom: 0; }

/* ── Tables: the centerpiece ──────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin: 20px 0 8px; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 16px;
  background: var(--color-white);
}
caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--color-ink);
  padding-bottom: 8px;
}
th, td {
  border: 1px solid var(--color-border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
thead th {
  background: var(--color-cloud);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
  font-size: 14px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-storm);
}
tbody tr:nth-child(even) td { background: var(--color-cloud); }
td.num, th.num {
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
  font-size: 15px;
}
.table-source {
  color: var(--color-muted);
  font-size: 14px;
  margin: 4px 0 24px;
}

/* ── Callouts ─────────────────────────────────────────────────────── */
.note {
  background: var(--color-cloud);
  border-left: 4px solid var(--color-teal);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 16px;
}
.projection-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-amber);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  margin-bottom: 8px;
}

/* ── Calculator ───────────────────────────────────────────────────── */
.calc {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 24px 0;
  background: var(--color-white);
}
.calc h2 { border-bottom: none; margin-top: 0; padding-bottom: 0; }
.calc fieldset { border: none; padding: 0; margin: 0 0 18px; }
.calc legend, .calc label {
  font-weight: var(--font-weight-bold);
  font-size: 17px;
  color: var(--color-ink);
}
.calc .hint { color: var(--color-muted); font-size: 15px; font-weight: 400; }
.calc input[type="text"], .calc input[type="number"], .calc select {
  font-family: var(--font-mono);
  font-size: 20px;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 320px;
  color: var(--color-ink);
  background: var(--color-white);
}
.calc input:focus, .calc select:focus, .calc .radio-row label:focus-within {
  outline: 3px solid var(--color-cobalt-light);
  outline-offset: 1px;
}
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 17px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  background: var(--color-white);
}
.radio-row input { accent-color: var(--color-cobalt); width: 20px; height: 20px; }
.radio-row label:has(input:checked) {
  border-color: var(--color-cobalt);
  background: var(--color-cobalt-pale);
}
.btn-primary {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
  font-size: 18px;
  background: var(--color-cobalt);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius);
  padding: 14px 28px;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--color-cobalt-dark); }

.calc-result {
  border-top: 2px solid var(--color-cobalt);
  margin-top: 20px;
  padding-top: 16px;
}
.calc-result .headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--color-ink);
  margin-bottom: 12px;
}
.calc-result .figure { font-family: var(--font-mono); }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.stat {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--color-cloud);
}
.stat .stat-label {
  font-size: 13px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
  display: block;
}
.stat .stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--color-ink);
}
.cliff-warning {
  background: var(--color-cobalt-pale);
  border-left: 4px solid var(--color-teal);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-size: 17px;
}

/* Bracket position bar */
.cliff-bar { margin: 18px 0; }
.cliff-bar .bar {
  position: relative;
  height: 18px;
  border-radius: var(--radius-full);
  background: linear-gradient(to right, var(--color-cobalt-pale), var(--color-cobalt-light), var(--color-cobalt), var(--color-cobalt-dark), var(--color-cobalt-black));
}
.cliff-bar .marker {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 30px;
  background: var(--color-ink);
  border-radius: 2px;
}
.cliff-bar .bar-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 6px;
}

/* ── Ad slots ─────────────────────────────────────────────────────────
   Slots are defined in markup now but collapsed until ads go live: adding
   class "ads-enabled" to <body> reserves the space from first paint (no
   layout shift when units fill) and CI verifies every slot stays >=150px
   from anything interactive. Never reload a slot on calculator recalcs. */
.ad-slot { display: none; }
.ads-enabled .ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 48px 0;
  background: var(--color-cloud);
  border-radius: var(--radius-sm);
  color: var(--color-muted-light);
}
.ads-enabled .ad-slot::before {
  content: "Advertisement";
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  align-self: flex-start;
  padding: 2px 0;
}
.ads-enabled .ad-slot--leaderboard { min-height: 116px; }
.ads-enabled .ad-slot--rect { min-height: 304px; }
/* Hard clearance around the calculator, belt and suspenders vs the margin */
.ads-enabled .calc { margin-top: 150px; margin-bottom: 150px; }
.ads-enabled .calc:first-of-type { margin-top: 24px; }

.magi-helper summary {
  display: inline-block;
  padding: 12px 4px;
  cursor: pointer;
}
.magi-helper label { display: block; margin-top: 10px; }
.table-scroll:focus-visible { outline: 3px solid var(--color-cobalt-light); }

/* ── FAQ ──────────────────────────────────────────────────────────── */
.faq h3 { margin-top: 24px; }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--color-border);
  background: var(--color-cloud);
  padding: 32px 0 40px;
  font-size: 15px;
  color: var(--color-muted);
}
.site-footer .disclaimer { max-width: 46rem; }
.footer-nav { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.footer-nav a { color: var(--color-storm); padding: 12px 4px; display: inline-block; }
.colophon { font-size: 13px; }

/* ── Small screens ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: 22px; }
  /* Compact two-row nav; links stay visible (no hamburger: this audience
     should never have to hunt for navigation) but wrap tightly. */
  .header-row { min-height: 0; padding-top: 10px; padding-bottom: 2px; }
  .site-nav { gap: 0 2px; margin-left: -8px; width: 100%; }
  .site-nav a { font-size: 15px; padding: 10px 8px; }
}

/* ── Print: this audience prints ──────────────────────────────────── */
@media print {
  .site-nav, .footer-nav, .ad-slot, .skip-link, .btn-primary, .no-print { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .answer-first, .note, .cliff-warning { border: 1px solid #000; background: #fff; }
  table, th, td { border: 1px solid #000 !important; }
  tbody tr:nth-child(even) td { background: #fff; }
  table { page-break-inside: avoid; }
  h2 { border-bottom-color: #000; }
  .site-footer { background: #fff; border-top: 1px solid #000; }
}
