@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --bg-soft: #eaf1ef;
  --surface: #ffffff;
  --text: #102126;
  --muted: #4f6670;
  --brand: #0a7a72;
  --brand-strong: #075e59;
  --accent: #f59e0b;
  --bmi-under: #5ca5d8;
  --bmi-normal: #39c67a;
  --bmi-over: #efb34b;
  --bmi-obese: #df7453;
  --bmi-extreme: #b43a44;
  --border: #d3ddda;
  --shadow: 0 14px 34px rgba(14, 50, 62, 0.12);
  --radius: 16px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c171b;
  --bg-soft: #102229;
  --surface: #132930;
  --text: #ebf4f7;
  --muted: #a8c0c8;
  --brand: #3cc4b9;
  --brand-strong: #66ddd3;
  --accent: #ffb347;
  --border: #254148;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(150deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
  font-family: 'Space Grotesk', 'Avenir Next', 'Segoe UI', sans-serif;
  line-height: 1.6;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: auto;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}

body::before {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -70px;
  background: radial-gradient(circle, rgba(10, 122, 114, 0.24) 0%, rgba(10, 122, 114, 0) 72%);
}

body::after {
  width: 320px;
  height: 320px;
  bottom: -110px;
  left: -100px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0) 70%);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--brand-strong);
}

a:hover {
  opacity: 0.9;
}

.container {
  width: min(100% - 1.5rem, 1060px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background-color: color-mix(in oklab, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 75%, transparent);
}

.header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.15px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-menu {
  position: relative;
}

.lang-menu > summary {
  list-style: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lang-menu > summary::-webkit-details-marker {
  display: none;
}

.lang-menu[open] > summary {
  background: color-mix(in oklab, var(--surface) 88%, var(--brand) 12%);
}

.lang-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  width: min(240px, 84vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem;
  margin: 0;
  box-shadow: var(--shadow);
  z-index: 30;
  max-height: min(72vh, 430px);
  overflow-y: auto;
}

.lang-list li {
  list-style: none;
  margin: 0;
}

.lang-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  border-radius: 9px;
  transition: background-color 140ms ease, color 140ms ease;
}

.lang-list a:hover {
  background: color-mix(in oklab, var(--surface) 85%, var(--brand) 15%);
}

.lang-list a[aria-current='page'] {
  background: color-mix(in oklab, var(--brand) 22%, transparent);
  color: var(--brand-strong);
}

.lang-flag {
  font-size: 1rem;
}

.lang-code {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 120ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.hero {
  padding: 2.2rem 0 1.3rem;
}

.hero-grid {
  display: grid;
  gap: 1.25rem;
}

.hero-card {
  background: linear-gradient(145deg, color-mix(in oklab, var(--surface) 95%, #ffffff 5%) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.kicker {
  display: inline-block;
  background: color-mix(in oklab, var(--brand) 16%, transparent);
  color: var(--brand-strong);
  border-radius: 999px;
  padding: 0.24rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  font-family: 'Fraunces', 'Times New Roman', serif;
  line-height: 1.16;
  margin: 0.6rem 0;
}

h1 {
  font-size: clamp(1.7rem, 5.8vw, 2.7rem);
  max-width: 22ch;
}

.hero p {
  color: var(--muted);
  margin: 0.7rem 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn,
button,
input,
select {
  font: inherit;
}

.btn {
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  padding: 0.72rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in oklab, var(--brand) 70%, var(--accent)) 100%);
  color: #fff;
}

.btn-secondary {
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
}

main section {
  margin: 2.2rem 0;
}

.calculator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.calculator-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.calculator-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.unit-switch {
  display: inline-flex;
  gap: 0.4rem;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem;
}

.unit-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-weight: 600;
}

.unit-switch button.active {
  background: var(--brand);
  color: #fff;
}

.calc-grid {
  display: grid;
  gap: 0.7rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-size: 0.84rem;
}

.field input[type='number'] {
  width: 100%;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  color: var(--text);
  border-radius: 10px;
  padding: 0.68rem 0.72rem;
}

.field input[type='range'] {
  width: 100%;
  accent-color: var(--brand);
}

.imperial-hidden {
  display: none;
}

.calc-action {
  margin-top: 0.6rem;
}

.calc-action button {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in oklab, var(--brand) 72%, var(--accent)) 100%);
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.82rem 1rem;
  cursor: pointer;
}

