/* ── Mobile nav fix ── */
.top-nav {
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .top-nav {
    gap: 0.5rem 1rem;
  }
  .top-nav a {
    white-space: nowrap;
  }
  .mode-toggle {
    margin-left: auto;
  }
}

/* ── Human / Machine Toggle ── */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  border: 1px solid var(--divider, var(--line, #ddd));
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: auto;
}

.mode-toggle-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--fg-muted, var(--text-muted, #999));
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
}

.mode-toggle-btn:hover {
  color: var(--fg, var(--text, #222));
}

.mode-toggle-btn.active {
  color: var(--bg, #fff);
}

/* Sliding pill indicator */
.mode-toggle-pill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 4px;
  background: var(--fg, var(--text, #222));
  transition: left 0.25s ease, width 0.25s ease;
  z-index: 0;
}

/* ── Machine Mode: Dark warm theme (inspired by ManagementCraft) ── */
[data-mode="machine"] {
  /* Lesson page variables */
  --bg: #100f0f;
  --fg: #cecdc3;
  --fg-dim: #a09f95;
  --fg-muted: #6b6a63;
  --accent: #d4a27f;
  --card: #1a1918;
  --chip: #1a1918;
  --chip-fg: #a09f95;
  --divider: #2a2928;
  --green: #d4a27f;
  --green-dim: #b08968;
  --shadow: none;
  /* Homepage variables */
  --text: #cecdc3;
  --text-soft: #a09f95;
  --text-muted: #6b6a63;
  --surface: #1a1918;
  --surface-soft: #1a1918;
  --surface-strong: #100f0f;
  --surface-dark: #0a0908;
  --surface-dark-soft: #1a1918;
  --line: #2a2928;
  --line-strong: #3a3938;
  --blue: #d4a27f;
  --shadow-strong: none;
}

[data-mode="machine"] body {
  background: #100f0f;
  color: #cecdc3;
}

/* ── Human-only content hidden in machine mode ── */
[data-mode="machine"] .human-only,
[data-mode="machine"] .email-capture-shell {
  display: none !important;
}

/* ── Machine-only content shown in machine mode ── */
.machine-only {
  display: none !important;
}

[data-mode="machine"] .machine-only {
  display: block !important;
}

/* ── Machine mode: content styling ── */
[data-mode="machine"] .machine-content {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #cecdc3;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

[data-mode="machine"] .machine-content h1 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #d4a27f;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #2a2928;
}

[data-mode="machine"] .machine-content h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4a27f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2rem 0 0.75rem;
}

[data-mode="machine"] .machine-content p {
  color: #a09f95;
  margin-bottom: 0.75rem;
}

[data-mode="machine"] .machine-content pre {
  background: #0a0908;
  border: 1px solid #2a2928;
  border-radius: 4px;
  padding: 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #cecdc3;
}

[data-mode="machine"] .machine-content code {
  background: #1a1918;
  color: #d4a27f;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
}

[data-mode="machine"] .machine-content pre code {
  background: none;
  color: #cecdc3;
  padding: 0;
}

[data-mode="machine"] .machine-content ul,
[data-mode="machine"] .machine-content ol {
  color: #a09f95;
  margin: 0.5rem 0 1rem 1.5rem;
}

[data-mode="machine"] .machine-content a {
  color: #d4a27f;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Copy prompt button */
.machine-copy-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
  border: 1px solid #2a2928;
  border-radius: 4px;
  background: #1a1918;
  color: #a09f95;
  cursor: pointer;
  transition: all 0.15s;
  margin: 1rem 0.5rem 1rem 0;
}

.machine-copy-btn:hover {
  background: #2a2928;
  color: #cecdc3;
}

/* Machine mode prompt line prefix */
.machine-content .prompt-line::before {
  content: '> ';
  color: #6b6a63;
}

/* Machine mode: hide decorative elements */
[data-mode="machine"] .hero-image,
[data-mode="machine"] .proof-toast,
[data-mode="machine"] .arch-proof-cluster,
[data-mode="machine"] .architect-intro,
[data-mode="machine"] .footer,
[data-mode="machine"] .nav-footer {
  display: none;
}

/* Machine mode: toggle appearance */
[data-mode="machine"] .mode-toggle {
  border-color: #333;
}

[data-mode="machine"] .mode-toggle-btn {
  color: #6b6a63;
}

[data-mode="machine"] .mode-toggle-btn:hover {
  color: #cecdc3;
}

[data-mode="machine"] .mode-toggle-btn.active {
  color: #100f0f;
}

[data-mode="machine"] .mode-toggle-pill {
  background: #333;
}

/* Machine mode: nav */
[data-mode="machine"] .top-nav a,
[data-mode="machine"] .nav a,
[data-mode="machine"] .nav-link {
  color: #6b6a63;
}

[data-mode="machine"] .top-nav a:hover,
[data-mode="machine"] .nav a:hover,
[data-mode="machine"] .nav-link:hover {
  color: #cecdc3;
}

/* Machine mode: selection */
[data-mode="machine"] ::selection {
  background: #d4a27f;
  color: #100f0f;
}
