/* Medicare & Social Security 2027
   Style: Kitchen Table (Atkinson Hyperlegible, large type, warm shapes)
   Palette: Coastal Calm (sea glass, deep teal, coral highlights)
   No gradients. Icons come from Lucide, loaded from jsDelivr. */

:root {
  --paper: #EEF5F3;
  --surface: #FFFFFF;
  --ink: #0F2E36;
  --muted: #4B6A70;
  --line: #C4D9D4;
  --accent: #0F6B6B;
  --accent-hover: #0A5353;
  --accent2: #E0704F;
  --accent-soft: #DDEEEB;
  --warm-soft: #FCE6DC;
  --bad: #9A3B22;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius: 20px;
  --radius-sm: 14px;
  --max: 1140px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 20px/1.6 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
  border-radius: 8px;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 12px; z-index: 60; }
.skip:focus { left: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { line-height: 1.18; letter-spacing: -.01em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.3rem, 4.6vw, 3.5rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.7rem, 2.8vw, 2.25rem); margin-top: 2.2em; }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: .5em; }
.lede { font-size: 1.3rem; line-height: 1.55; color: var(--muted); max-width: 40em; }
.muted { color: var(--muted); }
.up { color: var(--accent); }
.down { color: var(--bad); }

/* Icons (Lucide) */
.lucide { width: 1.2em; height: 1.2em; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: -0.2em; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 2px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; min-height: 84px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; margin-right: auto; line-height: 1.2; }
.brand em { font-style: normal; color: var(--accent); }
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px;
  background: var(--accent); color: #fff;
}
.brand-mark .lucide { width: 24px; height: 24px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 1.02rem; }
.nav a:hover { background: var(--accent-soft); color: var(--accent-hover); }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px; padding: 14px 26px; border-radius: 18px;
  font: inherit; font-weight: 700; font-size: 1.1rem; line-height: 1.2;
  text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.btn .lucide { width: 22px; height: 22px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--accent-soft); color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent-hover); }

