/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg-alt: #f8f9fb;
  --bg-code: #f1f3f5;
  --text: #1a1a2e;
  --text-muted: #555e6e;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --border: #e2e5ea;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --max-w: 960px;
  --sidebar-w: 240px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* === Top Navigation === */
.topnav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: .75rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav .logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  background: linear-gradient(to right, #2563eb, #9333ea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topnav .logo:hover { text-decoration: none; }
.topnav .logo-icon {
  width: 2rem;
  height: 2rem;
  background: linear-gradient(to bottom right, #2563eb, #9333ea);
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topnav .logo-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text-muted); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active { color: var(--accent); }

/* === Hero === */
.hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
.hero-sub { font-size: 1.15rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

/* === Container === */
.container { max-width: var(--max-w); margin: 0 auto; padding: 2rem; }

/* === Card Grid (Home) === */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 3rem; }
.card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
  color: var(--text);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); text-decoration: none; }
.card-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.card p { font-size: .88rem; color: var(--text-muted); }

/* === Page Layout with Sidebar === */
.page-layout { display: flex; gap: 2rem; max-width: 1200px; margin: 0 auto; padding: 2rem; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}
.sidebar h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 1.25rem 0 .4rem;
}
.sidebar h3:first-child { margin-top: 0; }
.sidebar a {
  display: block;
  padding: .25rem 0;
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.sidebar a:hover { color: var(--accent); text-decoration: none; }
.sidebar a.active { color: var(--accent); font-weight: 600; }

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

/* === Prose === */
.page-content h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 1rem; border-bottom: 2px solid var(--border); padding-bottom: .5rem; }
.page-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2.5rem 0 .75rem; letter-spacing: -.01em; }
.page-content h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.page-content p { margin-bottom: 1rem; }
.page-content ul, .page-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.page-content li { margin-bottom: .35rem; }

/* === Code === */
code {
  font-family: var(--font-mono);
  font-size: .87em;
  background: var(--bg-code);
  padding: .15em .35em;
  border-radius: 4px;
}
pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: .85rem;
  line-height: 1.6;
}
pre code { background: none; padding: 0; color: inherit; }

/* === Tables === */
table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; background: var(--bg-alt); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }

/* === Definition Lists === */
.concept-list dt { font-weight: 700; margin-top: .75rem; }
.concept-list dd { color: var(--text-muted); margin-left: 0; margin-bottom: .5rem; }

/* === Steps === */
.steps-list { padding-left: 1.5rem; }
.steps-list li { margin-bottom: .75rem; }

/* === Callout === */
.callout {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.25rem;
  font-size: .92rem;
}
.callout strong { display: block; margin-bottom: .25rem; }
.callout.warning { border-left-color: #f59e0b; background: #fffbeb; }
.callout.success { border-left-color: #10b981; background: #ecfdf5; }

/* === Command Block (for CLI) === */
.cmd-block {
  margin-bottom: 2rem;
}
.cmd-block h3 { margin-bottom: .35rem; }
.cmd-block .cmd-desc { color: var(--text-muted); font-size: .92rem; margin-bottom: .5rem; }

/* === Overview Section === */
.overview-section { margin-bottom: 2.5rem; }
.overview-section h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .75rem; border-bottom: 2px solid var(--border); padding-bottom: .4rem; }
.overview-section h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 .5rem; }

/* === Footer === */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: .82rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .topnav { flex-wrap: wrap; padding: .75rem 1rem; }
  .nav-links { gap: 1rem; }
  .page-layout { flex-direction: column; padding: 1rem; }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 1rem;
    margin-bottom: 1rem;
  }
  .hero h1 { font-size: 1.8rem; }
  .card-grid { grid-template-columns: 1fr; }
}
