/* ==========================================================================
   TrueCalc Pro — style.css
   Base reset, design tokens (structure), layout, header, footer, components.
   Colour palettes for dark + light live in dark-mode.css.
   ========================================================================== */

/* ---------- 1. Modern reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul[class], ol[class] { list-style: none; padding: 0; }

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

input, button, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: 0; }

/* Any author `display` rule beats the browser's built-in [hidden] style, so
   state it explicitly. Without this, hiding a flex element does nothing. */
[hidden] { display: none !important; }

table { border-collapse: collapse; width: 100%; }

/* ---------- 2. Structural tokens ---------- */
:root {
  /* Type scale (fluid) */
  --fs-xs:   0.8125rem;   /* 13px */
  --fs-sm:   0.9375rem;   /* 15px */
  --fs-base: 1rem;        /* 16px — never smaller for body copy */
  --fs-md:   1.0625rem;
  --fs-lg:   clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --fs-xl:   clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem);
  --fs-2xl:  clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  --fs-3xl:  clamp(2.125rem, 1.4rem + 3.2vw, 3.75rem);

  /* Spacing */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;  --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem;  --sp-8: 2rem;    --sp-10: 2.5rem;
  --sp-12: 3rem;   --sp-16: 4rem;   --sp-20: 5rem;   --sp-24: 6rem;

  /* Radii */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* Layout */
  --wrap: 1200px;
  --wrap-narrow: 760px;
  --header-h: 68px;

  /* Motion */
  --t-fast: 140ms cubic-bezier(.4, 0, .2, 1);
  --t-base: 240ms cubic-bezier(.4, 0, .2, 1);

  /* Fonts */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

/* ---------- 3. Base elements ---------- */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--t-base), color var(--t-base);
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { text-wrap: pretty; }

a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
a:hover { color: var(--link-hover); }

strong, b { font-weight: 650; color: var(--text-strong); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .12em .42em;
}

kbd {
  box-shadow: 0 1px 0 var(--border-strong);
  font-size: .8em;
  font-weight: 600;
}

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-10) 0; }

/* Focus — always visible, never removed */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--primary); color: #fff; }

/* ---------- 4. Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.wrap--narrow { max-width: var(--wrap-narrow); }

.section { padding-block: var(--sp-16); }
.section--tight { padding-block: var(--sp-10); }

.section-head { max-width: 60ch; margin-bottom: var(--sp-8); }
.section-head p { color: var(--text-muted); font-size: var(--fs-md); margin-top: var(--sp-3); }

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: var(--sp-3);
}

.text-muted { color: var(--text-muted); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 200;
  background: var(--cta-bg);
  color: var(--cta-fg);
  font-weight: 650;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  transition: top var(--t-fast);
}
.skip-link:focus { top: var(--sp-4); }

/* ---------- 5. Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
}

/* ---------- 6. Buttons ---------- */
.btn {
  --btn-pad-y: .75rem;
  --btn-pad-x: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 46px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: .01em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform var(--t-fast), background-color var(--t-fast),
              border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn--primary {
  background: var(--cta-bg);
  color: var(--cta-fg);
  box-shadow: 0 6px 20px -8px var(--cta-glow);
}
.btn--primary:hover { background: var(--cta-bg-hover); color: var(--cta-fg); }

.btn--violet {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 24px -10px var(--primary);
}
.btn--violet:hover { filter: brightness(1.08); color: #fff; }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-strong);
}
.btn--ghost:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-strong); }

.btn--link { padding: 0; min-height: 0; color: var(--accent-text); background: none; }
.btn--link:hover { color: var(--link-hover); }

.btn--lg { --btn-pad-y: .95rem; --btn-pad-x: 1.8rem; min-height: 54px; font-size: var(--fs-md); }
.btn--sm { --btn-pad-y: .5rem; --btn-pad-x: .9rem; min-height: 40px; font-size: var(--fs-xs); }
.btn--block { width: 100%; }

.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- 7. Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 750;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  text-decoration: none;
  flex: none;
}
.brand:hover { color: var(--text-strong); }
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__name .pro {
  background: linear-gradient(90deg, var(--primary-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: var(--sp-1); }
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--text-muted);
  text-decoration: none;
}
.nav__link:hover { color: var(--text-strong); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--text-strong); background: var(--surface-2); }

