/* Calculator Suite - stylesheet
   Modern design system with motion. Light + dark, no external dependencies. */

/* ============================================================
   TOKENS
   ============================================================ */

:root {
  /* surfaces */
  --bg: #f4f6fa;
  --bg-glow-1: rgba(26, 127, 240, .12);
  --bg-glow-2: rgba(34, 179, 163, .12);
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e9edf3;
  --elevated: rgba(255, 255, 255, .78);

  /* text */
  --text: #101725;
  --text-2: #3d4759;
  --muted: #6b7688;
  --faint: #97a1b2;

  /* lines */
  --border: #e2e7ef;
  --border-strong: #cfd6e2;

  /* logo brand colours — fixed, used by the wordmark */
  --brand-navy: #0f2038;
  --brand-blue: #1a7ff0;
  --brand-teal: #22b3a3;

  /* brand */
  --accent: #1a7ff0;
  --accent-2: #22b3a3;
  --accent-dark: #1565d8;
  --accent-soft: #e9f3fe;
  --accent-ring: rgba(26, 127, 240, .30);
  --grad: linear-gradient(135deg, #1a7ff0 0%, #2199c9 55%, #22b3a3 100%);
  --grad-soft: linear-gradient(135deg, rgba(26,127,240,.10), rgba(34,179,163,.09));

  /* status */
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-ring: rgba(220, 38, 38, .2);

  /* chart series */
  --c1: #1a7ff0;
  --c2: #22b3a3;
  --c3: #10b981;
  --c4: #f59e0b;
  --c5: #ec4899;

  /* shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* elevation */
  --sh-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --sh: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -8px rgba(16, 24, 40, .10);
  --sh-lg: 0 2px 6px rgba(16, 24, 40, .06), 0 20px 44px -16px rgba(16, 24, 40, .18);
  --sh-glow: 0 8px 30px -10px rgba(26, 127, 240, .42);

  /* motion */
  --e-out: cubic-bezier(.16, 1, .3, 1);
  --e-spring: cubic-bezier(.34, 1.56, .64, 1);
  --e-io: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 140ms;
  --t: 240ms;
  --t-slow: 480ms;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b12;
    --bg-glow-1: rgba(26, 127, 240, .16);
    --bg-glow-2: rgba(34, 179, 163, .11);
    --surface: #121826;
    --surface-2: #1a2233;
    --surface-3: #232d42;
    --elevated: rgba(18, 24, 38, .78);

    --text: #eef2f8;
    --text-2: #c2cbdb;
    --muted: #8e9ab0;
    --faint: #6b7688;

    --border: #232c3f;
    --border-strong: #33405a;

    --brand-blue: #4d9bf5;
    --brand-teal: #3fd0bd;

    --accent: #4d9bf5;
    --accent-2: #3fd0bd;
    --accent-dark: #2b8ef5;
    --accent-soft: #0f2740;
    --accent-ring: rgba(77, 155, 245, .34);

    --danger: #f87171;
    --danger-soft: #2a1416;
    --danger-ring: rgba(248, 113, 113, .22);

    --c1: #4d9bf5; --c2: #3fd0bd; --c3: #34d399; --c4: #fbbf24; --c5: #f472b6;

    --sh-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --sh: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 24px -8px rgba(0, 0, 0, .6);
    --sh-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 20px 44px -16px rgba(0, 0, 0, .75);
    --sh-glow: 0 8px 30px -10px rgba(77, 155, 245, .4);
  }
}

