/* Thresholds. Limestone, a painted door, and the light through its fanlight. */

@font-face { font-family: Alegreya; font-weight: 400; font-display: swap; src: url(/fonts/alegreya-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Alegreya; font-weight: 500; font-display: swap; src: url(/fonts/alegreya-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 400; font-display: swap; src: url(/fonts/alegreya-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 500; font-display: swap; src: url(/fonts/alegreya-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 700; font-display: swap; src: url(/fonts/alegreya-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --limestone: #e9ebe4;
  --limestone-deep: #d2d6c9;
  --limestone-edge: #b4baaa;
  --paper: #f7f8f3;
  --ink: #1f2d2d;
  --ink-soft: #4a5856;
  --door: #15383c;
  --door-deep: #0d2a2e;
  --door-line: #3a5f60;
  --on-door: #f0f2ea;
  --on-door-soft: #c1cec7;
  --glow: #e8c15f;
  --glow-pale: #a9bdb3;
  --heather: #6e3f6b;
  --link: #0f5560;
  --serif: Alegreya, Georgia, 'Times New Roman', serif;
  --sans: 'Alegreya Sans', 'Gill Sans', 'Trebuchet MS', sans-serif;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--limestone);
  color: var(--ink);
  font-weight: 400; font-size: 1.1875rem; line-height: 1.5; font-family: var(--sans);
  font-variant-numeric: lining-nums;
}
input, select, button, output { font-variant-numeric: lining-nums; }
[hidden] { display: none !important; }

a { color: var(--link); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--heather); outline-offset: 2px; border-radius: 2px; }
.door :focus-visible { outline-color: var(--glow); }
.step :focus-visible { outline-color: var(--heather); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.3rem, 1.8rem + 2vw, 3.1rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 1.45rem + 1vw, 2.2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0; }

.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 0.5rem 1rem; }
.skip:focus { left: var(--gutter); z-index: 5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: 100%; max-width: 76rem; margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 640px) { :root { --gutter: 32px; } }

/* Header */
.site-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 2rem; padding-block: 1.1rem; }
.mark { display: inline-flex; align-items: flex-end; gap: 0.55rem; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1.5rem; line-height: 1; font-family: var(--serif); }
.mark svg { width: 1.9rem; height: 0.95rem; margin-bottom: 0.2rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.1rem 1.15rem; font-size: 1.0625rem; }
.site-nav a { color: var(--ink); text-decoration: none; padding-block: 0.35rem; }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; text-underline-offset: 0.3em; }

/* Calculator layout */
.calc { display: grid; gap: 2.5rem; padding-block: 1rem 3.5rem; }
.intro h1 { margin-bottom: 0.9rem; }
.intro p { font-size: 1.3125rem; line-height: 1.4; }
.intro p + p { margin-top: 0.7rem; font-size: 1.125rem; color: var(--ink-soft); }
.form-col { display: grid; gap: 1.6rem; align-content: start; min-width: 0; }
@media (min-width: 980px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 29rem); gap: 4.5rem; align-items: start; padding-top: 1.75rem; }
}

/* Fields */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fields { display: grid; gap: 1.6rem; }
legend, .label { display: block; padding: 0; font-weight: 700; font-size: 1.125rem; margin-bottom: 0.4rem; }
.hint { color: var(--ink-soft); font-size: 1.0625rem; line-height: 1.35; margin-top: 0.4rem; }
.hint:empty { display: none; }
.error { color: var(--heather); font-weight: 500; font-size: 1.0625rem; margin-top: 0.4rem; }
.error a { color: inherit; }

.groups { display: grid; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); overflow: hidden; }
.group-row { position: relative; display: grid; grid-template-columns: 2.1rem 1fr auto; gap: 0.1rem 0.6rem; align-items: baseline; padding: 0.7rem 0.9rem; cursor: pointer; }
.group-row + .group-row { border-top: 1px solid var(--limestone-edge); }
.group-row input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.group-row .letter { font-weight: 500; font-size: 1.6rem; line-height: 1; font-family: var(--serif); }
.group-row .who { font-size: 1.0625rem; line-height: 1.25; }
.group-row .amount { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; line-height: 1.2; white-space: nowrap; }
.group-row:has(input:checked) { background: var(--door); color: var(--on-door); }
.group-row:has(input:checked) .letter { color: var(--glow); }
.group-row:has(input:focus-visible) { outline: 3px solid var(--heather); outline-offset: -3px; }

.helper { margin-top: 0.8rem; }
.after-pair { margin-top: 0.7rem; }
select, input[type="text"], input[type="date"] {
  width: 100%; min-height: 3rem; padding: 0.55rem 0.75rem;
  font-weight: 400; font-size: 1.125rem; line-height: 1.2; font-family: var(--sans); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 4px;
}
select { padding-right: 2rem; }
[aria-invalid="true"] { border-color: var(--heather); border-width: 2.5px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); overflow: hidden; }
.pair label { position: relative; text-align: center; padding: 0.65rem 0.5rem; font-weight: 500; cursor: pointer; }
.pair input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pair label:has(input:checked) { background: var(--door); color: var(--on-door); }
.pair label:has(input:focus-visible) { outline: 3px solid var(--heather); outline-offset: -3px; }

