/* ═══════════════════════════════════════════
   Houston Learn — Design System
   Mirrors @houston-ai/core globals.css
   ═══════════════════════════════════════════ */

:root {
  --background: #ffffff;
  --foreground: #0d0d0d;
  --secondary: #f9f9f9;
  --muted-foreground: #5d5d5d;
  --border: #e5e5e5;
  --gray-50: #f9f9f9;
  --gray-100: #ececec;
  --gray-200: #e3e3e3;
  --gray-300: #cdcdcd;
  --gray-400: #b4b4b4;
  --gray-500: #9b9b9b;
  --gray-600: #676767;
  --gray-700: #424242;
  --gray-900: #1a1a1a;
  --gray-950: #0d0d0d;
  --success: #00a240;
  --info: #2964aa;
  --warning: #e0ac00;
  --danger: #e02e2a;
  --border-light: rgba(13, 13, 13, 0.05);
  --border-medium: rgba(0, 0, 0, 0.12);
  --border-heavy: rgba(13, 13, 13, 0.15);
  --composer-shadow:
    0 4px 4px rgba(0, 0, 0, 0.04),
    0 4px 80px 8px rgba(0, 0, 0, 0.04),
    0 0 1px rgba(0, 0, 0, 0.62);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica,
    Arial, sans-serif;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.6;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ═══════════════════════════════════════════
   Top Nav (mirrors landing /redirect-page/index.html)
   ═══════════════════════════════════════════ */

body {
  padding-top: 65px;
}

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}

.nav-logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--gray-950);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-logo svg {
  width: 28px;
  height: 28px;
  color: var(--gray-950);
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-center a {
  font-size: 14px;
  color: var(--gray-600);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-center a:hover {
  color: var(--gray-950);
}

.nav-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-right a:not(.btn) {
  color: var(--gray-600);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-right a:not(.btn):hover {
  color: var(--gray-950);
}

/* Navbar button is the small landing variant (36px), not learn's default 44px */
nav .btn {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
  gap: 8px;
}

@media (max-width: 900px) {
  nav {
    padding: 16px 20px;
  }
  .nav-center {
    display: none;
  }
}

/* ═══════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════ */

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1280px;
  margin: 0 auto;
  gap: 48px;
  padding: 48px 32px 120px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 32px 24px 80px;
  }
}

/* ═══════════════════════════════════════════
   Sidebar (chapter list)
   ═══════════════════════════════════════════ */

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    max-height: none;
    margin-bottom: 32px;
    padding-right: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
  }
}

.sidebar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0;
  margin-bottom: 12px;
  padding: 0 10px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-700);
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--gray-50);
  color: var(--gray-950);
}

.sidebar-nav a.active {
  background: var(--gray-100);
  color: var(--gray-950);
  font-weight: 500;
}

.sidebar-nav .num {
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  min-width: 18px;
}

.sidebar-nav a.active .num {
  color: var(--gray-600);
}

/* ═══════════════════════════════════════════
   Content
   ═══════════════════════════════════════════ */

.content {
  max-width: 720px;
  min-width: 0;
}

.content-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0;
  margin-bottom: 16px;
}

.content h1 {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--gray-950);
  margin-bottom: 20px;
}

.content .lead {
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin-bottom: 48px;
  max-width: 640px;
}

.content h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--gray-950);
  margin-top: 56px;
  margin-bottom: 16px;
  scroll-margin-top: 88px;
}

.content h2:first-of-type {
  margin-top: 0;
}

.content h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--gray-950);
  margin-top: 32px;
  margin-bottom: 10px;
}

.content p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.content p strong {
  color: var(--gray-950);
  font-weight: 600;
}

.content ul,
.content ol {
  margin-bottom: 20px;
  padding-left: 22px;
  color: var(--gray-700);
}

.content li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.content li::marker {
  color: var(--gray-400);
}

.content code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--gray-950);
}

.content pre {
  background: var(--gray-950);
  color: #f0f0f0;
  padding: 20px 24px;
  border-radius: 12px;
  overflow-x: auto;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 14px;
}

/* ═══════════════════════════════════════════
   On-this-page TOC
   ═══════════════════════════════════════════ */

.toc {
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 48px;
}

.toc-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0;
  margin-bottom: 12px;
}

.toc ol {
  list-style: none;
  padding: 0;
  counter-reset: toc;
  margin: 0;
}

.toc li {
  counter-increment: toc;
  margin-bottom: 6px;
  font-size: 14px;
  padding-left: 0;
}

