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

:root {
  --bg: #faf9f7;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-code: #1e1e2e;
  --bg-subtle: #f3f1ed;
  --bg-tag: rgba(214, 90, 56, 0.08);
  --accent: #c45c3e;
  --accent-dark: #a34a30;
  --accent-soft: #e07a5a;
  --accent-bg: rgba(196, 92, 62, 0.07);
  --border: #e5e1db;
  --border-strong: #cfc9c0;
  --text-1: #1a1714;
  --text-2: #5c5650;
  --text-3: #9a928c;
  --green: #0f6e56;
  --green-bg: rgba(15, 110, 86, 0.08);
  --blue: #185fa5;
  --blue-bg: rgba(24, 95, 165, 0.08);
  --purple: #534ab7;
  --purple-bg: rgba(83, 74, 183, 0.08);
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "DM Serif Display", Georgia, serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --sidebar-w: 280px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --r: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e0d;
    --bg-sidebar: #161514;
    --bg-card: #1c1b1a;
    --bg-code: #0a0a0f;
    --bg-subtle: #141312;
    --bg-tag: rgba(224, 122, 90, 0.12);
    --accent: #e07a5a;
    --accent-dark: #c45c3e;
    --border: #2a2724;
    --border-strong: #3a3632;
    --text-1: #f2ede8;
    --text-2: #a09890;
    --text-3: #605a55;
    --green-bg: rgba(15, 110, 86, 0.15);
    --blue-bg: rgba(24, 95, 165, 0.15);
    --purple-bg: rgba(83, 74, 183, 0.15);
  }
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ── Layout ── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(250, 249, 247, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(15, 14, 13, 0.92); }
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.5rem;
}
.logo {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
  color: var(--text-1);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.header-nav { display: flex; gap: 1.25rem; margin-left: auto; }
.header-nav a {
  font-size: 13px; font-weight: 500;
  color: var(--text-2); text-decoration: none;
}
.header-nav a:hover { color: var(--accent); }
.header-nav .nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
}
.header-nav .nav-cta:hover {
  background: var(--accent-dark);
  color: #fff !important;
  text-decoration: none;
}
.profile-strip {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: center;
  padding: 0.45rem 1rem;
  color: var(--text-2);
}
.profile-strip a { font-weight: 600; }
.footer-links { margin-top: 0.35rem; }
.footer-links a { margin: 0 0.35rem; }
.footer-disclaimer {
  margin-top: 0.75rem;
  font-size: 12px;
  color: var(--text-3);
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.course-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
}

.sidebar {
  position: sticky; top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  padding: 1.25rem 0 2rem;
}
.sidebar-search {
  padding: 0 1rem 1rem;
}
.sidebar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-subtle);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 13px;
}
.sidebar-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.sidebar-group { margin-bottom: 0.5rem; }
.sidebar-group-title {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  padding: 0.5rem 1rem 0.25rem;
}
.sidebar-link {
  display: block;
  padding: 0.35rem 1rem 0.35rem 1.25rem;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar-link:hover {
  color: var(--accent);
  background: var(--accent-bg);
  text-decoration: none;
}
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-bg);
  font-weight: 600;
}

.main-content {
  padding: 2rem 2.5rem 4rem;
  max-width: 820px;
}

/* ── Landing page ── */
.landing {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}
.landing-hero {
  text-align: center;
  padding: 3rem 1rem 4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.landing-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.landing-hero h1 em { font-style: italic; color: var(--accent); }
.landing-hero p {
  font-size: 17px;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 0.75rem 1.75rem;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none !important;
  transition: background 0.18s;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  display: inline-block;
  border: 1px solid var(--border-strong);
  color: var(--text-1) !important;
  padding: 0.75rem 1.75rem;
  border-radius: var(--r);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none !important;
  margin-left: 0.75rem;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.module-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.module-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.module-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-1);
}
.module-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Content typography ── */
.lesson-section {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}
.lesson-section:last-child { border-bottom: none; }
.lesson-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.lesson-section h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
}
.lesson-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-1);
}
.lesson-section p { margin-bottom: 1rem; color: var(--text-2); }
.lesson-section ul, .lesson-section ol {
  margin: 0 0 1rem 1.25rem;
  color: var(--text-2);
}
.lesson-section li { margin-bottom: 0.35rem; }

.callout {
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 3px solid;
}
.callout-info { background: var(--blue-bg); border-color: var(--blue); }
.callout-tip { background: var(--green-bg); border-color: var(--green); }
.callout-warn { background: var(--bg-tag); border-color: var(--accent); }
.callout strong { color: var(--text-1); display: block; margin-bottom: 0.25rem; }
.callout p { margin: 0; font-size: 14px; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 14px;
}
.compare-table th, .compare-table td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}
.compare-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-1);
}
.compare-table td { color: var(--text-2); }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}
pre {
  background: var(--bg-code);
  color: #cdd6f4;
  padding: 1rem 1.25rem;
  border-radius: var(--r);
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.diagram {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-card);
}
.diagram img {
  width: 100%;
  height: auto;
  display: block;
}
.diagram figcaption {
  padding: 0.65rem 1rem;
  font-size: 13px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  text-align: center;
}

.compare-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}
.compare-columns > div {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.15rem;
  font-size: 14px;
}
.compare-columns strong { display: block; margin-bottom: 0.35rem; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
@media (max-width: 640px) { .compare-columns { grid-template-columns: 1fr; } }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.tag {
  font-size: 12px; font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: var(--bg-tag);
  color: var(--accent);
  border: 1px solid rgba(196, 92, 62, 0.2);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; top: 0;
    height: auto; max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main-content { padding: 1.5rem 1.25rem 3rem; }
  .landing-hero .btn-secondary { margin-left: 0; margin-top: 0.75rem; display: inline-block; }
}
