/* ============================================================
   Calculator — "One Website. Every Calculation."
   Light OS-inspired theme (macOS / Windows 11): frosted glass,
   soft blurred gradients, blue/purple/teal/emerald accents.
   Full dark mode via [data-theme="dark"].
   Also ships the component contract used by generated
   calculator pages (.calc-* classes) + compat shims for the
   existing tools/*, guides, legal pages (not to be touched).
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg: #F5F7FA;
  --bg-2: #EEF2F7;
  --bg-3: #EAF0F8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --panel-strong: rgba(255, 255, 255, 0.92);
  --ink: #0e1a2e;
  --ink-soft: #33415c;
  --muted: #64748b;
  --line: rgba(14, 26, 46, 0.09);
  --line-soft: rgba(14, 26, 46, 0.055);
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --teal: #0d9488;
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --grad: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.12));
  --shadow: 0 18px 44px -18px rgba(14, 26, 46, 0.22);
  --shadow-sm: 0 8px 24px -12px rgba(14, 26, 46, 0.18);
  --shadow-lift: 0 30px 60px -20px rgba(14, 26, 46, 0.28);
  --radius: 20px;
  --radius-sm: 14px;
  --nav-h: 74px;
  --max: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --cat: #2563eb; /* per-category accent, overridden below */
}

