/*
 * ML & AI theory — illustrated notes only (theory/ml_theory_hub.html + theory/theory_*.html).
 * Portfolio landing uses portfolio_home.css; older teal theme was portfolio_hub.css.
 */
:root {
  --th-violet: #7c3aed;
  --th-violet-d: #5b21b6;
  --th-teal: #0d9488;
  --th-teal-pale: #ccfbf1;
  --th-amber: #d97706;
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink2: #334155;
  --ink3: #64748b;
  --border: #e2e8f0;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 270px;
  background: linear-gradient(165deg, #312e81 0%, #1e1b4b 55%, #0f172a 100%);
  overflow-y: auto;
  z-index: 100;
  padding-bottom: 2rem;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 2px; }

.sb-logo { padding: 1.45rem 1.3rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-logo-mark {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.2rem;
  color: #a5b4fc;
  letter-spacing: -0.02em;
}
.sb-logo-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: #94a3b8;
  margin-top: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-group { padding: 0.75rem 0 0.25rem; }
.nav-group-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0 1.25rem;
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 1.25rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #94a3b8;
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.35;
}
.nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,.04); }
.nav-link.active {
  color: #fde68a;
  border-left-color: #fde68a;
  background: rgba(253, 230, 138, 0.06);
}
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: #475569; flex-shrink: 0; }
.nav-link.active .nav-dot { background: #fde68a; }

#main { margin-left: 270px; min-height: 100vh; }

.hero {
  background: linear-gradient(135deg, #3730a3 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 3rem 2.75rem 2.75rem;
  position: relative;
}
.hero-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: #fde68a;
  border: 1px solid rgba(253, 230, 138, 0.35);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 1rem;
}
.hero h1 {
  font-weight: 800;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: #f8fafc;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 720px;
}
.hero h1 em { color: #a5b4fc; font-style: normal; }
.hero-lead {
  margin-top: 1rem;
  color: #cbd5e1;
  font-size: 16px;
  max-width: 680px;
  line-height: 1.7;
}

.content { max-width: 820px; padding: 2.25rem 2.75rem 4rem; }

.sec {
  margin-top: 2.75rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}
.sec:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

.sec h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--th-violet-d);
  background: #ede9fe;
  padding: 3px 8px;
  border-radius: 4px;
}

.prose { color: var(--ink2); font-size: 15px; line-height: 1.75; margin-bottom: 1rem; }
.prose strong { color: var(--ink); }
.prose ul { margin: 0.5rem 0 1rem 1.25rem; }
.prose li { margin-bottom: 0.35rem; }

/* Figures & SVG */
.figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin: 1.25rem 0;
  overflow-x: auto;
}
.figure-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--th-violet-d);
  margin-bottom: 0.85rem;
}
.svg-wrap {
  display: block;
  width: 100%;
  min-height: 120px;
}
.figure-caption {
  font-size: 13px;
  color: var(--ink3);
  margin-top: 0.85rem;
  line-height: 1.55;
}

.compare-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 1rem 0;
}
@media (max-width: 720px) { .compare-2 { grid-template-columns: 1fr; } }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.75rem 0; }
.pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background: #ede9fe;
  color: var(--th-violet-d);
  border: 1px solid #ddd6fe;
}

.callout {
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink2);
}
.callout-info { background: #ecfeff; border: 1px solid #a5f3fc; }
.callout-warn { background: #fffbeb; border: 1px solid #fcd34d; }
.callout-title { font-weight: 700; color: var(--ink); margin-bottom: 0.35rem; font-size: 13px; }

table.theory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 1rem 0;
}
.theory-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--ink);
  color: #f1f5f9;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.theory-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink2);
}
.theory-table tr:last-child td { border-bottom: none; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
}
.hub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.hub-card:hover { border-color: var(--th-violet); box-shadow: 0 6px 20px rgba(124, 58, 237, 0.12); }
.hub-card.current { border-color: #fde68a; background: #fffbeb; }
.hub-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.hub-card p { font-size: 12.5px; color: var(--ink3); line-height: 1.5; }
.hub-meta { font-family: "JetBrains Mono", monospace; font-size: 9px; color: var(--th-teal); margin-top: 8px; }

.cross-footer {
  margin-top: 3rem;
  padding: 1.25rem;
  background: #f1f5f9;
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink2);
}
.cross-footer a { color: var(--th-violet-d); font-weight: 600; }

#menu-toggle {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--th-violet);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .hero { padding: 2rem 1.25rem; }
  .content { padding: 1.5rem; }
  #menu-toggle { display: flex; align-items: center; justify-content: center; }
}
