/* ==========================================================================
   SITE NAME: "Healthy Man"  (rename here + SITE.name in js/config.js)
   style.css — global design system
   --------------------------------------------------------------------------
   01. Design tokens — light          10. Mobile drawer
   02. Design tokens — dark           11. Search overlay & results
   03. Reset & base                   12. Footer
   04. Typography                     13. Page components (breadcrumb, page hero,
   05. Layout & utilities                 prose, tables, FAQ, callouts, CTA)
   06. Buttons, badges, cards         14. Home page sections
   07. Forms (base)                   15. All Tools filters, toast, back-to-top
   08. Header & navigation            16. Motion, reduced motion, print
   09. Mega menu
   Breakpoints: 480 · 768 · 992 · 1200 · 1440 (mobile-first, min-width)
   ========================================================================== */

/* ==========================================================================
   01. Design tokens — light
   ========================================================================== */
:root {
  /* Brand palette */
  --brand: #10b981;            /* fresh emerald (decorative, icons, glows) */
  --brand-strong: #047857;     /* AA text/buttons on light backgrounds */
  --brand-deep: #065f46;
  --teal: #0f766e;
  --navy: #0b1b33;
  --accent: #f97362;           /* coral highlight */
  --accent-ink: #b93a2b;
  --violet: #7c3aed;

  /* Surfaces & text */
  --bg: #f5f9f8;
  --bg-alt: #ecf4f2;
  --surface: #ffffff;
  --surface-2: #f6faf9;
  --surface-hover: rgba(11, 27, 51, 0.05);
  --surface-glass: rgba(255, 255, 255, 0.74);
  --surface-glass-strong: rgba(255, 255, 255, 0.86);
  --input-bg: #ffffff;
  --text: #0b1b33;
  --text-muted: #44546a;
  --text-subtle: #5a6a7f;
  --border: #e1e9ee;
  --border-strong: #c9d5de;
  --link: #047857;
  --link-hover: #065f46;
  --brand-soft: #e7f8f1;
  --ring: rgba(16, 185, 129, 0.28);
  --focus: #047857;
  --grid-dot: rgba(11, 27, 51, 0.07);

  /* Buttons */
  --primary-bg: linear-gradient(135deg, #047857 0%, #0f766e 100%);
  --primary-bg-hover: linear-gradient(135deg, #065f46 0%, #115e59 100%);
  --on-primary: #ffffff;
  --primary-glow: rgba(4, 120, 87, 0.45);

  /* Gradient text */
  --text-gradient: linear-gradient(120deg, #047857 0%, #0369a1 55%, #7c3aed 100%);

  /* Status colours (ink = text on tinted bg, fill = gauges/bars) */
  --good-ink: #047857;   --good-bg: #ecfdf5;   --good-border: #a7f3d0;   --good-fill: #10b981;
  --info-ink: #1d4ed8;   --info-bg: #eff6ff;   --info-border: #bfdbfe;   --info-fill: #3b82f6;
  --caution-ink: #a16207; --caution-bg: #fefce8; --caution-border: #fde68a; --caution-fill: #eab308;
  --warning-ink: #c2410c; --warning-bg: #fff7ed; --warning-border: #fed7aa; --warning-fill: #f97316;
  --danger-ink: #b91c1c; --danger-bg: #fef2f2;  --danger-border: #fecaca;  --danger-fill: #ef4444;

  /* Category accents */
  --cat-body: #0ea5e9;    --cat-body-ink: #0369a1;
  --cat-fitness: #f97316; --cat-fitness-ink: #c2410c;
  --cat-women: #ec4899;   --cat-women-ink: #be185d;
  --cat-mind: #8b5cf6;    --cat-mind-ink: #6d28d9;
  --cat: var(--brand);
  --cat-ink: var(--brand-strong);

  /* Chart palette */
  --chart-1: #10b981; --chart-2: #3b82f6; --chart-3: #f97316;
  --chart-4: #8b5cf6; --chart-5: #ec4899; --chart-6: #eab308;

  /* Footer (navy in both themes) */
  --footer-bg: #0b1b33;
  --footer-bg-2: #0f2442;
  --footer-text: #b9c6d8;
  --footer-heading: #ffffff;
  --footer-border: rgba(255, 255, 255, 0.1);

  /* Typography */
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem);
  --fs-2xl: clamp(1.625rem, 1.35rem + 1.2vw, 2.125rem);
  --fs-3xl: clamp(2rem, 1.55rem + 2vw, 2.875rem);
  --fs-4xl: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);

  /* Spacing scale */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.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;

  /* Radius */
  --r-sm: 8px; --r: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(11, 27, 51, 0.05);
  --shadow-sm: 0 2px 8px -2px rgba(11, 27, 51, 0.08), 0 1px 2px rgba(11, 27, 51, 0.04);
  --shadow-md: 0 10px 30px -12px rgba(11, 27, 51, 0.16), 0 2px 6px -2px rgba(11, 27, 51, 0.06);
  --shadow-lg: 0 22px 48px -18px rgba(11, 27, 51, 0.22), 0 4px 10px -4px rgba(11, 27, 51, 0.06);
  --shadow-xl: 0 32px 70px -24px rgba(11, 27, 51, 0.3), 0 8px 18px -8px rgba(11, 27, 51, 0.08);

  /* Layout & motion */
  --header-h: 64px;
  --container: 1240px;
  --gutter: 16px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --scrollbar-gap: 0px;

  color-scheme: light;
}

@media (min-width: 768px) { :root { --gutter: 24px; } }
@media (min-width: 992px) { :root { --header-h: 72px; --gutter: 32px; } }

/* ==========================================================================
   02. Design tokens — dark
   ========================================================================== */
[data-theme='dark'] {
  --bg: #0a1120;
  --bg-alt: #0d1628;
  --surface: #111b2e;
  --surface-2: #15213a;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-glass: rgba(10, 17, 32, 0.72);
  --surface-glass-strong: rgba(17, 27, 46, 0.86);
  --input-bg: #0e1729;
  --text: #e8eef7;
  --text-muted: #a9b7ca;
  --text-subtle: #91a0b6;
  --border: #1f2c45;
  --border-strong: #2d3d5b;
  --link: #34d399;
  --link-hover: #6ee7b7;
  --brand-soft: rgba(16, 185, 129, 0.13);
  --ring: rgba(52, 211, 153, 0.3);
  --focus: #34d399;
  --grid-dot: rgba(255, 255, 255, 0.06);

  --primary-bg: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  --primary-bg-hover: linear-gradient(135deg, #34d399 0%, #2dd4bf 100%);
  --on-primary: #04271d;
  --primary-glow: rgba(16, 185, 129, 0.45);

  --text-gradient: linear-gradient(120deg, #34d399 0%, #38bdf8 55%, #a78bfa 100%);

  --good-ink: #6ee7b7;    --good-bg: rgba(16, 185, 129, 0.13);  --good-border: rgba(16, 185, 129, 0.35);
  --info-ink: #93c5fd;    --info-bg: rgba(59, 130, 246, 0.14);  --info-border: rgba(59, 130, 246, 0.38);
  --caution-ink: #fde047; --caution-bg: rgba(234, 179, 8, 0.13); --caution-border: rgba(234, 179, 8, 0.35);
  --warning-ink: #fdba74; --warning-bg: rgba(249, 115, 22, 0.13); --warning-border: rgba(249, 115, 22, 0.38);
  --danger-ink: #fca5a5;  --danger-bg: rgba(239, 68, 68, 0.14);  --danger-border: rgba(239, 68, 68, 0.4);
  --good-fill: #34d399; --info-fill: #60a5fa; --caution-fill: #facc15; --warning-fill: #fb923c; --danger-fill: #f87171;

  --cat-body: #38bdf8;    --cat-body-ink: #7dd3fc;
  --cat-fitness: #fb923c; --cat-fitness-ink: #fdba74;
  --cat-women: #f472b6;   --cat-women-ink: #f9a8d4;
  --cat-mind: #a78bfa;    --cat-mind-ink: #c4b5fd;
  --cat-ink: var(--link);

  --chart-1: #34d399; --chart-2: #60a5fa; --chart-3: #fb923c;
  --chart-4: #a78bfa; --chart-5: #f472b6; --chart-6: #facc15;

  --footer-bg: #070d19;
  --footer-bg-2: #0a1324;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 48px -18px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 32px 70px -24px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* Category accent variables (used by cards, icons, menus) */
[data-cat='body']    { --cat: var(--cat-body);    --cat-ink: var(--cat-body-ink); }
[data-cat='fitness'] { --cat: var(--cat-fitness); --cat-ink: var(--cat-fitness-ink); }
[data-cat='women']   { --cat: var(--cat-women);   --cat-ink: var(--cat-women-ink); }
[data-cat='mind']    { --cat: var(--cat-mind);    --cat-ink: var(--cat-mind-ink); }

/* ==========================================================================
   03. Reset & base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

main { flex: 1 0 auto; display: block; }
main:focus { outline: none; }

img, picture, video, canvas { display: block; max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
.icon { width: 1.25em; height: 1.25em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }

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

::selection { background: rgba(16, 185, 129, 0.25); color: inherit; }

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

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 0.1em 0.45em;
  font: 600 0.72rem/1.4 var(--font-body);
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
}

/* Scroll lock (drawer / search overlay open) */
html.scroll-locked { overflow: hidden; }
html.scroll-locked body { padding-right: var(--scrollbar-gap); }

/* ==========================================================================
   04. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); font-weight: 600; }
h4 { font-size: var(--fs-lg); font-weight: 600; }

p { margin: 0 0 var(--sp-4); }
p, li { text-wrap: pretty; }
small { font-size: var(--fs-sm); }
strong { font-weight: 700; }

.lead { font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem); color: var(--text-muted); line-height: 1.7; }
.muted { color: var(--text-muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: 0.35rem 0.85rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cat-ink);
  background: color-mix(in srgb, var(--cat) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat) 24%, transparent);
  border-radius: var(--r-full);
}

.text-gradient {
  background: var(--text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   05. Layout & utilities
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-narrow { max-width: 880px; }

.section { padding-block: clamp(3rem, 2rem + 4vw, 5.5rem); }
.section-sm { padding-block: clamp(2rem, 1.5rem + 2vw, 3.25rem); }
.section-alt { background: var(--bg-alt); }

.section-head {
  max-width: 720px;
  margin: 0 auto clamp(2rem, 1.5rem + 2vw, 3rem);
  text-align: center;
}
.section-head h2 { margin-bottom: var(--sp-3); }
.section-head p { margin: 0; color: var(--text-muted); font-size: var(--fs-md); }
.section-head-left { margin-inline: 0; text-align: left; }

.grid { display: grid; gap: clamp(1rem, 0.75rem + 1vw, 1.5rem); }
.tool-grid,
.grid-auto { display: grid; gap: clamp(1rem, 0.75rem + 1vw, 1.5rem); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stack > * + * { margin-top: var(--sp-4); }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary-bg);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
  text-decoration: none;
}
.skip-link:focus { transform: none; color: var(--on-primary); }

/* noscript fallback link list inside JS-rendered tool grids */
.noscript-links { grid-column: 1 / -1; margin: 0; padding-left: 1.25rem; columns: 2 220px; line-height: 2; }

/* noscript fallback nav */
.noscript-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 0.75rem var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

/* ==========================================================================
   06. Buttons, badges, cards
   ========================================================================== */
.btn {
  --btn-h: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--btn-h);
  padding: 0 1.4rem;
  font: 600 var(--fs-base)/1.1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--r-full);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover .icon-arrow { transform: translateX(3px); }
.btn .icon-arrow { transition: transform 0.2s var(--ease); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn[disabled],
.btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  color: var(--on-primary);
  background: var(--primary-bg);
  box-shadow: 0 8px 20px -8px var(--primary-glow);
}
.btn-primary:hover {
  color: var(--on-primary);
  background: var(--primary-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -10px var(--primary-glow);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  color: var(--link);
  border-color: color-mix(in srgb, var(--brand) 60%, var(--border-strong));
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost { color: var(--link); }
.btn-ghost:hover { color: var(--link-hover); background: var(--brand-soft); }

.btn-accent { color: #2b0b05; background: var(--accent); box-shadow: 0 8px 20px -8px rgba(249, 115, 98, 0.6); }
.btn-accent:hover { color: #2b0b05; background: #fb8a7b; transform: translateY(-2px); }

.btn-light { color: #064e3b; background: #ffffff; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.35); }
.btn-light:hover { color: #064e3b; background: #ecfdf5; transform: translateY(-2px); }

.btn-outline-light { color: #ffffff; border-color: rgba(255, 255, 255, 0.55); }
.btn-outline-light:hover { color: #ffffff; background: rgba(255, 255, 255, 0.12); border-color: #ffffff; }

.btn-danger { color: var(--danger-ink); background: var(--danger-bg); border-color: var(--danger-border); }
.btn-danger:hover { color: var(--danger-ink); border-color: var(--danger-ink); }

.btn-sm { --btn-h: 44px; padding: 0 1rem; font-size: var(--fs-sm); }
.btn-lg { --btn-h: 56px; padding: 0 1.75rem; font-size: var(--fs-md); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--link); }
.icon-btn .icon { width: 22px; height: 22px; }

/* Badges & pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.4;
  color: var(--link);
  background: var(--brand-soft);
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge-cat { color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 13%, transparent); }
.badge-neutral { color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); }
.badge .icon { width: 14px; height: 14px; }

/* Generic card */
.card {
  position: relative;
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-hover { transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* Tool card (generated by main.js) */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.5rem;
  overflow: hidden;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.tool-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--cat), transparent 85%);
  opacity: 0;
  transition: opacity 0.3s;
}
.tool-card::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 180px;
  top: -90px;
  right: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--cat) 16%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
}
.tool-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--cat) 40%, var(--border));
  box-shadow: var(--shadow-lg);
}
.tool-card:hover::before,
.tool-card:hover::after { opacity: 1; }
.tool-card:has(.stretched-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }

.tool-card-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-size: 1.65rem;
  line-height: 1;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border-radius: var(--r-md);
  transition: transform 0.35s var(--ease-spring);
}
.tool-card:hover .tool-card-icon { transform: scale(1.08) rotate(-5deg); }

.tool-card-title { margin: 0.15rem 0 0; font-size: var(--fs-lg); font-weight: 600; }
.tool-card-title a { color: var(--text); text-decoration: none; }
.tool-card-title a:focus-visible { outline: none; }
.stretched-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }

.tool-card-desc { flex: 1; margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.tool-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.35rem; }
.tool-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--cat-ink);
}
.tool-card-cta .icon { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.tool-card:hover .tool-card-cta .icon { transform: translateX(4px); }

/* Emoji icon square (menus, search) */
.tool-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
  line-height: 1;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border-radius: 10px;
}

