/* ════════════════════════════════════════════════════════════
   tools/bmi/style.css — BMI Calculator
   Aesthetic: /for/ master template — page bg เทา + การ์ดขาว + pill ดำ
   Accent: mint (healthy) + amber/coral (warning gradient)
   ════════════════════════════════════════════════════════════ */

body.tool-bmi {
  --page-bg:    #F2F2F4;
  --card-bg:    #FFFFFF;
  --card-soft:  #F7F7F8;
  --ink:        #0A0A0A;
  --text:       #1F2937;
  --muted:      #6B7280;
  --hairline:   #EAEAEC;

  --acc:        #10B981;
  --acc-soft:   #D8EFE0;
  --acc-text:   #047857;

  --warn:       #DC2626;
  --warn-soft:  #FEE4E2;
  --warn-text:  #B42318;

  --amber:      #B54708;
  --amber-soft: #FEF0C7;
  --amber-text: #93370D;

  --info:       #2A8FE0;
  --info-soft:  #DDEBFA;
  --info-text:  #1E5F94;

  --r-card:     24px;
  --r-pill:     999px;
  --r-tile:     16px;
  --r-input:    14px;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -16px rgba(0,0,0,.06);

  background: var(--page-bg);
  color: var(--text);
}

body.tool-bmi main.container,
body.tool-bmi .site-header-inner {
  max-width: 1280px;
  padding-inline: clamp(16px, 3vw, 28px);
}

body.tool-bmi .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13.5px;
  text-decoration: none; margin: 20px 0 16px; font-weight: 500;
}
body.tool-bmi .back-link:hover { color: var(--ink); }

/* ─── HERO ────────────────────────────────────────────────── */
.bm-hero {
  padding: clamp(16px, 3vw, 28px) 4px clamp(16px, 3vw, 24px);
  max-width: 760px;
}
.bm-eyebrow {
  font-size: 11px; letter-spacing: .14em; font-weight: 600;
  color: var(--muted); text-transform: uppercase; margin: 0 0 14px;
}
.bm-h1 {
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.12; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); margin: 0 0 14px;
}
.bm-h1-accent { color: var(--muted); font-weight: 600; }
.bm-sub {
  font-size: 15px; color: var(--muted); margin: 0;
  line-height: 1.55; max-width: 640px;
}

/* ─── PANEL ───────────────────────────────────────────────── */
.bm-panel {
  background: var(--card-bg);
  border-radius: var(--r-card);
  padding: clamp(20px, 3vw, 36px);
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.bm-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px; padding: 0 2px; gap: 14px; flex-wrap: wrap;
}
.bm-panel-title {
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 700; color: var(--ink); margin: 0; letter-spacing: -.01em;
}
.bm-panel-sub { font-size: 12.5px; color: var(--muted); margin: 0; }

/* ─── FORM ────────────────────────────────────────────────── */
.bm-form { display: flex; flex-direction: column; gap: 22px; }
.bm-field { display: flex; flex-direction: column; gap: 8px; }
.bm-field-label {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.bm-field-hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.bm-input-wrap {
  display: flex; align-items: center;
  background: var(--card-soft); border: 1px solid var(--hairline);
  border-radius: var(--r-input); padding: 0 16px;
  transition: border-color .15s, background .15s;
}
.bm-input-wrap:focus-within { border-color: var(--ink); background: var(--card-bg); }
.bm-input-suffix { font-size: 14px; color: var(--muted); flex-shrink: 0; font-weight: 500; }
.bm-input-wrap input {
  flex: 1; background: transparent; border: 0; padding: 14px 8px;
  font: inherit; font-size: 15px; color: var(--ink); font-weight: 600;
  outline: none; text-align: right; min-width: 0;
}

.bm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .bm-field-row { grid-template-columns: 1fr; } }
.bm-field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .bm-field-row-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .bm-field-row-3 { grid-template-columns: 1fr; } }

