@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

/* ── VARIABLES ───────────────────────────────────────────── */
:root {
  --color-black:    #202020;
  --color-white:    #FAFAF8;
  --color-amber:    #C8873A;
  --color-tan:      #F0EEE6;
  --color-muted:    #6B6B6F;
  --color-muted-50: #9A9A9E;
  --color-border:   rgba(0, 0, 0, 0.13);
  --font-serif:     'Instrument Serif', Georgia, serif;
  --font-sans:      'DM Sans', system-ui, sans-serif;
  --max-width:      1080px;
  --nav-height:     60px;
  --row-height:     74px;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

/* ── BASE ────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background: var(--color-white);
  color: var(--color-black);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ── NAV ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-black);
  display: flex;
  align-items: center;
  padding: 0 40px;
  flex-shrink: 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  width: 100%;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--color-white);
  text-decoration: none;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  line-height: 1;
}
.site-logo .period { color: var(--color-amber); }

.nav-sep {
  color: var(--color-muted);
  margin: 0 16px;
  font-weight: 300;
  font-size: 15px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 13px;
  min-width: 0;
}
.breadcrumb a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color 100ms ease;
  white-space: nowrap;
}
.breadcrumb a:hover { color: var(--color-white); }
.breadcrumb .dot { color: var(--color-muted); margin: 0 8px; flex-shrink: 0; }
.breadcrumb .current {
  color: var(--color-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── SHARED LAYOUT ───────────────────────────────────────── */
.page-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
}

.page-header {
  padding: 56px 0 0;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 64px;
  font-style: italic;
  font-weight: 400;
  color: var(--color-amber);
  line-height: 1.05;
}

.page-subtitle {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  color: var(--color-black);
  margin-top: 14px;
  line-height: 1.5;
}

.stats-row {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.stat-item { color: var(--color-muted); }
.stat-item strong {
  color: var(--color-black);
  font-weight: 500;
}

/* ── CAPACITY TOGGLE ─────────────────────────────────────── */
.capacity-control {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 10px;
}

.capacity-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.capacity-toggle button {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  padding: 0 16px;
  height: 32px;
  border: none;
  border-right: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-black);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
  white-space: nowrap;
}
.capacity-toggle button:last-child { border-right: none; }
.capacity-toggle button.active {
  background: var(--color-amber);
  color: var(--color-white);
}

.capacity-label {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-muted);
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 32px 0;
}

/* ── SHARED CTA BUTTON ───────────────────────────────────── */
.cta-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-white);
  background: var(--color-black);
  border: none;
  border-radius: 4px;
  padding: 0 20px;
  height: 36px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background 150ms ease;
}
.cta-btn:hover { background: var(--color-amber); }

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  flex-shrink: 0;
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--color-black);
  text-decoration: none;
  line-height: 1;
}
.footer-logo .period { color: var(--color-amber); }

.footer-center { text-align: center; }

.footer-right {
  display: flex;
  gap: 24px;
  justify-content: flex-end;
}

.footer-link {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 100ms ease;
}
.footer-link:hover { color: var(--color-black); }

/* ── CURRICULUM GRID ─────────────────────────────────────── */
.curriculum-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  padding-bottom: 80px;
}

.phase-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 20px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: background 150ms ease, border-color 150ms ease;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-phase-tag {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 150ms ease;
}
.card-phase-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-amber);
  flex-shrink: 0;
}

.card-est {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-muted);
  transition: color 150ms ease;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--color-black);
  margin: 10px 0 6px;
  line-height: 1.2;
  transition: color 150ms ease;
}

.card-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  color: var(--color-muted);
  line-height: 1.5;
  transition: color 150ms ease;
}

.card-meta {
  font-family: var(--font-sans);
  font-size: 12px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: 16px;
  display: flex;
  gap: 16px;
  transition: border-color 150ms ease;
}

.card-meta-modules { color: var(--color-muted); transition: color 150ms ease; }
.card-meta-lessons  { color: var(--color-muted); transition: color 150ms ease; }

/* Hover — full dark flip */
.phase-card:hover { background: var(--color-black); border-color: var(--color-black); }
.phase-card:hover .card-phase-tag   { color: var(--color-muted-50); }
.phase-card:hover .card-est         { color: var(--color-muted-50); }
.phase-card:hover .card-title       { color: var(--color-white); }
.phase-card:hover .card-desc        { color: var(--color-muted-50); }
.phase-card:hover .card-meta        { border-color: rgba(255,255,255,0.12); }
.phase-card:hover .card-meta-modules { color: var(--color-amber); }
.phase-card:hover .card-meta-lessons { color: var(--color-muted-50); }

/* ── PHASE PAGE ──────────────────────────────────────────── */
.module-section { margin-bottom: 56px; }

.module-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}

.module-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.module-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.15;
}