[data-theme="dark"] {
  --bg: #0a1120;
  --bg-2: #0d1526;
  --bg-3: #101a30;
  --panel: rgba(18, 28, 48, 0.66);
  --panel-solid: #121c30;
  --panel-strong: rgba(18, 28, 48, 0.94);
  --ink: #eaf0fb;
  --ink-soft: #c2cde2;
  --muted: #8d9bb5;
  --line: rgba(234, 240, 251, 0.11);
  --line-soft: rgba(234, 240, 251, 0.06);
  --grad: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --grad-soft: linear-gradient(135deg, rgba(59,130,246,.16), rgba(139,92,246,.16));
  --shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

/* Per-category accent (used by generated calculator pages) */
body[data-category="math"]       { --cat: #2563eb; }
body[data-category="finance"]    { --cat: #059669; }
body[data-category="health"]     { --cat: #e11d48; }
body[data-category="conversion"] { --cat: #d97706; }
body[data-category="education"]  { --cat: #7c3aed; }
body[data-category="home"]       { --cat: #0d9488; }
body[data-category="tech"]       { --cat: #4f46e5; }
body[data-category="travel"]     { --cat: #0284c7; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Soft blurred OS-style gradient wash */
body::before {
  content: "";
  position: fixed;
  inset: -20vh -20vw;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(44rem 30rem at 12% 8%,  rgba(37,99,235,.16),  transparent 60%),
    radial-gradient(40rem 28rem at 88% 12%, rgba(124,58,237,.15), transparent 60%),
    radial-gradient(46rem 32rem at 50% 100%,rgba(13,148,136,.13), transparent 60%),
    radial-gradient(30rem 22rem at 78% 62%, rgba(5,150,105,.10),  transparent 60%);
  filter: blur(10px);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(44rem 30rem at 12% 8%,  rgba(59,130,246,.20),  transparent 60%),
    radial-gradient(40rem 28rem at 88% 12%, rgba(139,92,246,.18), transparent 60%),
    radial-gradient(46rem 32rem at 50% 100%,rgba(45,212,191,.10),  transparent 60%),
    radial-gradient(30rem 22rem at 78% 62%, rgba(16,185,129,.08),  transparent 60%);
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; height: auto; }
::selection { background: rgba(37,99,235,.22); }
section { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* ---------- 3. Glass panel utility ---------- */
.glass {
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* ---------- 4. Header — floating glass nav ---------- */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 200;
  width: calc(100% - 28px);
  max-width: 1400px;
  margin: 14px auto 0;
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel-strong) 84%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--line);
  box-shadow:
    0 24px 60px -20px rgba(14,26,46,.30),
    0 4px 14px -6px rgba(14,26,46,.12),
    inset 0 1px 0 rgba(255,255,255,.55);
}
[data-theme="dark"] .site-header {
  box-shadow:
    0 24px 60px -20px rgba(0,0,0,.65),
    0 4px 14px -6px rgba(0,0,0,.4),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  position: relative;
  overflow: hidden;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(37,99,235,.7), inset 0 1px 0 rgba(255,255,255,.35);
  flex: 0 0 auto;
}
.logo-mark svg { width: 23px; height: 23px; }
.logo-mark::after {
  content: "";
  position: absolute;
  inset: -45%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.6) 50%, transparent 58%);
  transform: translateX(-130%) rotate(0.001deg);
  pointer-events: none;
}
.site-header.nav-in .logo-mark::after { animation: logoSweep 1.2s ease .35s 1; }
.logo:hover .logo-mark::after { animation: logoSweep .9s ease 1; }
@keyframes logoSweep { to { transform: translateX(130%) rotate(0.001deg); } }
.main-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px 12px 6px 2px;
}
.main-nav::-webkit-scrollbar { display: none; }
/* Edge fade = scroll affordance when tabs overflow (kept narrow so it never washes out a label) */
.main-nav.nav-scrollable {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent 100%);
}
.main-nav a {
  position: relative;
  z-index: 1;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .82rem;
  padding: 8px 9px;
  border-radius: 12px;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: transform .18s ease, color .18s ease, background .18s ease, box-shadow .22s ease;
}
.nav-boot .main-nav a { opacity: 0; }
.site-header.nav-in .main-nav a {
  animation: navTabIn .55s cubic-bezier(.22,1,.36,1) forwards;
  animation-delay: calc(var(--ti, 0) * 65ms);
}
@keyframes navTabIn {
  from { opacity: 0; translate: 30px 0; }
  to { opacity: 1; translate: 0 0; }
}
.main-nav a:hover {
  background: var(--line-soft);
  text-decoration: none;
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(37,99,235,.5);
}
.main-nav a.active {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 22px -10px rgba(37,99,235,.65), inset 0 1px 0 rgba(255,255,255,.35);
}
.main-nav a.active:hover { color: #fff; transform: translateY(-2px); }
/* sliding gradient indicator */
.nav-ind {
  position: absolute;
  bottom: 2px;
  height: 3px;
  border-radius: 999px;
  background: var(--grad);
  box-shadow: 0 2px 12px rgba(37,99,235,.55);
  opacity: 0;
  transition: left .32s cubic-bezier(.22,1,.36,1), width .32s cubic-bezier(.22,1,.36,1), opacity .25s ease;
  pointer-events: none;
  z-index: 0;
}
.nav-ind.on { opacity: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 12px -6px rgba(14,26,46,.18);
  transition: transform .18s ease, box-shadow .22s ease, color .18s ease, background .18s ease;
}
.icon-btn:hover {
  color: var(--brand);
  box-shadow: 0 12px 24px -10px rgba(37,99,235,.55), inset 0 1px 0 rgba(255,255,255,.6);
  transform: translateY(-2px);
  text-decoration: none;
}
.icon-btn:active { transform: translateY(0) scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }
.nav-menu { display: none; }

/* Profile popover */
.profile-wrap { position: relative; }
.profile-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 300;
}
.profile-popover[hidden] { display: none; }
.profile-title { font-weight: 700; margin: 0 0 10px; font-size: .95rem; }
.profile-popover .calc-input { margin-bottom: 10px; }
.profile-note { font-size: .78rem; color: var(--muted); margin: 10px 0 0; }
.profile-hello { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- 5. Buttons ---------- */
.btn, .calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 14px;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 12px 26px -12px rgba(59, 99, 246, .75);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover, .calc-btn:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }
.btn:active, .calc-btn:active { transform: translateY(0); }
.btn-ghost {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.btn-sm { min-height: 40px; padding: 0 16px; font-size: .9rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* Favorite heart on cards */
.fav-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease, color .15s ease;
}
.fav-btn:hover { transform: scale(1.08); color: var(--rose); }
.fav-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.fav-btn[aria-pressed="true"] { color: var(--rose); border-color: rgba(225,29,72,.4); }
.fav-btn[aria-pressed="true"] svg { fill: var(--rose); stroke: var(--rose); }

/* Copy / print buttons for calculator pages */
.copy-btn, .print-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.copy-btn:hover, .print-btn:hover { color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- 6. Hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px 20px 40px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--brand);
  background: var(--grad-soft);
  border: 1px solid var(--line);
  padding: 8px 18px;
  border-radius: 999px;
  margin: 0 0 22px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 850;
  margin: 0 0 18px;
}
.hero h1 .h-grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 34px;
}
/* AI search bar */
.hero-search {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 22px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero-search .search-glyph {
  width: 22px; height: 22px; margin: 11px 0 11px 12px;
  color: var(--muted); flex: 0 0 auto;
}
.hero-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  outline: none;
  min-height: 44px;
}
.hero-search input::placeholder { color: var(--muted); }
.hero-search .calc-btn { border-radius: 15px; white-space: nowrap; width: auto; }
.suggest {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; right: 0;
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 250;
  text-align: left;
}
.suggest[hidden] { display: none; }
.suggest-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 16px;
  min-height: 52px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item.active { background: var(--grad-soft); }
.suggest-item .s-name { font-weight: 600; display: block; }
.suggest-item .s-tag { font-size: .78rem; color: var(--muted); display: block; }
.suggest-item .s-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-cat, var(--brand)); flex: 0 0 auto; }
/* Popular chips */
.chips { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.chips-label { color: var(--muted); font-size: .9rem; font-weight: 600; }
.chip {
  min-height: 44px;
  display: inline-flex; align-items: center;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .9rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.chip:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--ink); }
/* Trust row */
.trust-row {
  list-style: none;
  margin: 34px auto 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  justify-content: center;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
}
.trust-row li { display: inline-flex; align-items: center; gap: 8px; }
.trust-row svg { width: 17px; height: 17px; color: var(--emerald); }

/* ---------- 7. Sections / tiles ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: 44px 20px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-head p { color: var(--muted); margin: 0; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.cat-tile {
  position: relative;
  border-radius: 22px;
  padding: 30px 24px 26px;
  min-height: 215px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color .25s ease;
}
.cat-tile::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tile, var(--brand)) 12%, transparent), transparent 55%);
  opacity: .9;
  pointer-events: none;
}
.cat-tile:hover {
  text-decoration: none;
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--tile, var(--brand)) 48%, transparent);
  box-shadow:
    0 32px 64px -22px color-mix(in srgb, var(--tile, var(--brand)) 45%, transparent),
    var(--shadow-lift);
}
.cat-tile > * { position: relative; }
.cat-icon {
  width: 76px; height: 76px;
  border-radius: 21px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tile, var(--brand)), color-mix(in srgb, var(--tile, var(--brand)) 58%, #7c3aed));
  color: #fff;
  margin-bottom: 8px;
  box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--tile, var(--brand)) 65%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.cat-icon::after {
  content: "";
  position: absolute; inset: -45%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.55) 50%, transparent 58%);
  transform: translateX(-130%);
  pointer-events: none;
}
.cat-tile:hover .cat-icon { transform: scale(1.08) rotate(-2deg); }
.cat-tile:hover .cat-icon::after { animation: logoSweep .8s ease 1; }
.cat-icon svg { width: 36px; height: 36px; }
.cat-tile h3 { margin: 0; font-size: 1.18rem; letter-spacing: -.01em; }
.cat-count {
  font-size: .78rem; font-weight: 700;
  color: var(--tile, var(--brand));
  text-transform: uppercase; letter-spacing: .08em;
}
.cat-tag { color: var(--muted); font-size: .92rem; margin: 0; }
.cat-arrow { margin-top: auto; padding-top: 10px; font-weight: 700; font-size: .92rem; color: var(--tile, var(--brand)); }
.tiles-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- 8. Featured cards ---------- */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feat-card {
  border-radius: 22px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink);
  min-height: 300px;
  overflow: hidden;
  position: relative;
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color .25s ease;
}
.feat-card:hover {
  text-decoration: none;
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--tile, #2563eb) 48%, transparent);
  box-shadow:
    0 32px 64px -22px color-mix(in srgb, var(--tile, #2563eb) 45%, transparent),
    var(--shadow-lift);
}
.feat-art {
  height: 150px;
  border-radius: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tile, #2563eb) 24%, transparent),
    color-mix(in srgb, var(--tile, #2563eb) 7%, transparent));
  border: 1px solid color-mix(in srgb, var(--tile, #2563eb) 22%, transparent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
}
.feat-art::after {
  content: "";
  position: absolute; inset: -45%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.5) 50%, transparent 58%);
  transform: translateX(-130%);
  pointer-events: none;
}
.feat-card:hover .feat-art::after { animation: logoSweep .8s ease 1; }
.feat-art svg {
  width: 84px; height: 84px;
  filter: drop-shadow(0 12px 18px color-mix(in srgb, var(--tile, #2563eb) 38%, transparent));
  transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.feat-card:hover .feat-art svg { transform: scale(1.1) rotate(-2deg); }
.feat-card h3 { margin: 0; font-size: 1.18rem; letter-spacing: -.01em; }
.feat-card p { color: var(--muted); font-size: .94rem; margin: 0; flex: 1; }
.feat-cta { font-weight: 700; color: var(--tile, var(--brand)); font-size: .95rem; }

/* ---------- 9. Directory cards ---------- */
.dir-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.dir-card {
  border-radius: 22px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 28px 26px;
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color .25s ease;
}
.dir-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--tile, var(--brand)) 45%, transparent);
  box-shadow:
    0 28px 56px -22px color-mix(in srgb, var(--tile, var(--brand)) 42%, transparent),
    var(--shadow-lift);
}
.dir-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.dir-head .cat-icon { width: 58px; height: 58px; margin: 0; border-radius: 17px; flex: 0 0 auto; }
.dir-head .cat-icon svg { width: 28px; height: 28px; }
.dir-head h3 { margin: 0; font-size: 1.1rem; }
.dir-count { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--muted);
  background: var(--line-soft); padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.dir-links { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.dir-links a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px;
  min-height: 44px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: .95rem;
  border-bottom: 1px solid var(--line-soft);
}
.dir-links a:last-child { border-bottom: 0; }
.dir-links a:hover { color: var(--tile, var(--brand)); text-decoration: none; }
.dir-all { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-weight: 700; color: var(--tile, var(--brand)); min-height: 44px; }

/* ---------- 10. Footer ---------- */
.site-footer {
  margin-top: 60px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.footer-grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 52px 20px 30px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 34px;
}
.footer-brand p { color: var(--muted); font-size: .95rem; }
.footer-brand .logo { margin-bottom: 12px; }
.footer-tagline { font-weight: 600; color: var(--ink-soft); }
.footer-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 16px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-col a { color: var(--ink-soft); font-size: .95rem; min-height: 44px; display: inline-flex; align-items: center; padding: 6px 0; }
.footer-col a:hover { color: var(--ink); }
.newsletter-form { display: flex; gap: 8px; margin-top: 6px; }
.newsletter-form input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 0 14px;
  min-height: 44px;
  font: inherit;
  color: var(--ink);
}
.social-row { display: flex; gap: 10px; margin-top: 18px; }
.social-row a {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--panel);
}
.social-row a:hover { color: var(--ink); box-shadow: var(--shadow-sm); }
.social-row svg { width: 19px; height: 19px; }
.footer-bottom {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 20px 28px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .88rem;
}

/* ---------- 11. Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0;
  z-index: 400;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  padding: 12vh 20px 20px;
}
.search-overlay[hidden] { display: none; }
.search-panel {
  width: min(620px, 100%);
  height: fit-content;
  max-height: 70vh;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
}
.search-panel input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 0 18px;
  min-height: 52px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  outline: none;
}
.search-results { margin-top: 12px; display: grid; }
.search-hint { color: var(--muted); font-size: .9rem; padding: 14px 6px; }

/* ---------- 12. Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 40px));
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: none; }

/* ============================================================
   13. CALCULATOR PAGE COMPONENT CONTRACT
   (generated calculator pages use these classes)
   ============================================================ */
.breadcrumbs {
  font-size: .88rem;
  color: var(--muted);
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--ink); }
.calc-hero { text-align: center; max-width: 720px; margin: 0 auto 34px; }
.eyebrow-chip {
  display: inline-block;
  font-size: .76rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--cat);
  background: color-mix(in srgb, var(--cat) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat) 28%, transparent);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.calc-hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); margin-bottom: 14px; }