/* ==========================================================================
   07. Forms (base — shared by contact page and tools)
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label,
.field > legend,
.label {
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}
.label-optional { font-weight: 500; color: var(--text-subtle); }

.input,
.field input:not([type='radio']):not([type='checkbox']):not([type='range']),
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 1rem;
  font-size: 1rem; /* ≥16px prevents iOS zoom */
  color: var(--text);
  background-color: var(--input-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.55; }

.input:hover,
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); }

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

.field ::placeholder { color: var(--text-subtle); opacity: 1; }

.field select {
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2344546a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 18px;
}
[data-theme='dark'] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b7ca' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Hide number spinners (cleaner inputs, units shown as suffix) */
.field input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.field input[type='number']::-webkit-outer-spin-button,
.field input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field input[type='date']::-webkit-calendar-picker-indicator,
.field input[type='time']::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
[data-theme='dark'] .field input[type='date']::-webkit-calendar-picker-indicator,
[data-theme='dark'] .field input[type='time']::-webkit-calendar-picker-indicator { filter: invert(1); }

input[type='checkbox'],
input[type='radio'],
input[type='range'] { accent-color: var(--brand-strong); }
[data-theme='dark'] input[type='checkbox'],
[data-theme='dark'] input[type='radio'],
[data-theme='dark'] input[type='range'] { accent-color: var(--brand); }

