/* =============================================================
   1. Tokens (ToolSprout's own neutral green identity)
   ============================================================= */
:root {
  --bg: #f5f9f8;
  --bg-alt: #e9f2ef;
  --card: #ffffff;
  --text: #142420;
  --text-soft: #56706a;
  --border: #dbe8e3;

  --accent: #0f6f5c;
  --accent-bright: #14b892;
  --accent-dark: #0b5347;

  --bmi-under: #5b8def;
  --bmi-healthy: #14b892;
  --bmi-over: #e8b13a;
  --bmi-obese: #e8843a;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sans: "Inter", system-ui, sans-serif;
  --display: "Sora", var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --bg-alt: #131f1b;
    --card: #17231f;
    --text: #eaf5f1;
    --text-soft: #9fb6ae;
    --border: #223129;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; text-wrap: balance; line-height: 1.15; color: var(--text); }
::selection { background: var(--accent-bright); color: #06231c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--card); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }

/* =============================================================
   4. Header (ToolSprout site-wide)
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; padding: .85rem 0; border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.header-inner { gap: 1rem; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 1.1rem; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; color: var(--text); }
.logo-mark {
  display: inline-grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; width: 26px; height: 26px; padding: 5px; border-radius: 8px;
  background: var(--accent-dark); flex-shrink: 0;
}
.logo-mark span { background: var(--accent-bright); border-radius: 2px; }

.header-nav { position: relative; }
.dropdown-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .8rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem;
  color: var(--text); transition: background .15s var(--ease-out);
}
.dropdown-toggle:hover { background: var(--bg-alt); }
.dropdown-caret { transition: transform .18s var(--ease-out); }
.dropdown-toggle[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + .5rem); left: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px -16px rgba(10, 30, 25, .25);
  padding: .4rem; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s var(--ease-out), transform .16s var(--ease-out), visibility .16s;
}
.dropdown-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu li a { display: block; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; font-weight: 500; color: var(--text); }
.dropdown-menu li a:hover { background: var(--bg-alt); text-decoration: none; }

.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem .9rem; flex: 1; max-width: 260px; min-width: 140px;
}
.search-icon { color: var(--text-soft); flex-shrink: 0; }
.header-search input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: .92rem; width: 100%; }
.header-search input::placeholder { color: var(--text-soft); }
.search-kbd {
  font-family: var(--sans); font-size: .72rem; color: var(--text-soft);
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: .1rem .4rem; flex-shrink: 0; display: none;
}
@media (min-width: 540px) { .search-kbd { display: inline-block; } }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-block: .9rem; font-size: .85rem; color: var(--text-soft); }
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin-bottom: .6rem; }
.hero .subtitle { color: var(--text-soft); max-width: 52ch; margin-inline: auto; font-size: 1.02rem; }

/* =============================================================
   6. Tool card / form
   ============================================================= */
.tool-section { padding-block: 1.25rem 1rem; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: 0 12px 40px -20px rgba(15, 60, 50, .25);
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.form-row { margin-bottom: 1.1rem; }
.form-row label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .5rem; }
.hint { color: var(--text-soft); font-size: .82rem; margin-top: .35rem; }

.segmented { display: inline-flex; background: var(--bg-alt); border-radius: 999px; padding: .25rem; flex-wrap: wrap; }
.segmented-btn { padding: .55rem 1rem; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--text-soft); }
.segmented-btn.is-active { background: var(--card); color: var(--accent-dark); box-shadow: 0 2px 6px rgba(0,0,0,.08); }

.calc-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin-top: 1rem; }
@media (min-width: 640px) { .calc-grid { grid-template-columns: repeat(2, 1fr); } }

.input-with-suffix {
  display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); overflow: hidden;
}
.input-with-suffix:focus-within { border-color: var(--accent); }
.input-suffix { padding: 0 .8rem; color: var(--text-soft); font-weight: 700; flex-shrink: 0; }
.input-with-suffix input {
  border: 0; background: none; outline: none; padding: .8rem .5rem .8rem .9rem; font-size: 1rem; color: var(--text);
  width: 100%; font-family: var(--sans); min-width: 0;
}
.term-row { display: flex; gap: .5rem; }
.term-row .input-with-suffix { flex: 1; }

.range-input { width: 100%; margin-top: .6rem; accent-color: var(--accent); height: 4px; border-radius: 999px; background: var(--border); }

/* =============================================================
   7. BMI result + scale
   ============================================================= */
