:root {
  --ink: #111827;
  --muted: #5f6673;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --green: #0f4c3a;
  --green-2: #1c6a50;
  --gold: #d2a94a;
  --gold-soft: #f4e8bf;
  --border: #ddd8ca;
  --danger: #9f2f2f;
  --shadow: 0 18px 50px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--green-2); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 20;
  transform: translateY(-180%);
  background: var(--surface);
  color: var(--ink);
  padding: .6rem 1rem;
  border-radius: .4rem;
}
.skip-link:focus { transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  color: #fff;
  background: linear-gradient(120deg, #082e24, var(--green));
  border-bottom: 4px solid var(--gold);
}
.brand-block { display: flex; align-items: center; gap: 1rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-soft);
  font-weight: 900;
  letter-spacing: .06em;
}
.topbar h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.15rem, 2.2vw, 1.75rem); line-height: 1.2; }
.eyebrow { margin: 0 0 .15rem; color: var(--gold-soft); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; }
.top-progress { min-width: min(16rem, 28vw); text-align: right; font-size: .9rem; font-weight: 700; }
.progress-track { height: .55rem; margin-top: .35rem; overflow: hidden; background: rgba(255,255,255,.2); border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold); transition: width .35s ease; }

.course-shell { display: grid; grid-template-columns: 20rem minmax(0, 1fr); min-height: calc(100vh - 110px); }
.course-nav {
  padding: 1.5rem 1rem 2rem;
  background: #ece8dc;
  border-right: 1px solid var(--border);
}
.learner-card { padding: 1rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: .8rem; }
.learner-card label { display: block; margin-bottom: .35rem; font-weight: 800; }
.name-row { display: flex; gap: .5rem; }
input, textarea, select {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aaa69b;
  border-radius: .45rem;
  padding: .65rem .75rem;
}
textarea { min-height: 7rem; resize: vertical; }
.microcopy { margin: .55rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.nav-button {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: .65rem;
  width: 100%;
  margin: .3rem 0;
  padding: .75rem;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .6rem;
}
.nav-button:hover { background: rgba(255,255,255,.6); }
.nav-button.active { background: var(--surface); border-color: var(--gold); box-shadow: 0 6px 20px rgba(17,24,39,.06); }
.nav-number { display: grid; place-items: center; width: 2rem; height: 2rem; color: #fff; background: var(--green); border-radius: 50%; font-weight: 900; }
.nav-title { font-size: .91rem; font-weight: 750; line-height: 1.25; }
.nav-status { color: var(--green); font-weight: 900; }
.text-button { padding: .5rem; color: var(--green); background: transparent; border: 0; text-decoration: underline; }
.danger { color: var(--danger); }

main { width: 100%; max-width: 70rem; padding: clamp(1.5rem, 4vw, 3.5rem); }
.view { animation: appear .25s ease-out; }
@keyframes appear { from { opacity: .2; transform: translateY(5px); } }
.hero-card {
  padding: clamp(1.5rem, 5vw, 3.5rem);
  color: #fff;
  background: linear-gradient(135deg, #0d3b2e, #1d604a);
  border-left: .45rem solid var(--gold);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}
.hero-card h2 { max-width: 18ch; margin: .25rem 0 1rem; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.06; }
.hero-card p { max-width: 64ch; font-size: 1.08rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0; }
.pill { display: inline-flex; align-items: center; padding: .38rem .7rem; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); font-size: .86rem; font-weight: 700; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .7rem 1rem;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: .5rem;
  font-weight: 800;
  text-decoration: none;
}
.button:hover { background: var(--green-2); }
.button.gold { color: #152018; background: var(--gold); border-color: var(--gold); }
.button.secondary { color: var(--green); background: #fff; }
.button.small { padding: .55rem .7rem; font-size: .86rem; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; }

.section-card { padding: clamp(1.15rem, 3vw, 2rem); margin-top: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 8px 28px rgba(17,24,39,.045); }
.section-card h2, .section-card h3 { font-family: Georgia, serif; line-height: 1.2; }
.section-card h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.section-card h3 { margin-top: 0; font-size: 1.4rem; }
.module-header { padding-bottom: 1.2rem; border-bottom: 2px solid var(--gold-soft); }
.module-kicker { color: var(--green); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 900; }
.learning-list { display: grid; gap: .55rem; padding-left: 1.25rem; }
.lesson { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.lesson:last-child { border-bottom: 0; }
.lesson h3 { font-size: 1.3rem; }
.lesson h4 { margin-bottom: .2rem; }
.callout { padding: 1rem 1.1rem; margin: 1rem 0; background: #f2f7f4; border-left: 4px solid var(--green-2); border-radius: .35rem; }
.warning { background: #fff6dc; border-left-color: #b97808; }
.example { background: #f6f6f3; border-left-color: #747168; }
.video-companion { border-top: 5px solid var(--gold); background: linear-gradient(135deg, #fffdf7, #f6f0df); }
.video-companion h3 { margin-bottom: .5rem; color: var(--green); }
.video-note { padding: 1rem; margin-top: 1rem; color: #f7f5ef; background: var(--green); border-radius: .55rem; font-weight: 750; }
.video-frame { position: relative; width: 100%; padding-top: 56.25%; margin-top: 1rem; overflow: hidden; background: #081f19; border-radius: .65rem; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.case-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.case-facts div { padding: .9rem; background: #f2f7f4; border: 1px solid #cbded5; border-radius: .55rem; }
.case-facts span { display: block; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.case-facts strong { display: block; margin-top: .2rem; color: var(--green); font-family: Georgia, serif; font-size: 1.1rem; }
.lesson-check { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem; margin-top: 1rem; background: var(--gold-soft); border-radius: .5rem; font-weight: 750; }
.lesson-check input { width: 1.15rem; height: 1.15rem; margin-top: .25rem; accent-color: var(--green); }
.activity-field { margin-top: 1rem; }
.activity-field label { display: block; margin-bottom: .35rem; font-weight: 800; }
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .6rem; }
.check-option { display: flex; gap: .55rem; align-items: flex-start; padding: .75rem; background: #f6f6f3; border-radius: .45rem; }
.check-option input { width: 1.1rem; height: 1.1rem; margin-top: .25rem; }

.calculator { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .9rem; }
.calc-result { grid-column: 1 / -1; padding: 1rem; color: #fff; background: var(--green); border-radius: .6rem; }
.calc-result strong { display: block; color: var(--gold-soft); font-family: Georgia, serif; font-size: 1.8rem; }

.quiz-question { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.quiz-question legend { padding: 0; margin-bottom: .55rem; font-weight: 800; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem .6rem; border-radius: .35rem; }
.choice:hover { background: #f6f6f3; }
.choice input { width: 1rem; height: 1rem; margin-top: .3rem; }
.feedback { padding: 1rem; margin-top: 1rem; border-radius: .55rem; font-weight: 650; }
.feedback.pass { color: #0c412f; background: #dcf1e7; border: 1px solid #7cb99f; }
.feedback.fail { color: #6e271f; background: #f8e0dc; border: 1px solid #d99c93; }
.source-list li { margin: .7rem 0; }
.locked { padding: 2rem; text-align: center; color: var(--muted); background: #eeece6; border: 1px dashed #aaa69b; border-radius: .8rem; }

.certificate-wrap { padding: 1rem; }
.certificate {
  position: relative;
  overflow: hidden;
  min-height: 45rem;
  padding: clamp(2rem, 7vw, 5rem);
  text-align: center;
  background: #fffdf7;
  border: 12px double var(--green);
  box-shadow: var(--shadow);
}
.certificate::before, .certificate::after { content: ""; position: absolute; width: 7rem; height: 7rem; border: 2px solid var(--gold); transform: rotate(45deg); }
.certificate::before { top: -4rem; left: -4rem; }
.certificate::after { right: -4rem; bottom: -4rem; }
.certificate .seal { display: grid; place-items: center; width: 5.5rem; height: 5.5rem; margin: 0 auto 1.5rem; color: var(--green); border: 3px solid var(--gold); border-radius: 50%; font-weight: 900; letter-spacing: .08em; }
.certificate h2 { margin: .5rem 0; color: var(--green); font-family: Georgia, serif; font-size: clamp(2.2rem, 6vw, 4rem); }
.certificate .recipient { margin: 1.5rem auto; padding-bottom: .4rem; max-width: 34rem; font-family: Georgia, serif; font-size: clamp(1.8rem, 5vw, 3rem); border-bottom: 2px solid var(--gold); }
.certificate .course-name { max-width: 36rem; margin: 1rem auto; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 800; }
.certificate-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 2rem; margin-top: 2.5rem; color: var(--muted); font-size: .9rem; }
.certificate-note { margin-top: 2.5rem; color: var(--muted); font-size: .75rem; }

footer { padding: 2rem clamp(1rem,4vw,3rem); color: #dceae4; background: #082e24; font-size: .85rem; }
footer p { max-width: 80rem; margin: .25rem auto; }

.access-message {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  max-width: none;
  padding: 2rem;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, #082e24, #1d604a);
}
.access-message .brand-mark { width: 5rem; height: 5rem; margin-bottom: 1rem; }
.access-message h1 { margin: .2rem 0; font-family: Georgia, serif; font-size: clamp(2.2rem, 7vw, 4.8rem); }
.access-message p:not(.eyebrow) { max-width: 40rem; margin: .75rem auto 1.5rem; font-size: 1.1rem; }

@media (max-width: 820px) {
  .topbar { position: static; display: block; }
  .top-progress { min-width: 0; margin-top: 1rem; text-align: left; }
  .course-shell { display: block; }
  .course-nav { border-right: 0; border-bottom: 1px solid var(--border); }
  #module-list { display: flex; gap: .35rem; padding-bottom: .45rem; overflow-x: auto; }
  .nav-button { min-width: 13rem; }
  .activity-grid, .calculator, .check-grid { grid-template-columns: 1fr; }
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .case-facts { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .topbar, .course-nav, footer, #welcome-view, #module-view, #final-view, .certificate-actions { display: none !important; }
  .course-shell, main { display: block; max-width: none; padding: 0; }
  #certificate-view { display: block !important; padding: 0; }
  .certificate { min-height: 0; box-shadow: none; page-break-inside: avoid; }
}
