/* Social Security claiming-age calculator. Loaded after site.css (same paper / ink palette, Inter); not with calc.css
   (the 401(k) calculator's). Only these two pages load it, so, like calc.css, its class names are not scoped; the shared
   header and footer use none of them. No inline styles: the page is served under style-src 'self'.
   The three claiming ages have their own colours, validated as a set on the light chart surface (all pairs). */
.ss-page {
  --surface: #fbf8f2; --grid: #e7e0d3;
  --c62: #d0582a; --c67: #2a78d6; --c70: #1b8f68;
  --accent: #1c5cab; --bar: #a9b8c8;
  --heat0: #efeae0; --heat1: #cde2fb; --heat2: #9ec5f4; --heat3: #6da7ec; --heat4: #1c5cab;
  --warn-bg: #fbe9dc; --warn-ink: #7a3410;
}
.ss-page [hidden] { display: none !important; }
.ss-page .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ss-page .hero { padding-bottom: 1.2rem; }

.basics { margin-top: 0.4rem; }
.basics-grid { display: grid; gap: 0.8rem 1.6rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin: 0.4rem 0 0.4rem; }
.basic { border-left: 4px solid var(--rule); padding: 0.1rem 0 0.1rem 0.9rem; }
.basic.b62 { border-left-color: var(--c62); }
.basic.b67 { border-left-color: var(--c67); }
.basic.b70 { border-left-color: var(--c70); }
.basic h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.basic p { margin: 0; color: var(--ink-soft); font-size: 0.93rem; }
.boot { margin: 1.6rem 0 0; padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper-deep);
  color: var(--ink-soft); font-size: 0.92rem; }

/* ---- layout: the form and the results; on wide screens two panes a window high that scroll on their own (as the
   401(k) calculator), so the results stay in view while the form is filled in */
.calc { display: grid; gap: clamp(1.4rem, 3vw, 2.6rem); grid-template-columns: minmax(0, 1fr); margin-top: 2rem; }
@media (min-width: 62rem) {
  .calc { grid-template-columns: minmax(0, 22.5rem) minmax(0, 1fr); height: calc(100vh - 1.5rem); align-items: stretch; }
  .calc-form, .calc-results { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .calc-results { padding: 0 0.7rem 1.5rem 0; }
}

/* ---- form */
.calc-form { background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 14px; padding: 1.3rem 1.3rem 1.2rem; }
.calc-form h2 { margin-bottom: 1rem; }
.calc-form fieldset { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
.calc-form legend { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.35rem; padding: 0; }
.calc-form .field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.3rem; margin-bottom: 1rem; min-width: 0; }
/* (a bare grid column is as wide as its widest content: WebKit made the amount + age-column row wider than a phone) */
.calc-form label { font-weight: 700; font-size: 0.95rem; }
.calc-form .hint { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.5; font-weight: 400; }
.calc-form .hint.why { margin-top: 0.15rem; }
.calc-form > .hint { margin: -0.6rem 0 0.8rem; }
.calc-form input[type=number], .calc-form select { font: inherit; font-variant-numeric: tabular-nums; width: 100%; min-width: 0;
  padding: 0.5rem 0.65rem; border: 1px solid #cfc5b2; border-radius: 8px; background: var(--surface); color: var(--ink); }
.calc-form select { padding-right: 0.4rem; }
.calc-form input[type=number]:hover, .calc-form select:hover { border-color: var(--ink-soft); }
.calc-form :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.calc-form .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.calc-form .by-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; }
.calc-form .by-row input { flex: 0 1 8.5rem; }
.calc-form .by-row .derived { font-weight: 700; color: var(--ink-soft); }
.calc-form .trio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr); gap: 0.6rem; }
.calc-form .trio label { font-size: 0.85rem; }
.money-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; min-width: 0; }
.money-row .prefix { color: var(--muted); font-weight: 700; }
.money-row input { flex: 1 1 6rem; }
.money-row select { flex: 1 1 100%; }   /* its own line: WebKit lets a select's text spill past a narrow box,
   and the English labels are long */