.money { position: relative; }
.money span { position: absolute; left: 0.8rem; top: 0; line-height: 3.5rem; font-weight: 500; font-size: 1.5rem; line-height: 3.5rem; font-family: var(--serif); color: var(--ink-soft); }
.money input { min-height: 3.5rem; padding-left: 2.1rem; font-weight: 500; font-size: 1.625rem; line-height: 1; font-family: var(--serif); }
.two-up { display: grid; gap: 1.6rem; }
@media (min-width: 640px) { .two-up { grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; } }

.check { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.6rem; align-items: start; font-size: 1.0625rem; line-height: 1.35; cursor: pointer; }
.check input { width: 1.3rem; height: 1.3rem; margin: 0.1rem 0 0; accent-color: var(--door); }
.check + .check, .helper .check { margin-top: 0.7rem; }

/* The door */
.door-wrap { container-type: inline-size; min-width: 0; }
.door {
  position: relative; background: var(--door); color: var(--on-door);
  border-radius: 50cqw 50cqw 0 0; padding: 12px 12px 0;
}
.fan { display: block; width: 100%; height: auto; }
.fan .glass { fill: var(--door-deep); }
.fan [data-fan="earlier"] { fill: var(--glow-pale); }
.fan [data-fan="current"] { fill: var(--glow); }
.fan .bars { fill: none; stroke: var(--door); stroke-width: 3.5; }
.fan .hub { fill: var(--door); stroke: var(--door-line); stroke-width: 2; }
.fan .frame { fill: none; stroke: var(--door-line); stroke-width: 2; }

.door-body { padding: 1.3rem 1.25rem 1.5rem; }
.door-figure { text-align: center; }
.door-figure output { display: block; font-weight: 500; font-size: clamp(2.9rem, 15cqw, 4.25rem); line-height: 1.05; font-family: var(--serif); }
.door-figure output[data-kind="tax"] { color: var(--glow); }
.door-figure p { margin-top: 0.3rem; color: var(--on-door-soft); font-size: 1.0625rem; line-height: 1.3; }

.legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 1.3rem 0 0; padding: 0; }
.legend > div { min-width: 0; }
.legend dt { display: flex; align-items: baseline; gap: 0.35rem; color: var(--on-door-soft); font-size: 1rem; line-height: 1.2; }
.legend dt i { flex: none; width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 1px solid transparent; }
.legend .k-earlier i { background: var(--glow-pale); }
.legend .k-this i { background: var(--glow); }
.legend .k-left i { background: var(--door-deep); border-color: var(--on-door-soft); }
.legend dd { margin: 0.1rem 0 0; font-weight: 500; font-size: 1.25rem; line-height: 1.2; font-family: var(--serif); overflow-wrap: anywhere; }

.working { margin: 1.3rem 0 0; padding: 0.35rem 0.9rem; border: 1px solid var(--door-line); }
.working > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.4rem 0; }
.working > div + div { border-top: 1px solid var(--door-line); }
.working dt { color: var(--on-door-soft); font-size: 1.0625rem; line-height: 1.25; }
.working dd { margin: 0; font-weight: 500; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.working .total dt, .working .total dd { color: var(--on-door); font-weight: 700; }

.door-note { margin-top: 1rem; color: var(--on-door-soft); font-size: 1rem; line-height: 1.35; }
.door-note a { color: var(--on-door); }

.step {
  margin: 0 -12px; padding: 0.95rem 1.25rem 1.05rem;
  background: var(--limestone-deep); color: var(--ink);
  border-top: 3px solid var(--limestone-edge); font-size: 1.0625rem; line-height: 1.35;
}
.step a { color: var(--ink); }
.step-over { font-weight: 500; font-size: 1.3rem; line-height: 1.2; font-family: var(--serif); color: var(--heather); margin-bottom: 0.3rem; }
.estimate-note { margin-top: 0.9rem; font-size: 1.0625rem; line-height: 1.35; color: var(--ink-soft); }

/* Keeps the answer in view on a phone while typing */
.bar { display: none; }
@media (max-width: 979px) {
  .bar {
    position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: baseline;
    padding: 0.55rem var(--gutter) calc(0.55rem + env(safe-area-inset-bottom));
    background: var(--door); color: var(--on-door); text-decoration: none; transition: transform 160ms ease-out;
  }
  .bar[data-away="false"] { transform: translateY(110%); visibility: hidden; }
  .bar strong { font-weight: 500; font-size: 1.4rem; line-height: 1.1; font-family: var(--serif); }
  .bar span { color: var(--on-door-soft); font-size: 1rem; }
  .bar:focus-visible { outline-color: var(--glow); outline-offset: -4px; }
}

/* Content sections on the home page */
.section { padding-block: 3rem; border-top: 1px solid var(--limestone-edge); }
.section-head { margin-bottom: 1.4rem; }
.section-grid { display: grid; gap: 2rem 4.5rem; }
@media (min-width: 980px) { .section-grid { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); } }

