:root {
  color-scheme: light;
  --navy: #1e3557;
  --cerulean: #2980b9;
  --gold: #e09b24;
  --plum: #884c82;
  --taupe: #867875;
  --bg: #f6f3ee;
  --bg-deep: #e6dfd4;
  --card: #ffffff;
  --text: var(--navy);
  --muted: #5c4e4b;
  --line: var(--taupe);
  --rule: var(--navy);
  --link: #18608f;
  --link-hover: var(--plum);
  --signal: var(--plum);
  --focus: #18608f;
  --btn-bg: var(--navy);
  --btn-text: #f6f3ee;
  --btn-hover: #18608f;
  --pill: var(--plum);
  --pill-text: #ffffff;
  --hover: #efe6da;
  --selection-bg: #d5e6f4;
  --selection-text: var(--navy);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --measure: 40rem;
  --site-header-height: 5.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --cerulean: #4da6e8;
    --gold: #f0b43c;
    --plum: #b56eb0;
    --bg: #0b1320;
    --bg-deep: #101a2b;
    --card: #132033;
    --text: #f1f5f9;
    --muted: #b8aaa6;
    --line: #867875;
    --rule: #8aa0b8;
    --link: var(--cerulean);
    --link-hover: var(--gold);
    --signal: var(--gold);
    --focus: var(--gold);
    --btn-bg: var(--cerulean);
    --btn-text: #0b1320;
    --btn-hover: var(--gold);
    --pill: var(--plum);
    --pill-text: #0b1320;
    --hover: #1c3148;
    --selection-bg: #1d4e78;
    --selection-text: #f1f5f9;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

p {
  margin: 0 0 0.9rem;
}

p:last-child {
  margin-bottom: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  line-height: 1.15;
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  line-height: 1.2;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 120;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.math {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  white-space: nowrap;
}

.kicker,
.num,
.status {
  margin: 0;
}

.kicker {
  margin-bottom: 0.9rem;
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-label {
  margin-bottom: 0;
  padding-top: 1.35rem;
}

.num {
  color: var(--signal);
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1;
}

.masthead,
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--site-header-height);
  min-height: var(--site-header-height);
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  overflow: visible;
}

.masthead-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  width: 100%;
  height: 100%;
  max-width: none;
  margin-inline: 0;
  min-height: 0;
  padding: 0.45rem clamp(1rem, 2vw, 2rem);
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  margin: 0;
  min-width: 0;
  color: inherit;
  line-height: 0;
  text-decoration: none;
}

a.brand:hover {
  color: inherit;
}

.brand picture {
  display: block;
}

.brand img {
  display: block;
  height: clamp(44px, 36px + 1.15vw, 50px);
  width: auto;
  max-height: calc(var(--site-header-height) - 1.15rem);
  max-width: min(22rem, 58vw);
  object-fit: contain;
  object-position: left center;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  margin-left: auto;
  margin-right: 0;
}

.nav a {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav a:hover {
  color: var(--link-hover);
}

.nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--signal);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  min-height: 2.75rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text);
  font: 600 0.85rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 0.85fr);
  gap: 3rem;
  align-items: center;
  padding: 4.25rem 0 3.5rem;
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(3rem, 6.2vw, 5.35rem);
  line-height: 0.94;
}

.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.28rem;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  margin-top: 0.4rem;
  padding: 0.75rem 1.05rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s linear;
}

.btn:hover {
  background: var(--btn-hover);
  color: var(--btn-text);
}

.diagram {
  margin: 0;
  padding: 0.85rem 0.85rem 0.8rem;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--text);
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.diagram figcaption {
  margin: 0.7rem 0.15rem 0.15rem;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.4;
}

