/* ============================================
   THE DESIGNER WHO CODES — Main Stylesheet
   Bold editorial design system
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bungee+Inline&family=Jersey+10&family=Nunito:wght@400;500;600;700&family=SUSE:wght@400;500;600&display=swap');

/* --- Design Tokens (CSS Variables) --- */
:root {
  /* Colors */
  --color-bg: #0a0a0a;
  --color-surface: #111111;
  --color-surface-2: #181818;
  --color-border: #222222;
  --color-border-subtle: #1a1a1a;
  --color-accent: #f5e642;
  --color-accent-dim: rgba(245, 230, 66, 0.12);
  --color-accent-border: rgba(245, 230, 66, 0.4);
  --color-red: #ff4d4d;
  --color-red-dim: rgba(255, 77, 77, 0.12);
  --color-blue: #4d9fff;
  --color-blue-dim: rgba(77, 159, 255, 0.12);
  --color-green: #4dff9a;
  --color-green-dim: rgba(77, 255, 154, 0.12);
  --color-text-primary: #f0f0f0;
  --color-text-secondary: #999999;
  --color-text-muted: #555555;
  --color-text-on-accent: #0a0a0a;

  /* Typography */
  --font-display: 'Bungee Inline', Georgia, serif;
  --font-display-accent: 'Jersey 10', Georgia, serif;
  --font-body: 'Nunito', -apple-system, sans-serif;
  --font-mono: 'SUSE', 'Courier New', monospace;

  /* Layout */
  --sidebar-width: 272px;
  --content-max-width: 740px;
  --progress-height: 3px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* --- Light mode tokens --- */
[data-theme="light"] {
  --color-bg: #f7f5f0;
  --color-surface: #ffffff;
  --color-surface-2: #f0ede8;
  --color-border: #e0dbd4;
  --color-border-subtle: #eae7e2;
  --color-accent: #c9a800;
  --color-accent-dim: rgba(201, 168, 0, 0.10);
  --color-accent-border: rgba(201, 168, 0, 0.4);
  --color-red: #cc2200;
  --color-red-dim: rgba(204, 34, 0, 0.10);
  --color-blue: #0066cc;
  --color-blue-dim: rgba(0, 102, 204, 0.10);
  --color-green: #007a3d;
  --color-green-dim: rgba(0, 122, 61, 0.10);
  --color-text-primary: #111111;
  --color-text-secondary: #555555;
  --color-text-muted: #aaaaaa;
  --color-text-on-accent: #111111;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: var(--progress-height);
  background: var(--color-accent);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ============================================
   LAYOUT — Sidebar + Content
   ============================================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar__brand {
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar__brand-logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar__brand-title {
  font-family: var(--font-display-accent);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-primary);
  letter-spacing: 0.04em;
}

.sidebar__brand-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-1);
  font-weight: 500;
}

.sidebar__nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
}

.sidebar__section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-6) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--color-surface-2);
}

.nav-item--active {
  background: var(--color-accent-dim);
  border-left-color: var(--color-accent);
}

.nav-item__number {
  font-family: var(--font-display-accent);
  font-size: 11px;
  color: var(--color-text-muted);
  min-width: 20px;
  padding-top: 2px;
  font-weight: 500;
}

.nav-item--active .nav-item__number {
  color: var(--color-accent);
}

.nav-item__text {}

.nav-item__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.4;
  display: block;
}

.nav-item--active .nav-item__title {
  color: var(--color-text-primary);
  font-weight: 600;
}

.nav-item__tag {
  font-size: 10px;
  color: var(--color-text-muted);
  display: block;
  margin-top: 1px;
}

.sidebar__footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-border);
}

.sidebar__progress-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.sidebar__progress-track {
  height: 3px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}

.sidebar__progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* --- Theme toggle --- */
.theme-toggle {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-start;
}