.field-hint { margin: 0; font-size: var(--fs-sm); color: var(--text-subtle); }

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--danger-ink);
}
.field-error:empty { display: none; }
.field-error::before {
  content: '!';
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: var(--danger-fill);
  border-radius: 50%;
}
.field.has-error input:not([type='radio']):not([type='checkbox']),
.field.has-error select,
.field.has-error textarea,
.field [aria-invalid='true'] { border-color: var(--danger-fill) !important; }
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-fill) 22%, transparent); }

.form-grid { display: grid; gap: var(--sp-5); }
@media (min-width: 480px) { .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .span-all { grid-column: 1 / -1; }

.form-success {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  color: var(--good-ink);
  background: var(--good-bg);
  border: 1px solid var(--good-border);
  border-radius: var(--r-md);
  font-weight: 600;
}

/* ==========================================================================
   08. Header & navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
}
/* Reserve height before layout.js injects the markup (prevents layout shift) */
#site-header:empty { display: block; height: var(--header-h); }

/* Glass background lives on a pseudo-element so fixed children are not trapped */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(170%) blur(16px);
  backdrop-filter: saturate(170%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s;
}
.site-header.is-scrolled::before,
.site-header.mega-open::before,
.site-header.drawer-open::before {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-md);
}
.site-header.drawer-open::before { background: var(--surface); }

.header-inner { display: flex; align-items: center; gap: 0.75rem; height: 100%; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-right: auto;
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r);
}
.brand:hover { color: var(--text); }
.brand-logo { width: 38px; height: 38px; transition: transform 0.4s var(--ease-spring); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-accent { color: var(--link); }
.brand-name { white-space: nowrap; }

.main-nav { display: none; }
.nav-list { display: flex; align-items: center; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 44px;
  padding: 0 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: var(--r-full);
  transition: color 0.2s, background-color 0.2s;
}
.nav-link:hover,
.nav-link[aria-expanded='true'] { color: var(--text); background: var(--surface-hover); }
.nav-link.is-active { color: var(--link); }
.nav-link.is-active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 18px;
  height: 3px;
  background: var(--brand);
  border-radius: 3px;
  transform: translateX(-50%);
}
.mega-toggle .icon-chevron { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.mega-toggle[aria-expanded='true'] .icon-chevron { transform: rotate(180deg); }

.header-actions { display: flex; align-items: center; gap: 0.25rem; }

.search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.search-trigger:hover { background: var(--surface-hover); color: var(--link); }
.search-trigger .icon { width: 21px; height: 21px; }
.search-trigger-text,
.search-trigger-kbd { display: none; }

/* Theme toggle: animated sun ⇄ moon */
.theme-icon { position: relative; display: block; width: 22px; height: 22px; }
.theme-icon .icon {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  transition: transform 0.5s var(--ease-spring), opacity 0.3s var(--ease);
}
.theme-icon .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.4); }
.theme-icon .icon-moon { opacity: 1; transform: none; }
[data-theme='dark'] .theme-icon .icon-sun { opacity: 1; transform: none; color: #fcd34d; }
[data-theme='dark'] .theme-icon .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }

