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

:root {
  --sidebar-w: 280px;
  --bg: #0f1117;
  --bg-2: #161b27;
  --bg-3: #1e2433;
  --bg-4: #252c3d;
  --border: #2a3147;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --text-dim: #5c6580;
  --blue: #4f8ef7;
  --blue-dim: #1e3a6e;
  --green: #34d399;
  --green-dim: #0d3a26;
  --amber: #fbbf24;
  --amber-dim: #3d2e07;
  --red: #f87171;
  --red-dim: #3d1515;
  --purple: #a78bfa;
  --purple-dim: #2e1f5e;
  --code-bg: #111827;
  --code-border: #1f2b45;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

.sidebar-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.sidebar-section-label {
  padding: 16px 20px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.nav-list {
  list-style: none;
  padding: 4px 10px;
  flex: 1;
}

.nav-list li { margin: 2px 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-3);
  color: var(--text);
}

.nav-link.active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 500;
}

.nav-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.nav-badge.critical { background: var(--red-dim); color: var(--red); }
.nav-badge.high { background: var(--amber-dim); color: var(--amber); }
.nav-badge.medium { background: var(--blue-dim); color: var(--blue); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  max-width: 900px;
  padding: 0 48px 80px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-family: var(--font-mono);
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  margin-bottom: 72px;
  scroll-margin-top: 32px;
}

.section-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.section-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--bg-4);
  font-family: var(--font-mono);
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
  min-width: 56px;
}

.section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.25;
}

.section-header h2 { margin-bottom: 8px; }

.section-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 12px;
}

.section p {
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.7;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-critical { background: var(--red-dim); color: var(--red); }
.badge-high { background: var(--amber-dim); color: var(--amber); }
.badge-medium { background: var(--blue-dim); color: var(--blue); }
.badge-time { background: var(--bg-4); color: var(--text-muted); }

/* ============================================================
   CALLOUTS
   ============================================================ */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  font-size: 0.9rem;
  line-height: 1.65;
  border-left: 3px solid;
}
.callout-info { background: var(--blue-dim); border-color: var(--blue); color: #93c5fd; }
.callout-problem { background: var(--red-dim); border-color: var(--red); color: #fca5a5; }
.callout-warning { background: var(--amber-dim); border-color: var(--amber); color: #fcd34d; }

.callout strong { font-weight: 600; }
.callout code.inline-code { background: rgba(255,255,255,0.08); }

/* ============================================================
   CODE BLOCKS
   ============================================================ */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0d1117;
  border-bottom: 1px solid var(--code-border);
}

.code-lang {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

pre {
  overflow-x: auto;
  padding: 20px;
  font-size: 0.84rem;
  line-height: 1.65;
}

code {
  font-family: var(--font-mono);
}

pre code {
  color: #c9d1d9;
}

.inline-code {
  background: var(--bg-4);
  color: var(--purple);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* Simple syntax highlighting */
.token-comment { color: #6e7681; font-style: italic; }
.token-important { color: var(--red); font-weight: 600; }

/* ============================================================
   COPY BUTTONS
   ============================================================ */
.copy-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover { background: var(--bg-4); color: var(--text); border-color: var(--text-dim); }
.copy-btn.copied { background: var(--green-dim); color: var(--green); border-color: var(--green); }

/* ============================================================
   COPY BLOCKS (inline single-line)
   ============================================================ */
.copy-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}

.copy-block code {
  flex: 1;
  font-size: 0.84rem;
  color: var(--purple);
  line-height: 1.5;
  word-break: break-all;
}

/* ============================================================
   FIELD GROUPS
   ============================================================ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-note {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   OPTION BLOCKS
   ============================================================ */
.option-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}

.option-recommended {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.option-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.option-block p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* ============================================================
   STEPS LIST
   ============================================================ */
.steps-list {
  list-style: none;
  counter-reset: steps;
  padding: 0;
  margin: 16px 0;
}

.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.steps-list li:last-child { border-bottom: none; }

.steps-list li::before {
  content: counter(steps);
  background: var(--bg-4);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-3);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-2); }
.data-table a { color: var(--blue); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table strong { color: var(--text); }

/* ============================================================
   CHECKLIST
   ============================================================ */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 20px 0;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.check-item:hover { background: var(--bg-3); border-color: var(--border); }

.check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
  position: relative;
}

.check-item input[type="checkbox"]:checked {
  background: var(--green);
  border-color: var(--green);
}

.check-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 6px; height: 10px;
  border: 2px solid #0d3a26;
  border-top: none;
  border-left: none;
  transform: rotate(40deg);
}

.check-item:has(input:checked) span {
  color: var(--text-dim);
  text-decoration: line-through;
}

/* ============================================================
   RESOURCE LIST
   ============================================================ */
.resource-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resource-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.resource-list li::before {
  content: '→';
  color: var(--text-dim);
  font-size: 0.85em;
}

.resource-list a { color: var(--blue); text-decoration: none; font-weight: 500; }
.resource-list a:hover { text-decoration: underline; }

.resource-note {
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ============================================================
   BLOG GRID
   ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.blog-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s;
}

.blog-card:hover { border-color: var(--blue); }

.blog-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.blog-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 10px;
}

.blog-kw {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.8;
}

.footer strong { color: var(--text-muted); }

/* ============================================================
   LINKS
   ============================================================ */
a { color: var(--blue); }
a:hover { text-decoration: underline; }

/* ============================================================
   MOBILE NAV TOGGLE
   ============================================================ */
.nav-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-sm { margin-top: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .main {
    padding: 0 24px 64px;
  }
  .hero-title { font-size: 1.9rem; }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.6);
  }

  .main {
    margin-left: 0;
    padding: 64px 20px 64px;
    max-width: 100%;
  }

  .section-number { font-size: 1.8rem; min-width: 40px; }
  .hero-title { font-size: 1.7rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 10px; }
}

/* ============================================================
   SECTION DONE BARS
   ============================================================ */
.section-done-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.section-done-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}

.section-done-btn:hover {
  background: var(--bg-4);
  color: var(--text);
  border-color: var(--text-dim);
}

.is-done .section-done-btn {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}

.is-done .section-done-btn:hover {
  background: #0a2f1f;
  color: #6ee7b7;
}

.section-done-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Fade done sections slightly */
.is-done .section-header .section-number {
  color: var(--green-dim);
}

/* ============================================================
   NAV DONE INDICATORS
   ============================================================ */
.nav-link {
  flex-wrap: nowrap;
}

.nav-done {
  display: none;
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

.nav-done.visible {
  display: inline;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