.derived { display: block; font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.calc-form .warn, .calc-results .status { padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink);
  border: 1px solid #efc6a8; font-size: 0.88rem; }
.calc-form > .warn { margin: -0.4rem 0 0.9rem; }
.calc-form .radios { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; }
.calc-form .radios label { font-weight: 400; display: inline-flex; gap: 0.45rem; align-items: center; cursor: pointer; }
.calc-form .radios.stack { flex-direction: column; gap: 0.55rem; }
.calc-form .radios.stack label { align-items: flex-start; }
.calc-form .radios.stack input { margin-top: 0.35rem; }
.calc-form .radios.stack b { font-weight: 700; font-size: 0.93rem; }
.calc-form input[type=radio], .calc-form input[type=checkbox] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; }
.calc-form .sub { border-left: 3px solid var(--rule); padding: 0.2rem 0 0.1rem 0.9rem; margin: 0 0 1rem; }
.calc-form .toggle { border-top: 1px solid var(--rule); padding-top: 0.85rem; margin-top: 0.2rem; }
.calc-form .toggle .check { display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; margin-bottom: 0.7rem; }
.calc-form .toggle .check input { margin-top: 0.3rem; }
.rate-row { display: grid; grid-template-columns: minmax(0, 1fr) 5.2rem auto; gap: 0.6rem; align-items: center; }
.rate-row input[type=range] { width: 100%; accent-color: var(--accent); }
.rate-row .unit { color: var(--muted); font-weight: 700; }
.quick { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.15rem 0 0.2rem; }
.quick button, .seg button { font: inherit; font-size: 0.82rem; border: 1px solid #cfc5b2; background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 0.18rem 0.7rem; cursor: pointer; }
.quick button:hover, .seg button:hover { border-color: var(--ink-soft); }
.quick button:active, .seg button:active { transform: translateY(1px); }
.link-note { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 0.85rem; margin: 0.3rem 0 0.7rem; }
.calc-form .reset { font: inherit; font-size: 0.9rem; background: none; border: 1px solid var(--ink-soft); color: var(--ink);
  border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; }
.calc-form .reset:hover { background: var(--surface); }

/* ---- results */
.calc-results { min-width: 0; }
.calc-results h2 { margin-bottom: 0.8rem; }
.calc-results.empty .cards, .calc-results.empty .block { display: none; }
.calc-results .status { margin: 0 0 1rem; max-width: var(--measure); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 0.9rem; }   /* 3 across at 1280 px */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 0.95rem 1.1rem 1rem; }
.card.best { border-top: 4px solid var(--accent); padding-top: calc(0.95rem - 3px); }
.card .label { display: block; font-weight: 700; font-size: 0.86rem; color: var(--ink-soft); }
.card .value { display: block; font-size: clamp(1.3rem, 0.95rem + 0.8vw, 1.7rem); font-weight: 700; line-height: 1.2; margin: 0.25rem 0 0.3rem;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; text-wrap: balance; word-break: keep-all; }   /* break at spaces: 配偶 stays whole */
.card .note { display: block; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.verdict { font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); font-weight: 700; line-height: 1.5; margin: 1.2rem 0 0.2rem; max-width: var(--measure); }

