/* === Harness Course — Linear-Inspired Design System v2 === */
/* font-feature-settings: 'cv01', 'ss03' are FUNDAMENTAL to Linear's look */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Backgrounds — Linear's luminance stacking model */
  --bg-page: #08090a;
  --bg-panel: #0f1011;
  --bg-surface: #191a1b;
  --bg-surface-alt: #1f2024;
  --bg-hover: rgba(255,255,255,0.04);
  --bg-card: rgba(255,255,255,0.02);
  --bg-card-hover: rgba(255,255,255,0.05);

  /* Borders — always semi-transparent white */
  --border: rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.05);
  --border-hover: rgba(255,255,255,0.12);

  /* Text — warm off-white, never pure #fff */
  --text-primary: #f7f8f8;
  --text-secondary: #d0d6e0;
  --text-muted: #8a8f98;
  --text-dim: #62666d;

  /* Accent — Linear's signature indigo-violet */
  --accent: #5e6ad2;
  --accent-hover: #828fff;
  --accent-text: #7170ff;

  /* Status */
  --success: #27a644;
  --warning: #eab308;
  --danger: #ef4444;

  /* Geometry */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 260px;

  /* Typography — Linear-inspired scale */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-weight-regular: 400;
  --font-weight-emphasis: 500;
  --font-weight-strong: 600;

  /* Elevation shadows */
  --shadow-elevated: rgba(0,0,0,0.4) 0px 2px 4px;
  --shadow-dialog: rgba(0,0,0,0) 0px 8px 2px, rgba(0,0,0,0.01) 0px 5px 2px, rgba(0,0,0,0.04) 0px 3px 2px, rgba(0,0,0,0.07) 0px 1px 1px, rgba(0,0,0,0.08) 0px 0px 1px;

  /* Page transition */
  --page-transition: 0.35s ease;
}

/* Page fade-in on load */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.main { animation: page-fade-in var(--page-transition); }

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

body {
  font-family: var(--font);
  font-feature-settings: 'cv01', 'ss03';
  font-weight: 400;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 15px;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(94,106,210,0.3); color: var(--text-primary); }

/* === Sidebar === */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto; z-index: 100;
  padding: 0; transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}
.sidebar-brand a { text-decoration: none; }
.sidebar-brand h2 {
  font-size: 15px; font-weight: 500;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.sidebar-brand .brand-sub {
  font-size: 11px; color: var(--text-dim);
  margin-top: 2px; font-weight: 400;
  letter-spacing: 0.01em;
}

.sidebar nav { padding: 0 6px; }
.sidebar .nav-section { margin-bottom: 2px; }

.sidebar .nav-section-title {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-dim);
  padding: 16px 14px 6px; font-weight: 500;
}

.sidebar nav a {
  display: flex; align-items: center;
  gap: 10px; padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: all 0.12s ease;
}
.sidebar nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar nav a.active { background: rgba(94,106,210,0.12); color: var(--accent-text); }
.sidebar nav a .nav-icon { font-size: 14px; width: 20px; text-align: center; opacity: 0.6; flex-shrink: 0; }
.sidebar nav a.active .nav-icon { opacity: 1; }

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* === Hamburger (mobile) === */
.hamburger {
  display: none; position: fixed;
  top: 16px; left: 16px; z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px; cursor: pointer;
  color: var(--text-primary); font-size: 18px; line-height: 1;
}
.hamburger:hover { border-color: var(--border-hover); }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; }