.theme-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  background: transparent;
  border: 1.5px solid var(--color-accent-border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle__btn:hover {
  background: var(--color-accent-dim);
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

[data-theme="dark"]  .theme-icon--dark  { opacity: 1; }
[data-theme="light"] .theme-icon--light { opacity: 1; }

/* Mobile hamburger */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  z-index: 200;
}

.mobile-header__title {
  font-family: var(--font-display-accent);
  font-size: 15px;
  font-weight: 700;
}

.mobile-hamburger {
  background: none;
  border: none;
  color: var(--color-text-primary);
  cursor: pointer;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mobile-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-primary);
  transition: all 0.2s ease;
}

.sidebar--open .mobile-hamburger span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.sidebar--open .mobile-hamburger span:nth-child(2) { opacity: 0; }
.sidebar--open .mobile-hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.content {
  grid-column: 2;
  min-height: 100vh;
  padding: 0;
}

/* ============================================
   SCROLL-SPY SECTION INDICATOR
   Sticky bar below reading progress showing current section
   ============================================ */
.section-indicator {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-16);
  height: 36px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.section-indicator--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.section-indicator__count {
  font-family: var(--font-display-accent);
  font-size: 10px;
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}
.section-indicator__divider {
  width: 1px;
  height: 12px;
  background: var(--color-border);
  flex-shrink: 0;
}
.section-indicator__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-indicator__dots {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.section-indicator__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease;
}
.section-indicator__dot--active {
  background: var(--color-accent);
  transform: scale(1.3);
}

/* ============================================
   HOME PAGE — Landing
   ============================================ */
.home-hero {
  padding: var(--space-20) var(--space-16) var(--space-12);
  border-bottom: 1px solid var(--color-border);
  max-width: var(--content-max-width);
}

.home-hero__eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: var(--space-5);
}

.home-hero__title {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: 0.04em;
  color: var(--color-text-primary);
  margin-bottom: var(--space-6);
}

.home-hero__title em {
  font-style: italic;
  color: var(--color-accent);
}

.home-hero__subtitle {
  font-size: 19px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin-bottom: var(--space-8);
}

.home-hero__meta {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.home-hero__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.home-hero__meta-item strong {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.home-start-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-weight: 700;
  font-size: 15px;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
}

.home-start-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

/* Chapter grid on home page */
.chapter-grid {
  padding: var(--space-12) var(--space-16);
  max-width: 900px;
}

.chapter-grid__heading {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-8);
  letter-spacing: 0.03em;
}

.chapter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.chapter-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-decoration: none;
  transition: all 0.2s ease;
  display: block;
}

.chapter-card:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-2);
  transform: translateY(-2px);
}

.chapter-card__number {
  font-family: var(--font-display-accent);
  font-size: 11px;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.chapter-card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-2);
}

.chapter-card__tagline {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.chapter-card__meta {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chapter-card__meta::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

/* ============================================
   CHAPTER PAGE HEADER
   ============================================ */
.chapter-header {
  padding: var(--space-16) var(--space-16) var(--space-12);
  border-bottom: 1px solid var(--color-border);
  max-width: var(--content-max-width);
}

.chapter-header__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.chapter-header__number {
  font-family: var(--font-display-accent);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--color-accent-dim);
  padding: 3px var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 230, 66, 0.2);
}

.chapter-header__phase {
  font-family: var(--font-display-accent);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--color-blue-dim);
  padding: 3px var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(77, 159, 255, 0.2);
}

.chapter-header__title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--color-text-primary);
  margin-bottom: var(--space-5);
}

.chapter-header__tagline {
  font-size: 19px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  max-width: 560px;
  margin-bottom: var(--space-6);
  font-style: italic;
}

.chapter-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.meta-badge--time {
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.meta-badge--tools {
  background: var(--color-blue-dim);
  color: var(--color-blue);
  border: 1px solid rgba(77, 159, 255, 0.2);
}

/* ============================================
   CHAPTER BODY
   ============================================ */
.chapter-body {
  padding: var(--space-12) var(--space-16);
  max-width: var(--content-max-width);
}

/* Sections */
.section {
  margin-bottom: var(--space-12);
}

.section__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.03em;
  margin-bottom: var(--space-4);
  line-height: 1.25;
}

