/* ============================================================
   VEX Push Back – Tutorial Website Styles
   ============================================================ */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --accent: #c1121f;       /* VEX red */
  --accent2: #e63946;
  --gold: #f4a261;
  --text: #e8eaf0;
  --text-muted: #8b90a7;
  --code-bg: #0d1117;
  --border: #2d3148;
  --sidebar-w: 260px;
  --radius: 8px;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  --font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 2.4rem; margin-bottom: .5rem; }
h2 { font-size: 1.7rem; margin: 2.5rem 0 .75rem; color: var(--accent2); }
h3 { font-size: 1.25rem; margin: 2rem 0 .5rem; color: var(--gold); }
h4 { font-size: 1.05rem; margin: 1.5rem 0 .4rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
p  { margin-bottom: 1rem; }
a  { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: .3rem; }
strong { color: #fff; }
em { color: var(--gold); font-style: italic; }

/* ── Layout ── */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.sidebar-logo .logo-badge {
  background: var(--accent);
  color: #fff;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
}

.sidebar nav { padding: 1rem 0; flex: 1; }

.nav-section-label {
  padding: .3rem 1.25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-top: .75rem;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1.25rem;
  color: var(--text-muted);
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all .15s;
  text-decoration: none;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text);
  background: var(--surface2);
  border-left-color: var(--accent);
}
.sidebar nav a .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }

/* ── Main content ── */
.main {
  flex: 1;
  max-width: 900px;
  padding: 3rem 2.5rem;
}

.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-header .tag {
  display: inline-block;
  background: var(--surface2);
  color: var(--accent2);
  border: 1px solid var(--accent);
  padding: .15rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}
.page-header p.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 0;
}

/* ── Code blocks ── */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-family: var(--font-mono);
  font-size: .83rem;
  line-height: 1.65;
  position: relative;
}
pre .filename {
  position: absolute;
  top: .5rem;
  right: .75rem;
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: .1rem .5rem;
  border-radius: 4px;
}
code { font-family: var(--font-mono); font-size: .85em; }
p code, li code {
  background: var(--surface2);
  padding: .1em .4em;
  border-radius: 4px;
  color: var(--gold);
}

/* Syntax highlight colors (manual) */
.kw  { color: #c792ea; }   /* keywords */
.ty  { color: #82aaff; }   /* types */
.fn  { color: #82b1ff; }   /* function names */
.cm  { color: #546e7a; font-style: italic; } /* comments */
.st  { color: #c3e88d; }   /* strings */
.nu  { color: #f78c6c; }   /* numbers */
.op  { color: #89ddff; }   /* operators */
.pp  { color: #f07178; }   /* preprocessor */

/* ── Callout boxes ── */
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
  display: flex;
  gap: .75rem;
}
.callout-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: .1rem; }
.callout-body { flex: 1; }
.callout-body > *:last-child { margin-bottom: 0; }
.callout.info    { background: #0d1b2a; border-color: #3a8fd1; }
.callout.tip     { background: #0d1f17; border-color: #2d9e5f; }
.callout.warning { background: #1f1800; border-color: #e2a020; }
.callout.danger  { background: #1f0b0b; border-color: var(--accent); }

/* ── Cards ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color .15s, transform .15s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.card h3 { margin: 0 0 .3rem; color: var(--text); font-size: 1rem; }
.card p  { margin: 0; font-size: .85rem; color: var(--text-muted); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .88rem; }
th { background: var(--surface2); text-align: left; padding: .6rem .9rem; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); }
td { padding: .55rem .9rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

/* ── Math / formula display ── */
.formula {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: .95rem;
  color: var(--gold);
  margin: 1rem 0 1.5rem;
  text-align: center;
}

/* ── Diagram ── */
.diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: #90caf9;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  white-space: pre;
  line-height: 1.6;
}

/* ── Step list ── */
.steps { list-style: none; padding: 0; counter-reset: step; margin: 1rem 0 1.5rem; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.steps li::before {
  content: counter(step);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .15rem;
}

/* ── Page nav (prev/next) ── */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}
.page-nav a {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.2rem;
  max-width: 240px;
  flex: 1;
  text-decoration: none;
  transition: border-color .15s;
}
.page-nav a:hover { border-color: var(--accent); text-decoration: none; }
.page-nav a.next { text-align: right; margin-left: auto; }
.page-nav .nav-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.page-nav .nav-title { color: var(--text); font-weight: 600; font-size: .95rem; }

/* ── Hero (index page) ── */
.hero {
  background: linear-gradient(135deg, #1a0a0b 0%, var(--surface) 60%, #1a1f35 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(193,18,31,.25) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 { font-size: 2.8rem; margin-bottom: .75rem; }
.hero h1 span { color: var(--accent2); }
.hero .lead { font-size: 1.15rem; color: var(--text-muted); max-width: 600px; margin-bottom: 1.75rem; }
.btn {
  display: inline-block;
  padding: .65rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4268; }

/* ── Mobile ── */
.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 99;
    transform: translateX(-100%);
    transition: transform .25s;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 4rem 1.25rem 2rem; }
  h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2rem; }
}

/* ── Annotation list (for distance reset walkthrough) ── */
.annotated-code { margin: 1rem 0 1.5rem; }
.annotated-code pre { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.annotation-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: .75rem 1rem;
  list-style: none;
}
.annotation-list li {
  padding: .35rem 0;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: .75rem;
}
.annotation-list li:last-child { border-bottom: none; }
.annotation-list .ann-marker {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 3px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  margin-top: .1rem;
}