.calc-hero .lede { color: var(--muted); font-size: 1.08rem; margin: 0; }

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: start;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px 20px;
}
.calc-device {
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  position: relative;
  overflow: hidden;
}
.calc-device::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--cat), var(--brand-2));
}
.calc-field { margin-bottom: 18px; }
.calc-field label {
  display: block;
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 8px;
  color: var(--ink);
}
.calc-input, .calc-select {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.calc-input:focus, .calc-select:focus {
  border-color: var(--cat);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 22%, transparent);
}
.calc-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.input-wrap { display: flex; gap: 8px; align-items: stretch; }
.input-wrap .calc-input { flex: 1; }
.unit-chip {
  display: inline-flex; align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
}
.calc-btn { width: 100%; margin-top: 6px; background: linear-gradient(135deg, var(--cat), var(--brand-2)); }

.calc-results {
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 26px 24px;
  min-height: 200px;
}
.result-display {
  background: linear-gradient(160deg, #101b30, #0a1222);
  border-radius: var(--radius-sm);
  padding: 30px 24px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 2px 18px rgba(0,0,0,.45);
  margin-bottom: 20px;
}
.result-label { color: #93a4c4; font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.result-hero-num {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #7df9c9;
  text-shadow: 0 0 18px rgba(125, 249, 201, .55), 0 0 42px rgba(125, 249, 201, .25);
  word-break: break-all;
}
.result-sub { color: #93a4c4; font-size: .9rem; margin-top: 8px; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-tile {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 14px 16px;
}
.stat-tile .sv { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.stat-tile .sl { font-size: .8rem; color: var(--muted); font-weight: 600; }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  min-height: 48px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .96rem;
}
.result-row:last-child { border-bottom: 0; }
.result-row .rv-label { color: var(--muted); font-weight: 600; }
.result-row .rv-value { font-family: var(--font-mono); font-weight: 700; color: var(--ink); text-align: right; }

.formula-box {
  border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--cat) 45%, transparent);
  background: color-mix(in srgb, var(--cat) 7%, transparent);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: .95rem;
  color: var(--ink-soft);
  margin: 20px 0;
  overflow-x: auto;
}
.formula-box .f-var { color: var(--cat); font-weight: 700; }

