/* ==========================================================================
   Calculator Platform — design system
   A "precision instrument" direction: cool paper, ink navy, one teal signal.
   System fonts only, so there is no webfont round-trip on first paint.
   ========================================================================== */

:root {
  --ink:          #0f1a2b;
  --ink-2:        #33415c;
  --muted:        #64748b;
  --paper:        #ffffff;
  --wash:         #f4f7fd;
  --wash-2:       #eef2f7;
  --rule:         #dde3ec;
  --signal:       #0d6efd;
  --signal-dark:  #0a58ca;
  --signal-wash:  #e7f0ff;
  --warn:         #a2540b;
  --warn-wash:    #fdf4e7;
  --good:         #1b7a4b;
  --danger:       #b3261e;
  --danger-wash:  #fdecea;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 1px 2px rgba(15, 26, 43, .06), 0 4px 16px rgba(15, 26, 43, .05);
  --shadow-lg: 0 2px 4px rgba(15, 26, 43, .06), 0 12px 32px rgba(15, 26, 43, .10);

  --wrap: 1120px;
  --gap:  clamp(1rem, 3vw, 1.75rem);
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
svg { display: block; }

h1, h2, h3, h4, h5 {
  color: var(--ink);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.018em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -.026em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.75rem); margin-top: 2.25rem; }
h3 { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); margin-top: 1.75rem; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--signal-dark); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: #fff; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------------ layout */

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gap); }
.wrap--narrow { max-width: 760px; }

.layout { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: start; }
@media (min-width: 1000px) {
  .layout--sidebar { grid-template-columns: minmax(0, 1fr) 300px; gap: 3rem; }
  .layout__aside { position: sticky; top: 5.25rem; }
}

.section { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section--wash { background: var(--wash); border-block: 1px solid var(--rule); }

.stack > * + * { margin-top: 1rem; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 62px;
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 700; font-size: 1.0625rem; letter-spacing: -.028em;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand__mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
}

.nav { display: none; margin-left: auto; }
.nav__list { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.nav__link {
  display: block; padding: .5rem .8rem; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; font-size: .9375rem; font-weight: 500;
}
.nav__link:hover, .nav__link[aria-current="page"] { background: var(--wash-2); color: var(--ink); }

@media (min-width: 880px) {
  .nav { display: block; }
  .nav-toggle { display: none; }
}

.nav-toggle {
  margin-left: auto; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  cursor: pointer; color: var(--ink);
}
.nav-mobile {
  display: none; border-top: 1px solid var(--rule);
  padding-block: .75rem; background: var(--paper);
}
.nav-mobile[data-open="true"] { display: block; }
.nav-mobile__list { list-style: none; margin: 0; padding: 0; }
.nav-mobile__list a {
  display: block; padding: .7rem .25rem; color: var(--ink);
  text-decoration: none; border-bottom: 1px solid var(--wash-2); font-weight: 500;
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  padding-block: clamp(2.75rem, 7vw, 5rem);
  background: var(--wash);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
/* Faint engineering-paper grid — the one decorative flourish on the page. */
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 26, 43, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 26, 43, .045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 30%, #000 30%, transparent 78%);
  pointer-events: none;
}
.hero__inner { position: relative; text-align: center; max-width: 720px; margin-inline: auto; }
.hero__lead { font-size: clamp(1rem, .95rem + .3vw, 1.1875rem); color: var(--ink-2); margin-bottom: 1.75rem; }

.eyebrow {
  display: inline-block; font-family: var(--mono);
  font-size: .6875rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--signal); background: var(--signal-wash);
  padding: .3rem .6rem; border-radius: 5px; margin-bottom: 1rem;
}

/* ------------------------------------------------------------------ search */

.searchbox { position: relative; max-width: 540px; margin-inline: auto; }
.searchbox__input {
  width: 100%; padding: .875rem 1rem .875rem 2.75rem;
  font-size: 1rem; font-family: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.searchbox__input:focus { outline: 2px solid var(--signal); outline-offset: 1px; border-color: transparent; }
.searchbox__icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.searchbox__results {
  position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + .4rem);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; text-align: left;
}
.searchbox__results:empty { display: none; }
.searchbox__result {
  display: block; padding: .65rem .9rem; color: var(--ink);
  text-decoration: none; border-bottom: 1px solid var(--wash-2); font-size: .9375rem;
}
.searchbox__result:last-child { border-bottom: 0; }
.searchbox__result:hover, .searchbox__result.is-active { background: var(--signal-wash); }
.searchbox__result span { display: block; font-size: .8125rem; color: var(--muted); }

/* ------------------------------------------------------------------ cards */

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  display: flex; flex-direction: column;
  padding: 1.15rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  text-decoration: none; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.card:hover {
  border-color: color-mix(in srgb, var(--signal) 45%, var(--rule));
  box-shadow: var(--shadow); transform: translateY(-2px);
}
.card__title { font-weight: 640; color: var(--ink); font-size: 1rem; margin-bottom: .3rem; letter-spacing: -.012em; }
.card__desc { font-size: .875rem; color: var(--muted); line-height: 1.55; margin: 0; }
.card__meta {
  margin-top: .85rem; padding-top: .7rem; border-top: 1px solid var(--wash-2);
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--signal);
}

