:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #23332f;
  background: #f7f2e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #23332f;
  --muted: #65756e;
  --green: #2e7668;
  --green-dark: #225d53;
  --green-soft: #e4f0e9;
  --gold: #cf9a55;
  --coral: #c77962;
  --line: #dce5df;
  --surface: #fffefa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: #f7f2e8;
  background-image:
    linear-gradient(rgba(250, 247, 239, 0.22), rgba(250, 247, 239, 0.22)),
    url("/images/munozden-back.png");
  background-size: cover, 768px 768px;
  background-repeat: no-repeat, repeat;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.site-header,
main,
.site-footer {
  width: min(1080px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.site-header {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px 10px 10px 4px;
  background: var(--green);
  color: white;
  font-size: 1.2rem;
  line-height: 1;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 27px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--green-dark);
}

main {
  padding-bottom: 54px;
}

.breadcrumbs {
  padding-top: 24px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  color: #89968e;
  font-size: 0.78rem;
  list-style: none;
}

.breadcrumbs a {
  color: var(--green-dark);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumbs [aria-current="page"] {
  color: #52635a;
  font-weight: 650;
}

.back-to-biology {
  display: inline-block;
  margin-top: 10px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none;
}

.back-to-biology:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.intro {
  max-width: 760px;
  padding: 40px 0 56px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 19px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 8vw, 6.1rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.99;
}

h1 span {
  color: var(--green);
}

.intro > p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.8;
}

.lesson,
.explorer,
.quick-check {
  margin-top: 18px;
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: 0 18px 48px rgba(43, 69, 58, 0.06);
}

.section-heading,
.simulation-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading .eyebrow,
.simulation-heading .eyebrow {
  margin-bottom: 6px;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.section-index,
.simulation-label {
  color: #829087;
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
}

.chapter-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faf6;
}

.chapter-button {
  display: flex;
  min-height: 41px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64746c;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  text-align: left;
}

.chapter-button span {
  color: #8a9a91;
  font-size: 0.67rem;
  font-weight: 800;
}

.chapter-button:hover {
  background: #edf4ee;
  color: var(--green-dark);
}

.chapter-button[aria-current="step"] {
  background: var(--green-soft);
  color: var(--green-dark);
}

.chapter-button[aria-current="step"] span {
  color: var(--green);
}

.lesson-panel {
  min-width: 0;
  padding: clamp(20px, 3.5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffefa;
}

.chapter-kicker {
  margin-bottom: 7px;
  color: var(--green);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.lesson-panel h3 {
  margin-bottom: 16px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.chapter-content {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.chapter-content p {
  margin-bottom: 12px;
}

.chapter-content p:last-child {
  margin-bottom: 0;
}

.chapter-content strong {
  color: #405b4e;
}

.chapter-takeaway {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 18px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: #fbf6ec;
  color: #6f604b;
  font-size: 0.81rem;
}

.chapter-takeaway strong {
  color: #88643a;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.reflection {
  padding: 15px;
  border: 1px solid #e6eee7;
  border-radius: 10px;
  background: #f7faf6;
}

.reflection-question {
  margin-bottom: 9px;
  color: #40534a;
  font-size: 0.82rem;
  font-weight: 700;
}

.reveal-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reflection-answer {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.lesson-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.lesson-controls > span {
  color: #829087;
  font-size: 0.74rem;
  font-weight: 700;
}

.lesson-step-button {
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.lesson-step-button:last-child {
  justify-self: end;
}

.lesson-step-button:disabled {
  border-color: var(--line);
  background: #f3f5f1;
  color: #9aa59f;
  cursor: not-allowed;
}

.mode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.mode-button,
.answer-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffefa;
  color: #50625a;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.mode-button:hover,
.answer-button:hover {
  border-color: #9cbbad;
  background: #f2f7f3;
}

.mode-button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.explorer-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
}

.explanation,
.simulation {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
}

.explanation {
  padding: clamp(20px, 3vw, 30px);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 17px;
}

.transport-type {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.07em;
}

.transport-type {
  background: var(--green-soft);
  color: var(--green-dark);
}

h3 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  font-weight: 550;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.explanation > p:not(.key-idea) {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.75;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  padding-top: 11px;
  border-top: 1px solid #edf0ea;
}

.facts dt {
  margin-bottom: 2px;
  color: #87948b;
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: #3b4e45;
  font-size: 0.83rem;
  font-weight: 650;
}

.key-idea {
  margin: 17px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: #fbf6ec;
  color: #6f604b;
  font-size: 0.8rem;
}

.simulation {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3vw, 26px);
  background: #f7faf6;
}

.simulation-heading {
  align-items: flex-start;
  margin-bottom: 10px;
}

.simulation-heading h3 {
  margin-bottom: 0;
  font-size: 1.26rem;
}

.simulation-label {
  padding-top: 4px;
  font-size: 0.59rem;
}

.schematic-note,
.diagram-description,
.net-readout,
.simulation-status,
.model-assumptions {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.schematic-note {
  margin: 0 0 10px;
  font-weight: 700;
}

.diagram {
  display: block;
  width: 100%;
  height: 280px;
  border: 1px solid #e4ebe4;
  border-radius: 10px;
  background: #f8faf6;
}

.diagram-description {
  margin: 10px 0 0;
}

.net-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 10px 0 0;
  color: #3b4e45;
}

.net-readout-note {
  color: var(--muted);
}

.particle-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid #e4ebe4;
  border-radius: 9px;
  background: #fffefa;
}

.legend-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #53645b;
  font-size: 0.68rem;
  line-height: 1.35;
}

.legend-symbol {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  color: #235d53;
  font-size: 0.54rem;
  font-weight: 800;
}

.legend-o2 {
  border: 2px solid #2e7668;
  border-radius: 50%;
}

.legend-ion {
  border: 2px solid #4f7892;
  border-radius: 50%;
  color: #315d78;
  font-size: 0.8rem;
}

.legend-water {
  width: 14px;
  height: 14px;
  flex-basis: 22px;
}

.legend-water::before {
  width: 13px;
  height: 13px;
  border: 1px solid #3c7f9e;
  border-radius: 50% 50% 50% 0;
  background: #dceef4;
  content: "";
  transform: rotate(-45deg);
}

.legend-solute::before {
  width: 12px;
  height: 12px;
  border: 1px solid #996a33;
  border-radius: 2px;
  background: #f4dfb9;
  content: "";
  transform: rotate(45deg);
}

.legend-bilayer {
  background:
    radial-gradient(circle, #6f9c86 0 2px, transparent 2.5px) 2px 2px / 8px 8px repeat-y,
    radial-gradient(circle, #6f9c86 0 2px, transparent 2.5px) 12px 2px / 8px 8px repeat-y,
    linear-gradient(90deg, transparent 0 7px, #d5e5d9 7px 15px, transparent 15px);
}

.legend-channel::before {
  width: 10px;
  height: 20px;
  border: 2px solid #40816d;
  border-radius: 6px;
  background: #e6f3eb;
  content: "";
}

.legend-pump::before {
  width: 18px;
  height: 18px;
  border: 2px solid #a96349;
  background: #f8e9df;
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
  content: "";
}

.atp-reaction,
.pump-phase {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #f8e9df;
  color: #854f3d;
  font-size: 0.76rem;
  font-weight: 750;
}

.atp-reaction span {
  color: #795e53;
  font-size: 0.68rem;
  font-weight: 500;
}

.pump-phase {
  margin-top: 6px;
  background: #fffefa;
  color: #53645b;
  font-weight: 600;
}

.simulation-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.simulation-button,
.speed-control select {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #cbd9d0;
  border-radius: 9px;
  background: #fffefa;
  color: #30463c;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.simulation-button {
  cursor: pointer;
}

.simulation-button:hover:not(:disabled) {
  border-color: #9cbbad;
  background: #f2f7f3;
}

.simulation-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.simulation-button-primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.simulation-button-primary:hover:not(:disabled) {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

#atp-toggle[aria-pressed="false"] {
  border-color: #bd8063;
  background: #f8e9df;
  color: #854f3d;
}

.speed-control {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  color: #53645b;
  font-size: 0.75rem;
  font-weight: 700;
}

.speed-control select {
  min-width: 74px;
  padding-right: 26px;
}

.simulation-status {
  min-height: 1.5em;
  margin: 10px 0 0;
}

.model-assumptions {
  margin-top: 8px;
}

.model-assumptions summary {
  width: fit-content;
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 700;
}

.model-assumptions p {
  margin: 8px 0 0;
}

.quick-check {
  margin-top: 24px;
}

.question {
  padding: clamp(19px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7faf6;
}

.question > p:first-child {
  margin-bottom: 17px;
  font-size: 1rem;
  font-weight: 700;
}

.answer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.answer-button {
  min-height: 44px;
}

.answer-feedback {
  min-height: 1.5em;
  margin: 13px 0 0;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 650;
}

.answer-feedback.incorrect {
  color: #a45e46;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: #7d8b83;
  font-size: 0.76rem;
}

:focus-visible {
  outline: 3px solid #d39a55;
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .chapter-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explorer-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    padding-top: 75px;
  }
}

@media (max-width: 540px) {
  .site-header,
  main,
  .site-footer {
    width: calc(100% - 32px);
  }

  .site-header {
    min-height: 72px;
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
  }

  .site-header nav {
    justify-content: space-between;
    gap: 8px;
  }

  .site-header nav a {
    font-size: 0.76rem;
  }

  .intro {
    padding: 58px 0 36px;
  }

  h1 {
    font-size: clamp(3.1rem, 13vw, 4.3rem);
  }

  .lesson,
  .explorer,
  .quick-check {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .chapter-nav {
    gap: 3px;
    padding: 6px;
  }

  .chapter-button {
    align-items: flex-start;
    gap: 6px;
    padding: 8px 6px;
    font-size: 0.68rem;
  }

  .chapter-button span {
    padding-top: 1px;
    font-size: 0.6rem;
  }

  .lesson-controls {
    grid-template-columns: auto 1fr auto;
  }

  .lesson-step-button {
    padding: 8px 10px;
    font-size: 0.7rem;
  }

  .mode-picker {
    gap: 7px;
  }

  .mode-button {
    min-height: 39px;
    padding: 8px 11px;
    font-size: 0.74rem;
  }

  .diagram {
    height: 250px;
  }

  .particle-legend {
    grid-template-columns: 1fr;
  }

  .simulation-controls {
    align-items: stretch;
  }

  .simulation-button {
    flex: 1 1 auto;
  }

  .speed-control {
    flex: 1 1 120px;
    justify-content: space-between;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