.result {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
}

#bmiValue {
  font-size: clamp(1.8rem, 9vw, 2.6rem);
  font-weight: 700;
}

#bmiCategory {
  font-weight: 700;
  color: var(--brand-strong);
}

#bmiCategory.cat-underweight {
  color: var(--bmi-under);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: color-mix(in oklab, var(--bmi-under) 22%, transparent);
}

#bmiCategory.cat-normal {
  color: var(--bmi-normal);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: color-mix(in oklab, var(--bmi-normal) 22%, transparent);
}

#bmiCategory.cat-overweight {
  color: var(--bmi-over);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: color-mix(in oklab, var(--bmi-over) 24%, transparent);
}

#bmiCategory.cat-obesity {
  color: var(--bmi-obese);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: color-mix(in oklab, var(--bmi-obese) 24%, transparent);
}

#bmiCategory.cat-extremely-obese {
  color: var(--bmi-extreme);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: color-mix(in oklab, var(--bmi-extreme) 24%, transparent);
}

#bmiHint,
#healthyRange {
  color: var(--muted);
  margin: 0.42rem 0 0;
}

.bmi-scale {
  margin-top: 0.9rem;
  position: relative;
  padding-top: 0.15rem;
}

.scale-bar {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--bmi-under) 0% 28.333%,
    var(--bmi-normal) 28.333% 50%,
    var(--bmi-over) 50% 66.667%,
    var(--bmi-obese) 66.667% 100%
  );
}

.scale-boundary {
  position: absolute;
  top: 0;
  left: var(--pos);
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
  background: color-mix(in oklab, var(--surface) 90%, #fff 10%);
  border-radius: 999px;
  opacity: 0.96;
  pointer-events: none;
}

.scale-marker {
  position: absolute;
  top: -5px;
  width: 3px;
  height: 22px;
  background: var(--text);
  border-radius: 999px;
  left: 50%;
  transform: translateX(-50%);
  transition: left 240ms ease;
}

.scale-labels {
  margin-top: 0.35rem;
  position: relative;
  height: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.scale-labels span {
  position: absolute;
  left: var(--pos);
  transform: translateX(-50%);
  white-space: nowrap;
}

.scale-labels span:first-child {
  transform: none;
}

.scale-labels span:last-child {
  transform: translateX(-100%);
}

.bmi-scale.cat-underweight .scale-marker {
  background: var(--bmi-under);
}

.bmi-scale.cat-normal .scale-marker {
  background: var(--bmi-normal);
}

.bmi-scale.cat-overweight .scale-marker {
  background: var(--bmi-over);
}

.bmi-scale.cat-obesity .scale-marker {
  background: var(--bmi-obese);
}

.bmi-scale.cat-extremely-obese .scale-marker {
  background: var(--bmi-extreme);
}

.feature-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.feature-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
}

.feature-item h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0.78rem;
}

th {
  font-weight: 700;
  font-size: 0.92rem;
}

td {
  color: color-mix(in oklab, var(--text) 90%, #0000);
}

.faq {
  display: grid;
  gap: 0.68rem;
}

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.72rem 0.8rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

details p {
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.disclaimer {
  border-left: 4px solid var(--accent);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  padding: 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.93rem;
}

.site-footer {
  margin-top: 2.2rem;
  border-top: 1px solid var(--border);
}

.footer-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0 1.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.55s ease forwards;
}

.reveal-delay-1 {
  animation-delay: 90ms;
}

.reveal-delay-2 {
  animation-delay: 170ms;
}

.reveal-delay-3 {
  animation-delay: 250ms;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .header-wrap {
    padding: 0.95rem 0;
  }

  .hero {
    padding: 2.8rem 0 1.4rem;
  }

  .hero-grid {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }

  .calculator {
    padding: 1.3rem;
  }

  .calc-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }

  .feature-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
  }

  .calculator {
    margin-top: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