.bmi-result { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.bmi-number-block { text-align: center; margin-bottom: 1.5rem; }
.result-label { display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-bottom: .3rem; }
.bmi-number { font-family: var(--display); font-size: clamp(2.4rem, 8vw, 3.2rem); font-weight: 800; color: var(--text); display: block; line-height: 1.1; }
.bmi-category { display: inline-block; margin-top: .5rem; padding: .35rem .9rem; border-radius: 999px; font-weight: 700; font-size: .92rem; background: var(--bg-alt); color: var(--text-soft); }
.bmi-category--under { background: color-mix(in srgb, var(--bmi-under) 18%, var(--card)); color: var(--bmi-under); }
.bmi-category--healthy { background: color-mix(in srgb, var(--bmi-healthy) 18%, var(--card)); color: var(--accent-dark); }
.bmi-category--over { background: color-mix(in srgb, var(--bmi-over) 22%, var(--card)); color: #8a6112; }
.bmi-category--obese { background: color-mix(in srgb, var(--bmi-obese) 22%, var(--card)); color: #9a4c14; }

.bmi-scale { max-width: 560px; margin-inline: auto; }
.bmi-scale-track { position: relative; display: flex; height: 14px; border-radius: 999px; overflow: visible; }
.bmi-zone { display: block; height: 100%; }
.bmi-zone--under { width: 14%; background: var(--bmi-under); border-radius: 999px 0 0 999px; }
.bmi-zone--healthy { width: 26%; background: var(--bmi-healthy); }
.bmi-zone--over { width: 20%; background: var(--bmi-over); }
.bmi-zone--obese { width: 40%; background: var(--bmi-obese); border-radius: 0 999px 999px 0; }
.bmi-marker {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--text); transform: translate(-50%, -50%);
  transition: left .25s var(--ease-out); box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.bmi-scale-labels { display: flex; justify-content: space-between; margin-top: .5rem; font-size: .74rem; color: var(--text-soft); font-weight: 600; }
.bmi-scale-labels span:nth-child(2) { flex: 1.4; text-align: center; }
.bmi-scale-labels span:nth-child(3) { flex: 1.1; text-align: center; }
.bmi-scale-labels span:first-child { flex: .6; }
.bmi-scale-labels span:last-child { flex: 1.6; text-align: right; }

/* =============================================================
   8. Disclaimer
   ============================================================= */
.disclaimer { color: var(--text-soft); font-size: .82rem; margin-top: 1rem; line-height: 1.5; }

/* =============================================================
   9. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 2px dashed #cfe3dc; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-weight: 700; letter-spacing: .06em; font-size: .85rem;
  background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 2rem auto; max-width: 960px; }
.ad-slot--incontent { min-height: 250px; margin: 2rem auto; max-width: 728px; }

.ad-popup { border: none; border-radius: var(--radius-lg); padding: 0; max-width: 380px; width: 90vw; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.ad-popup::backdrop { background: rgba(10, 30, 25, .45); backdrop-filter: blur(2px); }
.ad-popup-inner { padding: 1.5rem; text-align: center; position: relative; }
.ad-popup-close { position: absolute; top: .6rem; right: .6rem; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-alt); font-size: 1.1rem; line-height: 1; }
.ad-popup .ad-slot { min-height: 220px; margin: 1rem 0 0; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 40;
  background: var(--card); border: 2px dashed #cfe3dc; border-radius: var(--radius);
  padding: .7rem 2.2rem .7rem 1rem; max-width: 240px; font-size: .8rem; color: var(--text-soft);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.corner-ad.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.corner-ad strong { display: block; font-weight: 800; color: var(--text); margin-bottom: .15rem; }
.corner-ad-close { position: absolute; top: .4rem; right: .4rem; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); font-size: .85rem; line-height: 1; }

/* =============================================================
   10. Content sections
   ============================================================= */
.content-section { padding-block: 2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); margin-bottom: 1rem; }
.content-section > p { color: var(--text-soft); max-width: 68ch; margin-bottom: 1rem; }
.content-section > p.center-text { max-width: none; margin-inline: 0; text-align: justify; text-align-last: left; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.step .step-num {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-soft); font-size: .92rem; }

.usecases { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .usecases { grid-template-columns: repeat(5, 1fr); } }
.usecase { background: var(--bg-alt); border-radius: var(--radius); padding: 1rem .75rem; text-align: center; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; }
.usecase-icon { display: block; margin-bottom: .4rem; color: var(--text); }
.usecase-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.usecase h3 { font-size: .88rem; margin-top: auto; }

.faq { max-width: 68ch; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--text-soft); margin-top: .6rem; font-size: .94rem; }

/* =============================================================
   11. Related tools (interlinking)
   ============================================================= */
.related-tools-title { font-size: 1rem; margin-bottom: .75rem; color: var(--text-soft); }
.related-tools-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.related-tools-list a {
  display: inline-flex; padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: .88rem;
}
.related-tools-list a:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

/* =============================================================
   12. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* =============================================================
   12. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dropdown-menu, .dropdown-caret, .corner-ad, .bmi-marker { transition: none; }
}