.section__intro {
  font-size: 17px;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-6);
}

/* Prose — paragraphs inside sections */
.prose p {
  color: var(--color-text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-5);
  font-size: 17px;
}

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

.prose strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.prose em {
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Concept list */
.concept-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.concept-list li {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.concept-list__icon {
  width: 22px;
  height: 22px;
  background: var(--color-accent-dim);
  border: 1px solid rgba(245, 230, 66, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.concept-list__icon::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.concept-list__text {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.concept-list__text strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* ============================================
   CALLOUT BOXES
   ============================================ */
.callout {
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  border-left: 3px solid;
}

.callout__label {
  font-family: var(--font-display-accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

.callout__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.callout__body {
  font-size: 15px;
  line-height: 1.7;
}

.callout--jargon {
  background: var(--color-blue-dim);
  border-left-color: var(--color-blue);
}
.callout--jargon .callout__label { color: var(--color-blue); }
.callout--jargon .callout__title { color: var(--color-text-primary); }
.callout--jargon .callout__body { color: var(--color-text-secondary); }

.callout--tip {
  background: var(--color-accent-dim);
  border-left-color: var(--color-accent);
}
.callout--tip .callout__label { color: var(--color-accent); }
.callout--tip .callout__title { color: var(--color-text-primary); }
.callout--tip .callout__body { color: var(--color-text-secondary); }

.callout--warning {
  background: var(--color-red-dim);
  border-left-color: var(--color-red);
}
.callout--warning .callout__label { color: var(--color-red); }
.callout--warning .callout__title { color: var(--color-text-primary); }
.callout--warning .callout__body { color: var(--color-text-secondary); }

.callout--insight {
  background: var(--color-green-dim);
  border-left-color: var(--color-green);
}
.callout--insight .callout__label { color: var(--color-green); }
.callout--insight .callout__title { color: var(--color-text-primary); }
.callout--insight .callout__body { color: var(--color-text-secondary); }

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.code-block__lang {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-block__dots {
  display: flex;
  gap: 5px;
}

.code-block__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.code-block__dot:nth-child(1) { background: #ff5f57; }
.code-block__dot:nth-child(2) { background: #febc2e; }
.code-block__dot:nth-child(3) { background: #28c840; }

.code-block__copy {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.code-block__copy:hover {
  border-color: var(--color-accent-border);
  color: var(--color-accent);
}
.code-block__copy--copied {
  color: #28c840;
  border-color: #28c840;
}

.code-block pre {
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  white-space: pre;
}

/* Inline code */
code:not(.code-block code) {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--color-accent);
}

/* ============================================
   ACTIVITY BOX
   ============================================ */
.activity {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.activity__header {
  background: var(--color-accent);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.activity__icon {
  font-size: 20px;
}

.activity__header-text {}

.activity__label {
  font-family: var(--font-display-accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.5);
}

.activity__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-on-accent);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.activity__body {
  padding: var(--space-6);
}

.activity__tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.activity__tools-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  color: var(--color-text-secondary);
}

.activity__steps {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.activity__step {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  counter-increment: steps;
}

.activity__step-number {
  width: 26px;
  height: 26px;
  background: var(--color-accent-dim);
  border: 1px solid rgba(245, 230, 66, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display-accent);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.activity__step-text {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.activity__step-text strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* ============================================
   KEY TAKEAWAYS
   ============================================ */
.takeaways {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.takeaways__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: 0.03em;
}

.takeaways__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.takeaways__list li {
  display: flex;
  gap: var(--space-3);
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.takeaways__list li::before {
  content: '✓';
  color: var(--color-accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================
   CHAPTER NAVIGATION (Prev/Next)
   ============================================ */
.chapter-nav {
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  max-width: var(--content-max-width);
}

.chapter-nav__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.15s ease;
  min-width: 200px;
}

.chapter-nav__link:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.chapter-nav__link--next {
  text-align: right;
  margin-left: auto;
}

.chapter-nav__direction {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.chapter-nav__completion {
  padding: var(--space-4) var(--space-5);
  text-align: right;
}

.chapter-nav__completion-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.chapter-nav__completion-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--color-accent);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.chapter-nav__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

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

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    width: 280px;
    transition: left 0.25s ease;
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 150;
  }

  .sidebar--open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,0.7);
    z-index: 140;
  }

  .sidebar-overlay--open {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .content {
    grid-column: 1;
    padding-top: 56px;
  }

  .home-hero,
  .chapter-header {
    padding: var(--space-10) var(--space-5) var(--space-8);
  }

  .home-hero__title {
    font-size: 42px;
  }

  .chapter-header__title {
    font-size: 34px;
  }

  .chapter-body {
    padding: var(--space-8) var(--space-5);
  }

  .chapter-grid {
    padding: var(--space-8) var(--space-5);
  }

  .chapter-nav {
    padding: var(--space-6) var(--space-5);
    flex-direction: column;
  }

  .chapter-nav__link {
    width: 100%;
    min-width: auto;
  }

  .chapter-nav__link--next {
    text-align: left;
    margin-left: 0;
  }

  .chapter-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   GRADUATE BUTTON (Chapter 10)
   ============================================ */
.graduate-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.graduate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 230, 66, 0.25);
}

/* ============================================
   GRADUATE MODAL (full-screen celebration)
   ============================================ */
.graduate-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.graduate-modal--open {
  opacity: 1;
  pointer-events: all;
}
.graduate-modal__card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: var(--space-10) var(--space-16);
  text-align: center;
  max-width: 520px;
  width: 90%;
  transform: scale(0.85);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.graduate-modal--open .graduate-modal__card {
  transform: scale(1);
}
.graduate-modal__emoji {
  font-size: 64px;
  margin-bottom: var(--space-4);
  display: block;
}
.graduate-modal__title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.graduate-modal__sub {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-8);
}
.graduate-modal__close {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-8);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.graduate-modal__close:hover { transform: translateY(-1px); }

/* ============================================
   CONFETTI CANVAS
   ============================================ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1999;
}

/* ============================================
   SIDEBAR PROGRESS — dual phase labels
   ============================================ */
.sidebar__progress-section {
  margin-bottom: var(--space-3);
}

.sidebar__progress-phase-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar__progress-fill--p2 {
  height: 100%;
  background: var(--color-blue);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ============================================
   NAV PHASE DIVIDER
   ============================================ */
.nav-phase-divider {
  padding: var(--space-3) var(--space-5) var(--space-1);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.nav-phase-divider__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-blue);
}

/* ============================================
   IN-BROWSER IDE COMPONENT
   ============================================ */
.ide {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
}

.ide__header {
  background: var(--color-accent);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ide__icon {
  font-size: 15px;
  flex-shrink: 0;
  color: var(--color-text-on-accent);
}

.ide__header-text {
  flex: 1;
  min-width: 0;
}

.ide__label {
  font-family: var(--font-display-accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.45);
}

.ide__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-on-accent);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ide__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.ide__btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.ide__btn--reset {
  background: rgba(0,0,0,0.15);
  color: var(--color-text-on-accent);
}

.ide__btn--reset:hover {
  background: rgba(0,0,0,0.28);
}

.ide__btn--run {
  background: var(--color-text-on-accent);
  color: var(--color-accent);
}

.ide__btn--run:hover {
  background: #1e1e1e;
}

.ide__split {
  display: flex;
  height: 420px;
  border-top: 1px solid var(--color-border);
}

.ide__editor-pane {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--color-border);
  position: relative;
}

.ide__preview-pane {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.ide__editor {
  width: 100%;
  height: 100%;
}

.ide__preview {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Mobile: stack editor above preview */
@media (max-width: 900px) {
  .ide__split {
    flex-direction: column;
    height: 620px;
  }

  .ide__editor-pane {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    flex: 0 0 310px;
  }

  .ide__preview-pane {
    flex: 1;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }
.font-mono { font-family: var(--font-mono); }
.mb-0 { margin-bottom: 0; }
.mt-6 { margin-top: var(--space-6); }