/* Hamburger ⇄ X */
.burger-box { position: relative; display: block; width: 22px; height: 16px; }
.burger-box span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2.2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s var(--ease), top 0.3s var(--ease), opacity 0.2s;
}
.burger-box span:nth-child(1) { top: 0; }
.burger-box span:nth-child(2) { top: 7px; }
.burger-box span:nth-child(3) { top: 14px; }
.burger[aria-expanded='true'] .burger-box span:nth-child(1) { top: 7px; transform: rotate(45deg); }
.burger[aria-expanded='true'] .burger-box span:nth-child(2) { opacity: 0; transform: scaleX(0.2); }
.burger[aria-expanded='true'] .burger-box span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

@media (min-width: 992px) {
  .main-nav { display: block; }
  .burger { display: none; }
  .header-inner { gap: 1.25rem; }
}
@media (min-width: 1200px) {
  .search-trigger {
    width: auto;
    padding: 0 0.6rem 0 0.9rem;
    color: var(--text-subtle);
    background: var(--surface);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
  }
  .search-trigger:hover { background: var(--surface); border-color: var(--brand); color: var(--text); }
  .search-trigger .icon { width: 18px; height: 18px; }
  .search-trigger-text { display: inline; min-width: 8.5rem; text-align: left; }
  .search-trigger-kbd { display: inline-flex; }
}
@media (max-width: 359.98px) {
  .brand { font-size: 1.12rem; }
  .brand-logo { width: 34px; height: 34px; }
}

/* ==========================================================================
   09. Mega menu
   ========================================================================== */
.has-mega { position: static; }
.mega {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  right: 0;
  padding-top: 0.6rem;
  animation: mega-in 0.24s var(--ease) both;
}
@keyframes mega-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.mega-panel {
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
}
.mega-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.mega-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  margin-bottom: 0.4rem;
  padding: 0.3rem 0.5rem 0.6rem;
  font-family: var(--font-head);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--cat-ink);
  text-decoration: none;
  border-bottom: 2px solid color-mix(in srgb, var(--cat) 30%, transparent);
  border-radius: 0;
}
.mega-heading:hover { color: var(--cat-ink); }
.mega-heading-ico { font-size: 1.15rem; }
.mega-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mega-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background-color 0.15s, color 0.15s, transform 0.2s var(--ease);
}
.mega-link .tool-ico { width: 32px; height: 32px; font-size: 1rem; transition: transform 0.25s var(--ease-spring); }
.mega-link:hover { color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 9%, transparent); }
.mega-link:hover .tool-ico { transform: scale(1.1); }
.mega-link[aria-current='page'] { font-weight: 700; color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 12%, transparent); }

