/* IRMAA Check theme on Pico CSS v2.1.1.
   Part 1 sets Pico's own variables (type size, colors, focus, spacing).
   Part 2 is the small set of rules Pico has no component for: the result box, notes,
   the answer sheet, screen-reader text and print. No animations anywhere. */

/* ---------- 1. Pico variables ---------- */
:root {
  --pico-font-size: 112.5%;            /* 18px on phones */
  --pico-line-height: 1.6;
  --pico-border-radius: 0.375rem;
  --pico-outline-width: 3px;
  --pico-spacing: 1.25rem;
  --pico-typography-spacing-vertical: 1.25rem;
  --pico-form-element-spacing-vertical: 0.8rem;
  --pico-form-element-spacing-horizontal: 1rem;
  --pico-transition: 0s;
  --tl-visited: #5b3a8a;
}
@media (min-width: 1024px) {
  :root { --pico-font-size: 118.75%; } /* 19px on larger screens */
}

/* Light (default) */
:root:not([data-theme=dark]),
[data-theme=light] {
  --pico-background-color: #ffffff;
  --pico-color: #1a1d23;
  --pico-h1-color: #111418;
  --pico-h2-color: #111418;
  --pico-h3-color: #1a1d23;
  --pico-h4-color: #1a1d23;
  --pico-muted-color: #474e5b;
  --pico-muted-border-color: #cfd4db;
  --pico-primary: #1d4f91;
  --pico-primary-background: #1d4f91;
  --pico-primary-border: #1d4f91;
  --pico-primary-underline: #1d4f91;
  --pico-primary-hover: #153a6b;
  --pico-primary-hover-background: #153a6b;
  --pico-primary-hover-border: #153a6b;
  --pico-primary-hover-underline: #153a6b;
  --pico-primary-focus: #1d4f91;
  --pico-primary-inverse: #ffffff;
  --pico-secondary: #3d4452;
  --pico-secondary-background: #3d4452;
  --pico-secondary-border: #3d4452;
  --pico-secondary-hover-background: #262b34;
  --pico-secondary-hover-border: #262b34;
  --pico-secondary-focus: #3d4452;
  --pico-secondary-inverse: #ffffff;
  --pico-form-element-background-color: #ffffff;
  --pico-form-element-border-color: #6b7280;
  --pico-form-element-focus-color: #1d4f91;
  --pico-card-background-color: #ffffff;
  --pico-card-sectioning-background-color: #eef3fa;
  --pico-table-border-color: #c3c9d1;
  --pico-del-color: #a1261b;
  --tl-soft: #eef3fa;
  --tl-note: #fdf6e7;
  --tl-note-border: #8a5a00;
  --tl-visited: #5b3a8a;
}

/* Dark: follows the device setting */
@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --pico-background-color: #121417;
    --pico-color: #e9ebee;
    --pico-h1-color: #f5f6f8;
    --pico-h2-color: #f5f6f8;
    --pico-h3-color: #e9ebee;
    --pico-h4-color: #e9ebee;
    --pico-muted-color: #c0c6cf;
    --pico-muted-border-color: #3a404a;
    --pico-primary: #9cc3f5;
    --pico-primary-background: #9cc3f5;
    --pico-primary-border: #9cc3f5;
    --pico-primary-underline: #9cc3f5;
    --pico-primary-hover: #c2dafa;
    --pico-primary-hover-background: #c2dafa;
    --pico-primary-hover-border: #c2dafa;
    --pico-primary-hover-underline: #c2dafa;
    --pico-primary-focus: #9cc3f5;
    --pico-primary-inverse: #0d1a2c;
    --pico-secondary: #c0c6cf;
    --pico-secondary-background: #3d4452;
    --pico-secondary-border: #8b93a1;
    --pico-secondary-hover-background: #4b5363;
    --pico-secondary-focus: #c0c6cf;
    --pico-secondary-inverse: #ffffff;
    --pico-form-element-background-color: #1b1e23;
    --pico-form-element-border-color: #8b93a1;
    --pico-form-element-focus-color: #9cc3f5;
    --pico-card-background-color: #181b20;
    --pico-card-sectioning-background-color: #18243a;
    --pico-table-border-color: #4a515c;
    --pico-del-color: #ff9a8f;
    --tl-soft: #18243a;
    --tl-note: #2a2416;
    --tl-note-border: #e0b04a;
    --tl-visited: #c9b2ef;
  }
}

