/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --green: #10b981;
  --green-light: #34d399;
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --red: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --sidebar-w: 280px;
  --header-h: 0px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #cbd5e1;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.sidebar-logo a { color: inherit; text-decoration: none; }
.sidebar-logo a:hover { text-decoration: none; }

.sidebar-logo h1 span { color: var(--blue-light); }

.sidebar-logo p {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav { padding: 16px 0; flex: 1; }

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  padding: 16px 24px 6px;
}

.nav-link {
  display: block;
  padding: 8px 24px 8px 28px;
  font-size: 14px;
  color: #94a3b8;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}

.nav-sub-link {
  display: block;
  padding: 4px 24px 4px 40px;
  font-size: 12.5px;
  color: #64748b;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-sub-link:hover {
  color: #cbd5e1;
  text-decoration: none;
}

.nav-sub-link.active {
  color: var(--blue-light);
  border-left-color: var(--blue-light);
}

.nav-link.active {
  color: #fff;
  background: rgba(37,99,235,0.15);
  border-left-color: var(--blue);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer .social-links {
  display: flex;
  gap: 8px;
}

.sidebar-footer .social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: background 0.2s;
}

.sidebar-footer .social-btn:hover { text-decoration: none; }

.sidebar-footer .social-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.sidebar-footer .github-btn { background: #333; }
.sidebar-footer .github-btn:hover { background: #555; }

.sidebar-footer .linkedin-btn { background: #0a66c2; }
.sidebar-footer .linkedin-btn:hover { background: #0077b5; }

/* ===== HAMBURGER ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--navy);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 22px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ===== MAIN CONTENT ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.content {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { line-height: 1.3; color: var(--navy); }

.content h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.content h2 {
  font-size: 26px;
  font-weight: 700;
  margin-top: 56px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.content h3 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 12px;
}

.content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.content p { margin-bottom: 16px; }

.content ul, .content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content li { margin-bottom: 6px; }

.subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: 20px;
  max-width: 600px;
  margin: 16px auto 32px;
}

.hero-cta {
  display: inline-block;
  padding: 14px 32px;
  background: var(--blue);
  color: #fff !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.2s;
}

.hero-cta:hover { background: var(--blue-light); text-decoration: none; }

/* ===== FEATURE CARDS ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.feature-icon.blue { background: rgba(37,99,235,0.1); color: var(--blue); }
.feature-icon.green { background: rgba(16,185,129,0.1); color: var(--green); }
.feature-icon.purple { background: rgba(139,92,246,0.1); color: var(--purple); }
.feature-icon.orange { background: rgba(245,158,11,0.1); color: var(--orange); }

.feature-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ===== CODE BLOCKS ===== */
pre {
  background: var(--navy-light);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 20px 24px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 1.65;
  position: relative;
}

pre code {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
}

code {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.9em;
}

p code, li code, td code {
  background: #f1f5f9;
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--text-light);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== SYNTAX HIGHLIGHTING (simple) ===== */
.hl-keyword { color: #c084fc; }
.hl-string { color: #34d399; }
.hl-number { color: #fbbf24; }
.hl-comment { color: #64748b; font-style: italic; }
.hl-type { color: #38bdf8; }
.hl-func { color: #f472b6; }
.hl-arrow { color: #f97316; }

/* ===== TABLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
}

th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: #f1f5f9; }

/* ===== INFO BOXES ===== */
.info-box {
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.info-box.tip {
  background: rgba(16,185,129,0.08);
  border-left: 4px solid var(--green);
}

.info-box.note {
  background: rgba(37,99,235,0.06);
  border-left: 4px solid var(--blue);
}

.info-box.warning {
  background: rgba(245,158,11,0.08);
  border-left: 4px solid var(--orange);
}

.info-box strong {
  display: block;
  margin-bottom: 4px;
}

/* ===== LAYER DIAGRAM ===== */
.layer-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 24px 0 32px;
  max-width: 520px;
}

.layer-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 14px 20px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.layer-row .layer-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-right: 14px;
  flex-shrink: 0;
}

.layer-row .layer-desc {
  font-weight: 400;
  font-size: 13px;
  opacity: 0.85;
  margin-left: auto;
  padding-left: 16px;
}

.layer-5 { background: #6366f1; }
.layer-4 { background: #8b5cf6; }
.layer-3 { background: var(--blue); }
.layer-2 { background: #0891b2; }
.layer-1 { background: var(--green); }

/* ===== STEP CARDS ===== */
.steps {
  counter-reset: step;
  margin: 24px 0;
}

.step {
  position: relative;
  padding: 24px 24px 24px 72px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 24px;
  top: 24px;
  width: 32px;
  height: 32px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.step h4 { margin-top: 0; }

/* ===== TWO COLUMN ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.blue { background: rgba(37,99,235,0.1); color: var(--blue); }
.badge.green { background: rgba(16,185,129,0.1); color: var(--green); }
.badge.purple { background: rgba(139,92,246,0.1); color: var(--purple); }
.badge.orange { background: rgba(245,158,11,0.1); color: var(--orange); }

/* ===== SEPARATOR ===== */
hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 48px 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    padding-top: 60px;
  }
  .sidebar.open { transform: translateX(0); }

  .hamburger { display: flex; }
  .overlay.open { display: block; }

  .main { margin-left: 0; }

  .content {
    padding: 80px 20px 60px;
  }

  .hero h1 { font-size: 32px; }
  .hero .subtitle { font-size: 16px; }

  .two-col { grid-template-columns: 1fr; }

  .features { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .content h1 { font-size: 28px; }
  .content h2 { font-size: 22px; }
  pre { font-size: 12px; padding: 14px 16px; }
  table { font-size: 13px; }
  td, th { padding: 8px 10px; }
}