:root[data-theme="dark"] {
  --bg: #080b12; --bg-glow-1: rgba(26,127,240,.16); --bg-glow-2: rgba(34,179,163,.11);
  --surface: #121826; --surface-2: #1a2233; --surface-3: #232d42; --elevated: rgba(18,24,38,.78);
  --text: #eef2f8; --text-2: #c2cbdb; --muted: #8e9ab0; --faint: #6b7688;
  --border: #232c3f; --border-strong: #33405a;
  --brand-blue: #4d9bf5; --brand-teal: #3fd0bd;
  --accent: #4d9bf5; --accent-2: #3fd0bd; --accent-dark: #2b8ef5;
  --accent-soft: #0f2740; --accent-ring: rgba(77,155,245,.34);
  --danger: #f87171; --danger-soft: #2a1416; --danger-ring: rgba(248,113,113,.22);
  --c1: #4d9bf5; --c2: #3fd0bd; --c3: #34d399; --c4: #fbbf24; --c5: #f472b6;
  --sh-sm: 0 1px 2px rgba(0,0,0,.4);
  --sh: 0 1px 3px rgba(0,0,0,.5), 0 8px 24px -8px rgba(0,0,0,.6);
  --sh-lg: 0 2px 6px rgba(0,0,0,.5), 0 20px 44px -16px rgba(0,0,0,.75);
  --sh-glow: 0 8px 30px -10px rgba(77,155,245,.4);
}
:root[data-theme="light"] {
  --bg: #f4f6fa; --bg-glow-1: rgba(26,127,240,.12); --bg-glow-2: rgba(34,179,163,.12);
  --surface: #ffffff; --surface-2: #f2f4f8; --surface-3: #e9edf3; --elevated: rgba(255,255,255,.78);
  --text: #101725; --text-2: #3d4759; --muted: #6b7688; --faint: #97a1b2;
  --border: #e2e7ef; --border-strong: #cfd6e2;
  --brand-blue: #1a7ff0; --brand-teal: #22b3a3;
  --accent: #1a7ff0; --accent-2: #22b3a3; --accent-dark: #1565d8;
  --accent-soft: #e9f3fe; --accent-ring: rgba(26,127,240,.30);
  --danger: #dc2626; --danger-soft: #fef2f2; --danger-ring: rgba(220,38,38,.2);
  --c1: #1a7ff0; --c2: #22b3a3; --c3: #10b981; --c4: #f59e0b; --c5: #ec4899;
  --sh-sm: 0 1px 2px rgba(16,24,40,.05);
  --sh: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px -8px rgba(16,24,40,.10);
  --sh-lg: 0 2px 6px rgba(16,24,40,.06), 0 20px 44px -16px rgba(16,24,40,.18);
  --sh-glow: 0 8px 30px -10px rgba(26,127,240,.42);
}

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes fade-up {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.96) translate3d(0, 10px, 0); }
  100% { opacity: 1; transform: none; }
}
@keyframes row-in {
  from { opacity: 0; transform: translate3d(-8px, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes slide-down {
  from { opacity: 0; transform: translate3d(0, -8px, 0) scaleY(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes pulse-hl {
  0%   { background-color: var(--accent-ring); }
  100% { background-color: transparent; }
}
@keyframes ripple-out {
  to { transform: scale(2.6); opacity: 0; }
}
@keyframes sheen {
  0%   { transform: translateX(-120%) skewX(-18deg); }
  100% { transform: translateX(320%) skewX(-18deg); }
}
@keyframes float-glow {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(2%, -3%, 0) scale(1.06); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BASE
   ============================================================ */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: opacity 320ms var(--e-out), background-color var(--t) var(--e-io), color var(--t) var(--e-io);
}

/* The page-load fade is opt-in: an inline script in <head> sets .js on the
   root element. If scripting is unavailable or fails, `opacity: 0` is never
   applied and the content stays visible instead of leaving a blank page. */
html.js body { opacity: 0; }
html.js body.is-ready { opacity: 1; }

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript-banner {
  background: var(--danger-soft);
  border-bottom: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 22px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

/* ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: -30vh -20vw auto;
  height: 90vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48vw 42vh at 22% 8%, var(--bg-glow-1), transparent 70%),
    radial-gradient(42vw 38vh at 82% 0%, var(--bg-glow-2), transparent 70%);
  animation: float-glow 22s var(--e-io) infinite;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--e-io); }
a:hover { color: var(--accent-dark); }

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

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 22px; }

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--elevated);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--e-io), box-shadow var(--t) var(--e-io);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -12px rgba(16, 24, 40, .35);
}
.site-header .header-top {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 66px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--r) 0;
  font-weight: 650;
}
.skip-link:focus { left: 0; top: 0; text-decoration: none; }

.logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 780;
  font-size: 18px;
  letter-spacing: -.03em;
  color: var(--text);
  white-space: nowrap;
  transition: transform var(--t) var(--e-spring);
}
.logo:hover { transform: translateY(-1px); color: var(--text); text-decoration: none; }
/* Inline SVG mark — no background plate, the artwork carries its own shape */
svg.logo-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: block;
  border-radius: 8px;
  transition: transform var(--t) var(--e-spring);
}
.logo:hover svg.logo-mark { transform: rotate(-6deg) scale(1.06); }

/* Wordmark: solid brand colours, matching the mark. Flat colour rather than a
   gradient clip so the three words stay legible at small sizes. */
.logo-text { line-height: 1; color: var(--text); }
.logo-text .lg-calc { color: var(--brand-blue); }
.logo-text .lg-hub  { color: var(--brand-teal); }

.footer-brand svg.logo-mark { width: 30px; height: 30px; }

/* ---- category nav bar ---- */

.header-cats {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
/* ---- icon system ----
   One 24x24 stroke grid for every icon. They inherit colour from the parent,
   so hover, active and theme states need no extra rules. */
.ico {
  width: 1em;
  height: 1em;
  flex: none;
  display: block;
  vertical-align: middle;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

/* Stroke weight must NOT scale with the icon.
   Drawn on a 24px grid but rendered at 16–18px, a 1.9 stroke shrinks to
   ~1.3px — which lands between device pixels on fractional-DPI displays
   (Windows at 125% is dpr 1.25) and the browser blurs it to soft grey.
   `non-scaling-stroke` measures the stroke in screen pixels instead, so
   every icon keeps the same crisp weight at every size. */
.ico * {
  vector-effect: non-scaling-stroke;
  stroke-width: 1.8px;
}
/* Larger tiles carry a touch more weight so they don't look spindly */
.cat-ico .ico *,
.cat-hero-ico .ico * { stroke-width: 2px; }
/* Small marks need the extra punch */
.hero-badges li .ico *,
.cat-cta .ico *,
.cat-detail-cta .ico * { stroke-width: 2.2px; }

.cat-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Centred while it fits. `safe` matters: with plain `center` in a scroll
     container, overflowing content is pushed past the scroll origin and the
     first items become unreachable. `safe` falls back to flex-start instead. */
  justify-content: safe center;
}
@supports not (justify-content: safe center) {
  /* Older engines: auto margins centre without the overflow trap */
  .cat-nav > a:first-child { margin-inline-start: auto; }
  .cat-nav > a:last-child  { margin-inline-end: auto; }
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 620;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast) var(--e-io), border-color var(--t-fast) var(--e-io),
              background-color var(--t-fast) var(--e-io);
}
.cat-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.cat-nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.nav-ico {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;          /* drives .ico sizing via 1em */
  opacity: .78;
  transition: opacity var(--t-fast) var(--e-io);
}
.cat-nav a:hover .nav-ico,
.cat-nav a.is-active .nav-ico { opacity: 1; }

.header-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.nav-all {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.nav-all:hover { color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px; height: 38px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text-2);
  transition: transform var(--t) var(--e-out), opacity var(--t) var(--e-io);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* search */
.header-search { flex: 1; max-width: 480px; position: relative; }
.header-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t) var(--e-io), box-shadow var(--t) var(--e-io),
              background-color var(--t) var(--e-io);
}
.header-search::before {
  content: "";
  position: absolute;
  left: 14px; top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  z-index: 1;
  pointer-events: none;
  opacity: .5;
  background: currentColor;
  color: var(--muted);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}
.header-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.header-search input::placeholder { color: var(--faint); }

.header-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.header-nav a {
  position: relative;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
}
.header-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 2px; width: 100%;
  border-radius: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t) var(--e-out);
}
.header-nav a:hover { color: var(--text); }
.header-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: transform var(--t) var(--e-spring), border-color var(--t) var(--e-io),
              color var(--t) var(--e-io), background-color var(--t) var(--e-io);
}
.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.theme-toggle:active { transform: translateY(0) scale(.96); }

/* search dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
  padding: 6px;
}
.search-results.open {
  display: block;
  animation: slide-down 220ms var(--e-out) both;
  transform-origin: top center;
}
.search-results a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background-color var(--t-fast) var(--e-io), transform var(--t-fast) var(--e-out);
}
.search-results a:hover, .search-results a.active {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateX(3px);
}
.search-results .cat {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.search-empty { padding: 14px; color: var(--muted); font-size: 14px; }

/* ============================================================
   HERO
   ============================================================ */

.hero {
  position: relative;
  padding: 66px 0 58px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(60vw 40vh at 50% -10%, var(--accent-soft), transparent 70%);
}
.hero h1 {
  margin: 0 auto 14px;
  max-width: 18ch;
  font-size: clamp(30px, 5.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fade-up 620ms var(--e-out) both;
}
.hero-sub {
  margin: 0 auto;
  max-width: 60ch;
  color: var(--muted);
  font-size: clamp(15.5px, 1.7vw, 18px);
  animation: fade-up 620ms 80ms var(--e-out) both;
}
.hero-sub strong { color: var(--accent); font-weight: 750; }
.hero .count { color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; }

.hero-badges {
  list-style: none;
  margin: 24px auto 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  animation: fade-up 620ms 160ms var(--e-out) both;
}
.hero-badges li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  box-shadow: var(--sh-sm);
}
.hero-badges span { color: var(--c3); font-weight: 800; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* center, not stretch: stretch inflated the taller-hypothetical button to
     the full flex-line cross size, leaving the two CTAs visibly uneven. With
     nowrap labels and equal padding they match at their natural height. */
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  animation: fade-up 620ms 230ms var(--e-out) both;
}
.hero-cta .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  font-size: 14.5px;
  font-weight: 650;
  /* Keep each label on one line. Without this the longer label wraps inside
     its own box and that button renders ~20px taller than its neighbour. */
  white-space: nowrap;
  line-height: 1.4;
}

/* The default .btn is a quiet form control — far too low-contrast to read as
   a call to action sitting on the hero. Give the secondary CTA a solid
   surface, a defined border and full-strength text. */
.hero-cta .btn:not(.primary) {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--sh-sm);
}
.hero-cta .btn:not(.primary):hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--sh);
}