.header-tools { display: flex; align-items: center; gap: var(--sp-2); flex: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { color: var(--text-strong); background: var(--surface-3); border-color: var(--border-strong); }
.icon-btn svg { width: 20px; height: 20px; }

/* Theme toggle: swap icons based on the active theme */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }

.nav-toggle { display: none; }

/* Mobile drawer */
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    margin: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: var(--sp-3) var(--sp-5) var(--sp-6);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-base), transform var(--t-base), visibility var(--t-base);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__link { min-height: 52px; padding-inline: var(--sp-4); font-size: var(--fs-md); }
}

/* ---------- 8. Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 7vw, 6rem) clamp(2.5rem, 5vw, 4rem);
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -55%;
  left: 50%;
  width: min(1100px, 130%);
  aspect-ratio: 1.6;
  transform: translateX(-50%);
  background: var(--hero-glow);
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}
.hero__title { margin-bottom: var(--sp-5); }
.hero__title .grad {
  background: linear-gradient(100deg, var(--primary-2) 10%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  max-width: 62ch;
  margin-inline: auto;
  font-size: var(--fs-lg);
  color: var(--text-muted);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-8);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.badge-row span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.badge-row svg { width: 16px; height: 16px; color: var(--accent-text); }

/* ---------- 9. Search ---------- */
.search {
  position: relative;
  max-width: 560px;
  margin: var(--sp-8) auto 0;
}
.search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-faint);
  pointer-events: none;
}
.search__input {
  width: 100%;
  min-height: 56px;
  padding: 0 var(--sp-5) 0 52px;
  font-size: var(--fs-md);
  color: var(--text-strong);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.search__input::placeholder { color: var(--text-faint); }
.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}
.search__empty {
  margin-top: var(--sp-6);
  text-align: center;
  color: var(--text-muted);
}

/* ---------- 10. Calculator grid / cards ---------- */
.grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.calc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base), background-color var(--t-base);
}
.calc-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-sheen);
  opacity: 0;
  transition: opacity var(--t-base);
  pointer-events: none;
}
.calc-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lg);
  color: inherit;
}
.calc-card:hover::after { opacity: 1; }

.calc-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  background: var(--icon-bg);
  border: 1px solid var(--border);
  color: var(--accent-text);
}
.calc-card__icon svg { width: 24px; height: 24px; }

.calc-card__title { font-size: var(--fs-lg); font-weight: 700; color: var(--text-strong); }
.calc-card__desc { font-size: var(--fs-sm); color: var(--text-muted); flex: 1; }
.calc-card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--accent-text);
}
.calc-card__cta svg { width: 16px; height: 16px; transition: transform var(--t-fast); }
.calc-card:hover .calc-card__cta svg { transform: translateX(4px); }

.tag {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: var(--r-pill);
  background: var(--tag-bg);
  color: var(--tag-fg);
  border: 1px solid var(--border);
}

/* ---------- 11. Feature tiles ---------- */
.feature {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.feature__icon {
  display: inline-flex;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: var(--icon-bg);
  color: var(--accent-text);
}
.feature__icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: var(--fs-md); }
.feature p { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- 12. FAQ accordion ---------- */
.faq { display: grid; gap: var(--sp-3); }
.faq__item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  text-align: left;
  padding: var(--sp-4) var(--sp-5);
  min-height: 56px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
}
.faq__q:hover { background: var(--surface-2); }
.faq__q svg {
  width: 20px; height: 20px; flex: none;
  color: var(--text-muted);
  transition: transform var(--t-base);
}
.faq__q[aria-expanded="true"] svg { transform: rotate(45deg); }
.faq__a {
  padding: 0 var(--sp-5) var(--sp-5);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.faq__a[hidden] { display: none; }
.faq__a p + p { margin-top: var(--sp-3); }

/* ---------- 13. Breadcrumbs ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding-block: var(--sp-5) 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); text-decoration: underline; }
.crumbs li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.crumbs li + li::before { content: "/"; color: var(--text-faint); }
.crumbs [aria-current="page"] { color: var(--text-strong); font-weight: 600; }

/* ---------- 14. Prose (article content) ---------- */
.prose { max-width: 72ch; }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { font-size: var(--fs-xl); margin-top: var(--sp-10); }
.prose h3 { font-size: var(--fs-lg); margin-top: var(--sp-8); }
.prose p, .prose li { color: var(--text-muted); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--sp-2); }
.prose li::marker { color: var(--accent-text); }
.prose a { font-weight: 550; }

