:root {
  color-scheme: light;
  --navy-950: #051d37;
  --navy-900: #082f5b;
  --navy-800: #0b417a;
  --blue-700: #0d64b8;
  --blue-600: #1476d4;
  --blue-100: #dceeff;
  --blue-50: #eff7ff;
  --ink: #10243b;
  --muted: #586b81;
  --line: #d7e2ee;
  --surface: #ffffff;
  --surface-alt: #f5f8fc;
  --success: #137a49;
  --shadow: 0 12px 30px rgba(5, 29, 55, 0.1);
  --radius: 16px;
  --sidebar: 300px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

button { font: inherit; }
button { color: inherit; }
a { color: var(--blue-700); }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .7rem 1rem;
  background: white;
  color: #082f5b;
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: linear-gradient(110deg, var(--navy-950), var(--navy-800));
  color: white;
  box-shadow: 0 4px 16px rgba(4, 22, 43, .25);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  color: white;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 88px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(145deg, #36b9ff, #0b67c4);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
  text-align: center;
}
.brand-mark span, .brand-title { display: block; }
.brand-title { white-space: nowrap; font-size: 1.08rem; line-height: 1.2; }

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  color: white;
  cursor: pointer;
}
.icon-button:hover, .icon-button:focus-visible { background: rgba(255,255,255,.2); }
.menu-button { display: none; }

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 80px auto 0 0;
  width: var(--sidebar);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.course-summary {
  padding: 1.35rem 1.2rem 1.15rem;
  background: linear-gradient(150deg, var(--blue-50), var(--surface));
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: inline-block;
  color: var(--blue-700);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.course-summary h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.nav-group { padding: 1rem .65rem .2rem; }
.nav-group h3 { margin: 0 .6rem .4rem; color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.nav-group h3 a { color: inherit; text-decoration: none; }
.nav-group h3 a:hover, .nav-group h3 a:focus-visible { color: var(--blue-700); text-decoration: underline; }
.lesson-link {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr 18px;
  align-items: center;
  gap: .55rem;
  padding: .68rem .6rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.lesson-link:hover { background: var(--blue-50); }
.lesson-link.active { background: var(--blue-100); color: var(--navy-900); font-weight: 700; }
.lesson-number { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.sidebar-scrim { display: none; }

main {
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding-top: 80px;
}

.view { max-width: 1220px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.6rem, 3vw, 3rem);
  border-radius: 24px;
  background: linear-gradient(125deg, var(--navy-950), var(--navy-800) 60%, #0a69bd);
  color: white;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -120px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(66,190,255,.35), rgba(66,190,255,0) 68%);
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { margin: .6rem 0 0; font-size: clamp(1.5rem, 3.75vw, 3rem); line-height: 1.03; letter-spacing: -.04em; }
.hero-line-primary, .hero-line-secondary { display: block; }
.hero-line-secondary { margin-top: .18em; font-size: .84em; }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin: 2.2rem 0 1rem; }
.section-heading h2 { margin: 0; font-size: 1.45rem; }
.section-heading p { margin: .3rem 0 0; color: var(--muted); }

.track-grid, .lesson-grid { display: grid; gap: 1rem; }
.track-grid { grid-template-columns: repeat(3, 1fr); }
.lesson-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.track-card, .lesson-card, .content-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(5, 29, 55, .05);
}
.track-card { display: block; padding: 1.25rem; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.track-card:hover, .track-card:focus-visible { transform: translateY(-2px); border-color: var(--blue-600); box-shadow: var(--shadow); }
.track-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--blue-100); color: var(--blue-700); font-weight: 900; }
.track-card h3 { margin: .8rem 0 .3rem; }
.track-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.track-header { max-width: 780px; }
.track-header .back-link { display: inline-block; margin-bottom: 1.2rem; font-weight: 700; text-decoration: none; }
.track-header .track-icon { margin-bottom: .8rem; }
.track-header h1 { margin: 0 0 .35rem; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -.035em; }
.track-header p { margin: 0 0 .8rem; color: var(--muted); font-size: 1.02rem; }
.track-header > strong { color: var(--blue-700); }
.track-lessons { margin-top: 1.5rem; }
.track-lessons .lesson-card h2 { margin: .08rem 0 .25rem; font-size: 1rem; }

.lesson-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 1rem;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.lesson-card-number { display: grid; place-items: center; min-height: 74px; border-radius: 13px; background: linear-gradient(145deg, var(--blue-50), var(--blue-100)); color: var(--blue-700); font-size: 1.25rem; font-weight: 900; }
.lesson-card h3 { margin: .08rem 0 .25rem; font-size: 1rem; }
.lesson-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.notice {
  margin-top: 1.3rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--blue-600);
  border-radius: 0 12px 12px 0;
  background: var(--blue-50);
}
.notice strong { display: block; margin-bottom: .18rem; }
.notice p { margin: 0; color: var(--muted); }