/* ============================================================
   SECTIONS
   ============================================================ */

.section { padding: 52px 0 8px; }
.section-alt {
  padding: 52px 0;
  margin: 44px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-head { text-align: center; margin-bottom: 30px; }
.section-head h2 {
  margin: 0 0 6px;
  font-size: clamp(21px, 2.6vw, 28px);
  letter-spacing: -.03em;
  font-weight: 760;
}
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }

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

.cat-cards {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh);
  color: var(--text);
  overflow: hidden;
  transition: transform var(--t-slow) var(--e-out), box-shadow var(--t-slow) var(--e-out),
              border-color var(--t) var(--e-io);
}
.cat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-slow) var(--e-out);
}
.cat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-lg);
  border-color: var(--border-strong);
  text-decoration: none;
}
.cat-card:hover::before { transform: scaleX(1); }

.cat-ico {
  font-size: 28px;
  margin-bottom: 14px;
  display: inline-flex;
  width: 56px; height: 56px;
  align-items: center; justify-content: center;
  border-radius: 16px;
  background: var(--grad-soft);
  color: var(--accent);
  border: 1px solid var(--border);
  transition: transform var(--t) var(--e-spring), color var(--t) var(--e-io);
}
.cat-card:hover .cat-ico { transform: scale(1.06) rotate(-4deg); }
.cat-ico .ico { stroke-width: 1.7; }