/* === Main Content Area === */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* === Hero (home page) === */
.hero {
  padding: 80px 48px 48px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  background: radial-gradient(ellipse at 50% 0%, rgba(94,106,210,0.06) 0%, transparent 60%);
}
.hero h1 {
  font-size: 36px; font-weight: 500;
  letter-spacing: -0.03em; line-height: 1.15;
  margin-bottom: 12px;
}
.hero h1 .accent-word { color: var(--accent-text); }
.hero p {
  font-size: 17px; font-weight: 400;
  color: var(--text-muted);
  max-width: 640px; margin: 0 auto 28px; line-height: 1.6;
}
.hero-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* === Stats Row === */
.stats-row {
  display: flex; gap: 8px; justify-content: center;
  padding: 28px 48px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.stat { text-align: center; padding: 0 20px; }
.stat-value { font-size: 24px; font-weight: 500; color: var(--text-primary); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

/* === Page Header (inner pages) === */
.page-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 44px 48px 32px;
  background: linear-gradient(180deg, rgba(94,106,210,0.04) 0%, transparent 100%);
}
.page-header h1 { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 8px; }
.page-header p { font-size: 15px; color: var(--text-muted); max-width: 680px; line-height: 1.6; }
.page-header .page-icon { margin-right: 8px; }

/* === Content === */
.content { padding: 40px 48px 64px; max-width: 960px; flex: 1; }

/* === Typography === */
h2 { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; margin: 36px 0 12px; color: var(--text-primary); }
h2:first-child { margin-top: 0; }
h3 { font-size: 16px; font-weight: 500; margin: 24px 0 8px; color: var(--text-primary); }
h4 { font-size: 14px; font-weight: 500; margin: 16px 0 6px; color: var(--text-primary); }
p { margin-bottom: 16px; font-size: 15px; color: var(--text-secondary); line-height: 1.6; }
a { color: var(--accent-text); text-decoration: none; transition: color 0.12s; }
a:hover { color: var(--accent-hover); }
strong { color: var(--text-primary); font-weight: 500; }
ul, ol { margin: 0 0 16px 20px; }
li { margin-bottom: 6px; font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
li strong { color: var(--text-secondary); }

/* === Code === */
code {
  font-family: var(--mono); font-size: 13px;
  background: rgba(255,255,255,0.05);
  padding: 2px 6px; border-radius: 4px;
  color: var(--text-primary);
}
pre {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px; overflow-x: auto;
  margin: 16px 0 24px;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
}
pre code { background: none; padding: 0; border-radius: 0; }

/* === Blockquote === */
blockquote {
  border-left: 2px solid var(--accent);
  padding: 12px 20px; margin: 16px 0 24px;
  background: rgba(94,106,210,0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
blockquote p { margin: 0; color: var(--text-secondary); font-style: italic; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center;
  gap: 6px; padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px;
  font-family: var(--font); text-decoration: none;
  transition: all 0.12s ease; cursor: pointer;
  border: none; line-height: 1.4;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-secondary {
  background: rgba(255,255,255,0.02);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }

/* === Cards === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px; margin: 20px 0;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.15s ease;
}
.card:hover { background: var(--bg-card-hover); border-color: var(--border); }
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 500; }
.card p { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.card .card-icon { font-size: 22px; margin-bottom: 10px; display: block; }
a.card { cursor: pointer; text-decoration: none; color: inherit; display: block; }
a.card:hover { transform: translateY(-1px); }
a.card:hover h3 { color: var(--accent-text); }

/* === Subsystem Grid (home page) === */
.subsystem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px; margin: 20px 0;
}
.subsystem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.subsystem-card:hover { border-color: var(--border); }
.subsystem-card .subsys-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 12px;
}
.subsystem-card .subsys-header .num {
  width: 28px; height: 28px;
  background: rgba(94,106,210,0.15);
  color: var(--accent-text);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 13px; flex-shrink: 0;
}
.subsystem-card .subsys-body { padding: 16px 20px; }
.subsystem-card .subsys-body p { font-size: 14px; margin-bottom: 8px; }
.subsystem-card .subsys-body p:last-child { margin-bottom: 0; }
.subsystag {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

/* === Tags === */
.tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

/* === Focus Visible (accessibility) === */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* === Scrollspy Active Nav === */
.sidebar nav a.active-nav {
  background: rgba(94,106,210,0.12);
  color: var(--accent-text);
  position: relative;
}
.sidebar nav a.active-nav::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 16px;
  background: var(--accent-text);
  border-radius: 0 2px 2px 0;
}

/* === Code Copy Button === */
.code-header {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 4px;
  margin-top: -8px;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.12s;
}
.copy-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.copy-btn.copied { color: var(--success); }

/* === Module Accordion === */
.module-collapsible { cursor: pointer; }
.module-collapsible .module-header::after {
  content: '▾';
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.module-collapsible.collapsed .module-header::after { transform: rotate(-90deg); }
.module-collapsible.collapsed > :not(.module-header) { display: none; }

/* === Search === */
.search-container {
  padding: 8px 14px;
  position: relative;
}
.search-container input {
  width: 100%;
  padding: 8px 10px 8px 28px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.12s;
}
.search-container input:focus { border-color: var(--accent); }
.search-container input::placeholder { color: var(--text-dim); }
.search-container::before {
  content: '⌕';
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}
.search-hint {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
  padding-right: 2px;
}

/* === Keyboard Shortcut Hint === */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-dim);
}
.kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--text-muted);
}