/* pill seg */
.bm-seg {
  display: flex; background: var(--card-soft); border-radius: var(--r-pill);
  padding: 4px; gap: 2px;
}
.bm-seg input { display: none; }
.bm-seg label {
  flex: 1; text-align: center; padding: 10px 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.bm-seg input:checked + label { background: var(--ink); color: #fff; }

/* ─── BIG RESULT ──────────────────────────────────────────── */
.bm-result-card {
  padding: 30px;
  border-radius: 20px;
  border: 1px solid;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  border-color: var(--acc-soft);
}
.bm-result-card.is-under  { background: linear-gradient(135deg, #DDEBFA, #C2DCF8); border-color: var(--info-soft); }
.bm-result-card.is-normal { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); border-color: var(--acc-soft); }
.bm-result-card.is-over   { background: linear-gradient(135deg, #FFFBEB, #FEF0C7); border-color: var(--amber-soft); }
.bm-result-card.is-obese  { background: linear-gradient(135deg, #FEF3F2, #FEE4E2); border-color: var(--warn-soft); }

.bm-result-eyebrow {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: var(--acc-text); margin: 0 0 8px;
}
.is-under  .bm-result-eyebrow { color: var(--info-text); }
.is-normal .bm-result-eyebrow { color: var(--acc-text); }
.is-over   .bm-result-eyebrow { color: var(--amber-text); }
.is-obese  .bm-result-eyebrow { color: var(--warn-text); }

.bm-result-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center;
}
@media (max-width: 600px) { .bm-result-grid { grid-template-columns: 1fr; } }

.bm-result-value {
  font-size: clamp(56px, 9vw, 84px);
  font-weight: 700; color: var(--ink);
  letter-spacing: -.03em; line-height: .95;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.bm-result-status {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 700; color: var(--ink); margin: 0 0 8px;
  letter-spacing: -.005em;
}
.bm-result-desc { font-size: 13.5px; color: var(--text); margin: 0; line-height: 1.55; }

/* BMI gauge */
.bm-gauge { margin-top: 22px; }
.bm-gauge-track {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  position: relative; background: var(--hairline);
}
.bm-gauge-seg {
  flex: 1; position: relative;
}
.bm-gauge-seg-1 { background: #C2DCF8; }
.bm-gauge-seg-2 { background: #B9E1C8; }
.bm-gauge-seg-3 { background: #F8E59C; }
.bm-gauge-seg-4 { background: #F4C6A3; }
.bm-gauge-seg-5 { background: #F4B5B0; }
.bm-gauge-marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: left .4s ease;
  z-index: 2;
}
.bm-gauge-labels {
  display: grid; grid-template-columns: repeat(5, 1fr);
  margin-top: 10px; font-size: 10.5px; color: var(--muted);
  font-weight: 600; text-align: center;
}
.bm-gauge-labels span { padding: 0 2px; }

/* ─── STAT GRID (3 stats) ────────────────────────────────── */
.bm-stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 720px) { .bm-stat-grid { grid-template-columns: 1fr; } }
.bm-stat {
  padding: 20px 22px;
  background: var(--card-soft);
  border: 1px solid var(--hairline);
  border-radius: 16px;
}
.bm-stat-label {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 600; color: var(--muted); margin: 0 0 8px;
}
.bm-stat-value {
  font-size: 24px; font-weight: 700; color: var(--ink);
  margin: 0; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
.bm-stat-note { font-size: 12px; color: var(--muted); margin: 4px 0 0; line-height: 1.45; }

/* ─── RANGE BOX ──────────────────────────────────────────── */
.bm-range {
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  border: 1px solid var(--acc-soft);
  border-radius: 20px;
  padding: 26px 28px;
  margin-bottom: 22px;
}
.bm-range-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: var(--acc-text); margin: 0 0 10px;
}
.bm-range-value {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700; color: var(--ink);
  margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.bm-range-note { font-size: 13px; color: var(--acc-text); margin: 0; }

.bm-suggest {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--card-bg);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
}
.bm-suggest strong { color: var(--ink); }

/* ─── BMI TABLE ──────────────────────────────────────────── */
.bm-table { overflow-x: auto; }
.bm-table table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px; min-width: 520px;
}
.bm-table th, .bm-table td {
  padding: 13px 14px; text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.bm-table thead th {
  font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 600; color: var(--muted);
}
.bm-table tbody td:nth-child(2),
.bm-table tbody td:nth-child(3) { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.bm-table .row-feat {
  background: rgba(16,185,129,.04);
}
.bm-table .row-feat td { color: var(--acc-text); }

.bm-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
}
.bm-pill-info   { background: var(--info-soft);  color: var(--info-text); }
.bm-pill-good   { background: var(--acc-soft);   color: var(--acc-text); }
.bm-pill-warn   { background: var(--amber-soft); color: var(--amber-text); }
.bm-pill-danger { background: var(--warn-soft);  color: var(--warn-text); }

/* ─── RISK CARDS ─────────────────────────────────────────── */
.bm-risk-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (max-width: 720px) { .bm-risk-grid { grid-template-columns: 1fr; } }
.bm-risk-card {
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--card-bg);
}
.bm-risk-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.bm-risk-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--card-soft);
}
.bm-risk-name {
  font-size: 15px; font-weight: 700; color: var(--ink); flex: 1;
}
.bm-risk-range {
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.bm-risk-body { font-size: 13px; color: var(--text); line-height: 1.6; margin: 0; }
.bm-risk-body strong { color: var(--ink); }

/* ─── ACCORDION (knowledge + FAQ) ────────────────────────── */
.bm-acc { display: flex; flex-direction: column; gap: 8px; }
.bm-acc details {
  background: var(--card-soft);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}
.bm-acc details[open] { background: var(--card-bg); border-color: var(--ink); }
.bm-acc summary {
  padding: 14px 18px; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.bm-acc summary::-webkit-details-marker { display: none; }
.bm-acc summary::after { content: '+'; color: var(--muted); font-size: 18px; font-weight: 400; }
.bm-acc details[open] summary::after { content: '−'; }
.bm-acc-body {
  padding: 4px 18px 18px;
  font-size: 13.5px; line-height: 1.65; color: var(--text);
}
.bm-acc-body p { margin: 0 0 10px; }
.bm-acc-body p:last-child { margin: 0; }
.bm-acc-body ul { margin: 6px 0 10px 22px; padding: 0; }
.bm-acc-body strong { color: var(--ink); }

/* ─── FAQ + Related ──────────────────────────────────────── */
.bm-faq-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 28px;
}
@media (max-width: 820px) { .bm-faq-grid { grid-template-columns: 1fr; } }

.bm-related-title {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 600; color: var(--muted); margin: 0 0 14px;
}
.bm-related-list { list-style: none; padding: 0; margin: 0; }
.bm-related-list li {
  padding: 12px 0; border-top: 1px solid var(--hairline);
  font-size: 13px; line-height: 1.5; color: var(--muted);
}
.bm-related-list li:first-child { border-top: 0; padding-top: 4px; }
.bm-related-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.bm-related-list a:hover { color: var(--acc-text); }

/* hide initial result before first calc */
.bm-needs-input { display: none; }
.bm-has-result .bm-needs-input { display: block; }
.bm-no-input-msg {
  padding: 60px 20px; text-align: center; color: var(--muted);
  background: var(--card-soft); border-radius: 16px;
}
.bm-has-result .bm-no-input-msg { display: none; }
