:root {
  --bg: #ffffff;
  --bg-soft: #f7f9fe;
  --paper: rgba(255, 255, 255, 0.96);
  --ink: #10233f;
  --muted: #4d6182;
  --line: rgba(0, 61, 165, 0.14);
  --blue: #003da5;
  --blue-soft: #e8f0ff;
  --gold: #ffb81c;
  --gold-soft: #fff3cf;
  --shadow: 0 18px 40px rgba(0, 61, 165, 0.09);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  line-height: 1.6;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: clamp(12px, 3vw, 34px);
  background: linear-gradient(180deg, var(--blue) 0%, #0a58d0 100%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0 0 0 auto;
  width: clamp(12px, 3vw, 34px);
  background: linear-gradient(180deg, var(--gold) 0%, #f3a900 100%);
  pointer-events: none;
  z-index: 0;
}

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

.site-shell {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px clamp(32px, 5vw, 64px);
}

.site-shell-inner {
  max-width: 1040px;
}

.notes-page .notes-shell {
  width: min(calc(100vw - 48px), 1440px);
  max-width: none;
  padding: 20px 18px 40px 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  color: var(--blue);
  text-decoration: none;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-links a {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--blue);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.hero,
.page-header {
  position: relative;
}

.hero-panel,
.page-intro,
.content-panel,
.info-card,
.timeline-panel {
  background: var(--paper);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 61, 165, 0.1);
  box-shadow: var(--shadow);
}

.hero-panel,
.page-intro {
  border-radius: var(--radius-lg);
  padding: 36px;
}

.hero-panel {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-top: 8px solid var(--blue);
  border-right: 8px solid var(--gold);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 184, 28, 0.26), rgba(0, 61, 165, 0.14));
  filter: blur(10px);
}

.eyebrow,
.section-tag {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
  font-family: Georgia, "Palatino Linotype", serif;
}

h1 {
  max-width: 12ch;
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 8vw, 5.4rem);
}

.hero-panel h1 {
  max-width: 100%;
  font-size: clamp(2rem, 4.8vw, 3.6rem);
}

.page-intro h1 {
  max-width: 100%;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.5rem, 4vw, 2.35rem);
}

h3 {
  margin-bottom: 8px;
  font-size: 1.12rem;
}