/* === Smooth anchor scroll offset === */
html { scroll-padding-top: 24px; }
.section-divider { height: 1px; background: var(--border-subtle); margin: 40px 0; }

/* === Compare Grid (with/without harness) === */
.compare-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin: 20px 0;
}
.compare-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
}
.compare-col h4 { margin: 0 0 10px; font-size: 14px; }
.compare-col ul { margin: 0 0 0 16px; }
.compare-col li { font-size: 14px; }
.compare-col.without { border-left: 2px solid rgba(239,68,68,0.3); }
.compare-col.without h4 { color: var(--danger); }
.compare-col.with { border-left: 2px solid rgba(39,166,68,0.3); }
.compare-col.with h4 { color: var(--success); }

/* === Checklist === */
.checklist { list-style: none; margin: 0 0 20px; }
.checklist li {
  display: flex; align-items: flex-start;
  gap: 10px; padding: 6px 0; margin: 0;
  font-size: 14px; color: var(--text-secondary);
}
.checklist li::before { content: "☐"; font-size: 14px; color: var(--text-dim); flex-shrink: 0; }
.checklist li.done::before { content: "☑"; color: var(--success); }
.checklist li.done { color: var(--text-muted); }

/* === Timeline === */
.timeline { margin: 20px 0; }
.timeline-item {
  display: flex; gap: 14px;
  padding: 0 0 20px; position: relative;
}
.timeline-item::before {
  content: ""; position: absolute;
  left: 7px; top: 22px; bottom: 0;
  width: 1px; background: var(--border-subtle);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  margin-top: 4px;
}
.timeline-body h4 { margin: 0 0 2px; font-size: 15px; }
.timeline-body p { font-size: 14px; margin: 0; color: var(--text-muted); }

/* === Gotchas === */
.gotcha-list { margin: 20px 0; }
.gotcha-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid rgba(234,179,8,0.4);
  border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 8px;
}
.gotcha-item .gotcha-num { font-weight: 500; color: var(--warning); margin-right: 4px; }
.gotcha-item .gotcha-title { font-weight: 500; color: var(--text-primary); }
.gotcha-item .gotcha-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* === Course Module === */
.module {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px; margin-bottom: 12px;
  transition: border-color 0.15s;
}
.module:hover { border-color: var(--border); }
.module .module-header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.module .module-num {
  width: 36px; height: 36px;
  background: rgba(94,106,210,0.12);
  color: var(--accent-text);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 14px; flex-shrink: 0;
}
.module h3 { margin: 0; font-size: 16px; }
.module p { font-size: 14px; }
.module .module-topics { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.module .module-topics .tag { background: rgba(94,106,210,0.08); color: var(--accent-text); border-color: transparent; }
.module ul ul { margin: 4px 0 4px 20px; }

/* === Table (minimal, no borders) === */
table { width: 100%; margin: 20px 0; border-collapse: collapse; }
thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 500; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
tbody td { font-size: 14px; color: var(--text-secondary); padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); }
tbody tr:last-child td { border-bottom: none; }

/* === Footer === */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 48px;
  text-align: center;
  font-size: 13px; color: var(--text-dim);
  margin-top: auto;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent-text); }

/* === Responsive === */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .hamburger { display: block; }
  .main { margin-left: 0; }
  .content { padding: 28px 20px; }
  .page-header { padding: 28px 20px; }
  .hero { padding: 56px 20px 36px; }
  .hero h1 { font-size: 28px; }
  .stats-row { padding: 20px; }
}

@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .subsystem-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 15px; }
  .content { padding: 20px 16px; }
  .page-header { padding: 20px 16px; }
  .hero { padding: 40px 16px 28px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .stats-row { padding: 16px; gap: 12px; }
  .stat { padding: 0 12px; }
  .footer { padding: 20px; }
  table { font-size: 13px; }
  thead th, tbody td { padding: 6px 8px; }
}

/* === Language Toggle === */
.lang-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

.lang-toggle button {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 4px 8px;
  transition: all 0.12s ease;
}

.lang-toggle button:hover {
  color: var(--text-primary);
}

.lang-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.lang-toggle button.active:hover {
  background: var(--accent-hover);
}