.cat-card h3 {
  margin: 0 0 7px;
  font-size: 17.5px;
  font-weight: 720;
  letter-spacing: -.02em;
}
/* Stretched link: the title anchor covers the whole card, so the card
   reads as one target without wrapping the nested list in an <a>. */
.cat-card h3 .cat-link { color: var(--text); }
.cat-card h3 .cat-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.cat-card:hover h3 .cat-link { color: var(--accent); text-decoration: none; }

.cat-card > p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }

/* Sample links sit above the stretched link so they stay clickable. */
.cat-sample { list-style: none; margin: 0 0 16px; padding: 0; position: relative; z-index: 2; }
.cat-sample li { margin-bottom: 1px; }
.cat-sample a {
  font-size: 13px;
  color: var(--text-2);
  display: block;
  padding: 3px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--e-io), color var(--t-fast) var(--e-io),
              transform var(--t-fast) var(--e-out);
}
.cat-sample a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(3px);
  text-decoration: none;
}

.cat-cta {
  margin-top: auto;
  padding-top: 4px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-card:hover .cat-cta span { transform: translateX(4px); }
.cat-cta span { transition: transform var(--t) var(--e-out); }

/* ---- tool grid ---- */

.tool-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.tool-grid-dense { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }

.tool-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  transition: transform var(--t) var(--e-out), border-color var(--t) var(--e-io),
              box-shadow var(--t) var(--e-out), color var(--t) var(--e-io);
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--sh);
  text-decoration: none;
}
.tool-ico {
  font-size: 20px;
  flex: none;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--accent);
  transition: background-color var(--t) var(--e-io), color var(--t) var(--e-io);
}
.tool-card:hover .tool-ico { background: var(--accent-soft); }
.tool-name { min-width: 0; }

/* ---- numbered steps ---- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 26px 24px 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.step-n {
  position: absolute;
  top: -15px; left: 24px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: var(--sh-glow);
}
.steps h3 { margin: 8px 0 7px; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.steps p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.62; }
.steps kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--text);
}

/* ---- category deep-dive ---- */

.cat-details { display: grid; gap: 26px; padding-bottom: 20px; }
.cat-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 30px;
  box-shadow: var(--sh);
}
.cat-detail h2 {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 740;
  letter-spacing: -.025em;
  display: flex;
  align-items: center;
  gap: 11px;
}
.cat-detail-ico {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex: none;
  font-size: 21px;
  border-radius: 11px;
  background: var(--grad-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}
.cat-detail p { margin: 0 0 13px; color: var(--text-2); line-height: 1.72; max-width: 76ch; }

.cat-detail-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-detail-list a {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--t) var(--e-io);
}
.cat-detail-list a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.cat-detail-cta { font-size: 14px; font-weight: 700; display: inline-flex; gap: 7px; align-items: center; }
.cat-detail-cta span { transition: transform var(--t) var(--e-out); }
.cat-detail-cta:hover span { transform: translateX(4px); }

/* ---- category landing hero ---- */

.cat-hero {
  padding: 42px 0 40px;
  text-align: center;
  background: radial-gradient(56vw 34vh at 50% -20%, var(--accent-soft), transparent 72%);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.cat-hero .breadcrumb { text-align: left; padding-top: 0; }
.cat-hero-ico {
  display: inline-flex;
  width: 72px; height: 72px;
  align-items: center; justify-content: center;
  font-size: 34px;
  color: var(--accent);
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh);
  margin-bottom: 14px;
  animation: pop-in 520ms var(--e-out) both;
}
.cat-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 780;
  letter-spacing: -.035em;
}
.cat-hero-count {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.cat-about { max-width: 80ch; margin: 0 auto; }

/* ============================================================
   CATEGORY GRID
   ============================================================ */

.categories {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  padding-bottom: 56px;
}

.category {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px 24px 24px;
  box-shadow: var(--sh);
  transition: transform var(--t-slow) var(--e-out), box-shadow var(--t-slow) var(--e-out),
              border-color var(--t) var(--e-io);
}
.category::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-slow) var(--e-out);
}
.category:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
  border-color: var(--border-strong);
}
.category:hover::before { transform: scaleX(1); }

