/* ==========================================================================
   ProfSCM course stylesheet
   Shared by every generated course landing page and lesson page.
   Authored by hand; scripts/render-courses.cjs links to it but never edits it.
   No external assets beyond the Google Fonts request made by each page.
   ========================================================================== */

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

:root {
  --cream: #FAF8F4;
  --ink: #1A1A18;
  --ink-light: #4A4A45;
  --accent: #2D5A3D;
  --accent-dark: #4A8C60;
  --accent-soft: #eef4f0;
  --border: #E2DDD6;
  --white: #ffffff;
  --focus: #77a58a;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
  --page: 1440px;
  --pad: 80px;
}

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.2; }
p { overflow-wrap: break-word; }
a { color: var(--accent); }

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

/* ── Skip link ───────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--white); padding: 10px 18px;
  border-radius: 0 0 6px 6px; text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Site navigation ─────────────────────────────────────────────────────── */
.site-nav {
  border-bottom: 1px solid var(--border);
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(10px);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.site-nav-inner {
  max-width: var(--page); margin: 0 auto; padding: 0 var(--pad);
  min-height: 64px; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.nav-logo { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); text-decoration: none; padding: 12px 0; }
.nav-logo span { color: var(--accent); font-style: italic; }
.nav-links { display: flex; gap: 28px; list-style: none; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.nav-links a { color: var(--ink-light); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 500; }
.nav-cta { background: var(--accent); color: var(--white) !important; padding: 9px 20px; border-radius: 4px; font-weight: 500; }
.nav-cta:hover { background: var(--accent-dark); }

/* ── Shared layout ───────────────────────────────────────────────────────── */
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--pad); }
.band { padding: 56px 0; border-bottom: 1px solid var(--border); }
.band-alt { background: var(--white); }
.band > .wrap > h2 { font-size: 1.7rem; margin-bottom: 10px; }
.band-intro { color: var(--ink-light); max-width: 68ch; margin-bottom: 28px; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb { margin-bottom: 20px; font-size: 0.85rem; color: var(--ink-light); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb li + li::before { content: '\203A'; margin-right: 8px; color: var(--border); }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--ink-light); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.course-hero { padding: 48px 0 44px; border-bottom: 1px solid var(--border); }
.course-code {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 5px 13px; border-radius: 3px; margin-bottom: 14px;
}
.course-hero h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); margin-bottom: 14px; }
.lede { font-size: 1.05rem; color: var(--ink-light); max-width: 70ch; }
.meta-list { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.meta-list li {
  background: var(--white); border: 1px solid var(--border); border-radius: 4px;
  padding: 8px 16px; font-size: 0.85rem; color: var(--ink-light);
}

/* ── Overview ────────────────────────────────────────────────────────────── */
.overview-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 32px; align-items: start; }
.overview-grid p + p { margin-top: 14px; }
.overview-grid .prose { color: var(--ink-light); max-width: 62ch; }
.how-card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 26px 28px; }
.how-card h3 { font-size: 1.1rem; margin-bottom: 12px; }
.how-card ol { margin: 0 0 0 20px; color: var(--ink-light); font-size: 0.92rem; }
.how-card li { margin-bottom: 8px; }
.how-card li:last-child { margin-bottom: 0; }