.calc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* FAQ (details/summary) */
/* FAQ — premium accordion */
.faq-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,.45));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(30,42,69,.05);
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow .25s ease, border-color .25s ease, transform .25s ease;
}
.faq-item:hover {
  border-color: var(--accent-soft, #c7d6f5);
  box-shadow: 0 8px 24px rgba(30,42,69,.09);
  transform: translateY(-1px);
}
.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  min-height: 60px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-q {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -.01em;
}
.faq-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft, #e8effe);
  color: var(--accent, #2f6df6);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .25s ease, color .25s ease;
}
.faq-icon svg { width: 18px; height: 18px; }
.faq-item[open] { border-color: var(--accent-soft, #c7d6f5); }
.faq-item[open] .faq-icon {
  transform: rotate(135deg);
  background: var(--accent, #2f6df6);
  color: #fff;
}
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s cubic-bezier(.4,0,.2,1);
}
.faq-item[open] .faq-a { grid-template-rows: 1fr; }
.faq-a > p {
  overflow: hidden;
  margin: 0;
  padding: 0 22px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.faq-item[open] .faq-a > p { padding-bottom: 20px; }
[data-theme="dark"] .faq-item {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

/* Related calculators */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.rel-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 20px 18px;
  color: var(--ink);
  display: block;
  transition: transform .18s ease, box-shadow .18s ease;
}
.rel-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-sm); }
.rel-card h4 { margin: 0 0 6px; font-size: 1rem; }
.rel-card p { margin: 0; font-size: .88rem; color: var(--muted); }

/* Big iLovePDF-style tool cards (category pages + related calculators) */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 215px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow-sm);
  padding: 28px 24px 24px;
  color: var(--ink);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color .25s ease;
}
.tool-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tile, var(--brand)) 10%, transparent), transparent 55%);
  pointer-events: none;
}
.tool-card:hover {
  text-decoration: none;
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--tile, var(--brand)) 48%, transparent);
  box-shadow:
    0 32px 64px -22px color-mix(in srgb, var(--tile, var(--brand)) 45%, transparent),
    var(--shadow-lift);
}
.tool-card > * { position: relative; }
.tool-ic {
  width: 74px; height: 74px;
  border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tile, var(--brand)), color-mix(in srgb, var(--tile, var(--brand)) 58%, #7c3aed));
  color: #fff;
  box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--tile, var(--brand)) 65%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.tool-ic::after {
  content: "";
  position: absolute; inset: -45%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.55) 50%, transparent 58%);
  transform: translateX(-130%);
  pointer-events: none;
}
.tool-card:hover .tool-ic { transform: scale(1.08) rotate(-2deg); }
.tool-card:hover .tool-ic::after { animation: logoSweep .8s ease 1; }
.tool-ic svg { width: 35px; height: 35px; }
.tool-tx h3 { margin: 0 0 6px; font-size: 1.12rem; letter-spacing: -.01em; }
.tool-tx p { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.55; }
.tool-go {
  margin-top: auto;
  padding-top: 10px;
  font-weight: 700;
  font-size: .92rem;
  color: var(--tile, var(--brand));
}