.mega-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.mega-foot p { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.mega-foot p .icon { width: 18px; height: 18px; color: var(--brand); }

/* ==========================================================================
   10. Mobile drawer
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 90;
  background: rgba(5, 12, 25, 0.48);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease); }

.drawer {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  width: min(100%, 400px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.35s var(--ease), visibility 0s linear 0.35s;
}
.drawer.is-open { transform: none; visibility: visible; transition: transform 0.35s var(--ease); }

.drawer-body { display: flex; flex-direction: column; gap: 1rem; min-height: 100%; padding: 1rem var(--gutter) 1.5rem; }

.drawer-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 50px;
  padding: 0 1rem;
  font-size: var(--fs-base);
  color: var(--text-subtle);
  text-align: left;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
}
.drawer-search .icon { color: var(--text-muted); }

.drawer-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.drawer-label {
  margin: 0.75rem 0 0.25rem;
  padding: 0 0.75rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.drawer-link,
.drawer-acc-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 52px;
  padding: 0 0.75rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: var(--r);
  transition: background-color 0.15s, color 0.15s;
}
.drawer-link:hover,
.drawer-acc-btn:hover { color: var(--text); background: var(--surface-hover); }
.drawer-link[aria-current='page'] { color: var(--link); background: var(--brand-soft); }
.drawer-link .icon { width: 20px; height: 20px; color: var(--text-muted); }

.drawer-acc-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border-radius: 10px;
}
.drawer-acc-name { flex: 1; }
.drawer-acc-count {
  min-width: 26px;
  padding: 0.1rem 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-align: center;
  color: var(--cat-ink);
  background: color-mix(in srgb, var(--cat) 12%, transparent);
  border-radius: var(--r-full);
}
.drawer-acc-btn .icon-chevron { width: 18px; height: 18px; color: var(--text-muted); transition: transform 0.25s var(--ease); }
.drawer-acc-btn[aria-expanded='true'] { color: var(--cat-ink); }
.drawer-acc-btn[aria-expanded='true'] .icon-chevron { transform: rotate(180deg); }

.drawer-acc-panel {
  display: grid;
  gap: 2px;
  margin: 0.15rem 0 0.5rem 1.6rem;
  padding: 0 0 0 0.75rem;
  list-style: none;
  border-left: 2px solid color-mix(in srgb, var(--cat) 30%, transparent);
  animation: mega-in 0.25s var(--ease) both;
}
.drawer-sublink {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 46px;
  padding: 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
}
.drawer-sublink .tool-ico { width: 30px; height: 30px; font-size: 0.95rem; }
.drawer-sublink:hover { color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 9%, transparent); }
.drawer-sublink[aria-current='page'] { font-weight: 700; color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 12%, transparent); }

.drawer-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: grid; gap: 0.85rem; }
.drawer-note { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--fs-xs); color: var(--text-subtle); }
.drawer-note .icon { width: 16px; height: 16px; color: var(--brand); }

@media (min-width: 992px) {
  .drawer,
  .drawer-backdrop { display: none; }
}

/* ==========================================================================
   11. Search overlay & results (also used by hero / 404 inline search)
   ========================================================================== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(0.75rem, 8vh, 6rem) var(--gutter) 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0s linear 0.22s;
}
.search-overlay.is-open { opacity: 1; visibility: visible; transition: opacity 0.22s var(--ease); }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 25, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.search-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 660px);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.28s var(--ease);
}
.search-overlay.is-open .search-panel { transform: none; }

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}
.search-field:focus-within { border-bottom-color: var(--brand); }
.search-field > .icon { width: 22px; height: 22px; color: var(--link); }
.search-field input {
  flex: 1;
  min-width: 0;
  height: 64px;
  padding: 0;
  font-size: 1.1rem;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
}
.search-field input::placeholder { color: var(--text-subtle); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-close { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0; background: none; border: 0; border-radius: var(--r); }

.search-status { margin: 0; padding: 0.85rem 1.25rem 0.25rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.search-status:empty { display: none; }

.search-results { margin: 0; padding: 0.5rem; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.search-option a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 56px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r);
  transition: background-color 0.12s;
}
.search-option.is-active a,
.search-option a:hover { background: color-mix(in srgb, var(--cat) 10%, transparent); }
.search-option .tool-ico { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 12px; }
.search-option-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.search-option-name { font-weight: 700; line-height: 1.3; }
.search-option-desc { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-option-cat { display: none; padding: 0.2rem 0.6rem; font-size: var(--fs-xs); font-weight: 700; color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 12%, transparent); border-radius: var(--r-full); white-space: nowrap; }
.search-option mark { color: inherit; background: color-mix(in srgb, var(--brand) 28%, transparent); border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 1rem 0.75rem; color: var(--text-muted); font-size: var(--fs-sm); }

.search-foot {
  display: none;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.search-foot span { display: inline-flex; align-items: center; gap: 0.3rem; }
.search-foot a { margin-left: auto; font-weight: 700; }

@media (min-width: 768px) {
  .search-option-cat { display: inline-block; }
  .search-foot { display: flex; }
}

/* ==========================================================================
   12. Footer
   ========================================================================== */
.site-footer {
  position: relative;
  color: var(--footer-text);
  background:
    radial-gradient(800px 320px at 10% 0%, rgba(16, 185, 129, 0.12), transparent 70%),
    radial-gradient(700px 300px at 95% 100%, rgba(139, 92, 246, 0.1), transparent 70%),
    linear-gradient(180deg, var(--footer-bg), var(--footer-bg-2));
}
.site-footer a { color: var(--footer-text); text-decoration: none; }
.site-footer a:hover { color: #ffffff; text-decoration: underline; }
.site-footer :focus-visible { outline-color: #34d399; }

.footer-top { padding: clamp(3rem, 2rem + 3vw, 4.5rem) 0 2.5rem; }
.footer-grid { display: grid; gap: 2.5rem; }
.footer-links-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; }

.brand-footer { margin: 0 0 1rem; color: #ffffff; }
.brand-footer:hover { color: #ffffff; text-decoration: none !important; }
.brand-footer .brand-accent { color: #34d399; }
.footer-about { max-width: 38ch; font-size: var(--fs-sm); line-height: 1.7; }
.footer-about strong { color: #ffffff; font-weight: 600; }

.social-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.social-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--footer-border);
  border-radius: 50%;
  transition: background-color 0.2s, transform 0.25s var(--ease-spring), border-color 0.2s;
}
.social-link:hover { background: #10b981; border-color: #10b981; transform: translateY(-3px); }
.social-link .icon { width: 19px; height: 19px; }

.footer-title {
  margin: 0 0 1rem;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--footer-heading);
}
.footer-links { display: grid; gap: 0.1rem; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.footer-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0.15rem 0; transition: color 0.15s, transform 0.2s var(--ease); }
.footer-links a:hover { transform: translateX(3px); }

.footer-disclaimer {
  display: flex;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  font-size: var(--fs-sm);
  line-height: 1.65;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--footer-border);
  border-radius: var(--r-md);
}
.footer-disclaimer .icon { width: 22px; height: 22px; margin-top: 0.1rem; color: #fbbf24; }
.footer-disclaimer p { margin: 0; }
.footer-disclaimer strong { color: #ffffff; }
.footer-disclaimer a { color: #6ee7b7; text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.5rem 0 2rem;
  font-size: var(--fs-sm);
}
.footer-bottom p { margin: 0; }
@media (max-width: 767.98px) { .footer-bottom { padding-bottom: 5.5rem; } /* clear the floating back-to-top button */ }
.footer-made { display: inline-flex; align-items: center; gap: 0.45rem; }
.footer-made .icon { width: 16px; height: 16px; color: #34d399; }

@media (min-width: 768px) {
  .footer-links-wrap { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-col-wide { grid-column: span 2; }
  .footer-links-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; }
}
@media (min-width: 1200px) {
  .footer-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 3.85fr); gap: 3rem; }
  .footer-links-wrap { grid-template-columns: 1fr 1fr 1.9fr 0.9fr; }
  .footer-col-wide { grid-column: auto; }
}

/* ==========================================================================
   13. Page components
   ========================================================================== */

/* ---- Breadcrumb ---- */
.breadcrumb { padding-top: 1.25rem; font-size: var(--fs-sm); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; color: var(--text-subtle); }
.breadcrumb li { display: inline-flex; align-items: center; }
.breadcrumb li + li::before { content: '›'; margin-right: 0.5rem; font-size: 1.1em; color: var(--text-subtle); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.breadcrumb [aria-current='page'] { font-weight: 700; color: var(--text); }

/* ---- Inner page hero ---- */
.page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem) 0 clamp(1.5rem, 1rem + 2vw, 2.5rem);
}
.page-hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -220px;
  right: -160px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, color-mix(in srgb, var(--cat) 16%, transparent), transparent 65%);
  pointer-events: none;
}
.page-hero h1 { max-width: 24ch; margin: 0.5rem 0 0.75rem; }
.page-hero .lead { max-width: 68ch; margin-bottom: 0; }
.page-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }

/* ---- Long-form content (SEO sections) ---- */
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
.content-layout > * { min-width: 0; } /* let wide tables scroll inside .table-wrap instead of widening the page */
@media (min-width: 1200px) {
  .content-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 3.5rem; align-items: start; }
  .content-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); }
}

.prose { max-width: 780px; color: var(--text); font-size: 1.03rem; }
.prose > * + * { margin-top: 1rem; }
.prose h2 { margin-top: 2.75rem; margin-bottom: 0.25rem; font-size: var(--fs-2xl); }
.prose h3 { margin-top: 2rem; margin-bottom: 0.25rem; font-size: var(--fs-xl); }
.prose > :first-child { margin-top: 0; }
.prose p { margin-bottom: 0; }
.prose ul,
.prose ol { margin-bottom: 0; padding-left: 1.35rem; }
.prose li + li { margin-top: 0.45rem; }
.prose li::marker { color: var(--brand-strong); font-weight: 700; }
[data-theme='dark'] .prose li::marker { color: var(--brand); }
.prose strong { color: var(--text); }
.prose a { font-weight: 600; }
.prose img { border-radius: var(--r-md); }

