:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5c6773;
  --paper: #fbfbfa;
  --panel: #ffffff;
  --line: #d7dcda;
  --navy: #003c38;
  --blue: #0c514c;
  --orange: #c87822;
  --green: #25705a;
  --shadow: 0 18px 50px rgba(0, 60, 56, .14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--blue); }
a:hover { color: var(--orange); }

.site-header {
  background: var(--navy);
  color: white;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.site-header a { color: white; text-decoration: none; }
.site-header .brand { font-weight: 830; letter-spacing: .14em; line-height: 1.05; text-transform: uppercase; }
.site-header .meta { color: #c6d8e7; font-size: .9rem; }
.lesson-nav { margin-left: auto; display: flex; gap: 1rem; flex-wrap: wrap; }
.lesson-nav a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }

.hero {
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 6vw, 7rem);
  color: white;
  background:
    radial-gradient(circle at 83% 20%, rgba(200, 120, 34, .82), transparent 18rem),
    linear-gradient(135deg, #003c38 0%, #072d2a 58%, #0c514c 100%);
}

.hero h1 { margin: 0; max-width: 14ch; font-size: clamp(3rem, 8vw, 7rem); line-height: .94; }
.hero p { max-width: 54rem; font-size: clamp(1.05rem, 2vw, 1.35rem); color: #e4eef5; }
.hero .eyebrow, .lesson-kicker { text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: .78rem; }

.course-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 6rem; }
.module { margin: 0 0 3rem; }
.module-heading { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; align-items: start; }
.module-number { color: var(--orange); font-size: 2rem; font-weight: 900; }
.module h2 { margin: .15rem 0; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.1; }
.module-description { color: var(--muted); max-width: 60rem; }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.lesson-card {
  position: relative;
  min-height: 12rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(16, 42, 67, .06);
}
.lesson-card h3 { margin: 1.2rem 0 .5rem; line-height: 1.18; }
.lesson-card p { color: var(--muted); }
.lesson-card a::after { content: ""; position: absolute; inset: 0; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: .18rem .62rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.badge.recommended { background: #dff3e9; border-color: #acd9c6; color: #155b45; }
.badge.legacy { background: #fff0d7; border-color: #eecb91; color: #76440d; }

.lesson-layout { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.lesson-main { width: min(1440px, calc(100% - 2rem)); margin: 0 auto; padding: 1.3rem 0 4rem; }
.lesson-title-row { display: flex; gap: 1rem; justify-content: space-between; align-items: end; margin-bottom: 1rem; }
.lesson-title-row h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.7rem); line-height: 1.08; }
.progress { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.player-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem); gap: 1rem; align-items: start; }
.stage { background: #0b1620; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 16/9; display: grid; place-items: center; }
.stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.semantic-slide { width: 100%; height: 100%; overflow: auto; padding: clamp(1.5rem, 4vw, 4rem); color: var(--ink); background: var(--panel); }
.semantic-slide h2 { color: var(--navy); font-size: clamp(1.7rem, 3.5vw, 3.2rem); line-height: 1.06; margin: 0 0 1.2rem; }
.semantic-slide li { margin: .55rem 0; }
.semantic-slide code, .semantic-slide pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.semantic-slide pre { background: #0f2130; color: #eef8ff; padding: 1rem; border-radius: 10px; overflow: auto; font-size: clamp(.72rem, 1.15vw, 1rem); }
.semantic-slide table { width: 100%; border-collapse: collapse; font-size: clamp(.75rem, 1.25vw, 1rem); }
.semantic-slide th, .semantic-slide td { border-bottom: 1px solid var(--line); text-align: left; padding: .55rem; vertical-align: top; }
.route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.route-grid article { border-left: .35rem solid var(--orange); padding: .25rem 1rem; background: #fff8ed; }

.side-panel { display: grid; gap: .8rem; }
.controls, .transcript-card, .agent-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
button, .button-link {
  border: 1px solid #b7c6d1;
  border-radius: 9px;
  background: white;
  color: var(--navy);
  padding: .7rem .8rem;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button:hover, .button-link:hover { background: #eaf2f7; color: var(--navy); }
button:focus-visible, a:focus-visible, audio:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
button[aria-pressed="true"] { background: var(--navy); color: white; }
audio { width: 100%; margin-top: .8rem; }
.transcript-card h2 { margin: 0 0 .7rem; font-size: 1rem; }
.narration { max-height: 38vh; overflow: auto; white-space: pre-wrap; color: #384652; }
.subtitle { position: fixed; z-index: 20; left: 50%; bottom: 1.2rem; transform: translateX(-50%); width: min(900px, calc(100% - 2rem)); padding: .75rem 1rem; color: white; background: rgba(7, 15, 22, .9); border-radius: 9px; text-align: center; box-shadow: var(--shadow); pointer-events: none; }
.subtitle[hidden] { display: none; }
.ai-disclosure { margin-top: .7rem; color: var(--muted); font-size: .82rem; }
.source-list { font-size: .88rem; overflow-wrap: anywhere; }
.source-list li { margin: .35rem 0; }
.agent-card { border-color: #acd9c6; background: #f2faf6; }
.agent-card h2 { margin: .2rem 0 .7rem; font-size: 1.05rem; }
.agent-label { color: var(--green); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.agent-card textarea { width: 100%; min-height: 14rem; resize: vertical; border: 1px solid #9dbdaf; border-radius: 9px; padding: .75rem; background: white; color: var(--ink); font: .88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.agent-actions { display: flex; align-items: center; gap: .7rem; margin-top: .6rem; }
.agent-actions button { padding: .45rem .7rem; }
#copy-status { color: var(--green); font-size: .82rem; }
.skill-candidate { margin: .75rem 0; font-size: .88rem; }
.manual-commands { padding-left: 1.2rem; overflow-wrap: anywhere; }
.manual-commands li { margin: .45rem 0; }
.manual-commands code { font-size: .78rem; }
.skills-callout { display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-bottom: 3rem; padding: 1.5rem; border: 1px solid #acd9c6; border-radius: 16px; background: #f2faf6; }
.skills-callout h2 { margin: .2rem 0; }
.skills-callout p { margin: .4rem 0 0; max-width: 48rem; }
.skills-shell { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 6rem; }
.skills-shell > h1 { margin: .2rem 0; font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: 1; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 2rem; }
.skill-card { display: flex; flex-direction: column; align-items: flex-start; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: white; }
.skill-card h2 { margin: 0; font-size: 1.2rem; }
.skill-card p { flex: 1; color: var(--muted); }

@media (max-width: 900px) {
  .player-grid { grid-template-columns: 1fr; }
  .stage { border-radius: 10px; }
  .narration { max-height: none; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .site-header { align-items: flex-start; flex-direction: column; }
  .lesson-nav { margin-left: 0; }
  .module-heading { grid-template-columns: 2.5rem 1fr; }
  .lesson-title-row { align-items: start; flex-direction: column; }
  .route-grid { grid-template-columns: 1fr; }
  .skills-callout { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