.toc li::before {
  content: counter(toc) ".";
  color: var(--gray-400);
  margin-right: 10px;
  font-variant-numeric: tabular-nums;
}

.toc a {
  color: var(--gray-700);
  transition: color 0.15s;
}

.toc a:hover {
  color: var(--gray-950);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ═══════════════════════════════════════════
   Callouts
   ═══════════════════════════════════════════ */

.callout {
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--gray-300);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--gray-50);
}

.callout-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0;
  margin-bottom: 6px;
}

.callout p {
  margin-bottom: 0;
  font-size: 15px;
  color: var(--gray-700);
}

.callout p + p {
  margin-top: 10px;
}

.callout-info {
  border-left-color: var(--info);
}
.callout-info .callout-label {
  color: var(--info);
}

.callout-warning {
  border-left-color: var(--warning);
}
.callout-warning .callout-label {
  color: var(--warning);
}

.callout-success {
  border-left-color: var(--success);
}
.callout-success .callout-label {
  color: var(--success);
}

/* ═══════════════════════════════════════════
   Chat example (mimics Houston chat)
   ═══════════════════════════════════════════ */

.chat-example {
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  margin: 28px 0;
}

.chat-user {
  background: #f4f4f4;
  border-radius: 20px;
  padding: 10px 18px;
  max-width: 75%;
  margin-left: auto;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--gray-950);
}

.chat-ai {
  font-size: 15px;
  color: var(--gray-950);
  line-height: 1.6;
  margin-bottom: 12px;
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9999px;
  background: white;
  border: 1px solid var(--border-medium);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-950);
  cursor: default;
  transition: background 0.15s;
}

.chip:hover {
  background: var(--gray-50);
}

.chip-arrow {
  color: var(--gray-500);
}

/* ═══════════════════════════════════════════
   Comparison grid (for the shift chapter)
   ═══════════════════════════════════════════ */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

@media (max-width: 700px) {
  .compare {
    grid-template-columns: 1fr;
  }
}

.compare-card {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 22px 24px;
  background: white;
}

.compare-card h4 {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0;
  margin-bottom: 6px;
}

.compare-card .compare-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-950);
  margin-bottom: 12px;
}

.compare-card ol {
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--gray-700);
}

.compare-card ol li {
  margin-bottom: 6px;
}

.compare-card.bad {
  background: var(--gray-50);
}

.compare-card.good {
  border-color: var(--border-medium);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 2px 8px rgba(0, 0, 0, 0.02);
}

/* ═══════════════════════════════════════════
   Table of contents cards (index page)
   ═══════════════════════════════════════════ */

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 48px;
}

@media (max-width: 700px) {
  .chapter-grid {
    grid-template-columns: 1fr;
  }
}

.chapter-card {
  display: block;
  padding: 22px 24px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: white;
  transition:
    border-color 0.15s,
    box-shadow 0.2s,
    transform 0.15s;
}

.chapter-card:hover {
  border-color: var(--border-medium);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 8px 24px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.chapter-card .chapter-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  letter-spacing: 0;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.chapter-card .chapter-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-950);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.chapter-card .chapter-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-foreground);
}

/* ═══════════════════════════════════════════
   Hero (index page)
   ═══════════════════════════════════════════ */

.hero {
  padding-top: 24px;
  padding-bottom: 24px;
}

.hero .content-label {
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 52px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero .lead {
  font-size: 20px;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--gray-950);
  color: white;
}

.btn-primary:hover {
  background: var(--gray-700);
}

.btn-secondary {
  background: white;
  color: var(--gray-950);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--gray-50);
}

/* ═══════════════════════════════════════════
   Prev / Next
   ═══════════════════════════════════════════ */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.pager a {
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.pager a:hover {
  border-color: var(--border-medium);
  background: var(--gray-50);
}

.pager .pager-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: 0;
}

.pager .pager-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-950);
}

.pager .next {
  text-align: right;
}

.pager .spacer {
  border: none;
  background: transparent;
}

.pager .spacer:hover {
  background: transparent;
  border: none;
}

/* ═══════════════════════════════════════════
   File tree (for pages chapter)
   ═══════════════════════════════════════════ */

.tree {
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  color: var(--gray-700);
  line-height: 1.75;
  white-space: pre;
  overflow-x: auto;
}

.tree .dir {
  color: var(--gray-950);
  font-weight: 600;
}

.tree .comment {
  color: var(--gray-500);
}

/* ═══════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════ */

.footer {
  border-top: 1px solid var(--border-light);
  padding: 32px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
}