/* ---------- 2. Site components ---------- */
:focus-visible { outline: var(--pico-outline-width) solid var(--pico-primary-focus); outline-offset: 2px; }
a:not([role=button]):visited { color: var(--tl-visited); text-decoration-color: var(--tl-visited); }
a:not([role=button]) { text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--pico-background-color); padding: 0.5rem 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Header: brand + links wrap on phones instead of overflowing */
.site-header nav, .site-header nav ul { flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.4rem; text-decoration: none !important; color: var(--pico-color) !important; }
.brand svg { width: 40px; height: 40px; flex: none; }
.primary-nav a[aria-current=page] { font-weight: 700; text-decoration-thickness: 3px; }
.notice-strip { border-top: 1px solid var(--pico-muted-border-color); border-bottom: 1px solid var(--pico-muted-border-color); color: var(--pico-muted-color); font-size: 0.9rem; padding: 0.5rem 0; margin-bottom: 1rem; }
@media (max-width: 600px) { .wide-only { display: none; } }

/* Reading width */
.lead, .page > p, .page > section:not(.tool), .page > .keyfact, .page > .note, .prose { max-width: 70ch; }
.lead { font-size: 1.1rem; }
.byline, .source, .muted, .hint, .table-note { color: var(--pico-muted-color); }
.byline, .source, .table-note, .small { font-size: 0.9rem; }
.hint { font-size: 0.95rem; margin: 0.35rem 0 0.75rem; }
.error { color: var(--pico-del-color); font-weight: 600; margin: 0; }
.error:empty { display: none; }
h2 { margin-top: 2.25rem; }

/* Calculator layout: inputs left, result right; on phones inputs, result, extras */
.tool { margin: 1.5rem 0 2rem; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 0 2.5rem; align-items: start; }
.calc-grid { grid-template-areas: "basics result" "options result"; }
.calc-grid .basics { grid-area: basics; }
.calc-grid .options { grid-area: options; }
.calc-grid .result { grid-area: result; }
@media (max-width: 760px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .calc-grid { grid-template-areas: "basics" "result" "options"; }
}
label.check { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.75rem; min-height: 44px; }
label.check input { flex: none; margin-top: 0.2rem; }
#calc-go { width: 100%; margin-bottom: 1.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* Result box: bordered, large numbers */
.result, .ssa-result { border: 2px solid var(--pico-primary); border-radius: var(--pico-border-radius); padding: 1.25rem 1.25rem 0.5rem; margin-bottom: 1.5rem; background: var(--pico-card-background-color); }
.ssa-result:has(> p.muted:only-child) { border-style: dashed; }
.verdict { font-size: 1.3rem; line-height: 1.4; font-weight: 600; }
.verdict b { color: var(--pico-primary); }
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; margin: 0 0 1rem; }
.figures > div { border-top: 1px solid var(--pico-muted-border-color); padding: 0.75rem 0; }
.figures dt { font-weight: 600; font-size: 0.95rem; }
.figures dd { margin: 0.2rem 0 0; font-size: 1.6rem; font-weight: 700; line-height: 1.25; }
.figures dd.range-dd { font-size: 1.1rem; }
.figures dd small { display: block; font-size: 0.9rem; font-weight: 400; color: var(--pico-muted-color); line-height: 1.4; margin-top: 0.25rem; }
@media (max-width: 460px) { .figures { grid-template-columns: minmax(0, 1fr); } }
.headroom { padding-left: 1.2rem; }
.headroom li { margin-bottom: 0.75rem; }
.quick { display: none; border: 2px solid var(--pico-primary); border-radius: var(--pico-border-radius); padding: 0.75rem 1rem; margin: 0.25rem 0 1rem; }
@media (max-width: 760px) { .quick { display: block; } }
.stale { opacity: 0.35; }

/* Callouts */
.keyfact, .note { padding: 1rem 1.25rem; margin: 1.25rem 0; border-left: 5px solid; border-radius: var(--pico-border-radius); }
.keyfact { background: var(--tl-soft); border-color: var(--pico-primary); }
.note { background: var(--tl-note); border-color: var(--tl-note-border); }
.keyfact p:last-child, .note p:last-child { margin-bottom: 0; }