.category h2 {
  margin: 0 0 14px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.category h2 .n {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
}
.category ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 22px; }
.category li { break-inside: avoid; margin-bottom: 2px; }
.category li a {
  display: block;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 3px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast) var(--e-io), background-color var(--t-fast) var(--e-io),
              transform var(--t-fast) var(--e-out);
}
.category li a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(3px);
}

/* scroll reveal */
.reveal { opacity: 0; transform: translate3d(0, 22px, 0); }
.reveal.is-visible {
  animation: fade-up 640ms var(--e-out) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

/* ============================================================
   CALCULATOR PAGE
   ============================================================ */

.breadcrumb {
  padding: 22px 0 12px;
  font-size: 13px;
  color: var(--faint);
  animation: fade-in 400ms var(--e-io) both;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .current { color: var(--text-2); font-weight: 500; }

.calc-head { margin-bottom: 22px; animation: fade-up 560ms var(--e-out) both; }
.calc-head h1 {
  margin: 0 0 8px;
  font-size: clamp(25px, 3.6vw, 34px);
  letter-spacing: -.035em;
  font-weight: 760;
  line-height: 1.15;
}
.calc-head p { margin: 0; color: var(--muted); max-width: 72ch; font-size: 15.5px; }

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 26px;
  align-items: start;
  padding-bottom: 60px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--sh);
  animation: fade-up 560ms 70ms var(--e-out) both;
}

/* ---- form ---- */

.calc-form { margin-bottom: 24px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 17px 20px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  animation: fade-up 460ms var(--e-out) both;
  animation-delay: calc(var(--i, 0) * var(--step, 24ms));
}
.field.wide { grid-column: 1 / -1; }
.field label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
  letter-spacing: .01em;
}
.field small.help { color: var(--faint); font-size: 11.5px; line-height: 1.45; }

.ctl {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--t) var(--e-io), box-shadow var(--t) var(--e-io),
              background-color var(--t) var(--e-io), transform var(--t-fast) var(--e-out);
}
.ctl:hover { border-color: var(--border-strong); }
.ctl:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
select.ctl {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7688' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
textarea.ctl { font-family: var(--mono); font-size: 13px; resize: vertical; line-height: 1.6; }
.ctl-check {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  transition: transform var(--t-fast) var(--e-spring);
}
.ctl-check:hover { transform: scale(1.12); }

.with-unit { display: flex; align-items: center; gap: 9px; }
.with-unit .ctl { flex: 1; min-width: 0; }
.with-unit .unit {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* radio groups render as a real fieldset/legend for screen readers */
fieldset.field-group {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
fieldset.field-group legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
  letter-spacing: .01em;
}

.radio-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.radio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  cursor: pointer;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  transition: all var(--t) var(--e-io);
}
.radio:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.radio input { accent-color: var(--accent); cursor: pointer; margin: 0; }
.radio:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

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

.actions { display: flex; gap: 11px; margin-top: 22px; flex-wrap: wrap; }
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 11px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t) var(--e-out),
              border-color var(--t) var(--e-io), color var(--t) var(--e-io),
              background-color var(--t) var(--e-io);
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(0) scale(.97); }

.btn.primary {
  background: var(--grad);
  background-size: 180% 180%;
  border-color: transparent;
  color: #fff;
  box-shadow: var(--sh-glow);
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t) var(--e-out),
              background-position var(--t-slow) var(--e-io);
}
.btn.primary:hover {
  color: #fff;
  background-position: 100% 0;
  box-shadow: 0 12px 34px -10px var(--accent-ring), var(--sh-glow);
}
/* sheen sweep on hover */
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: translateX(-120%) skewX(-18deg);
}
.btn.primary:hover::after { animation: sheen 820ms var(--e-io); }

/* copy-link feedback states */
.btn.is-ok {
  border-color: var(--c3);
  color: var(--c3);
  background: color-mix(in srgb, var(--c3) 10%, transparent);
}
.btn.is-fail {
  border-color: var(--c4);
  color: var(--c4);
  background: color-mix(in srgb, var(--c4) 10%, transparent);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .28;
  transform: scale(0);
  pointer-events: none;
  animation: ripple-out 600ms var(--e-out) forwards;
}
.btn.primary .ripple { background: #fff; opacity: .4; }

/* ============================================================
   RESULTS
   ============================================================ */

.result {
  position: relative;
  border-top: 1px solid var(--border);
  padding-top: 22px;
  transition: opacity var(--t) var(--e-io);
}
.result.is-busy { opacity: .72; }

/* thin progress bar while recomputing */
.result.is-busy::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  height: 2px; width: 100%;
  border-radius: 2px;
  background: var(--grad);
  transform-origin: left;
  animation: fade-in 120ms var(--e-io) both;
}