.steps-list { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps-list > li { position: relative; padding-left: 2.75rem; counter-increment: step; }
.steps-list > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.05rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  font: 700 0.9rem/1 var(--font-head);
  color: var(--on-primary);
  background: var(--primary-bg);
  border-radius: 50%;
}

.formula {
  display: block;
  margin: 1.25rem 0;
  padding: 1.1rem 1.25rem;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--r);
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ---- Tables ---- */
.table-wrap {
  width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.table-wrap table,
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table-wrap th,
.table-wrap td,
.data-table th,
.data-table td { padding: 0.8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table-wrap th,
.data-table th { font-weight: 700; color: var(--text); background: var(--surface-2); white-space: nowrap; }
.table-wrap tr:last-child td,
.data-table tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover,
.data-table tbody tr:hover { background: var(--surface-hover); }
.table-wrap caption { padding: 0.75rem 1rem; text-align: left; font-size: var(--fs-sm); color: var(--text-muted); caption-side: bottom; }
.row-highlight { background: var(--brand-soft) !important; font-weight: 700; }

/* ---- Table-of-contents / aside cards ---- */
.toc { padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.toc-title { margin: 0 0 0.75rem; font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.toc ol { display: grid; gap: 0.15rem; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.toc a { display: block; padding: 0.4rem 0.6rem; color: var(--text-muted); text-decoration: none; border-radius: var(--r-sm); }
.toc a:hover { color: var(--link); background: var(--brand-soft); }
@media (min-width: 600px) and (max-width: 1199.98px) {
  .content-aside .toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- FAQ accordion ---- */
.faq-list { display: grid; gap: 0.75rem; max-width: 880px; margin-inline: auto; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item.is-open { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow-sm); }
.faq-h { margin: 0; font-family: var(--font-body); font-size: inherit; font-weight: inherit; letter-spacing: 0; }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 60px;
  padding: 1rem 1.25rem;
  font: 600 1.02rem/1.45 var(--font-body);
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  border-radius: inherit;
}
.faq-q:hover { color: var(--link); }
.faq-icon { position: relative; flex: none; width: 30px; height: 30px; background: var(--brand-soft); border-radius: 50%; transition: transform 0.3s var(--ease), background-color 0.3s; }
.faq-icon::before,
.faq-icon::after { content: ''; position: absolute; top: 50%; left: 50%; width: 12px; height: 2px; background: var(--link); border-radius: 2px; transform: translate(-50%, -50%); transition: transform 0.3s var(--ease); }
.faq-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item.is-open .faq-icon { transform: rotate(180deg); }
.faq-item.is-open .faq-icon::after { transform: translate(-50%, -50%) rotate(0deg); }

.faq-a { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.35s var(--ease), visibility 0s; }
.faq-a-inner { min-height: 0; overflow: hidden; padding-inline: 1.25rem; color: var(--text-muted); }
.faq-a-inner > :first-child { margin-top: 0; }
.faq-a-inner > :last-child { margin-bottom: 1.25rem; }
/* Collapse only when JS is running (answers stay readable without JS) */
.js .faq-item:not(.is-open) .faq-a { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 0.35s var(--ease), visibility 0s linear 0.35s; }

/* ---- Callouts & disclaimer box ---- */
.callout {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.25rem;
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.callout > .icon { width: 22px; height: 22px; margin-top: 0.1rem; }
.callout p { margin: 0; }
.callout p + p { margin-top: 0.5rem; }
.callout-info { background: var(--info-bg); border-color: var(--info-border); }
.callout-info > .icon { color: var(--info-ink); }
.callout-good { background: var(--good-bg); border-color: var(--good-border); }
.callout-good > .icon { color: var(--good-ink); }
.callout-caution,
.disclaimer-box { background: var(--caution-bg); border-color: var(--caution-border); }
.callout-caution > .icon,
.disclaimer-box > .icon { color: var(--caution-ink); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout-danger > .icon { color: var(--danger-ink); }
.disclaimer-box { display: flex; gap: 0.9rem; padding: 1.1rem 1.25rem; font-size: var(--fs-sm); border: 1px solid var(--caution-border); border-radius: var(--r-md); }
.disclaimer-box p { margin: 0; }

/* ---- CTA banner ---- */
.cta-banner {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 1.5rem;
  align-items: center;
  overflow: hidden;
  padding: clamp(2rem, 1.5rem + 3vw, 3.5rem);
  color: #ffffff;
  background: linear-gradient(135deg, #065f46 0%, #0f766e 45%, #1e3a8a 100%);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
}
.cta-banner::before,
.cta-banner::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.cta-banner::before { width: 420px; height: 420px; top: -200px; right: -120px; background: radial-gradient(circle, rgba(52, 211, 153, 0.45), transparent 65%); }
.cta-banner::after { width: 320px; height: 320px; bottom: -180px; left: -80px; background: radial-gradient(circle, rgba(167, 139, 250, 0.4), transparent 65%); }
.cta-banner h2 { margin-bottom: 0.5rem; color: #ffffff; }
.cta-banner p { margin: 0; color: rgba(255, 255, 255, 0.88); font-size: var(--fs-md); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
@media (min-width: 992px) { .cta-banner { grid-template-columns: minmax(0, 1fr) auto; } }

/* ==========================================================================
   14. Home page sections
   ========================================================================== */

/* ---- Hero ---- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(2.25rem, 1.5rem + 4vw, 5rem) 0 clamp(3.5rem, 2.5rem + 4vw, 6rem);
}
/* Lift the hero above the stats strip while its search suggestions are open */
.hero:focus-within { z-index: 3; }
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hero-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  animation: blob-float 20s ease-in-out infinite alternate;
  will-change: transform;
}
.blob-1 { width: 520px; height: 520px; top: -180px; left: -160px; background: radial-gradient(circle, #6ee7b7 0%, transparent 68%); }
.blob-2 { width: 460px; height: 460px; top: 4%; right: -180px; background: radial-gradient(circle, #c4b5fd 0%, transparent 68%); animation-delay: -7s; }
.blob-3 { width: 400px; height: 400px; bottom: -200px; left: 38%; background: radial-gradient(circle, #fda4af 0%, transparent 68%); animation-delay: -13s; }
[data-theme='dark'] .blob { opacity: 0.22; }
@keyframes blob-float {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, -30px, 0) scale(1.08); }
  100% { transform: translate3d(-30px, 25px, 0) scale(0.95); }
}

.hero-inner { display: grid; gap: clamp(2.5rem, 2rem + 3vw, 4rem); align-items: center; }
.hero-content { max-width: 640px; }
.hero-title { margin: 0.6rem 0 1.1rem; font-size: var(--fs-4xl); line-height: 1.07; letter-spacing: -0.035em; }
.hero-lead { max-width: 56ch; margin-bottom: 1.75rem; font-size: clamp(1.05rem, 1rem + 0.4vw, 1.22rem); color: var(--text-muted); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-anim { animation: rise-in 0.8s var(--ease) both; animation-delay: calc(var(--d, 0) * 110ms); }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* Hero search */
/* z-index keeps the suggestion list above the (animated) trust badges below it */
.hero-search { position: relative; z-index: 5; max-width: 580px; margin-top: 1.75rem; }
.hero-search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hero-search-field:focus-within { border-color: var(--brand); box-shadow: var(--shadow-lg), 0 0 0 4px var(--ring); }
.hero-search-field > .icon { width: 21px; height: 21px; color: var(--link); }
.hero-search-field input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
}
.hero-search-field input::placeholder { color: var(--text-subtle); }
.hero-search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.hero-search-field .btn { --btn-h: 48px; padding: 0 1.25rem; }
.hero-search .search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  animation: mega-in 0.2s var(--ease) both;
}
@media (max-width: 479.98px) {
  .hero-search-field .btn-text { display: none; }
  .hero-search-field .btn { width: 48px; padding: 0; }
}

/* Trust badges */
.trust-badges { display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.trust-badges li { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.trust-badges .icon { width: 18px; height: 18px; padding: 2px; color: var(--on-primary); background: var(--primary-bg); border-radius: 50%; }

/* Hero visual: monitor card + ECG + floating cards */
.hero-visual { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1 / 1.1; margin-inline: auto; }
.hero-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 35%, transparent);
  animation: spin 60s linear infinite;
}
.hero-ring::after { content: ''; position: absolute; inset: 12%; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--violet) 18%, transparent); }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-monitor {
  position: absolute;
  top: 50%;
  left: 7%;
  right: 7%;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  transform: translate3d(var(--px, 0px), calc(-50% + var(--py, 0px)), 0);
  transition: transform 0.6s var(--ease);
}
.monitor-bpm { margin: 0; }
.monitor-label { white-space: nowrap; }
@media (max-width: 399.98px) { .monitor-head .badge { display: none; } }
.monitor-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; }
.monitor-label { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.monitor-bpm { font: 700 clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem)/1 var(--font-head); color: var(--text); }
.monitor-bpm small { margin-left: 0.25rem; font-size: 0.9rem; font-weight: 600; color: var(--text-subtle); }
.pulse-dot { position: relative; width: 10px; height: 10px; background: var(--danger-fill); border-radius: 50%; }
.pulse-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 1.4s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.8); opacity: 0; } }

.ecg { display: block; width: 100%; height: auto; overflow: visible; }
.ecg-grid line { stroke: var(--border); stroke-width: 1; }
.ecg-ghost { fill: none; stroke: color-mix(in srgb, var(--brand) 18%, transparent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ecg-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.55));
  animation: ecg-draw 3s linear infinite;
}
@keyframes ecg-draw {
  0% { stroke-dashoffset: 1000; opacity: 1; }
  75% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
.monitor-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.monitor-stat { padding: 0.55rem 0.65rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.monitor-stat span { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-subtle); }
.monitor-stat strong { font: 700 1rem/1.3 var(--font-head); color: var(--text); }

.float-wrap {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
  transition: transform 0.6s var(--ease);
}
.float-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem 0.5rem 0.5rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: floaty 6s ease-in-out infinite;
  animation-delay: var(--fd, 0s);
}
.float-card small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-subtle); }
.float-card .tool-ico { width: 38px; height: 38px; font-size: 1.2rem; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@media (max-width: 479.98px) {
  .hero-visual { aspect-ratio: 1 / 1.25; }
  .float-optional { display: none; }
  .float-card { font-size: 0.78rem; }
  .float-card .tool-ico { width: 32px; height: 32px; font-size: 1rem; }
}

@media (min-width: 992px) {
  .hero-inner { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); }
}

/* ---- Stats strip ---- */
.stats-strip { position: relative; z-index: 2; margin-top: clamp(-3rem, -2rem - 1vw, -1.5rem); }
.stats-grid {
  margin: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.stat-item { padding: 1rem 0.5rem; text-align: center; border-radius: var(--r-md); }
.stat-num {
  display: block;
  font: 800 clamp(2rem, 1.6rem + 1.8vw, 2.9rem)/1 var(--font-head);
  letter-spacing: -0.03em;
  background: var(--text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: 0.45rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 1.25rem; }
  .stat-item + .stat-item { border-left: 1px solid var(--border); border-radius: 0; }
}

/* ---- Tabs (Browse by category) ---- */
.tabs-list {
  display: flex;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 2rem;
  padding: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-xs);
}
.tabs-list::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  min-height: 44px;
  padding: 0 1.1rem;
  font: 600 var(--fs-sm) var(--font-body);
  color: var(--text-muted);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: var(--r-full);
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab[aria-selected='true'] { color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 13%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cat) 35%, transparent); }
.tab-panel:focus-visible { outline-offset: 8px; }
.tab-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 1.5rem; }
.tab-panel-head p { max-width: 62ch; margin: 0; color: var(--text-muted); }