.cat-card__icon {
  width: 38px; height: 38px; border-radius: 9px; margin-bottom: .8rem;
  display: grid; place-items: center;
  background: var(--signal-wash); color: var(--signal);
  font-size: 1.15rem; line-height: 1;
}
.cat-card__count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.15rem; min-height: 44px;
  font: inherit; font-size: .9375rem; font-weight: 600;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--signal); color: #fff; }
.btn--primary:hover { background: var(--signal-dark); color: #fff; }
.btn--ghost { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: var(--wash); color: var(--ink); }
.btn--sm { padding: .45rem .8rem; min-height: 36px; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------ calculator */

.calc {
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--paper); box-shadow: var(--shadow);
}
.calc__form { padding: 1.35rem; display: grid; gap: 1.1rem; }
@media (min-width: 620px) {
  .calc__form { grid-template-columns: 1fr 1fr; }
  .calc__field--full, .calc__actions { grid-column: 1 / -1; }
}

.field__label {
  display: block; font-size: .875rem; font-weight: 600;
  color: var(--ink); margin-bottom: .35rem;
}
.field__hint { display: block; font-weight: 400; font-size: .8125rem; color: var(--muted); margin-top: .15rem; }

.field__control { position: relative; display: flex; align-items: stretch; }
.field__input, .field__select {
  width: 100%; padding: .7rem .8rem; min-height: 46px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.field__input:focus, .field__select:focus { outline: 2px solid var(--signal); outline-offset: -1px; border-color: transparent; }
.field__input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-wash); }
.field__unit {
  display: grid; place-items: center; padding-inline: .75rem;
  background: var(--wash); border: 1px solid var(--rule); border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--mono); font-size: .8125rem; color: var(--muted); white-space: nowrap;
}
.field__control:has(.field__unit) .field__input { border-radius: var(--radius) 0 0 var(--radius); }

.field__radios { display: flex; flex-wrap: wrap; gap: .5rem; }
.field__radio {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius);
  font-size: .9375rem; cursor: pointer; background: var(--paper);
}
.field__radio:has(input:checked) {
  border-color: var(--signal); background: var(--signal-wash); color: var(--signal-dark); font-weight: 600;
}
.field__radio input { accent-color: var(--signal); }

.calc__actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.calc__actions .btn--primary { flex: 1 1 200px; }

.calc__error {
  margin: 0 1.35rem 1.35rem;
  padding: .75rem .9rem; border-radius: var(--radius);
  background: var(--danger-wash); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger); font-size: .9375rem;
}
.calc__error:empty { display: none; }

/* ---- SIGNATURE: the readout -------------------------------------- */

.readout {
  background: var(--ink);
  color: #fff;
  padding: 1.35rem;
  border-top: 1px solid var(--ink);
}
.readout__primary { margin-bottom: 1rem; }
.readout__label {
  display: block; font-family: var(--mono);
  font-size: .6875rem; letter-spacing: .13em; text-transform: uppercase;
  color: rgba(255, 255, 255, .58); margin-bottom: .3rem;
}
.readout__value {
  font-family: var(--mono);
  font-size: clamp(1.85rem, 1.2rem + 3.2vw, 2.85rem);
  font-weight: 600; line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  overflow-wrap: anywhere;
}

.readout__grid {
  display: grid; gap: .1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid rgba(255, 255, 255, .14);
  padding-top: 1rem;
}
.readout__item { padding: .35rem 0; }
.readout__item .readout__value { font-size: 1.25rem; font-weight: 550; }

/* The "tape": a hairline strip showing how the number was reached. */
.tape {
  margin-top: 1.1rem; padding-top: .85rem;
  border-top: 1px dashed rgba(255, 255, 255, .22);
  font-family: var(--mono); font-size: .75rem;
  color: rgba(255, 255, 255, .62);
}
.tape__row { display: flex; justify-content: space-between; gap: 1rem; padding: .18rem 0; }
.tape__row span:last-child { color: rgba(255, 255, 255, .9); font-variant-numeric: tabular-nums; }

.readout__note {
  margin-top: 1.1rem; padding-top: .9rem;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: .9375rem; line-height: 1.6; color: rgba(255, 255, 255, .82);
}