/* ── Learning path ───────────────────────────────────────────────────────── */
.path { list-style: none; display: flex; flex-direction: column; gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.path li { background: var(--cream); padding: 22px 26px; display: grid; grid-template-columns: 54px 1fr; gap: 20px; align-items: start; }
.band-alt .path li { background: var(--white); }
.path-step { font-family: var(--serif); font-style: italic; font-size: 1.35rem; color: var(--accent); line-height: 1.2; }
.path h3 { font-size: 1.05rem; margin-bottom: 4px; }
.path p { font-size: 0.9rem; color: var(--ink-light); }

/* ── Chapter cards ───────────────────────────────────────────────────────── */
.chapter-list { list-style: none; display: flex; flex-direction: column; gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.chapter-card {
  background: var(--white); padding: 28px 30px; display: grid;
  grid-template-columns: 54px 1fr auto; gap: 20px; align-items: start;
  text-decoration: none; color: inherit; transition: background 0.2s;
}
.chapter-card:hover, .chapter-card:focus-visible { background: var(--accent-soft); }
.chapter-num { font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--accent); line-height: 1.2; }
.chapter-card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.chapter-objectives { list-style: none; font-size: 0.88rem; color: var(--ink-light); }
.chapter-objectives li { padding-left: 20px; position: relative; margin-bottom: 4px; }
.chapter-objectives li::before { content: '\2013'; position: absolute; left: 4px; color: var(--accent); }
.chapter-meta { font-size: 0.78rem; color: var(--ink-light); margin-top: 10px; letter-spacing: 0.02em; }
.chapter-go { font-size: 0.85rem; font-weight: 500; color: var(--accent); white-space: nowrap; align-self: center; }

/* ── Lesson page ─────────────────────────────────────────────────────────── */
.lesson-header { padding: 44px 0 36px; border-bottom: 1px solid var(--border); }
.chapter-label {
  display: flex; align-items: center; gap: 10px; font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.chapter-label::before { content: ''; width: 26px; height: 1px; background: var(--accent); }
.lesson-header h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); margin-bottom: 12px; }
.lesson-course-link { font-size: 0.9rem; color: var(--ink-light); }
.lesson-course-link a { color: var(--accent); }

.lesson-layout { max-width: var(--page); margin: 0 auto; padding: 40px var(--pad) 8px; display: grid; grid-template-columns: 1fr 264px; gap: 48px; align-items: start; }
.lesson-main { min-width: 0; max-width: 74ch; }

.toc { position: sticky; top: 88px; background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 22px 24px; }
.toc h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--sans); font-weight: 600; color: var(--ink-light); margin-bottom: 12px; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 4px; }
.toc a { display: block; font-size: 0.86rem; color: var(--ink-light); text-decoration: none; padding: 5px 8px; border-left: 2px solid transparent; border-radius: 3px; }
.toc a::before { content: counter(toc) '. '; color: var(--accent); }
.toc a:hover { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); }

.lesson-section { margin-bottom: 40px; scroll-margin-top: 88px; }
.lesson-section h2 { font-size: 1.55rem; margin-bottom: 14px; }
.lesson-section h3 { font-size: 1.12rem; margin: 22px 0 10px; }
.lesson-section p { color: var(--ink-light); margin-bottom: 16px; }
.lesson-section p:last-child { margin-bottom: 0; }