/* ---- How it works ---- */
.steps { display: grid; gap: 1.25rem; }
.step {
  position: relative;
  padding: 2rem 1.5rem 1.6rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.step-num {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 1.1rem;
  font: 700 1.4rem/1 var(--font-head);
  color: var(--on-primary);
  background: var(--primary-bg);
  border-radius: 50%;
  box-shadow: 0 12px 24px -10px var(--primary-glow), 0 0 0 8px var(--brand-soft);
}
.step h3 { font-size: var(--fs-lg); }
.step p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
  .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 62px;
    left: calc(50% + 46px);
    width: calc(100% - 92px + 2rem);
    border-top: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent);
  }
}

/* ---- Feature blocks (Why choose us) ---- */
.feature-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.feature {
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--cat) 35%, var(--border)); }
.feature-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 1rem;
  color: var(--cat-ink);
  background: color-mix(in srgb, var(--cat) 13%, transparent);
  border-radius: 14px;
}
.feature-icon .icon { width: 24px; height: 24px; }
.feature h3 { margin-bottom: 0.4rem; font-size: var(--fs-lg); }
.feature p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }

/* ---- Health tips / Did you know ---- */
.tip-card {
  position: relative;
  overflow: hidden;
  padding: 1.6rem;
  background: linear-gradient(165deg, color-mix(in srgb, var(--cat) 11%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.tip-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.tip-emoji { display: block; margin-bottom: 0.85rem; font-size: 2rem; line-height: 1; }
.tip-label { display: block; margin-bottom: 0.35rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cat-ink); }
.tip-card h3 { font-size: var(--fs-lg); margin-bottom: 0.5rem; }
.tip-card p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.tip-card a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.9rem; font-size: var(--fs-sm); font-weight: 700; color: var(--cat-ink); }

/* ==========================================================================
   15. All Tools filters, toast, back-to-top
   ========================================================================== */
.filter-bar {
  position: sticky;
  top: calc(var(--header-h) + 0.5rem);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
  padding: 0.85rem;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.filter-chips { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  min-height: 44px;
  padding: 0 1rem;
  font: 600 var(--fs-sm) var(--font-body);
  color: var(--text-muted);
  white-space: nowrap;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-full);
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--cat); }
.chip[aria-pressed='true'] { color: var(--bg); background: var(--text); border-color: var(--text); }
.filter-search { position: relative; flex: 1; min-width: 0; }
.filter-search .icon { position: absolute; top: 50%; left: 1rem; width: 19px; height: 19px; color: var(--text-subtle); transform: translateY(-50%); pointer-events: none; }
.filter-search input { width: 100%; min-height: 46px; padding: 0 1rem 0 2.75rem; font-size: 1rem; color: var(--text); background: var(--input-bg); border: 1.5px solid var(--border-strong); border-radius: var(--r-full); }
.filter-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.filter-count { margin: 0 0 1.5rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-subtle); }
.filter-section + .filter-section { margin-top: 3rem; }
.filter-section-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.25rem; }
.filter-section-head .tool-card-icon { width: 48px; height: 48px; font-size: 1.4rem; }
.filter-section-head h2 { margin: 0; font-size: var(--fs-xl); }
.filter-section-head p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state .tool-card-icon { margin: 0 auto 1rem; }
@media (min-width: 992px) {
  .filter-bar { flex-direction: row; align-items: center; justify-content: space-between; }
  .filter-search { max-width: 340px; }
}