.content-section { max-width: 860px; margin: 0 auto; padding: 24px 20px; }
.content-section h2 { margin-top: 8px; }

/* ============================================================
   14. Favorites page
   ============================================================ */
.fav-list { display: grid; gap: 14px; max-width: 860px; margin: 0 auto; }
.fav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.fav-card .cat-icon { width: 46px; height: 46px; margin: 0; border-radius: 13px; flex: 0 0 auto; }
.fav-card .cat-icon svg { width: 23px; height: 23px; }
.fav-card .fav-info { flex: 1; min-width: 0; }
.fav-card .fav-info a { font-weight: 700; color: var(--ink); font-size: 1.02rem; }
.fav-card .fav-info a:hover { color: var(--brand); }
.fav-card .fav-info .s-tag { font-size: .82rem; color: var(--muted); }
.empty-state {
  text-align: center;
  padding: 70px 24px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--panel);
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
}
.empty-state svg { width: 56px; height: 56px; color: var(--muted); opacity: .5; margin-bottom: 14px; }
.empty-state h2 { color: var(--ink); }

/* ---------- 15. Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 16. Focus ---------- */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 8px;
}
[data-theme="dark"] :focus-visible { outline-color: #7aa7ff; }

/* ---------- 17. Compat shims — existing tools/*, guides, legal pages ----------
   These pages are NOT rewritten; keep their layout working under the new theme. */
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.nav-inner {
  max-width: var(--max); margin: 0 auto; height: var(--nav-h);
  padding: 0 20px; display: flex; align-items: center; gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a { color: var(--ink-soft); font-weight: 600; padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.nav-links a:hover, .nav-links a.active { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav-cta { margin-left: 8px; }
.nav-toggle { display: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.section { padding-top: 36px; padding-bottom: 36px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--panel-strong); font: inherit; color: var(--ink);
}
.field-error { color: var(--rose); font-size: .85rem; margin-top: 6px; min-height: 1.2em; }
.input-row { display: flex; gap: 8px; }
.stat { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); min-height: 48px; }
.stat .sv { font-family: var(--font-mono); font-weight: 700; }
.stat .sl { color: var(--muted); font-weight: 600; font-size: .9rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.related-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 18px; color: var(--ink); display: block; }
.related-card:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.faq-list { max-width: 860px; margin: 0 auto; }
.faq-q { list-style: none; }
.faq-a { color: var(--ink-soft); }
.disclaimer { font-size: .88rem; color: var(--muted); }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.lede { color: var(--muted); font-size: 1.08rem; }
.small { font-size: .85rem; color: var(--muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.tag { display: inline-block; font-size: .76rem; font-weight: 700; background: var(--grad-soft); color: var(--brand); border-radius: 999px; padding: 4px 12px; }
.read-time { font-size: .82rem; color: var(--muted); }
.post-card, .card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 20px; color: var(--ink); display: block; box-shadow: var(--shadow-sm); }
.post-card:hover, .card:hover { text-decoration: none; box-shadow: var(--shadow); }
.article-body { color: var(--ink-soft); }
.article-hero { text-align: center; padding: 40px 20px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
table.data th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.grid { display: grid; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hint { font-size: .85rem; color: var(--muted); }
.kbd-note { font-size: .85rem; color: var(--muted); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); font-weight: 600; cursor: pointer; }
.tab.active { background: var(--grad); color: #fff; border-color: transparent; }
.bmi-scale { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg,#3b82f6,#22c55e 30%,#eab308 55%,#f97316 75%,#ef4444); }
.bmi-marker { position: absolute; top: -4px; width: 4px; height: 22px; background: var(--ink); border-radius: 2px; }
.bmi-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.calc-wrap { max-width: 560px; margin: 0 auto; }
.result-hero { text-align: center; }
.f-op { font-family: var(--font-mono); }
.f-var { color: var(--cat); font-weight: 700; }

/* ---------- 18. Responsive ---------- */
@media (max-width: 1020px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .main-nav {
    position: fixed;
    top: calc(14px + var(--nav-h) + 10px);
    right: 14px;
    left: auto;
    width: min(340px, calc(100vw - 28px));
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    padding: 14px;
    background: color-mix(in srgb, var(--panel-strong) 92%, transparent);
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    backdrop-filter: blur(26px) saturate(1.5);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 34px 70px -20px rgba(14,26,46,.4);
    opacity: 0;
    transform: translateX(28px);
    pointer-events: none;
    transition: opacity .28s ease, transform .34s cubic-bezier(.22,1,.36,1);
  }
  .main-nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .main-nav a { padding: 13px 16px; font-size: 1rem; }
  .main-nav.open a {
    animation: drawerIn .42s cubic-bezier(.22,1,.36,1) backwards;
    animation-delay: calc(var(--di, 0) * 45ms);
  }
  @keyframes drawerIn {
    from { opacity: 0; translate: 20px 0; }
    to { opacity: 1; translate: 0 0; }
  }
  .nav-menu { display: inline-flex; }
  .nav-ind { display: none; }
  .calc-layout { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .cat-tile { padding: 18px 14px; }
  .feat-grid { grid-template-columns: 1fr; }
  .dir-grid { grid-template-columns: 1fr; }
  .hero { padding: 52px 16px 30px; }
  .hero-search { flex-wrap: wrap; }
  .hero-search .calc-btn { width: 100%; }
  .hero-search .search-glyph { display: none; }
  .related-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .grid-3, .two-col { grid-template-columns: 1fr; }
  .fav-card { flex-wrap: wrap; }
  .search-overlay { padding-top: 8vh; }
}

/* ---------- 19. Print (clean results) ---------- */
@media print {
  body::before { display: none; }
  .site-header, .site-footer, .hero-search, .search-overlay, .toast-stack,
  .breadcrumbs, .calc-actions, .fav-btn, .newsletter-form, .social-row,
  .chips, .suggest, .profile-popover, .related-grid, .faq-item { display: none !important; }
  body { background: #fff; color: #000; }
  .calc-layout { display: block; }
  .calc-device, .calc-results, .result-display {
    box-shadow: none; border: 1px solid #ccc;
    -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff;
  }
  .result-display { background: #f4f6f9; }
  .result-hero-num { color: #000; text-shadow: none; }
  .result-label, .result-sub { color: #333; }
  .calc-hero .lede { color: #333; }
  a { color: #000; text-decoration: none; }
}

/* ---------- 20. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .site-header .main-nav a { opacity: 1 !important; animation: none !important; transform: none !important; }
  .nav-ind, .logo-mark::after { display: none !important; }
}