.lesson-header { display: block; }
.breadcrumbs { color: var(--muted); font-size: .82rem; }
.lesson-header h1 { margin: .45rem 0 .35rem; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; letter-spacing: -.035em; }
.lesson-header p { max-width: 780px; margin: 0; color: var(--muted); font-size: 1.02rem; }
.lesson-layout { margin-top: 1.5rem; }
.content-stack { display: grid; align-content: start; gap: 1.1rem; }
.content-card { padding: clamp(1rem, 3vw, 1.45rem); }
.content-card h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
.content-card h3 { margin: 1.2rem 0 .45rem; font-size: 1rem; }
.content-card p:last-child, .content-card ul:last-child { margin-bottom: 0; }
.content-card ul, .content-card ol { padding-left: 1.2rem; }
.content-card li + li { margin-top: .35rem; }

.source-figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.source-figure { min-width: 0; margin: 0; }
.source-button { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); cursor: zoom-in; }
.source-button img { display: block; width: 100%; }
.source-figure figcaption { margin-top: .55rem; color: var(--muted); font-size: .82rem; }

.objective-list { list-style: none; padding: 0 !important; }
.objective-list li { position: relative; padding-left: 1.55rem; }
.objective-list li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 900; }

.lesson-pagination { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.4rem; }
.pager { max-width: 48%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; }
.pager small, .pager strong { display: block; }
.pager small { color: var(--muted); }

.track-card small {
  display: block;
  margin-top: .7rem;
  color: var(--blue-700);
  font-weight: 700;
}

.image-dialog {
  width: min(96vw, 1500px);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 70px rgba(0,0,0,.42);
}
.image-dialog::backdrop { background: rgba(0, 13, 30, .86); }
.dialog-toolbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; background: var(--navy-950); color: white; }
.dialog-toolbar strong, .dialog-toolbar span { display: block; }
.dialog-toolbar span { color: #c8e4ff; font-size: .78rem; }
.image-dialog img { display: block; width: 100%; height: auto; }

.noscript { margin: 5rem 1rem 1rem; padding: 1rem; background: #fff3cd; color: #493500; }

@media (min-width: 721px) {
  .brand-mark { width: 132px; font-size: 1.02rem; }
  .brand-title { font-size: 1.62rem; }
}

@media (min-width: 981px) {
  .hero-line-primary { white-space: nowrap; }
}

@media (max-width: 1100px) {
  .menu-button { display: grid; }
  .sidebar { transform: translateX(-101%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 19; inset: 80px 0 0; border: 0; background: rgba(1, 15, 30, .55); }
  .sidebar-scrim.open { display: block; }
  main { margin-left: 0; }
}

@media (max-width: 720px) {
  .topbar { height: 72px; gap: .6rem; padding: 0 .75rem; }
  .sidebar { inset: 72px auto 0 0; }
  .sidebar-scrim { inset: 72px 0 0; }
  main { padding-top: 72px; }
  .brand { gap: .6rem; }
  .brand-mark { width: 76px; height: 52px; font-size: .62rem; }
  .brand-title { font-size: .82rem; }
  .track-grid, .lesson-grid { grid-template-columns: 1fr; }
  .view { padding: 1rem .85rem 3rem; }
  .hero { border-radius: 18px; }
  .lesson-card { grid-template-columns: 56px 1fr; }
  .lesson-card-number { min-height: 56px; }
}

@media (max-width: 480px) {
  .topbar { gap: .5rem; padding: 0 .625rem; }
  .brand { gap: .5rem; }
  .brand-mark { width: 68px; height: 50px; font-size: .58rem; }
  .brand-title { font-size: .75rem; }
}

@media (max-width: 360px) {
  .topbar { gap: .375rem; padding: 0 .5rem; }
  .icon-button { width: 40px; height: 40px; }
  .brand { gap: .375rem; }
  .brand-mark { width: 64px; height: 48px; font-size: .54rem; }
  .brand-title { font-size: .7rem; }
}

@media print {
  .topbar, .sidebar, .sidebar-scrim, .lesson-pagination { display: none !important; }
  main { margin: 0; padding: 0; }
  .view { max-width: none; padding: 0; }
  .lesson-layout { display: block; }
  .content-card { break-inside: avoid; margin-bottom: 1rem; box-shadow: none; }
}