/* Toasts (created by utils.js) */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 3vw, 1.5rem);
  z-index: 300;
  display: grid;
  gap: 0.5rem;
  width: min(calc(100% - 2rem), 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bg);
  background: var(--text);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease-spring) both;
}
.toast .icon { width: 18px; height: 18px; }
.toast-good .icon { color: #34d399; }
.toast-danger .icon { color: #f87171; }
[data-theme='dark'] .toast-good .icon { color: #047857; }
[data-theme='dark'] .toast-danger .icon { color: #b91c1c; }
.toast-caution .icon,
.toast-warning .icon { color: #fbbf24; }
.toast-info .icon { color: #7dd3fc; }
[data-theme='dark'] .toast-caution .icon,
[data-theme='dark'] .toast-warning .icon { color: #b45309; }
[data-theme='dark'] .toast-info .icon { color: #0369a1; }
.toast.is-leaving { animation: toast-out 0.3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* Back to top */
.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 70;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  color: var(--on-primary);
  background: var(--primary-bg);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 12px 28px -10px var(--primary-glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.back-to-top:hover { transform: translateY(-3px); }
.back-to-top .icon { width: 22px; height: 22px; }

/* ==========================================================================
   16. Motion, reduced motion, print
   ========================================================================== */

/* Scroll reveal — elements are hidden only once main.js has added .reveal-ready.
   Uses an animation with fill-mode "backwards" so hover transforms keep working. */
html.reveal-ready [data-reveal]:not(.is-visible) { opacity: 0; }
html.reveal-ready [data-reveal].is-visible { animation: reveal-up 0.7s var(--ease) backwards; animation-delay: var(--reveal-delay, 0ms); }
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

/* Smooth theme switch (class added by theme.js for ~400ms) */
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease, stroke 0.3s ease, box-shadow 0.3s ease !important;
  transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .blob,
  .float-card,
  .hero-ring,
  .pulse-dot::after,
  .ecg-line { animation: none !important; }
  .ecg-line { stroke-dashoffset: 0; }
  .float-wrap { transform: none !important; }
  html.reveal-ready [data-reveal]:not(.is-visible) { opacity: 1; }
}

@media print {
  :root { color-scheme: light; }
  body { color: #000; background: #fff; font-size: 11pt; }
  .site-header,
  .site-footer,
  .drawer,
  .drawer-backdrop,
  .search-overlay,
  .back-to-top,
  .toast-region,
  .skip-link,
  .cta-banner,
  .hero-bg,
  .no-print { display: none !important; }
  a { color: #000; text-decoration: underline; }
  .card,
  .tool-card,
  .faq-item { box-shadow: none !important; break-inside: avoid; }
  .js .faq-item .faq-a { grid-template-rows: 1fr !important; visibility: visible !important; }
  html.reveal-ready [data-reveal] { opacity: 1 !important; animation: none !important; }
}

/* ==========================================================================
   17. Legal pages & 404
   ========================================================================== */
.legal-updated { font-size: var(--fs-sm); color: var(--text-subtle); }
.error-hero { padding: clamp(2.5rem, 2rem + 4vw, 5rem) 0 2rem; text-align: center; }
.error-code { display: block; font: 800 clamp(4.5rem, 3rem + 8vw, 8rem)/1 var(--font-head); letter-spacing: -0.04em; background: var(--primary-bg); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-hero h1 { margin: 0.75rem auto; max-width: 22ch; }
.error-hero .lead { margin-inline: auto; max-width: 52ch; }
.error-hero .hero-search { margin: 1.75rem auto 0; text-align: left; }
.error-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.5rem; }