.primary {
  position: relative;
  overflow: hidden;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.primary::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--grad);
}
.primary.is-entering { animation: pop-in 520ms var(--e-out) both; }

.primary-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}
.primary-value {
  font-size: clamp(26px, 4.4vw, 36px);
  font-weight: 780;
  letter-spacing: -.035em;
  line-height: 1.15;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.primary-value.is-pulsing {
  animation: pulse-hl 620ms var(--e-out);
}
.primary-note { font-size: 13.5px; color: var(--muted); margin-top: 6px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--r);
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 0 0 4px var(--danger-ring);
}
.alert.is-entering { animation: pop-in 380ms var(--e-out) both; }
.alert::before { content: "!"; font-weight: 800; opacity: .7; }

/* ---- key/value table ---- */

table.kv { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
table.kv tr {
  animation: row-in 380ms var(--e-out) both;
  animation-delay: calc(var(--i, 0) * var(--step, 22ms));
}
table.kv th, table.kv td {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  transition: color var(--t-fast) var(--e-io);
}
table.kv th { font-weight: 500; color: var(--muted); width: 54%; padding-right: 14px; }
table.kv td { font-variant-numeric: tabular-nums; color: var(--text); }
table.kv tbody tr:hover th { color: var(--text-2); }
table.kv tr.strong th { color: var(--text-2); font-weight: 650; }
table.kv tr.strong td {
  font-weight: 750;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
table.kv tr.section th {
  padding-top: 20px;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  border-bottom: none;
}

/* ---- bars ---- */

.bars { margin-bottom: 20px; display: grid; gap: 9px; }
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  animation: fade-in 420ms var(--e-io) both;
  animation-delay: calc(var(--i, 0) * var(--step, 40ms));
}
.bar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  background: var(--surface-3);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 760ms var(--e-out);
}
.bar-val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; color: var(--text-2); }

/* ---- note ---- */

/* ---- provenance & sources ---- */

.provenance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 12.5px;
}
.prov-tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  letter-spacing: .01em;
}
.prov-as-of { color: var(--muted); }

.sources {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}
.sources h4 {
  margin: 0 0 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 700;
  color: var(--muted);
}
.sources ul { list-style: none; margin: 0; padding: 0; }
.sources li { margin-bottom: 4px; }
.sources li:last-child { margin-bottom: 0; }
.sources a {
  font-size: 13.5px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sources a::after {
  content: "↗";
  font-size: 11px;
  opacity: .6;
}

/* ---- prose pages ---- */

.prose { max-width: 78ch; margin-bottom: 44px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0 0 18px; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.prose thead th {
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.prose ul { color: var(--text-2); padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--accent); }
.prose-meta {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--faint);
}

.cat-blurb {
  margin: -6px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

p.note {
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 12px 15px;
  border-radius: var(--r-sm);
  margin: 0 0 20px;
  animation: fade-in 460ms 120ms var(--e-io) both;
}

/* ---- schedule table ---- */

details.sched {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color var(--t) var(--e-io);
}
details.sched:hover { border-color: var(--border-strong); }
details.sched summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  color: var(--accent);
  padding: 13px 16px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  transition: background-color var(--t) var(--e-io);
}
details.sched summary::-webkit-details-marker { display: none; }
details.sched summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--t) var(--e-spring);
}
details.sched[open] summary::before { transform: rotate(45deg); }
details.sched summary:hover { background: var(--accent-soft); }
details.sched[open] > .table-scroll { animation: fade-up 380ms var(--e-out) both; }

.table-scroll {
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--border);
}
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  z-index: 1;
}
table.grid tbody tr { transition: background-color var(--t-fast) var(--e-io); }
table.grid tbody tr:nth-child(even) { background: var(--surface-2); }
table.grid tbody tr:hover { background: var(--accent-soft); }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar { display: grid; gap: 18px; position: sticky; top: 90px; }
.sidebar .panel { padding: 20px; animation-delay: 160ms; }
.sidebar .panel h3 {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin-bottom: 1px; }
.sidebar li a {
  display: block;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 6px 9px;
  margin-left: -9px;
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--e-io), color var(--t-fast) var(--e-io),
              transform var(--t-fast) var(--e-out);
}
.sidebar li a:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(4px); }

.formula {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  overflow-x: auto;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 46px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 56px;
}
.footer-grid {
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(130px, 1fr));
  padding-bottom: 36px;
}
.footer-brand .logo { margin-bottom: 14px; }
.footer-brand p { margin: 0 0 12px; line-height: 1.66; max-width: 46ch; }
.footer-disclaimer { font-size: 12.5px; color: var(--faint); }

.footer-col h3 {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 700;
  color: var(--text-2);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: var(--muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.footer-col a:hover { color: var(--accent); }
.fc {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--faint);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 18px 22px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--faint);
}