/* Pills, tags and the hand-drawn underline */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--warm-soft); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 1rem; line-height: 1.2;
}
.pill .lucide { width: 18px; height: 18px; color: var(--accent2); }
.pill.teal { background: var(--accent-soft); }
.pill.teal .lucide { color: var(--accent); }
.underline { position: relative; display: inline; white-space: normal; }
.underline svg {
  position: absolute; left: -2%; bottom: -0.2em; width: 104%; height: 0.42em; overflow: visible;
}
.underline svg path { fill: none; stroke: var(--accent2); stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* Hero */
.hero { padding: 68px 0 48px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.hero h1 { margin-top: 20px; }
.hero-actions .btn { min-width: 0; }

/* Placeholder art: X-marked frame with a loud label */
.ph {
  position: relative; overflow: hidden; min-height: 320px;
  background: var(--surface); border: 2px dashed var(--accent); border-radius: var(--radius-xl);
}
.ph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph svg line { stroke: var(--accent); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .3; }
.ph-label {
  position: absolute; left: 18px; right: 18px; bottom: 18px;
  background: #FFE14D; color: #14161A; font-weight: 700; font-size: 1rem; line-height: 1.3;
  padding: 12px 16px; border-radius: 16px; text-align: center;
}

/* Sections and cards */
.section { margin-top: 64px; }
.section-lede { color: var(--muted); font-size: 1.2rem; max-width: 42em; margin-bottom: 26px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px;
}
.card h3 { margin-top: 0; }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover { transform: translateY(-3px); border-color: var(--accent); color: inherit; }
.card-link:hover h3 { color: var(--accent); }
.icon-badge {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.icon-badge .lucide { width: 30px; height: 30px; }
.icon-badge.warm { background: var(--warm-soft); color: var(--accent2); }
.icon-badge.warm .lucide { color: #B4502F; }

/* Stat cards */
.stat .label { color: var(--muted); font-size: 1.05rem; margin: 0 0 4px; font-weight: 700; }
.stat .num {
  font-size: 4.2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.02;
  color: var(--ink); margin: 0; font-variant-numeric: tabular-nums;
}
.delta {
  display: inline-block; margin-top: 14px; font-size: 1rem; font-weight: 700;
  color: var(--accent-hover); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px;
}
.delta.down { color: var(--bad); background: var(--warm-soft); }

/* Numbered steps */
.step-num {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 16px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 1.2rem; margin-bottom: 16px;
}

/* Breadcrumbs and meta */
.crumbs { font-size: 1rem; color: var(--muted); margin: 34px 0 16px; }
.crumbs a { color: var(--muted); }
.meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.meta .pill { font-size: .95rem; }

/* Article layout with table of contents */
.article-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; padding-bottom: 40px; align-items: start; }
.toc {
  position: sticky; top: 112px; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px 18px; font-size: 1.02rem;
}
.toc h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; padding: 0 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0 0 4px; }
.toc a { display: block; padding: 9px 12px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 700; line-height: 1.3; }
.toc a:hover { background: var(--accent-soft); }
.toc a.active { background: var(--accent); color: #fff; }
.prose { max-width: 68ch; }
.prose h2 { scroll-margin-top: 110px; }
.progress { position: fixed; top: 0; left: 0; height: 6px; width: 0; background: var(--accent2); z-index: 30; }

/* Callouts */
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 22px 24px; margin: 26px 0; }
.callout.warn { background: var(--warm-soft); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout strong { color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin: 22px 0; }
table { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
th, td { padding: 16px 18px; text-align: left; border-bottom: 2px solid var(--line); vertical-align: top; }
th { background: var(--accent-soft); font-weight: 700; font-size: 1rem; color: var(--ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td a { font-weight: 700; }

/* Status pills used on the Sources page */
.status { display: inline-block; font-size: .95rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: normal; }
.status.ok { background: var(--accent-soft); color: var(--accent-hover); }
.status.check { background: var(--warm-soft); color: #7A2E18; }

/* FAQ accordions */
details {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 14px;
}
details[open] { border-color: var(--accent); }
summary { cursor: pointer; font-weight: 700; font-size: 1.15rem; list-style: none; position: relative; padding-right: 40px; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+"; position: absolute; right: 0; top: -4px; width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hover); font-size: 1.4rem; line-height: 1;
}
details[open] summary::after { content: "\2013"; background: var(--accent); color: #fff; }
details p { margin: 14px 0 0; color: var(--muted); }

/* Calculator */
.calc-card { padding: 34px; }
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.field > label, .field .label-text { display: block; font-weight: 700; font-size: 1.25rem; margin-bottom: 8px; }
.hint { font-size: 1.05rem; color: var(--muted); margin: 0 0 16px; }
.money-input {
  display: flex; align-items: center; max-width: 380px; height: 76px;
  border: 2px solid var(--ink); border-radius: 22px; background: var(--surface); padding: 0 20px;
}
.money-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.money-input span { font-size: 1.8rem; color: var(--muted); margin-right: 8px; font-weight: 700; }
.money-input input {
  border: 0; outline: 0; background: transparent; width: 100%;
  font: inherit; font-size: 2rem; font-weight: 700; color: var(--ink);
}
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.chip {
  min-height: 52px; border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 10px 20px; font: inherit; font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.check {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 26px; font-weight: 700; font-size: 1.1rem; cursor: pointer; line-height: 1.4;
}
.check input { width: 26px; height: 26px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.results { background: var(--accent-soft); border-radius: var(--radius-lg); padding: 28px; }
.results .kicker-label { color: var(--muted); font-weight: 700; margin: 0; font-size: 1.05rem; }
.big-net { font-size: 4.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin: 8px 0 10px; font-variant-numeric: tabular-nums; color: var(--ink); }
.result-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 2px solid #B6D2CC; font-size: 1.05rem; }
.result-row:last-of-type { border-bottom: 0; }
.result-row .val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bars { margin-top: 20px; }
.bar-row { margin: 14px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 1.05rem; margin-bottom: 8px; gap: 12px; font-weight: 700; }
.bar-track { height: 18px; background: #FFFFFF; border-radius: 999px; overflow: hidden; border: 2px solid #B6D2CC; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .35s ease; }
.bar-fill.pos { background: var(--accent); }
.bar-fill.neg { background: var(--accent2); }
.verdict {
  margin: 20px 0 0; padding: 18px 20px; border-radius: var(--radius); background: var(--surface);
  font-size: 1.12rem; line-height: 1.5;
}

/* History chart */
.seg { display: inline-flex; background: var(--accent-soft); border-radius: 999px; padding: 6px; gap: 6px; flex-wrap: wrap; }
.seg button {
  min-height: 52px; border: 0; background: transparent; color: var(--ink); padding: 10px 20px;
  border-radius: 999px; font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chart {
  display: flex; align-items: stretch; gap: 12px; height: 320px;
  padding: 10px 6px 0; margin-top: 26px; border-bottom: 2px solid var(--ink);
}
.chart .col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.chart .val { font-size: 1rem; font-weight: 700; margin-bottom: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart .track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart .bar { width: 100%; max-width: 70px; background: var(--accent); border-radius: 16px 16px 6px 6px; transition: height .4s ease; }
.chart .col:last-child .bar { background: var(--accent2); }
.chart .yr { font-size: 1.05rem; font-weight: 700; color: var(--muted); margin: 10px 0 12px; }
.chart .col:hover .bar { filter: brightness(1.08); }

/* Feature cards: takeaways */
.takeaway { display: grid; gap: 6px; }
.takeaway .big-word { font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }

/* Next-step cards */
.next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 52px; }
.next .card h3 { margin-bottom: .3em; }
.next .card p { margin: 0; }

/* Footer */
.site-footer { background: var(--surface); border-top: 2px solid var(--line); margin-top: 80px; padding: 48px 0 40px; color: var(--muted); font-size: 1.05rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; }
.foot-h { font-weight: 700; color: var(--ink); margin: 0 0 10px; font-size: 1.1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: var(--ink); font-weight: 700; }
.disclaimer { font-size: 1rem; margin: 10px 0 0; }
.fine-print { margin-top: 30px; font-size: 1rem; }

/* Prose pages (about, sources, privacy, contact) */
.page-narrow { max-width: 760px; }

/* Small screens */
@media (max-width: 1020px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .ph { min-height: 260px; }
}

@media (max-width: 900px) {
  body { font-size: 19px; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .article-layout > *, .prose, .next > * { min-width: 0; }
  .toc { position: static; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .next { grid-template-columns: minmax(0, 1fr); }
  .calc { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .header-inner { flex-wrap: wrap; padding: 14px 0; gap: 12px; }
  .brand { margin-right: 0; width: 100%; }
  .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .nav a { white-space: nowrap; }
  .hero { padding: 40px 0 28px; }
  .chart { height: 260px; gap: 6px; }
  .chart .val { font-size: .85rem; }
  .stat .num { font-size: 3.4rem; }
  .big-net { font-size: 3.4rem; }
  .calc-card { padding: 22px; }
  .results { padding: 22px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  h1 { font-size: 2.2rem; }
  .btn { width: 100%; }
  .hero-actions .btn { width: 100%; }
  .card { padding: 22px; }
  .stat .num { font-size: 3rem; }
  .big-net { font-size: 2.8rem; }
  .chart { height: 220px; }
  .chart .yr { font-size: .9rem; }
}

/* Ads: banner slots, in-page slots, sticky anchor bar, interstitial.
   Each .ad-box is a placeholder that keeps its final size so nothing shifts
   when a real ad loads. Replace the .ad-tag inside it with the ad unit. */
.ad-slot { margin: 30px auto; max-width: var(--max); padding: 0 24px; }
.ad-slot.in-article { max-width: none; padding: 0; margin: 34px 0; }
.ad-label {
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}
.ad-box {
  position: relative; display: grid; place-items: center; overflow: hidden;
  max-width: 100%; margin: 0 auto; padding: 10px;
  background: var(--surface); border: 2px dashed var(--accent); border-radius: 18px;
}
.ad-slot:not(.in-article) .ad-label { max-width: 728px; margin: 0 auto 8px; }
.ad-tag {
  background: #FFE14D; color: #14161A; font-weight: 700; font-size: .92rem; line-height: 1.3;
  padding: 8px 12px; border-radius: 12px; text-align: center; max-width: 100%;
}
.ad-slot[data-size="728x90"] .ad-box { width: 728px; min-height: 90px; }
.ad-slot[data-size="300x250"] .ad-box { width: 300px; min-height: 250px; }
.ad-slot[data-size="responsive"] .ad-box { width: 100%; min-height: 250px; }
@media (max-width: 900px) {
  .ad-slot[data-size="728x90"] .ad-box { width: 100%; min-height: 100px; }
}

/* Guide rail: a sticky 300x600 column, shown only on wide screens */
.ad-rail { display: none; }
@media (min-width: 1240px) {
  .article-layout.with-rail { grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 40px; }
  .ad-rail { display: block; position: sticky; top: 112px; }
  .ad-rail .ad-box { width: 300px; min-height: 600px; }
}

/* Anchor bar: phones only, pinned to the bottom, dismissible */
.anchor-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--surface); border-top: 2px solid var(--line);
}
.anchor-bar .ad-box { flex: 1; min-width: 0; min-height: 50px; padding: 4px; border-radius: 12px; }
.anchor-close {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  display: grid; place-items: center;
}
.anchor-close .lucide { width: 20px; height: 20px; }
.anchor-bar[hidden] { display: none !important; }
@media (max-width: 900px) {
  .anchor-bar { display: flex; }
  body.has-anchor { padding-bottom: 84px; }
}

/* Interstitial: full-screen, shown between content pages, always closable */
.interstitial {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px;
  background: rgba(15, 46, 54, .8);
}
.interstitial[hidden] { display: none !important; }
.interstitial-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 28px;
  padding: 26px; text-align: center;
}
.interstitial-card .ad-label { margin-bottom: 12px; }
.interstitial-card .ad-box { width: 300px; max-width: 100%; min-height: 250px; margin: 0 auto 18px; }
.interstitial-card .btn { width: 100%; }

/* Generated illustrations (Grok Imagine), used in place of the placeholders */
.hero-art, .banner-art { margin: 0; }
.hero-art img, .banner-art img {
  display: block; width: 100%; height: auto;
  border: 2px solid var(--line); border-radius: var(--radius-xl);
}
.banner-art img { max-height: 320px; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
