/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #2ecc71;
  --green-dark: #27ae60;
  --green-light: #d5f5e3;
  --blue: #3498db;
  --yellow: #f39c12;
  --red: #e74c3c;
  --text: #2c3e50;
  --text-light: #636e72;
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.12);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { max-width: 100%; display: block; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
h2 { font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 600; line-height: 1.3; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ===== LAYOUT ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container--narrow { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }

/* ===== HEADER ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}

.logo span { color: var(--green); }

.site-nav { display: flex; align-items: center; gap: 0.25rem; }

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.site-nav a:hover { background: var(--bg-alt); color: var(--green-dark); }
.site-nav a.active { color: var(--green-dark); background: var(--green-light); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.2s;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--text);
  color: #b2bec3;
  padding: 2rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: #b2bec3; text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  text-align: center;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-dark);
  box-shadow: 0 4px 12px rgba(46,204,113,0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

.btn-full { width: 100%; }

.btn-disabled {
  background: #b2bec3;
  color: #fff;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== HERO ===== */
.page-hero {
  background: linear-gradient(135deg, #f0faf4 0%, #e8f8ef 100%);
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.page-hero p { color: var(--text-light); font-size: 1.05rem; max-width: 600px; }

/* ===== CALCULATOR GRID ===== */
.calculators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  padding: 2.5rem 0;
}

.calc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.calc-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.calc-card.coming-soon { opacity: 0.65; }

.calc-card__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.calc-card__title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; }
.calc-card__desc { font-size: 0.875rem; color: var(--text-light); flex: 1; margin-bottom: 1rem; }

.badge-coming {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f0f0f0;
  color: var(--text-light);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== WHY SECTION ===== */
.why-section {
  background: var(--bg-alt);
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.why-item { display: flex; gap: 0.75rem; align-items: flex-start; }
.why-item__icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; margin-top: 0.1rem; }
.why-item__text h3 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.why-item__text p { font-size: 0.85rem; color: var(--text-light); margin: 0; }

/* ===== BMI CALCULATOR ===== */
.calc-section { padding: 2.5rem 0; }

.calc-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

/* Unit Toggle */
.unit-toggle {
  display: inline-flex;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 1.75rem;
}

.unit-btn {
  padding: 0.4rem 1.1rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-light);
  transition: background 0.15s, color 0.15s;
}

.unit-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  font-weight: 600;
}

/* Form Fields */
.field-group { margin-bottom: 1.5rem; }

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.field-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

.field-input-wrap { position: relative; flex: 1; min-width: 80px; }
.field-input-wrap .unit-label {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-light);
  pointer-events: none;
}

.field-input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}

.field-input::-webkit-outer-spin-button,
.field-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46,204,113,0.15);
}

.field-slider {
  width: 100%;
  margin-top: 0.5rem;
  accent-color: var(--green);
  cursor: pointer;
  height: 4px;
}

/* Height Imperial */
.height-imperial { display: flex; gap: 0.75rem; }
.height-imperial .field-input-wrap { flex: 1; }