.band-table { width: 100%; border-collapse: collapse; }
.band-table caption { text-align: left; color: var(--ink-soft); font-size: 1.0625rem; padding-bottom: 0.6rem; }
.band-table th, .band-table td { padding: 0.55rem 0.8rem 0.55rem 0; text-align: left; border-bottom: 1px solid var(--limestone-edge); vertical-align: baseline; font-weight: 400; }
.band-table thead th { font-weight: 700; font-size: 1.0625rem; border-bottom: 1.5px solid var(--ink); }
.band-table td.num, .band-table th.num { font-variant-numeric: lining-nums tabular-nums; text-align: right; padding-right: 0; padding-left: 0.8rem; white-space: nowrap; }
.band-table tbody tr:first-child td, .band-table tbody tr:first-child th { font-weight: 500; }
.table-scroll { overflow-x: auto; }

.who-list { display: grid; }
.who-list a { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0.2rem 0.75rem; align-items: baseline; padding: 1rem 0; border-bottom: 1px solid var(--limestone-edge); color: var(--ink); text-decoration: none; }
.who-list a:first-child { border-top: 1.5px solid var(--ink); }
.who-list a:hover strong { text-decoration: underline; text-underline-offset: 0.15em; }
.who-list .letter { font-weight: 500; font-size: 2rem; line-height: 1; font-family: var(--serif); }
.who-list strong { display: block; font-weight: 500; line-height: 1.3; }
.who-list .amount { font-weight: 500; font-size: 1.5rem; line-height: 1.2; font-family: var(--serif); white-space: nowrap; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 0.75rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.2rem 1fr; }
.steps li::before { font-variant-numeric: lining-nums; content: counter(step); font-weight: 500; font-size: 1.5rem; line-height: 1.25; font-family: var(--serif); color: var(--link); }

.plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.55rem; }
.question-list { margin: 0; padding: 0; list-style: none; }
.question-list li { border-bottom: 1px solid var(--limestone-edge); }
.question-list li:first-child { border-top: 1.5px solid var(--ink); }
.question-list a { display: block; padding: 0.75rem 0; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1.3rem; line-height: 1.25; font-family: var(--serif); }
.question-list a:hover { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }

/* Article pages */
.article-grid { display: grid; gap: 3rem 4.5rem; padding-block: 1.5rem 4rem; }
@media (min-width: 980px) { .article-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); } }
.article { display: grid; gap: 1.05rem; align-content: start; min-width: 0; font-size: 1.25rem; line-height: 1.5; }
.article h1 { margin-bottom: 0.4rem; }
.article h2 { margin-top: 1.5rem; }
.article ul:not(.question-list), .article ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.4rem; }
.article .lead { font-size: 1.4rem; line-height: 1.4; }
.article .callout { padding: 1rem 1.1rem; background: var(--limestone-deep); border-left: 4px solid var(--door); font-size: 1.125rem; }
.article .callout p + p { margin-top: 0.5rem; }
.article .sum { width: 100%; border-collapse: collapse; font-size: 1.125rem; background: var(--paper); }
.article .sum th, .article .sum td { padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--limestone-deep); text-align: left; font-weight: 400; }
.article .sum td { text-align: right; white-space: nowrap; }
.article .sum tr:last-child th, .article .sum tr:last-child td { font-weight: 700; border-bottom: 0; }
.aside h2 { font-size: 1.35rem; margin-bottom: 0.7rem; }
.aside .question-list a { font-size: 1.125rem; padding: 0.55rem 0; }
.cta { display: inline-block; justify-self: start; margin-top: 0.5rem; padding: 0.7rem 1.15rem; background: var(--door); color: var(--on-door); border-radius: 4px; text-decoration: none; font-weight: 500; }
.cta:hover { background: var(--door-deep); }

.group-after { padding-block: 0 3rem; }

.ad-slot { margin-block: 2rem; }

/* Footer */
.site-foot { background: var(--limestone-deep); border-top: 3px solid var(--limestone-edge); padding-block: 2rem 2.5rem; font-size: 1.0625rem; line-height: 1.4; }
.foot-grid { display: grid; gap: 1.25rem 4.5rem; }
@media (min-width: 980px) { .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); } }
.foot-grid p + p { margin-top: 0.6rem; }
.site-foot a { color: var(--ink); }
.foot-links { display: grid; gap: 0.3rem; align-content: start; }
@media (max-width: 979px) { body:has(.bar) .site-foot { padding-bottom: 5rem; } }

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

@media print {
  .site-head, .site-foot, .bar, .aside { display: none; }
  body { background: #fff; }
  .door, .step { background: #fff; color: #000; border: 1px solid #000; }
  .door *, .door-note a { color: #000 !important; }
}