.objectives-card { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; padding: 24px 28px; margin-bottom: 40px; scroll-margin-top: 88px; }
.objectives-card h2 { font-size: 1.05rem; margin-bottom: 12px; }
.objectives-card ul { list-style: none; }
.objectives-card li { position: relative; padding-left: 24px; margin-bottom: 8px; color: var(--ink-light); font-size: 0.94rem; }
.objectives-card li:last-child { margin-bottom: 0; }
.objectives-card li::before { content: '\2713'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.example { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; padding: 26px 30px; margin-bottom: 40px; scroll-margin-top: 88px; }
.example h2 { font-size: 1.3rem; margin-bottom: 12px; }
.example h3 { font-size: 0.78rem; font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin: 20px 0 8px; }
.example p { color: var(--ink-light); margin-bottom: 12px; }
.example ol { margin: 0 0 4px 22px; color: var(--ink-light); }
.example li { margin-bottom: 8px; }
.example-answer { background: var(--white); border: 1px solid var(--border); border-radius: 6px; padding: 14px 18px; margin-top: 16px !important; margin-bottom: 0 !important; color: var(--ink) !important; font-size: 0.95rem; }
.example-answer strong { color: var(--accent); }

.practice { margin-bottom: 40px; scroll-margin-top: 88px; }
.practice h2 { font-size: 1.4rem; margin-bottom: 8px; }
.practice-list { list-style: none; counter-reset: practice; display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.practice-list > li { counter-increment: practice; background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 22px 26px; }
.practice-question { font-weight: 500; color: var(--ink); margin-bottom: 12px; }
.practice-question::before { content: 'Q' counter(practice) '. '; color: var(--accent); font-weight: 600; }
.practice details { border-top: 1px solid var(--border); padding-top: 12px; }
.practice summary {
  cursor: pointer; color: var(--accent); font-size: 0.88rem; font-weight: 500;
  list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; border-radius: 3px;
}
.practice summary::-webkit-details-marker { display: none; }
.practice summary::before { content: '\25B8'; transition: transform 0.2s; }
.practice details[open] summary::before { transform: rotate(90deg); }
.practice summary:hover { text-decoration: underline; }
.practice details p { color: var(--ink-light); font-size: 0.94rem; margin-top: 10px; }

.takeaway { background: var(--ink); color: var(--cream); border-radius: 8px; padding: 26px 30px; margin-bottom: 40px; scroll-margin-top: 88px; }
.takeaway h2 { font-size: 1.1rem; color: var(--white); margin-bottom: 8px; }
.takeaway p { color: rgba(248, 246, 240, 0.88); font-size: 0.96rem; }

/* ── Lesson navigation ───────────────────────────────────────────────────── */
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.lesson-nav a {
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 22px; text-decoration: none; color: inherit; transition: border-color 0.2s, background 0.2s;
  display: block;
}
.lesson-nav a:hover, .lesson-nav a:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.lesson-nav .nav-dir { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-light); margin-bottom: 5px; }
.lesson-nav .nav-title { font-family: var(--serif); font-size: 1.02rem; color: var(--ink); }
.lesson-nav .next { text-align: right; }
.lesson-nav .next-highlight { background: var(--accent); border-color: var(--accent); }
.lesson-nav .next-highlight .nav-dir { color: rgba(255, 255, 255, 0.78); }
.lesson-nav .next-highlight .nav-title { color: var(--white); }
.lesson-nav .next-highlight:hover, .lesson-nav .next-highlight:focus-visible { background: var(--accent-dark); border-color: var(--accent-dark); }
.lesson-nav .full { grid-column: 1 / -1; text-align: center; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); margin-top: 8px; }
.site-footer .wrap { padding-top: 32px; padding-bottom: 32px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-left { font-family: var(--serif); font-style: italic; }
.footer-right { font-size: 0.82rem; color: var(--ink-light); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .lesson-layout { grid-template-columns: 1fr; gap: 28px; }
  .toc { position: static; order: -1; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --pad: 22px; }
  body { font-size: 16px; }
  .site-nav { position: static; }
  .site-nav-inner { min-height: 0; padding-top: 8px; padding-bottom: 8px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.84rem; }
  .band { padding: 40px 0; }
  .path li, .chapter-card { grid-template-columns: 40px 1fr; gap: 14px; padding: 22px; }
  .chapter-go { grid-column: 2; align-self: start; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-nav .next { text-align: left; }
  .example, .objectives-card, .takeaway, .practice-list > li { padding: 20px 22px; }
}

/* Printing keeps the reading, the example and the questions; solutions print only
   for the practice items the reader left expanded. */
@media print {
  .site-nav, .toc, .lesson-nav, .skip-link, .site-footer { display: none; }
  body { background: var(--white); font-size: 12pt; }
  .example, .objectives-card, .practice-list > li, .takeaway { break-inside: avoid; }
  .takeaway { background: var(--white); color: var(--ink); border: 1px solid var(--border); }
  .takeaway h2, .takeaway p { color: var(--ink); }
}

/* Match the established statistics course shell. */
.site-nav-inner{max-width:none;padding:0 48px;height:64px;min-height:64px;flex-wrap:nowrap}.nav-links{gap:24px;flex-wrap:nowrap}.nav-links a{font-size:.875rem;white-space:nowrap}.course-hero,.lesson-hero{padding-top:120px}.course-hero h1{font-size:2.8rem}.band{padding:64px 0}
@media(max-width:700px){.site-nav-inner{padding:0 16px;gap:12px}.nav-links{gap:12px}.nav-links a{font-size:.78rem}.nav-cta{padding:8px 12px}.course-hero,.lesson-hero{padding-top:100px}}