/* Tables: clear row lines, readable size, scroll sideways only when needed */
.table-wrap { overflow-x: auto; margin-bottom: 0.5rem; }
table { font-size: 1rem; }
caption { caption-side: top; text-align: left; font-weight: 700; padding-bottom: 0.5rem; }
th, td { border-bottom: 1px solid var(--pico-table-border-color); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.is-you th, tr.is-you td { background: var(--tl-soft); font-weight: 700; }
table.brackets tbody th { font-weight: 500; }

/* SSA-44 answer sheet */
.sheet { border: 2px solid var(--pico-color); border-radius: var(--pico-border-radius); padding: 1.25rem; margin: 1rem 0; }
.sheet h3 { font-size: 1.15rem; margin-top: 1.25rem; }
.sheet h3:first-child { margin-top: 0; }
.box { display: inline-block; border: 1px solid var(--pico-color); padding: 0 0.4rem; font-weight: 700; }
fieldset.q { border-top: 1px solid var(--pico-muted-border-color); padding-top: 1rem; }

/* Related links and footer */
.next-links { list-style: none; padding: 0; }
.next-links li { list-style: none; border-bottom: 1px solid var(--pico-muted-border-color); padding: 0.75rem 0; margin: 0; }
.next-links a { font-weight: 600; }
.next-links span { display: block; color: var(--pico-muted-color); }
.site-footer { border-top: 1px solid var(--pico-muted-border-color); margin-top: 2rem; padding-top: 1.5rem; }
.site-footer h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.site-footer ul { padding: 0; }
.site-footer li { list-style: none; }
.disclaimer { color: var(--pico-muted-color); font-size: 0.9rem; margin-top: 1rem; }

/* ---------- Print: black and white, answer sheet and tables only ---------- */
@media print {
  :root, :root:not([data-theme]) { --pico-background-color: #fff; --pico-color: #000; --pico-primary: #000; --pico-muted-color: #000; --pico-table-border-color: #000; --tl-soft: #fff; --tl-note: #fff; --tl-note-border: #000; }
  body { font-size: 12pt; background: #fff; color: #000; }
  .site-header, .notice-strip, nav[aria-label=breadcrumb], .site-footer, .no-print, .byline, .faq, #next-h, .next-links, .quick, .basics, .options, #ssa44, #live { display: none !important; }
  .tool-grid { display: block; }
  .result, .ssa-result, .sheet { border: 1.5pt solid #000; }
  .keyfact, .note { border-left: 4pt solid #000; background: #fff; }
  a { color: #000 !important; text-decoration: none; }
  table { font-size: 10.5pt; }
  th, td { border-bottom: 0.75pt solid #000; }
  tr.is-you th, tr.is-you td { background: #fff; font-weight: 700; }
  h2, h3, table, .sheet h3 { break-after: avoid; }
  tr, .box { break-inside: avoid; }
}

/* Labels and legends read as clear field titles */
label:not(.check), legend { font-weight: 600; }
.site-header { padding-top: 0.5rem; }
.faq { max-width: 70ch; }
.faq h3 { font-size: 1.15rem; margin: 1.5rem 0 0.4rem; }
details.how { max-width: 70ch; margin-top: 2rem; }
/* Compact header on phones so the calculator starts high on the screen */
.site-header { --pico-nav-element-spacing-vertical: 0.5rem; }
@media (max-width: 600px) {
  .site-header { --pico-nav-element-spacing-vertical: 0.2rem; --pico-nav-element-spacing-horizontal: 0.6rem; }
  .primary-nav li:first-child { display: none; }
  .notice-strip { margin-bottom: 0.5rem; }
  h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
}
fieldset > legend, .tool legend { font-weight: 700; }

/* Simple homepage calculator: one column, two inputs, one big answer */
.simple-tool { max-width: 40rem; }
.big-choice label.check { font-size: 1.1rem; padding: 0.6rem 0.75rem; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); }
.big-choice label.check input { width: 1.4rem; height: 1.4rem; }
.answer { font-size: 1.6rem; line-height: 1.35; font-weight: 600; margin-bottom: 0.75rem; }
.answer strong { color: var(--pico-primary); font-size: 1.15em; }
.answer-line { font-size: 1.1rem; margin-bottom: 0.5rem; }
details.more { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: 0.75rem 1rem; }
details.more > summary { font-weight: 700; }
@media (max-width: 600px) { .answer { font-size: 1.35rem; } }
.big-choice { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.big-choice legend { width: 100%; }
.big-choice label.check { margin: 0; flex: 1 1 auto; }
@media (max-width: 600px) {
  :root { --pico-typography-spacing-vertical: 1rem; }
  .primary-nav li:nth-child(3) { display: none; }
  .site-header { padding-top: 0.25rem; }
  .simple-tool { margin-top: 0.75rem; }
  .simple-tool .hint { margin-bottom: 0.5rem; }
  #calc-go { margin-bottom: 1rem; }
}
.big-choice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 0.6rem; }
.big-choice legend { grid-column: 1 / -1; }
.simple-tool #magi { margin-bottom: 0.4rem; }
@media (max-width: 600px) {
  .simple-tool #calc { display: flex; flex-direction: column; }
  .simple-tool #result { order: 1; }
  .simple-tool #calc-go { order: 2; }
  .simple-tool details.more { order: 3; }
}
@media (max-width: 600px) { h1 { font-size: 1.45rem; } .notice-strip { padding: 0.3rem 0; } }
/* SSA-44 wizard: one column, big answer choices */
.wizard { max-width: 42rem; }
.wizard fieldset { margin-bottom: 1.75rem; }
.big-list label.check { font-size: 1.05rem; padding: 0.6rem 0.75rem; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); margin-bottom: 0.5rem; }
.big-list label.check input { width: 1.4rem; height: 1.4rem; }
.big-list label.check, .big-choice label.check { width: 100%; }