/* ============================================================
   SITEMAP PAGE
   ============================================================ */

.sitemap-grid { display: grid; gap: 30px; padding-bottom: 50px; }
.sitemap-grid section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  box-shadow: var(--sh);
}
.sitemap-grid h2 {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 14px;
}
.sitemap-grid ul { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: 26px; }
.sitemap-grid li { break-inside: avoid; margin-bottom: 2px; font-size: 13.5px; }
.sitemap-grid li a {
  display: block;
  color: var(--text-2);
  padding: 3px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--e-io), color var(--t-fast) var(--e-io),
              transform var(--t-fast) var(--e-out);
}
.sitemap-grid li a:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(3px); }

/* prose pages */
.panel h2 { font-size: 16.5px; margin-top: 26px; letter-spacing: -.015em; }
.panel h2:first-of-type { margin-top: 0; }
.panel p { color: var(--text-2); }
.panel code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
}

/* ============================================================
   ARTICLE CONTENT
   ============================================================ */

.calc-main { min-width: 0; display: grid; gap: 26px; }

.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 30px 34px 34px;
  box-shadow: var(--sh);
  animation: fade-up 560ms 140ms var(--e-out) both;
}
.article > * { max-width: 74ch; }

.article-intro {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-2);
  margin: 0 0 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-section { margin-bottom: 34px; scroll-margin-top: 90px; }
.article-section:last-child { margin-bottom: 0; }

.article h2 {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -.025em;
  margin: 0 0 14px;
  scroll-margin-top: 90px;
  position: relative;
}
.article h2::before {
  content: "";
  position: absolute;
  left: -34px; top: .38em;
  width: 4px; height: .95em;
  border-radius: 2px;
  background: var(--grad);
  opacity: 0;
  transform: scaleY(.4);
  transition: opacity var(--t) var(--e-out), transform var(--t) var(--e-spring);
}
.article-section:hover h2::before { opacity: 1; transform: scaleY(1); }

.article p { margin: 0 0 14px; color: var(--text-2); line-height: 1.72; }
.article p:last-child { margin-bottom: 0; }

.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; color: var(--text-2); }
.article li { margin-bottom: 8px; line-height: 1.68; }
.article li::marker { color: var(--accent); font-weight: 700; }

.article-formula {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  padding: 15px 18px;
  margin: 0 0 18px;
  overflow-x: auto;
  color: var(--text);
  white-space: pre;
  tab-size: 2;
}

.article-note {
  font-size: 13.5px !important;
  color: var(--muted) !important;
  background: var(--grad-soft);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  margin: 0 0 16px !important;
}

.article-table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin: 0 0 18px;
  max-width: 100%;
}
.article-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.article-table th, .article-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-table thead th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  white-space: nowrap;
}
.article-table tbody tr { transition: background-color var(--t-fast) var(--e-io); }
.article-table tbody tr:last-child td { border-bottom: none; }
.article-table tbody tr:hover { background: var(--accent-soft); }
.article-table td:first-child { font-weight: 600; color: var(--text); }
.article-table td + td { font-variant-numeric: tabular-nums; }

/* ---- table of contents ---- */

.toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  margin: 0 0 30px;
}
.toc h3 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
}
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.toc li { margin-bottom: 3px; break-inside: avoid; }
.toc li::marker { content: none; }
.toc a {
  display: block;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 3px 8px;
  margin-left: -8px;
  border-radius: 6px;
  transition: background-color var(--t-fast) var(--e-io), color var(--t-fast) var(--e-io),
              transform var(--t-fast) var(--e-out);
}
.toc a:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(3px); }

/* ---- FAQ ---- */

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--t) var(--e-io), box-shadow var(--t) var(--e-out);
}
.faq-item:hover { border-color: var(--border-strong); box-shadow: var(--sh-sm); }
.faq-item[open] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 640;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  user-select: none;
  transition: color var(--t-fast) var(--e-io), background-color var(--t-fast) var(--e-io);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent); background: var(--surface-2); }
.faq-item summary::after {
  content: "";
  flex: none;
  width: 9px; height: 9px;
  border-right: 2.2px solid var(--muted);
  border-bottom: 2.2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--t) var(--e-spring), border-color var(--t) var(--e-io);
}
.faq-item[open] summary::after {
  transform: rotate(-135deg) translateY(-2px);
  border-color: var(--accent);
}
.faq-answer {
  padding: 0 18px 16px;
  animation: fade-up 320ms var(--e-out) both;
}
.faq-answer p { margin: 0; font-size: 14.5px; color: var(--text-2); }

/* ============================================================
   ADS
   ============================================================ */

/* Reserved heights match the sizes AdSense actually returns for each
   placement, so a filled slot does not push content down (CLS). */
