:root {
  --white: #ffffff;
  --green-forest: #1b5e20;
  --green-forest-dark: #134017;
  --green-forest-2: #2e7d32;
  --green-light: #dff3e1;
  --text: #0f1a12;
  --muted: #3a4a40;
  --card: #f6fbf7;
  --border: rgba(27, 94, 32, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--text);
}

/* Main page theme (homepage) */
body.theme-main {
  background:
    radial-gradient(1200px 600px at 20% 0%, var(--green-light), transparent 60%),
    radial-gradient(900px 520px at 95% 10%, rgba(223, 243, 225, 0.65), transparent 55%),
    linear-gradient(180deg, var(--white), var(--white));
}

/* Subtitle theme (subpages) */
body.theme-subtitle {
  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(223, 243, 225, 0.55), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

/* Page-specific themes (override shared variables) */
body.theme-prevention {
  --green-forest: #0b5fa5; /* medical blue */
  --green-forest-dark: #073a63;
  --green-forest-2: #1677c7;
  --green-light: #e6f3ff;
  --text: #0b1622;
  --muted: #2a4057;
  --card: #f6fbff;
  --border: rgba(11, 95, 165, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(230, 243, 255, 0.9), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

body.theme-anatomy {
  --green-forest: #b3261e; /* warm red */
  --green-forest-dark: #7b1c18;
  --green-forest-2: #d33a32;
  --green-light: #ffe8e7;
  --text: #1b0d0d;
  --muted: #5b2a2a;
  --card: #fff7f7;
  --border: rgba(179, 38, 30, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(255, 232, 231, 0.85), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

body.theme-diseases {
  --green-forest: #7a1111; /* dark red */
  --green-forest-dark: #4f0b0b;
  --green-forest-2: #9a1a1a;
  --green-light: #f5d9d9;
  --text: #1a0b0b;
  --muted: #4e2a2a;
  --card: #fff6f6;
  --border: rgba(122, 17, 17, 0.22);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(245, 217, 217, 0.8), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

body.theme-home {
  /* Slightly darker green than default */
  --green-forest: #154a19;
  --green-forest-dark: #0f3312;
  --green-forest-2: #236327;
  --green-light: #d8efd9;
  --text: #0f1a12;
  --muted: #3a4a40;
  --card: #f6fbf7;
  --border: rgba(21, 74, 25, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(216, 239, 217, 0.95), transparent 60%),
    radial-gradient(900px 520px at 95% 10%, rgba(216, 239, 217, 0.65), transparent 55%),
    linear-gradient(180deg, var(--white), var(--white));
}

body.theme-glossary {
  /* Same green palette as the site default */
  --green-forest: #1b5e20;
  --green-forest-dark: #134017;
  --green-forest-2: #2e7d32;
  --green-light: #dff3e1;
  --text: #0f1a12;
  --muted: #3a4a40;
  --card: #f6fbf7;
  --border: rgba(27, 94, 32, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(223, 243, 225, 0.55), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

body.theme-sources {
  --green-forest: #06365d; /* medical blue */
  --green-forest-dark: #073a63;
  --green-forest-2: #095289;
  --green-light: #e6f3ff;
  --text: #061b2f;
  --muted: #2a4057;
  --card: #f6fbff;
  --border: rgba(6, 54, 93, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  background:
    radial-gradient(1200px 520px at 10% 0%, rgba(230, 243, 255, 0.9), transparent 62%),
    linear-gradient(180deg, #ffffff, #ffffff);
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--white);
  color: var(--green-forest);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 1000;
}

.skip-link:focus {
  left: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--green-forest-dark);
  color: var(--white);
  height: 44px;
  display: flex;
  align-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 14px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav__link {
  color: var(--white);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 10px;
  transition:
    background-color 140ms ease,
    transform 140ms ease,
    opacity 140ms ease;
  opacity: 0.95;
  line-height: 1;
  white-space: nowrap;
}

.nav__link:hover {
  background: var(--green-forest-2);
  opacity: 1;
}

.nav__link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.nav__link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}

.hero {
  padding: 34px 0 24px;
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.title {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  color: var(--green-forest);
  letter-spacing: -0.02em;
}

.title--center {
  grid-column: 1 / -1;
  text-align: center;
  margin-bottom: 16px;
}

.lede {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px;
  box-shadow: var(--shadow);
}

.card__title {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--green-forest);
}

.card__text {
  margin: 0;
  line-height: 1.65;
  color: var(--text);
}

.diagram {
  min-height: 320px;
  width: 100%;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(223, 243, 225, 0.75), #ffffff);
  border: 2px dashed rgba(27, 94, 32, 0.35);
  display: grid;
  place-content: center;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.diagram__label {
  font-weight: 800;
  color: var(--green-forest);
  font-size: 18px;
  margin-bottom: 6px;
}

.diagram__hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.diagram-link {
  display: block;
  text-decoration: none;
}

.diagram-image {
  width: 100%;
  min-height: 320px;
  border-radius: 16px;
  border: 2px dashed rgba(27, 94, 32, 0.35);
  background: linear-gradient(180deg, rgba(223, 243, 225, 0.75), #ffffff);
  object-fit: contain;
  box-shadow: var(--shadow);
}

.diagram-caption {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.diagram-link:focus-visible {
  outline: 3px solid var(--green-forest);
  outline-offset: 4px;
  border-radius: 18px;
}

.diagram-lightbox {
  width: min(96vw, 1200px);
  max-height: 92vh;
  border: none;
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

.diagram-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.diagram-lightbox__close {
  display: inline-block;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
}

.diagram-lightbox__image {
  width: 100%;
  max-height: calc(92vh - 80px);
  object-fit: contain;
  border-radius: 10px;
}

.footer {
  padding: 16px 0 26px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .diagram {
    min-height: 240px;
  }

  .diagram-image {
    min-height: 240px;
  }
}

/* Prevention page side navigation: collapsible stripe */
.prevention-layout {
  position: relative;
}

.side-nav {
  position: fixed;
  top: 44px;
  left: 0;
  width: 40px;
  height: calc(100vh - 44px);
  background: var(--green-forest);
  border-radius: 0 14px 14px 0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  transition: width 180ms ease;
  z-index: 60;
}

.side-nav:hover,
.side-nav:focus-within {
  justify-content: flex-start;
}

.side-nav__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.side-nav:hover .side-nav__arrow,
.side-nav:focus-within .side-nav__arrow {
  margin-top: auto;
}

.side-nav__items {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 160ms ease, max-height 180ms ease;
}

.side-nav:hover,
.side-nav:focus-within {
  width: 240px;
}

.side-nav:hover .side-nav__items,
.side-nav:focus-within .side-nav__items {
  max-height: min(78vh, 720px);
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
}

.side-nav__link {
  display: block;
  padding: 10px 14px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.side-nav__link:hover {
  background: var(--green-forest-2);
  box-shadow: 0 0 0 1px rgba(223, 243, 225, 0.5);
}

.side-nav__link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: -2px;
}

.page-sections {
  display: grid;
  gap: 14px;
  margin-left: 80px;
}

.page-section {
  padding: 10px 0;
  scroll-margin-top: 64px;
}

.page-section__title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--green-forest);
}

.page-section__text {
  margin: 0;
  line-height: 1.65;
}

.page-section__text + .page-section__text {
  margin-top: 12px;
}

/* Full-width prevention content (diagrams live inside sections, not a global aside) */
.prevention-page {
  padding: 34px 0 24px;
}

.prevention-page .title--center {
  margin-bottom: 16px;
}

/* Text column + diagram column */
.page-section-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 320px);
  gap: 20px;
  align-items: start;
  margin-top: 10px;
}

.page-section-split__text .page-section__text + .page-section__text {
  margin-top: 12px;
}

.page-section-split__aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diagram-image--stack {
  min-height: 160px;
}

.diagram-image--chart {
  height: 100%;
  width: 100%;
  object-fit: contain;
  border: 0;
  background: #ffffff;
  box-shadow: none;
  border-radius: 0;
}

.page-subsection {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.page-subsection__title {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--green-forest);
}

.page-subsection__subtitle {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

.page-section-split--subsection {
  margin-top: 8px;
}

/* Food & Diet: two large charts, bold titles only (no captions under images) */
.diagram-charts-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
  align-items: stretch;
}

.diagram-charts-two__item {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 420px;
}

.diagram-charts-two__label {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}

.diagram-image--foodchart1 {
  transform: none;
  object-position: left center;
}

.food-chart-frame {
  display: block;
  height: 360px;
  overflow: hidden;
  border-radius: 0;
  background: #ffffff;
}

@media (max-width: 860px) {
  .page-section-split {
    grid-template-columns: 1fr;
  }

  .page-section-split__aside {
    max-width: 100%;
  }

  .diagram-charts-two {
    grid-template-columns: 1fr;
  }

  .diagram-image--chart {
    max-height: none;
  }

  .food-chart-frame {
    height: 300px;
  }
}

.sources-links {
  margin: 8px 0 0;
  padding-left: 18px;
}

.sources-links li {
  margin: 6px 0;
}

.sources-links a {
  color: var(--green-forest);
  font-weight: 600;
}

.glossary-main {
  padding: 34px 0 24px;
}

.glossary-layout {
  display: grid;
  gap: 18px;
}

.glossary-search-wrap {
  position: relative;
  z-index: 80;
}

.glossary-search__label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--green-forest);
}

.glossary-search {
  position: relative;
}

.glossary-search__input {
  width: 100%;
  max-width: 720px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  line-height: 1.3;
}

.glossary-search__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(720px, calc(100vw - 40px));
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #7a7a7a;
  background: #b8b8b8;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.glossary-search__option {
  display: block;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: #111111;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.18);
  transition: background-color 130ms ease, box-shadow 130ms ease;
}

.glossary-search__option:hover,
.glossary-search__option:focus-visible {
  background: #d4d4d4;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  outline: none;
}

.glossary-search__no-results {
  padding: 10px;
  color: #111111;
  font-size: 14px;
}

.glossary-terms {
  display: grid;
  gap: 12px;
}

.glossary-term {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.glossary-term__title {
  margin: 0 0 6px;
  color: var(--green-forest);
  font-size: 18px;
}

.glossary-term__description {
  margin: 0;
  line-height: 1.6;
}

.glossary-term__diagram-placeholder {
  min-height: 160px;
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(223, 243, 225, 0.75), #ffffff);
  border: 2px dashed rgba(27, 94, 32, 0.35);
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  padding: 12px;
}

@media (max-width: 860px) {
  .side-nav {
    inset-block: auto;
    top: 120px;
  }
}