.hero-subtitle {
  max-width: 52ch;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-panel .hero-subtitle {
  max-width: 100%;
  font-size: clamp(0.98rem, 1.8vw, 1.12rem);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.hero-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  border: 1px solid rgba(0, 61, 165, 0.14);
  font-size: 0.94rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.hero-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-top: auto;
}

.hero-instructor {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-instructor-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-instructor-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.hero-instructor-email {
  font-weight: 600;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--blue);
  color: #ffffff;
}

.button-secondary {
  background: var(--gold-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.card-grid,
.content-grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
}

.info-card,
.content-panel,
.timeline-panel {
  border-radius: var(--radius-md);
  padding: 24px;
}

.info-card h2 {
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.card-highlight {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
}

.accent-gold {
  border-top: 6px solid var(--gold);
}

.accent-green {
  border-top: 6px solid var(--blue);
}

.accent-rust {
  border-top: 6px solid var(--gold);
}

.compact {
  align-self: start;
}

.feature-list,
.assignment-list {
  margin: 0;
  padding-left: 20px;
}

.feature-list li + li {
  margin-top: 8px;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
}

.facts dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.facts dd {
  margin: 0;
  font-weight: 700;
}

.grade-boxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.grade-box {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255, 184, 28, 0.22), rgba(0, 61, 165, 0.08));
  border: 1px solid rgba(0, 61, 165, 0.12);
}

.grade-box strong,
.grade-box span {
  display: block;
}

.grade-box span {
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 700;
}

.grading-panel {
  font-size: 0.95rem;
}

.grading-panel h2 {
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
}

.grading-panel .grade-box strong {
  font-size: 0.92rem;
}

.grading-panel .grade-box span {
  font-size: 1.08rem;
}

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

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.timeline div {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
}

.timeline span {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 700;
}

.timeline p {
  margin: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding: 18px 4px 0;
  color: var(--muted);
}

.stack-layout {
  display: grid;
  gap: 18px;
}

.two-column-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.assignment-list {
  display: grid;
  gap: 14px;
  padding-left: 0;
}

.assignment-list article {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.assignment-list h3,
.assignment-list p {
  margin: 0;
}

.assignment-list p {
  margin-top: 6px;
}

.schedule-table {
  display: grid;
  gap: 12px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.schedule-week {
  font-weight: 700;
  color: var(--blue);
}

.schedule-topic {
  min-width: 0;
}

.embed-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.notes-frame {
  display: block;
  width: 100%;
  min-height: 1200px;
  border: 0;
  background: #ffffff;
}

.notes-title {
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
}

.notes-page-title {
  max-width: 100%;
  font-size: clamp(2rem, 4.8vw, 3.6rem);
}

.notes-switcher {
  display: flex;
}

#deck-heading {
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  margin-bottom: 12px;
}

.notes-switcher {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.note-tab {
  border: 1px solid var(--line);
}

.note-tab.is-active {
  background: var(--blue);
  color: #ffffff;
}

.note-slide h2 {
  margin-bottom: 14px;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
}

.note-slide p {
  margin: 0 0 14px;
}

.note-slide p:last-child,
.note-slide ul:last-child,
.note-slide ol:last-child {
  margin-bottom: 0;
}

.note-slide code {
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: var(--blue-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
}

.notes-split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.3fr);
  gap: 14px;
  align-items: stretch;
  height: clamp(760px, calc(100vh - 170px), 1120px);
}

.split-pane {
  min-height: 0;
}

.split-pane-notes {
  overflow: auto;
  padding-right: 6px;
}

.split-pane-stack {
  display: grid;
  gap: 18px;
}

.split-pane-paper {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 61, 165, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.paper-open-link {
  flex: 0 0 auto;
}

.paper-pane-body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: #ffffff;
}

.paper-loading {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 1;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.paper-embed {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #ffffff;
}

.paper-fallback {
  display: grid;
  gap: 14px;
  align-content: center;
  max-width: 42ch;
  margin: auto;
  padding: 24px;
}

.paper-fallback h3,
.paper-fallback p {
  margin: 0;
}

.split-pane-paper.is-loaded .paper-loading {
  display: none;
}

.split-pane-paper.is-fallback .paper-embed,
.split-pane-paper.is-fallback .paper-loading {
  display: none;
}

.notes-ordered-list {
  margin: 0;
  padding-left: 22px;
}

.notes-ordered-list li + li {
  margin-top: 8px;
}

.notes-subtitle {
  display: inline-block;
  margin-top: 4px;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 700ms ease forwards;
}

.delay-1 {
  animation-delay: 80ms;
}

.delay-2 {
  animation-delay: 160ms;
}

.delay-3 {
  animation-delay: 240ms;
}

.delay-4 {
  animation-delay: 320ms;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .card-grid,
  .content-grid,
  .timeline,
  .grade-boxes,
  .two-column-list,
  .notes-split-layout {
    grid-template-columns: 1fr;
  }

  .site-footer,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 {
    max-width: 100%;
  }

  .hero-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .notes-split-layout {
    height: auto;
  }

  .split-pane-notes {
    overflow: visible;
    padding-right: 0;
  }

  .split-pane-paper {
    min-height: 640px;
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding: 16px 14px 42px 30px;
  }

  .notes-page .notes-shell {
    width: min(calc(100vw - 20px), 1560px);
    padding: 16px 10px 36px 14px;
  }

  .hero-panel,
  .page-intro,
  .content-panel,
  .info-card,
  .timeline-panel {
    padding: 20px;
  }

  .schedule-row {
    grid-template-columns: 1fr;
  }

  .nav-links {
    width: 100%;
  }

  .nav-links a {
    text-align: center;
    flex: 1 1 auto;
  }
}