/* ===== RESULT BLOCK ===== */
.result-block {
  display: none;
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.result-block.visible { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.bmi-number-wrap {
  text-align: center;
  margin-bottom: 1.5rem;
}

.bmi-number {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.bmi-category {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
}

.cat-underweight { background: #dbeafe; color: #1e40af; }
.cat-normal      { background: var(--green-light); color: var(--green-dark); }
.cat-overweight  { background: #fef3c7; color: #92400e; }
.cat-obese       { background: #fee2e2; color: #991b1b; }

/* BMI Scale */
.bmi-scale-wrap { margin-bottom: 1.5rem; }

.bmi-scale-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.bmi-scale {
  position: relative;
  height: 20px;
  border-radius: 10px;
  overflow: visible;
  display: flex;
  margin-bottom: 1.5rem;
}

.bmi-scale__segment {
  height: 100%;
  position: relative;
}

.bmi-scale__segment:first-child { border-radius: 10px 0 0 10px; }
.bmi-scale__segment:last-child { border-radius: 0 10px 10px 0; }

.seg-under  { background: #93c5fd; flex: 2.5; }
.seg-normal { background: var(--green); flex: 6.5; }
.seg-over   { background: #fcd34d; flex: 5; }
.seg-obese  { background: #f87171; flex: 10; }

.bmi-scale-marker {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  z-index: 2;
}

.bmi-scale-marker__line {
  width: 5px;
  height: 32px;
  background: var(--text);
  border-radius: 3px;
  margin: 0 auto;
}

.seg-label {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  font-size: 0.72rem;
  color: var(--text-light);
  transform: translateX(-50%);
  white-space: nowrap;
}
.seg-label--start { transform: translateX(0); }
.seg-label--end   { left: auto; right: 0; transform: translateX(0); }

.healthy-range-note {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--text-light);
}

.healthy-range-note strong { color: var(--green-dark); }

/* Percentile */
.percentile-block {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.percentile-num {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.percentile-text { font-size: 0.9rem; color: var(--text-light); margin-top: 0.25rem; }
.percentile-note { font-size: 0.75rem; color: #aaa; margin-top: 0.5rem; }

/* Chart */
.chart-wrap {
  margin-bottom: 1.5rem;
  position: relative;
  min-height: 400px;
}

.chart-wrap canvas { width: 100% !important; }

/* Dynamic Text */
.result-text { margin-bottom: 1.5rem; }
.result-text h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.result-text p { font-size: 0.9rem; color: var(--text-light); }

/* ===== SEO CONTENT ===== */
.seo-content {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.seo-content section { margin-bottom: 2.5rem; }

.seo-content h2 {
  font-size: 1.3rem;
  border-bottom: 2px solid var(--green-light);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.seo-content p, .seo-content li { font-size: 0.95rem; color: var(--text-light); }
.seo-content li { margin-left: 1.25rem; margin-bottom: 0.35rem; }

/* Table */
.bmi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.bmi-table th, .bmi-table td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.bmi-table th { background: var(--bg-alt); font-weight: 600; }
.bmi-table tr:hover { background: #fafafa; }

.bmi-table .row-under td:first-child { color: #1e40af; font-weight: 600; }
.bmi-table .row-normal td:first-child { color: var(--green-dark); font-weight: 600; }
.bmi-table .row-over td:first-child { color: #92400e; font-weight: 600; }
.bmi-table .row-obese td:first-child { color: #991b1b; font-weight: 600; }

/* FAQ */
.faq-list { list-style: none; padding: 0; }
.faq-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.75rem; overflow: hidden; }
.faq-q {
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: none;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

.faq-q::after { content: '+'; font-size: 1.2rem; color: var(--green); flex-shrink: 0; }
.faq-item.open .faq-q::after { content: '−'; }

.faq-a { display: none; padding: 0 1rem 0.9rem; font-size: 0.9rem; color: var(--text-light); }
.faq-item.open .faq-a { display: block; }

/* ===== ARTICLE / INFO PAGES ===== */
.article-hero {
  background: linear-gradient(135deg, #f0faf4 0%, #e8f8ef 100%);
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.article-hero p { color: var(--text-light); font-size: 1rem; margin-top: 0.5rem; }

.article-body {
  padding: 2.5rem 0;
}

.article-body section { margin-bottom: 2.5rem; }

.article-body h2 {
  font-size: 1.25rem;
  border-left: 4px solid var(--green);
  padding-left: 0.75rem;
  margin-bottom: 0.85rem;
}

.article-body p, .article-body li { font-size: 0.95rem; color: var(--text-light); line-height: 1.7; }
.article-body li { margin-left: 1.25rem; margin-bottom: 0.35rem; }
.article-body strong { color: var(--text); }

.cta-box {
  background: var(--green-light);
  border: 1px solid #a8e6c3;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-top: 2rem;
}

.cta-box p { font-size: 1rem; color: var(--text); margin-bottom: 1rem; font-weight: 500; }

/* ===== ABOUT PAGE ===== */
.about-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.source-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.875rem;
}

.source-card h3 { font-size: 0.9rem; color: var(--green-dark); margin-bottom: 0.3rem; }
.source-card p { color: var(--text-light); margin: 0; }

/* ===== PRIVACY ===== */
.privacy-body { padding: 2.5rem 0; }
.privacy-body section { margin-bottom: 2rem; }
.privacy-body h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.6rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.privacy-body p, .privacy-body li { font-size: 0.9rem; color: var(--text-light); }
.privacy-body li { margin-left: 1.25rem; margin-bottom: 0.25rem; }
.privacy-body .updated { font-size: 0.8rem; color: #aaa; margin-bottom: 1.5rem; }

/* ===== SCHEMA / formula ===== */
.formula-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--text);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }

  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.6rem 0.75rem; width: 100%; }

  .calc-box { padding: 1.25rem; }
  .height-imperial { flex-direction: column; }
  .field-row { flex-direction: column; }

  .bmi-table { font-size: 0.8rem; }
  .bmi-table th, .bmi-table td { padding: 0.4rem 0.5rem; }

  .chart-wrap { min-height: 300px; }

  .why-grid { grid-template-columns: 1fr 1fr; }
  .about-sources { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .why-grid { grid-template-columns: 1fr; }
  .about-sources { grid-template-columns: 1fr; }
}
