*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f9f7f2;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #5c574f;
  --text-muted: #7a756c;
  --accent: #2b5f73;
  --accent-dark: #1e4a5c;
  --accent-light: #e8f0f4;
  --border: #e3ded5;
  --border-light: #eeeae3;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Outfit", system-ui, -apple-system, sans-serif;
  --underweight: #5b9bd5;
  --normal: #4caf79;
  --overweight: #f0a830;
  --obese: #e05c5c;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, #f4f6f7 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  font-size: 18px;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  z-index: 1000;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Navigation ===== */
.nav {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 3px;
  background: rgba(249, 247, 242, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.nav-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* ===== Page Title (h1 for SEO) ===== */
.page-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  text-align: center;
  color: var(--text-muted);
  padding-top: 2.5rem;
  letter-spacing: 0.01em;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 1001;
  border-radius: 4px;
}

/* ===== Hero / Calculator ===== */
.hero {
  text-align: center;
  padding: 1.5rem 0 3rem;
  animation: fadeIn 0.6s ease-out both;
}

.hero-label {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero-number {
  font-family: var(--font-serif);
  font-size: clamp(5.5rem, 16vw, 11rem);
  font-weight: 300;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
  transition: color 0.3s ease;
}

.hero-divider {
  width: 40px;
  height: 1px;
  background: var(--accent);
  margin: 1.25rem auto;
  opacity: 0.7;
}

.hero-unit {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-category {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.85rem;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  display: inline-block;
  transition: all 0.3s ease;
}

.hero-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
}

/* ===== Calculator Inputs ===== */
.calc-inputs {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.input-group label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.calc-input {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  width: 5.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: right;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  -moz-appearance: textfield;
}

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

.calc-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 95, 115, 0.12);
}

.input-suffix {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== BMI Scale ===== */
.bmi-scale {
  margin-top: 2rem;
  padding: 0 1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.scale-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--underweight) 0%,
    var(--underweight) 10.4%,
    var(--normal) 10.4%,
    var(--normal) 37.5%,
    var(--overweight) 37.5%,
    var(--overweight) 58.3%,
    var(--obese) 58.3%,
    var(--obese) 100%
  );
  position: relative;
  margin-bottom: 0.5rem;
}

.scale-marker {
  position: absolute;
  top: -6px;
  width: 20px;
  height: 20px;
  background: var(--text);
  border: 3px solid var(--surface);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
}

.scale-marker.visible {
  display: block;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ===== Section Titles ===== */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* ===== BMI Table ===== */
.table-section {
  padding: 2rem 0 2.5rem;
  animation: fadeIn 0.6s ease-out 0.1s both;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--border);
  text-align: left;
}

.data-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(43, 95, 115, 0.03);
}

.data-table tr.highlight {
  background: var(--accent-light);
  font-weight: 500;
}

.data-table tr.highlight:hover {
  background: var(--accent-light);
}

.bmi-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ===== Category Cards ===== */
.category-section {
  padding: 2rem 0 2.5rem;
  animation: fadeIn 0.6s ease-out 0.15s both;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
}

.category-card {
  padding: 1.15rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s ease;
  background: var(--surface);
  cursor: default;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.category-card.active {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(43, 95, 115, 0.15);
}

.card-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
  opacity: 0.65;
}

.card-range {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.card-desc {
  font-size: 0.68rem;
  margin-top: 0.3rem;
  opacity: 0.55;
}

/* ===== Info ===== */
.info-section {
  padding: 2rem 0 2.5rem;
  max-width: 660px;
  animation: fadeIn 0.6s ease-out 0.2s both;
}

.info-section p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.info-section p:last-child {
  margin-bottom: 0;
}

.info-section strong {
  color: var(--text);
  font-weight: 500;
}

.info-section h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.info-section a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-section a:hover {
  color: var(--accent-dark);
}

.info-section ul {
  padding-left: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.info-section li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
  font-size: 0.95rem;
}

/* ===== Related pages grid ===== */
.related-section {
  padding: 2rem 0 2.5rem;
  animation: fadeIn 0.6s ease-out 0.25s both;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7rem;
}

.related-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.related-card-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.related-card-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
}

.related-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ===== FAQ ===== */
.faq-section {
  padding: 2rem 0 4rem;
  max-width: 660px;
  animation: fadeIn 0.6s ease-out 0.3s both;
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
}
.faq-item:first-of-type {
  border-top: 1px solid var(--border-light);
}

.faq-item summary {
  padding: 0.9rem 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.92rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: color 0.15s ease;
}

.faq-item summary:hover {
  color: var(--accent);
}
.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.faq-item p {
  padding: 0 0 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.88rem;
}

/* ===== Footer ===== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
}

.footer-links a {
  color: var(--text-muted);
}

/* ===== Animation ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero {
    padding: 1.25rem 0 2.5rem;
  }
  .page-title {
    padding-top: 2rem;
  }
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .section-title {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  .nav {
    padding: 1rem 0;
  }
  .brand {
    font-size: 1.15rem;
  }
  .hero {
    padding: 1rem 0 2rem;
  }
  .page-title {
    padding-top: 1.5rem;
    font-size: 0.95rem;
  }
  .hero-number {
    font-size: clamp(4rem, 20vw, 5.5rem);
  }
  .calc-inputs {
    gap: 1rem;
  }
  .calc-input {
    width: 4.5rem;
  }
  .category-grid {
    gap: 0.5rem;
  }
  .category-card {
    padding: 0.9rem 0.4rem;
  }
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
  }
}