.ad-unit {
  margin: 26px 0;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  text-align: center;
  overflow: hidden;
  contain: layout;
}
.ad-top, .ad-in-article, .ad-inArticle, .ad-bottom { min-height: 300px; }
.ad-sidebar { min-height: 620px; }
@media (max-width: 680px) {
  .ad-top, .ad-inArticle, .ad-bottom { min-height: 270px; }
}
.ad-label {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--faint);
  margin-bottom: 6px;
}
.ad-unit .adsbygoogle { display: block; width: 100%; }
.ad-sticky { position: sticky; top: 90px; margin: 0; }
.ad-top { margin: 0 0 24px; }

/* ---- sticky anchor bar ---- */

.ad-anchor {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: none;
  padding: 4px 0 2px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 18px -8px rgba(0, 0, 0, .35);
  transform: translateY(100%);
  transition: transform 320ms var(--e-out);
}
/* Only shown once consent is granted and the unit is live */
.ad-anchor.is-live { display: block; transform: none; }

.ad-anchor-close {
  position: absolute;
  top: -26px; right: 10px;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.ad-anchor-close:hover { color: var(--text); }

/* Keep the footer clear of the fixed bar */
body:has(.ad-anchor.is-live) .site-footer { padding-bottom: 74px; }
@media (max-width: 960px) {
  .ad-sidebar { display: none; }
}

/* ============================================================
   CONSENT BANNER
   ============================================================ */

.consent {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 90;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  font-size: 13.5px;
  color: var(--text-2);
  animation: fade-up 460ms 700ms var(--e-out) both;
}
.consent p { margin: 0; flex: 1; min-width: 200px; }
.consent .consent-actions { display: flex; gap: 8px; }
.consent .btn { padding: 8px 16px; font-size: 13px; }

/* ============================================================
   SCROLLBARS
   ============================================================ */

.table-scroll::-webkit-scrollbar, .search-results::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-track, .search-results::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid var(--surface);
}
.table-scroll::-webkit-scrollbar-thumb:hover, .search-results::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 960px) {
  .calc-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sitemap-grid ul { columns: 2; }
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .site-header .header-top { height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; row-gap: 12px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .header-actions { margin-left: auto; gap: 10px; }
  .nav-all { display: none; }
  .nav-toggle { display: flex; }

  /* Category bar collapses behind the hamburger on small screens */
  .header-cats { display: none; }
  .header-cats.is-open { display: block; }
  .header-cats.is-open .cat-nav {
    flex-direction: column;
    overflow: visible;
    padding-bottom: 8px;
  }
  .header-cats.is-open .cat-nav a {
    border-bottom: none;
    border-left: 2px solid transparent;
    padding: 11px 14px;
    border-radius: var(--r-sm);
  }
  .header-cats.is-open .cat-nav a.is-active {
    border-left-color: var(--accent);
    background: var(--accent-soft);
  }

  .category ul, .sitemap-grid ul { columns: 1; }
  .hero { padding: 40px 0 34px; }
  .hero-badges { gap: 8px; }
  .hero-badges li { font-size: 12.5px; padding: 6px 12px; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; text-align: center; }
  .section { padding: 36px 0 4px; }
  .section-alt { padding: 36px 0; margin: 32px 0; }
  .panel { padding: 20px; border-radius: var(--r-lg); }
  .category, .cat-card, .cat-detail { padding: 20px; border-radius: var(--r-lg); }
  .cat-detail h2 { font-size: 18.5px; }
  .tool-grid, .tool-grid-dense { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
  .bar-row { grid-template-columns: 92px 1fr auto; gap: 9px; }
  table.kv th { width: 50%; }
  .actions .btn { flex: 1; min-width: 110px; text-align: center; }
  .footer-grid { grid-template-columns: 1fr; }
  .article { padding: 22px 20px 26px; }
  .article h2::before { display: none; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  body { opacity: 1; }
  body::before { animation: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   PRINT
   ============================================================ */

@media print {
  .site-header, .site-footer, .sidebar, .actions, .breadcrumb { display: none !important; }
  body { background: #fff; color: #000; opacity: 1; }
  body::before { display: none; }
  .panel, .primary { box-shadow: none; border: 1px solid #ccc; }
  .primary-value, table.kv tr.strong td { color: #000 !important; background: none !important; }
  details.sched[open] .table-scroll { max-height: none; overflow: visible; }
}

/* TOC active state */
.toc a.is-current {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}


/* ---- icon placement ---- */

.hero-badges li .ico { font-size: 16px; color: var(--c3); stroke-width: 2.6; }

.step-ico {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 30px; height: 30px;
  flex: none;
  font-size: 18px;
  border-radius: 8px;
  background: var(--grad-soft);
  color: var(--accent);
  margin-right: 3px;
}
.steps h3 { display: flex; align-items: center; gap: 9px; }

/* CTA arrows nudge on hover */
.cat-cta .ico,
.cat-detail-cta .ico {
  font-size: 16px;
  transition: transform var(--t) var(--e-out);
}
.cat-card:hover .cat-cta .ico,
.cat-detail-cta:hover .ico { transform: translateX(4px); }

.cat-detail h2 { align-items: center; }