.block { margin-top: 2.3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.block h3 { font-size: 1.12rem; margin-bottom: 0.5rem; }
.sub-note, .note-line { color: var(--ink-soft); font-size: 0.93rem; max-width: var(--measure); margin: 0.2rem 0 0.6rem; }
.note-line { margin: 0.5rem 0; }
.note-line.insurance { border-left: 3px solid var(--accent); padding-left: 0.8rem; }

/* tables: undo site.css's defaults for wide data tables (min-width, pinned row heads, uppercase heads, a ruled top) */
.ss-page .table-wrap { overflow-x: auto; margin-top: 0.8rem; border-top: 0; }
.ss-page table.data { border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; min-width: 0; width: 100%; max-width: 46rem; }
.ss-page table.data caption { text-align: left; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.35rem; }
.ss-page table.data th, .ss-page table.data td { padding: 0.42rem 0.7rem 0.42rem 0; border-top: 1px solid var(--rule); border-bottom: 0;
  text-align: right; white-space: nowrap; vertical-align: baseline; }
.ss-page table.data thead th { border-top: 0; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.ss-page table.data th:first-child, .ss-page table.data td.what, .ss-page table.data thead th.what { text-align: left; }
.ss-page table.data tbody th { font-weight: 400; position: static; background: none; box-shadow: none; padding-left: 0; }
.ss-page table.data td.what { color: var(--ink-soft); white-space: normal; min-width: 9rem; }
.ss-page table.data tr.past th, .ss-page table.data tr.past td { color: #9a9387; }
.ss-page table.data td.max { font-weight: 700; }
.ss-page tbody tr:hover, .ss-page tbody tr:hover th { background: none; }
.with-swatch { display: inline-flex; align-items: center; gap: 0.45rem; }
span.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; background: var(--bar); flex: none; }
span.swatch.s62 { background: var(--c62); }
span.swatch.s67 { background: var(--c67); }
span.swatch.s70 { background: var(--c70); }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; padding: 0; margin: 0.6rem 0 0.2rem; font-size: 0.86rem; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend .swatch { width: 1.1rem; height: 0.22rem; border-radius: 2px; }
.charts-2 { display: grid; gap: 0.6rem 1.4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 88rem) { .charts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 40rem) and (max-width: 61.99rem) { .charts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chart-fig { margin: 0; min-width: 0; }
.chart-fig figcaption { font-size: 0.86rem; font-weight: 700; color: var(--ink-soft); margin: 0.6rem 0 0.1rem; }
.chart { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 0.3rem 0.2rem 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* SVG marks */
.chart svg text { font-family: var(--font); }
.axis .gridline { stroke: var(--grid); stroke-width: 1; }
.axis .baseline { stroke: #b9b0a2; stroke-width: 1; }
.tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s62 { stroke: var(--c62); }
.line.s67 { stroke: var(--c67); }
.line.s70 { stroke: var(--c70); }
circle.mark { stroke: var(--surface); stroke-width: 2; fill: var(--ink); }
circle.mark.main { stroke-width: 2.5; }
circle.mark.s62, rect.swatch.s62 { fill: var(--c62); }
circle.mark.s67, rect.swatch.s67 { fill: var(--c67); }
circle.mark.s70, rect.swatch.s70 { fill: var(--c70); }
.end-label { font-size: 12px; font-weight: 700; fill: var(--ink-soft); }
.mark-label { font-size: 12.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.hit { fill: transparent; cursor: crosshair; }
.crosshair { stroke: var(--ink-soft); stroke-width: 1; }
.tip-bg { fill: #fffdf8; stroke: var(--rule); stroke-width: 1; filter: drop-shadow(0 2px 6px rgba(40, 30, 10, 0.14)); }
.tip-title { font-size: 12px; font-weight: 700; fill: var(--ink); }
.tip-row { font-size: 12px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.col .bar { fill: var(--bar); }
.col.best .bar { fill: var(--accent); }
.col .hit { cursor: default; }
.col:hover .bar { fill: #8ea2b8; }
.col.best:hover .bar { fill: #174d90; }
.bar-top { font-size: 11px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.col.best .bar-top { font-weight: 700; fill: var(--ink); }
.bar-label { font-size: 12.5px; fill: var(--ink); font-weight: 700; }
.bar-sub { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.col.best .bar-sub { fill: var(--accent); font-weight: 700; }
.col.past .bar-label, .col.past .bar-sub { fill: #a49d91; font-weight: 400; }
svg.narrow .bar-sub { font-size: 9.5px; }
svg.narrow .bar-top { font-size: 10px; }

/* couple grid */
.seg { display: inline-flex; gap: 0.35rem; margin: 0.3rem 0 0.2rem; }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ss-page table.grid { border-collapse: separate; border-spacing: 2px; font-variant-numeric: tabular-nums; font-size: 0.92rem; min-width: 0; width: auto; }
.ss-page table.grid caption { text-align: left; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.35rem; white-space: nowrap; }
.ss-page table.grid th { font-size: 0.8rem; color: var(--muted); font-weight: 700; padding: 0.3rem 0.5rem; white-space: nowrap; border: 0;
  text-transform: none; letter-spacing: 0; position: static; background: none; box-shadow: none; }
.ss-page table.grid tbody th { text-align: right; }
.ss-page table.grid td { min-width: 4.2rem; padding: 0.5rem 0.6rem; text-align: right; border-radius: 6px; color: var(--ink); border: 0; }
.ss-page table.grid.wide td { min-width: 3.1rem; padding: 0.38rem 0.35rem; font-size: 0.8rem; }
.ss-page table.grid.wide th { padding: 0.25rem 0.3rem; font-size: 0.74rem; }
.h0 { background: var(--heat0); }
.h1 { background: var(--heat1); }
.h2 { background: var(--heat2); }
.h3 { background: var(--heat3); }
.h4 { background: var(--heat4); color: #fff; }
.ss-page table.grid td.h4 { color: #fff; }
.ss-page table.grid td.best { font-weight: 700; box-shadow: inset 0 0 0 2px var(--ink); }
.heat-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; padding: 0; margin: 0.5rem 0 0.4rem; font-size: 0.8rem; color: var(--muted); }
.heat-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.chip { display: inline-block; width: 0.95rem; height: 0.95rem; border-radius: 4px; }
.chip.best { box-shadow: inset 0 0 0 2px var(--ink); }

/* ---- notes */
.calc-notes { margin-top: var(--space-section); max-width: 52rem; }
.calc-notes h2 { margin-top: 2.2rem; }
.calc-notes h2:first-child { margin-top: 0; }
.calc-notes ul { padding-left: 1.2rem; }
.calc-notes li { margin: 0.4rem 0; font-size: 0.94rem; }
.calc-notes .sources a { color: var(--accent); }
.ss-disclaimer { font-weight: 700; margin-top: 1.6rem; }

@media (max-width: 30rem) {
  .calc-form { padding: 1rem 0.9rem; }
  .rate-row { grid-template-columns: minmax(0, 1fr) 4.6rem auto; }
  .calc-form .trio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calc-form .trio .field:last-child { grid-column: 1 / -1; }
  .ss-page table.data { font-size: 0.85rem; }
  .ss-page table.data th, .ss-page table.data td { padding-right: 0.5rem; }
  .ss-page table.grid.wide { border-spacing: 1px; }
  .ss-page table.grid.wide td { min-width: 0; padding: 0.32rem 0.16rem; font-size: 0.7rem; border-radius: 4px; }
  .ss-page table.grid.wide th { padding: 0.2rem 0.12rem; font-size: 0.64rem; }
  .ss-page table.grid caption { white-space: normal; }
}