.formula {
  display: block;
  padding: var(--sp-5);
  border-radius: var(--r-md);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-strong);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.8;
}

.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.callout svg { width: 20px; height: 20px; flex: none; color: var(--accent-text); margin-top: 2px; }
.callout--warn { border-color: var(--warn-border); background: var(--warn-bg); }
.callout--warn svg { color: var(--warn); }

.example-table { font-size: var(--fs-sm); }
.example-table th, .example-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.example-table th { color: var(--text-strong); font-weight: 650; background: var(--surface-2); }
.example-table td { color: var(--text-muted); }
.example-table tbody tr:hover td { background: var(--surface-2); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }

/* ---------- 15. Related calculators strip ---------- */
.related { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.related__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  text-decoration: none;
  color: var(--text-strong);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast), background-color var(--t-fast), transform var(--t-fast);
}
.related__item:hover { border-color: var(--border-accent); background: var(--surface-2); transform: translateY(-2px); color: var(--text-strong); }
.related__item svg { width: 20px; height: 20px; color: var(--accent-text); flex: none; }

/* ---------- 16. CTA band ---------- */
.cta-band {
  text-align: center;
  padding: clamp(2rem, 5vw, 3.5rem);
  border-radius: var(--r-xl);
  background: var(--cta-band-bg);
  border: 1px solid var(--border-accent);
}
.cta-band h2 { font-size: var(--fs-xl); }
.cta-band p { color: var(--text-muted); margin-top: var(--sp-3); max-width: 52ch; margin-inline: auto; }
.cta-band .hero__actions { margin-top: var(--sp-6); }

/* ---------- 17. Footer ---------- */
.site-footer {
  margin-top: var(--sp-20);
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  padding-block: var(--sp-12) var(--sp-6);
}
.footer-grid {
  display: grid;
  gap: var(--sp-8);
  grid-template-columns: minmax(220px, 1.4fr) repeat(auto-fit, minmax(150px, 1fr));
}
.footer-col h3 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  margin-bottom: var(--sp-4);
}
.footer-col ul { display: grid; gap: var(--sp-2); }
.footer-col a {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-decoration: none;
}
.footer-col a:hover { color: var(--accent-text); text-decoration: underline; }
.footer-about p { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-4); max-width: 38ch; }

.social { display: flex; gap: var(--sp-2); margin-top: var(--sp-5); }
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}
.social a:hover { color: var(--accent-text); border-color: var(--border-accent); }
.social svg { width: 18px; height: 18px; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-10);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

/* ---------- 18. Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 300;
  display: grid;
  gap: var(--sp-2);
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-pill);
  background: var(--toast-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-strong);
  font-size: var(--fs-sm);
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toast-in 220ms cubic-bezier(.2,.8,.3,1);
}
.toast svg { width: 18px; height: 18px; color: var(--accent-text); flex: none; }
.toast.is-out { animation: toast-out 200ms forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- 19. Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--overlay);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal__panel {
  width: min(560px, 100%);
  max-height: min(80vh, 680px);
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  animation: modal-in 200ms cubic-bezier(.2,.8,.3,1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.modal__head h2 { font-size: var(--fs-lg); }

.shortcut-list { display: grid; gap: var(--sp-2); }
.shortcut-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.shortcut-list li:last-child { border-bottom: 0; }

/* ---------- 20. Back to top ---------- */
.to-top {
  position: fixed;
  right: var(--sp-5);
  bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--t-base), transform var(--t-base), visibility var(--t-base);
  backdrop-filter: blur(10px);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- 21. Stat strip ---------- */
.stats {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: var(--sp-10);
}
.stat {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.stat__value {
  font-size: var(--fs-xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--primary-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat__label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- 22. Print ---------- */
@media print {
  .site-header, .site-footer, .to-top, .toast-host, .calc-actions,
  .nav, .skip-link, .related, .cta-band, .modal, .search { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .glass, .calc-panel, .calc-result { border: 1px solid #ccc !important; background: #fff !important; box-shadow: none !important; }
  * { color: #000 !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 11px; color: #555 !important; }
  .print-head { display: block !important; }
  @page { margin: 16mm; }
}
.print-head { display: none; }