.rule-block {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.principles article {
  padding: 1.6rem 1.5rem 1.8rem 0;
}

.principles article + article {
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
}

.principles .num {
  display: block;
  margin-bottom: 0.85rem;
}

.principles h2 {
  font-size: 1.55rem;
}

.band {
  margin-top: 3rem;
  background: var(--bg-deep);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.course-feature {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1rem 1.5rem;
  align-items: center;
  padding: 2.1rem 0;
}

.course-feature h2 {
  margin-bottom: 0.4rem;
}

.course-feature p {
  max-width: var(--measure);
  color: var(--muted);
}

.page-head {
  padding: 3.25rem 0 0.5rem;
}

.page-head h1 {
  max-width: 16ch;
}

.crumbs {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.crumbs a {
  color: var(--link);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  margin: 2rem 0 0;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0.25rem 0 0;
  font-family: var(--serif);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 2.25rem 0 0.5rem;
}

.split p,
.ticks {
  color: var(--text);
}

.ticks {
  margin: 0;
  padding-left: 1.15rem;
}

.ticks li {
  margin: 0.45rem 0;
  padding-left: 0.2rem;
}

.ticks li::marker {
  color: var(--signal);
}

.syllabus-block {
  padding-top: 2.5rem;
}

.syllabus-block .lede {
  margin-bottom: 0.25rem;
  font-size: 1.15rem;
}

.lessons {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  counter-reset: lesson;
}

.lessons li {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.5rem 1rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
  counter-increment: lesson;
}

.lessons li:last-child {
  border-bottom: 1px solid var(--line);
}

.lessons li::before {
  content: counter(lesson, decimal-leading-zero);
  color: var(--signal);
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.15;
}

.lessons p {
  max-width: 42rem;
  color: var(--muted);
}

.study {
  max-width: var(--measure);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.catalog {
  padding-bottom: 3rem;
}

.catalog-item {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.4rem 1.5rem;
  margin-top: 2rem;
  padding: 1.8rem 0 2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.catalog-item .num {
  font-size: 2rem;
}

.catalog-item h2 {
  margin-top: 0.35rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  background: var(--cerulean);
}

.catalog-item .summary {
  max-width: 40rem;
  margin-top: 0.7rem;
  color: var(--muted);
}

.status-later {
  color: var(--muted);
}

.status-later::before {
  background: var(--taupe);
}

.unit-heading {
  margin-top: 2.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
}

.topic-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.topic-list > li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.topic-list h4 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topic-summary {
  max-width: 42rem;
  color: var(--muted);
}

.page-links {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
}

.page-links a,
.page-links .pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  font-weight: 600;
}

.page-links .pending {
  color: var(--text);
}

.upcoming-badge {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.2rem 0 1.8rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.98rem;
}

.site-footer a {
  color: var(--link);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.page-section {
  padding-bottom: 0.4rem;
}

.page-section h2 {
  font-size: 1.55rem;
}

.section-pad {
  padding-bottom: 4rem;
}

.canvas-root h1,
.canvas-root h2,
.canvas-root h3,
.canvas-root h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  font-weight: 650;
  letter-spacing: normal;
  line-height: 1.25;
}

/* #0284c7 is 4.1:1 on white. Use the darker sky already used for links. */
.canvas-root [style*="color: #0284c7"] {
  color: #0369a1 !important;
}

@media (max-width: 800px) {
  .hero,
  .principles,
  .split,
  .course-feature {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 2rem;
    padding-top: 2.5rem;
  }

  .hero h1 {
    max-width: none;
  }

  .principles article {
    padding-right: 0;
  }

  .principles article + article {
    margin-top: 0.25rem;
    padding-top: 1.35rem;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .course-feature {
    padding: 1.6rem 0;
  }

  .facts {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 680px) {
  :root {
    --site-header-height: 4.25rem;
  }

  .brand img {
    height: clamp(32px, 9vw, 36px);
    max-width: min(12.5rem, 68vw);
  }

  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .js .nav {
    display: none;
    position: absolute;
    z-index: 3;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    width: auto;
    margin: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.35rem clamp(1rem, 2vw, 2rem) 0.85rem;
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
  }

  .js .nav.is-open {
    display: flex;
  }

  .js .nav a {
    padding: 0.7rem 0;
    font-size: 1rem;
  }
}

@media (min-width: 1441px) {
  :root {
    --site-header-height: 6.5rem;
  }

  .brand img {
    height: clamp(52px, 3.6vw, 58px);
    max-width: 24rem;
  }
}

#content,
#lesson,
h1,
h2,
h3,
h4 {
  scroll-margin-top: calc(var(--site-header-height) + 1rem);
}

@media (max-height: 550px) {
  .masthead,
  .site-header {
    position: static;
    height: auto;
    min-height: 0;
  }

  #content,
  #lesson,
  h1,
  h2,
  h3,
  h4 {
    scroll-margin-top: 1rem;
  }
}

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

  .btn {
    transition: none;
  }
}

/* Canvas fragments ship with light inline colors. Remap them in dark mode
   so those colors are not painted onto the dark page. */
@media (prefers-color-scheme: dark) {
  .canvas-root {
    background-color: #132033 !important;
    color: #f1f5f9 !important;
  }

  .canvas-root [style*="color: #0f172a"],
  .canvas-root [style*="color: #1e293b"],
  .canvas-root [style*="color: #334155"] {
    color: #f1f5f9 !important;
  }

  .canvas-root [style*="color: #475569"],
  .canvas-root [style*="color: #64748b"] {
    color: #cbd5e1 !important;
  }

  .canvas-root [style*="color: #0369a1"],
  .canvas-root [style*="color: #0284c7"],
  .canvas-root [style*="color: #195494"] {
    color: #4da6e8 !important;
  }

  .canvas-root [style*="color: #0c4a6e"] {
    color: #d6e9f8 !important;
  }

  .canvas-root [style*="color: #0f6b63"] {
    color: #9ee8dc !important;
  }

  .canvas-root [style*="color: #15803d"],
  .canvas-root [style*="color: #166534"] {
    color: #86efac !important;
  }

  .canvas-root [style*="color: #4c1d95"],
  .canvas-root [style*="color: #5b21b6"] {
    color: #d7a0d3 !important;
  }

  .canvas-root [style*="color: #be123c"] {
    color: #fda4af !important;
  }

  .canvas-root [style*="color: #881337"] {
    color: #fecdd3 !important;
  }

  .canvas-root [style*="background-color: #ffffff"]:not(iframe) {
    background-color: #132033 !important;
  }

  .canvas-root [style*="background-color: #f8fafc"],
  .canvas-root [style*="background-color: #f1f5f9"] {
    background-color: #1a2c44 !important;
  }

  .canvas-root [style*="background-color: #f0f9ff"] {
    background-color: #15283a !important;
  }

  .canvas-root [style*="background-color: #f2f9f8"] {
    background-color: #122c2e !important;
  }

  .canvas-root [style*="background-color: #fff1f2"] {
    background-color: #2a1520 !important;
  }

  .canvas-root [style*="#f0fdf4"] {
    background: #10261c !important;
    border-color: #3d9a62 !important;
  }

  .canvas-root [style*="#f5f3ff"] {
    background: #1c1730 !important;
    border-color: #b56eb0 !important;
  }

  .canvas-root [style*="#e2e8f0"],
  .canvas-root [style*="#cbd5e1"] {
    border-color: #8aa0b8 !important;
  }

  .canvas-root [style*="#94a3b8"],
  .canvas-root [style*="#475569"] {
    border-color: #cbd5e1 !important;
  }

  .canvas-root [style*="#3b82f6"],
  .canvas-root [style*="#bae6fd"] {
    border-color: #4da6e8 !important;
  }

  .canvas-root [style*="#0f6b63"],
  .canvas-root [style*="#ccdfdd"] {
    border-color: #5eead4 !important;
  }

  .canvas-root [style*="#fecdd3"] {
    border-color: #fb7185 !important;
  }

  .canvas-root [style*="#bbf7d0"] {
    border-color: #3d9a62 !important;
  }

  .canvas-root [style*="#ddd6fe"] {
    border-color: #b56eb0 !important;
  }

  .canvas-root mjx-container,
  .canvas-root mjx-container * {
    color: inherit !important;
    background-color: transparent !important;
  }

  .canvas-root svg [stroke="#475569" i] {
    stroke: #cbd5e1;
  }

  .canvas-root svg [fill="#475569" i] {
    fill: #cbd5e1;
  }

  .canvas-root svg [stroke="#e5e7eb" i] {
    stroke: #6d849c;
  }

  .canvas-root svg [stroke="#195494" i] {
    stroke: #4da6e8;
  }

  .canvas-root svg [fill="#195494" i] {
    fill: #4da6e8;
  }

  .canvas-root svg [stroke="#c05621" i] {
    stroke: #f0b43c;
  }

  .canvas-root svg [fill="#c05621" i] {
    fill: #f0b43c;
  }

  .canvas-root svg [fill="#1e293b" i] {
    fill: #f1f5f9;
  }

  .canvas-root svg [stroke="#ffffff" i] {
    stroke: #132033;
  }
}

@media print {
  .masthead,
  .site-header {
    position: static;
    height: auto;
  }

  .nav-toggle {
    display: none !important;
  }

  .nav {
    display: flex !important;
    position: static !important;
    width: auto !important;
    margin-left: 0 !important;
    border: 0 !important;
    padding: 0 !important;
  }

  body {
    background: #fff;
  }

  .btn {
    background: transparent;
    color: var(--text);
    padding-left: 0;
  }
}