.calc__table-wrap { padding: 1.35rem; border-top: 1px solid var(--rule); overflow-x: auto; }

/* ------------------------------------------------------------------ content */

.prose { max-width: 72ch; }
.prose h2 { scroll-margin-top: 5rem; }
.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose blockquote {
  margin: 1.5em 0; padding: .25rem 0 .25rem 1.15rem;
  border-left: 3px solid var(--signal); color: var(--ink-2); font-style: italic;
}
.prose code {
  font-family: var(--mono); font-size: .875em;
  background: var(--wash-2); padding: .12em .4em; border-radius: 4px; color: var(--ink);
}
.prose img { border-radius: var(--radius); margin-block: 1.5em; }
.prose table { width: 100%; }

table {
  width: 100%; border-collapse: collapse;
  font-size: .9375rem; font-variant-numeric: tabular-nums;
}
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--rule); }
th {
  font-family: var(--mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: var(--wash); white-space: nowrap;
}
td:not(:first-child), th:not(:first-child) { text-align: right; }
tbody tr:hover { background: var(--wash); }

.formula {
  margin: 1.25rem 0; padding: 1.1rem 1.25rem;
  background: var(--wash); border: 1px solid var(--rule);
  border-left: 3px solid var(--signal); border-radius: var(--radius);
  font-family: var(--mono); font-size: .9375rem; color: var(--ink);
  overflow-x: auto;
}

.callout {
  margin: 1.5rem 0; padding: 1rem 1.15rem;
  background: var(--signal-wash); border: 1px solid color-mix(in srgb, var(--signal) 22%, transparent);
  border-radius: var(--radius); font-size: .9375rem;
}
.callout--warn { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout__title { font-weight: 650; color: var(--ink); margin-bottom: .25rem; }

/* Quick answer — the block answer engines are most likely to lift. */
.quick-answer {
  margin: 1.5rem 0; padding: 1.15rem 1.3rem;
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 3px solid var(--ink); border-radius: var(--radius);
}
.quick-answer__label {
  font-family: var(--mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
  display: block; margin-bottom: .4rem;
}
.quick-answer p { font-size: 1.0625rem; color: var(--ink); margin: 0; }

/* ------------------------------------------------------------------ faq */

.faq { border-top: 1px solid var(--rule); }
.faq__item { border-bottom: 1px solid var(--rule); }
.faq__q {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  width: 100%; padding: 1.05rem 0; cursor: pointer;
  font: inherit; font-size: 1.0625rem; font-weight: 600; color: var(--ink);
  text-align: left; background: none; border: 0;
}
.faq__q::after {
  content: "+"; font-family: var(--mono); font-size: 1.35rem; font-weight: 400;
  color: var(--signal); line-height: 1; flex-shrink: 0;
}
.faq__q[aria-expanded="true"]::after { content: "−"; }
.faq__a { padding: 0 0 1.15rem; color: var(--ink-2); max-width: 68ch; }
.faq__a[hidden] { display: none; }

/* ------------------------------------------------------------------ misc ui */

.breadcrumbs {
  padding-block: .9rem; font-size: .8125rem; color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: .4rem; color: var(--rule); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--signal); text-decoration: underline; }

.meta-line {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  font-size: .8125rem; color: var(--muted);
  font-family: var(--mono); letter-spacing: .01em;
}

.toc {
  padding: 1rem 1.15rem; background: var(--wash);
  border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 2rem;
}
.toc__title {
  font-family: var(--mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem;
}
.toc ol { margin: 0; padding-left: 1.1rem; font-size: .9375rem; }
.toc li { margin-bottom: .2rem; }

.pagination { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-top: 2.5rem; }
.pagination a, .pagination span {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding-inline: .6rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: var(--ink-2); font-size: .9375rem;
}
.pagination a:hover { background: var(--wash); }
.pagination [aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.author-box {
  display: flex; gap: 1rem; align-items: flex-start;
  margin-top: 2.5rem; padding: 1.25rem;
  background: var(--wash); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.author-box img { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.author-box__name { font-weight: 650; color: var(--ink); }
.author-box__bio { font-size: .9375rem; color: var(--muted); margin: .2rem 0 0; }

/* ------------------------------------------------------------------ ads */

/* Ads are always visually separated and labelled so they cannot be mistaken
   for site controls. Nothing is placed adjacent to a button. */
.ad-slot {
  display: block; margin-block: 1.75rem; padding: .5rem;
  background: var(--wash); border: 1px solid var(--rule); border-radius: var(--radius);
  text-align: center; overflow: hidden;
}
.ad-slot__label {
  display: block; margin-bottom: .35rem;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.ad-slot--footer { margin-bottom: 0; }

/* ------------------------------------------------------------------ forms */

.form { display: grid; gap: 1.1rem; max-width: 560px; }
.form__row { display: grid; gap: .35rem; }
.form textarea { min-height: 150px; resize: vertical; }
.alert { padding: .85rem 1rem; border-radius: var(--radius); font-size: .9375rem; margin-bottom: 1.25rem; }
.alert--success { background: #e9f6ef; border: 1px solid #b8e0cb; color: var(--good); }
.alert--error   { background: var(--danger-wash); border: 1px solid #f2c4c0; color: var(--danger); }
.alert--info    { background: var(--signal-wash); border: 1px solid #b7dade; color: var(--signal-dark); }

/* ------------------------------------------------------------------ footer */

.site-footer {
  margin-top: 4rem; padding-block: 3rem 1.75rem;
  background: var(--ink); color: rgba(255, 255, 255, .7); font-size: .9375rem;
}
.site-footer h2 {
  font-family: var(--mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: rgba(255, 255, 255, .5); margin: 0 0 .85rem;
}
.site-footer a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer__grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.footer__grid ul { list-style: none; margin: 0; padding: 0; }
.footer__grid li { margin-bottom: .45rem; }
.footer__about { grid-column: span 2; max-width: 320px; }
@media (max-width: 640px) { .footer__about { grid-column: span 1; } }
.footer__bottom {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between;
  font-size: .8125rem; color: rgba(255, 255, 255, .5);
}

/* ------------------------------------------------------------------ print */

@media print {
  .site-header, .site-footer, .ad-slot, .calc__actions, .breadcrumbs, .toc { display: none !important; }
  .readout { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .readout__value, .readout__label, .readout__note, .tape { color: #000 !important; }
  body { font-size: 12pt; }
}

/* ==========================================================================
   Category colour coding
   Each category carries its own accent so finance, health and maths are
   distinguishable at a glance. Applied via data-cat on cards and headers.
   ========================================================================== */

/* Fallback first, and wrapped in :where() so it carries ZERO specificity.
   Without this, the fallback would tie with [data-cat="..."] on specificity,
   win on source order, and flatten every category to the same colour. */
:where(.card, .cat-card__icon, .eyebrow, .calc) {
  --cat: var(--signal);
  --cat-wash: var(--signal-wash);
}

[data-cat="finance"]   { --cat: #0d6efd; --cat-wash: #e7f0ff; }
[data-cat="health"]    { --cat: #d6336c; --cat-wash: #ffe9f0; }
[data-cat="maths"]     { --cat: #7048e8; --cat-wash: #f0ebff; }
[data-cat="date-time"] { --cat: #f08c00; --cat-wash: #fff4e0; }
[data-cat="business"]  { --cat: #099268; --cat-wash: #e3f7f0; }
[data-cat="everyday"]  { --cat: #e8590c; --cat-wash: #ffefe4; }

/* Coloured left edge on cards, revealed on hover */
a.card[data-cat] {
  position: relative;
  overflow: hidden;
}
a.card[data-cat]::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px; background: var(--cat);
  transform: scaleY(0); transform-origin: top;
  transition: transform .18s ease;
}
a.card[data-cat]:hover::before { transform: scaleY(1); }
a.card[data-cat]:hover {
  border-color: color-mix(in srgb, var(--cat) 45%, var(--rule));
}

/* Category label picks up the accent */
.card[data-cat] .card__meta { color: var(--cat); }

/* Category tiles get a solid colour block instead of a pale wash */
[data-cat] .cat-card__icon,
.cat-card__icon[data-cat] {
  background: var(--cat-wash);
  color: var(--cat);
}

/* Eyebrow on calculator and category pages */
.eyebrow[data-cat] { background: var(--cat-wash); color: var(--cat); }

/* The readout keeps a coloured hairline so the page identity carries through */
[data-cat] .readout { border-top: 3px solid var(--cat); }

/* ---- Warmer hero -------------------------------------------------------- */

.hero {
  background:
    radial-gradient(ellipse 70% 60% at 20% 0%,  rgba(13, 110, 253, .10), transparent 60%),
    radial-gradient(ellipse 60% 55% at 85% 10%, rgba(112, 72, 232, .09), transparent 60%),
    var(--wash);
}

/* Section headings get a small coloured rule above them */
.section > .wrap > h2:first-child,
.wrap > .section h2 { position: relative; }

/* ---- Category strip on the homepage ------------------------------------- */

.cat-card__icon {
  width: 42px; height: 42px; border-radius: 11px;
  font-size: 1.2rem; font-weight: 600;
}

/* Buttons: slightly more presence */
.btn--primary {
  background: var(--signal);
  box-shadow: 0 1px 2px rgba(13, 110, 253, .25);
}
.btn--primary:hover { background: var(--signal-dark); }