.lesson-list {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.lesson-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  height: var(--row-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.lesson-row:last-child { border-bottom: none; }

.lesson-row.featured { background: var(--color-black); }

.lesson-row:not(.featured):hover {
  background: var(--color-black);
  border-color: var(--color-black);
}

.lesson-num {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted-50);
  transition: color 150ms ease;
}

.lesson-title-text {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.3;
  transition: color 150ms ease;
}

.lesson-arrow {
  font-size: 16px;
  color: transparent;
  transition: color 150ms ease;
}

.lesson-row.featured .lesson-num        { color: rgba(255,255,255,0.3); }
.lesson-row.featured .lesson-title-text { color: var(--color-white); }
.lesson-row.featured .lesson-arrow      { color: var(--color-white); }

.lesson-row:not(.featured):hover .lesson-num        { color: rgba(255,255,255,0.3); }
.lesson-row:not(.featured):hover .lesson-title-text { color: var(--color-white); }
.lesson-row:not(.featured):hover .lesson-arrow      { color: var(--color-white); }

.lesson-row.more-topics .lesson-num { letter-spacing: 0.15em; font-size: 11px; }
.lesson-row.more-topics .lesson-title-text { color: var(--color-muted); }
.lesson-row.more-topics:hover .lesson-title-text { color: var(--color-white); }

.phase-cta {
  margin-top: 64px;
  margin-bottom: 80px;
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.phase-cta p {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  color: var(--color-muted);
}

/* ── LESSON PAGE ─────────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--color-amber);
  z-index: 99;
  transition: width 50ms linear;
}

.lesson-wrap {
  padding: 56px 0 80px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 80px;
  align-items: start;
}

.lesson-title {
  font-family: var(--font-serif);
  font-size: 40px;
  font-style: normal;
  font-weight: 400;
  color: var(--color-amber);
  line-height: 1.15;
  margin-bottom: 20px;
}

.lesson-lead {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  color: var(--color-black);
  line-height: 1.65;
}

.content-section { margin-bottom: 40px; }

.section-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-black);
  margin-bottom: 16px;
  display: block;
}

.content-body p {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.7;
  margin-bottom: 24px;
}
.content-body p:last-child { margin-bottom: 0; }

.action-items-box {
  background: var(--color-tan);
  border-radius: 4px;
  padding: 24px 28px;
  margin-top: 40px;
}

.action-items-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-black);
  margin-bottom: 18px;
  display: block;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}

.action-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(0,0,0,0.22);
  border-radius: 2px;
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: background 100ms ease, border-color 100ms ease;
}
.action-item input[type="checkbox"]:checked {
  background: var(--color-black);
  border-color: var(--color-black);
}
.action-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 1.5px solid var(--color-white);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.action-item label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.4;
  cursor: pointer;
  transition: color 100ms ease;
}

.action-item.is-checked label {
  text-decoration: line-through;
  color: var(--color-muted);
}

.lesson-cta {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.lesson-cta p {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--color-muted);
}

.lesson-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 32px);
}

.toc-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-black);
  margin-bottom: 14px;
}

.toc-link {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color 100ms ease;
}
.toc-link:hover  { color: var(--color-black); }
.toc-link.active { color: var(--color-black); font-weight: 500; }

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Tablet — 760px */
@media (max-width: 760px) {

  /* Reduce horizontal padding everywhere */
  .site-header  { padding: 0 24px; }
  .page-wrap    { padding: 0 24px; }
  .site-footer  { padding: 24px; }
  .phase-cta    { padding: 24px; }

  /* Breadcrumb: shrink intermediate items so current always fits */
  .breadcrumb a { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }

  /* Stack header row — title above toggle */
  .page-header-row {
    flex-direction: column;
    gap: 20px;
  }
  .capacity-control {
    align-items: flex-start;
    padding-top: 0;
    width: 100%;
  }

  /* Smaller page title */
  .page-title { font-size: 44px; }

  /* Curriculum: 2 columns */
  .curriculum-grid { grid-template-columns: repeat(2, 1fr); }

  /* Lesson: collapse to single column, sidebar flows below */
  .lesson-wrap {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 0 60px;
  }
  .lesson-sidebar { position: static; }

  /* Phase + lesson CTA: stack vertically */
  .phase-cta  { flex-direction: column; align-items: flex-start; }
  .lesson-cta { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* Mobile — 480px */
@media (max-width: 480px) {

  /* Even tighter padding */
  .site-header  { padding: 0 16px; }
  .page-wrap    { padding: 0 16px; }
  .site-footer  { padding: 20px 16px; grid-template-columns: 1fr; gap: 20px; }
  .footer-center { text-align: left; }
  .footer-right  { justify-content: flex-start; }

  /* Curriculum: 1 column */
  .curriculum-grid { grid-template-columns: 1fr; }

  /* Shrink large type */
  .page-title   { font-size: 36px; }
  .module-title { font-size: 24px; }
  .lesson-title { font-size: 30px; }

  /* Hide sidebar TOC on small screens — article sections are short */
  .lesson-sidebar { display: none; }

  /* Nav: hide the separator and breadcrumb beyond 1 level if space is tight */
  .nav-sep { margin: 0 10px; }

  /* Stats row: allow wrapping */
  .stats-row { flex-wrap: wrap; gap: 10px; }
}

/* ── 404 PAGE ────────────────────────────────────────────── */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-height) - 97px);
}

.not-found h1 {
  font-family: var(--font-serif);
  font-size: 64px;
  font-style: italic;
  color: var(--color-amber);
  line-height: 1.05;
  margin-bottom: 16px;
}

.not-found p {
  font-size: 16px;
  font-weight: 300;
  color: var(--color-muted);
  margin-bottom: 32px;
}

/* ── LANDING PAGE ────────────────────────────────────────── */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}

.landing-logo {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--color-black);
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1;
  margin-bottom: 56px;
}
.landing-logo .period { color: var(--color-amber); }

.landing-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-white);
  background: var(--color-amber);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 28px;
}

.landing-h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin-bottom: 20px;
}
.landing-h1 em {
  font-style: italic;
  color: var(--color-amber);
}

.landing-sub {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  color: var(--color-muted);
  line-height: 1.65;
  max-width: 480px;
  margin-bottom: 36px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-white);
  background: var(--color-black);
  border: none;
  border-radius: 4px;
  padding: 0 32px;
  height: 44px;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease;
}
.landing-btn:hover { background: var(--color-amber); }
