/* OASIS Learn — shared styles */

:root {
  --bg: #08101e;
  --surface: #0f1a2e;
  --surface-2: #162035;
  --surface-3: #1a2840;
  --border: #1e3050;
  --accent: #00d4ff;
  --accent-dim: #0099bb;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --purple: #7c3aed;
  --purple-dim: #5b21b6;
  --text: #e2e8f0;
  --text-dim: #a8bfd8;
  --text-muted: #64748b;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --sidebar-w: 268px;
  --rail-w: 200px;
  --content-max: 800px;
  --radius: 8px;
  --font-mono: 'Share Tech Mono', 'Fira Code', 'Consolas', monospace;
  --font-body: 'Titillium Web', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Orbitron', 'Titillium Web', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: #33ddff; }

/* ─── LAYOUT ─────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--rail-w);
  grid-template-areas: "sidebar main rail";
  min-height: 100vh;
}

.layout-no-rail {
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "sidebar main";
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */

.sidebar {
  grid-area: sidebar;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo:hover { text-decoration: none; }
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  color: #fff;
  font-family: var(--font-heading);
  flex-shrink: 0;
}
.sidebar-logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo-text .site-name {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  line-height: 1.2;
}
.sidebar-logo-text .site-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section-title {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}
.nav-item .step-num {
  width: 20px; height: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
}
.nav-item.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.nav-item.completed .step-num {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
}
.sidebar-footer a:hover { color: var(--text-dim); }

/* ─── MAIN CONTENT ────────────────────────────────────────── */

.main {
  grid-area: main;
  margin-left: var(--sidebar-w);
  margin-right: var(--rail-w);
  padding: 0 40px 80px 48px;
  max-width: calc(var(--sidebar-w) + var(--content-max) + 80px);
}

.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text-dim); }
.breadcrumb-sep { opacity: 0.5; }

.page-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-beginner { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-intermediate { background: rgba(245,158,11,0.15); color: var(--orange); border: 1px solid rgba(245,158,11,0.3); }
.badge-advanced { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.badge-time { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }

h1.page-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.page-desc {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 640px;
  line-height: 1.65;
}

/* ─── TYPOGRAPHY ──────────────────────────────────────────── */

h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 20px;
}

h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 10px;
  scroll-margin-top: 20px;
}

h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p { margin-bottom: 16px; color: var(--text-dim); }

ul, ol {
  padding-left: 24px;
  margin-bottom: 16px;
  color: var(--text-dim);
}
li { margin-bottom: 6px; }
li::marker { color: var(--accent); }

strong { color: var(--text); font-weight: 700; }

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}

/* ─── CODE BLOCKS ─────────────────────────────────────────── */

.code-block {
  position: relative;
  margin: 20px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.copy-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.copy-btn:hover { background: var(--surface-3); color: var(--text-dim); border-color: var(--accent); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.code-block pre {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: #c9d8f0;
}

/* Simple token colouring */
.code-block pre .kw  { color: #7c3aed; }   /* keywords */
.code-block pre .fn  { color: #00d4ff; }   /* functions */
.code-block pre .str { color: #10b981; }   /* strings */
.code-block pre .cmt { color: #4a6080; font-style: italic; } /* comments */
.code-block pre .num { color: #f59e0b; }   /* numbers */
.code-block pre .cls { color: #e879f9; }   /* classes */
.code-block pre .prp { color: #a8bfd8; }   /* properties */

/* Filename header variant */
.code-filename {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.code-filename::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--surface-2);
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* Terminal block variant */
.terminal-block .code-block-header { background: #0a0a0a; border-color: #1a1a1a; }
.terminal-block pre { background: #0a0a0a; color: #a8d8a8; }
.terminal-block .code-lang { color: #555; }
.terminal-block pre .prompt { color: #555; }
.terminal-block pre .cmd { color: #7ec8e3; }
.terminal-block pre .out { color: #a8d8a8; }

/* ─── STEP SYSTEM ─────────────────────────────────────────── */

.step {
  display: flex;
  gap: 20px;
  margin: 32px 0;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.step-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin-top: 4px;
}

.step-content { flex: 1; padding-top: 6px; }
.step-content h3 { margin-top: 0; }

/* ─── CALLOUTS ────────────────────────────────────────────── */

.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 24px 0;
  border-left: 3px solid;
  display: flex;
  gap: 12px;
}
.callout-icon { font-size: 18px; flex-shrink: 0; line-height: 1.5; }
.callout-body { flex: 1; }
.callout-body p:last-child { margin-bottom: 0; }

.callout-note { background: rgba(0,212,255,0.06); border-color: var(--accent); }
.callout-note .callout-title { color: var(--accent); font-weight: 700; font-size: 13px; margin-bottom: 6px; }

.callout-tip { background: rgba(16,185,129,0.06); border-color: var(--green); }
.callout-tip .callout-title { color: var(--green); font-weight: 700; font-size: 13px; margin-bottom: 6px; }

.callout-warning { background: rgba(245,158,11,0.06); border-color: var(--orange); }
.callout-warning .callout-title { color: var(--orange); font-weight: 700; font-size: 13px; margin-bottom: 6px; }

.callout-usecase { background: rgba(124,58,237,0.08); border-color: var(--purple); }
.callout-usecase .callout-title { color: #a78bfa; font-weight: 700; font-size: 13px; margin-bottom: 6px; }

/* ─── API REFERENCE TABLE ─────────────────────────────────── */

.api-table-wrap { overflow-x: auto; margin: 20px 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--surface-2);
  color: var(--text-dim);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: top;
}

tbody tr:hover { background: var(--surface-2); }

td code { font-size: 12px; }

/* ─── MODULE CARD (INDEX PAGE) ────────────────────────────── */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.module-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  text-decoration: none;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity 0.2s;
}
.module-card:hover::before { opacity: 1; }

.module-num {
  font-family: var(--font-heading);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.module-card h3 {
  font-size: 15px;
  color: #fff;
  margin: 0 0 8px;
  font-weight: 700;
}
.module-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 14px;
  line-height: 1.5;
}
.module-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ─── PREV / NEXT NAVIGATION ──────────────────────────────── */

.tutorial-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.tutorial-nav a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  transition: border-color 0.15s;
  display: block;
}
.tutorial-nav a:hover { border-color: var(--accent); text-decoration: none; }
.tutorial-nav .nav-direction { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.tutorial-nav .nav-title { font-size: 14px; font-weight: 600; color: var(--text); }
.tutorial-nav .next { text-align: right; }

/* ─── ON-PAGE RAIL ────────────────────────────────────────── */

.rail {
  grid-area: rail;
  position: fixed;
  top: 0;
  right: 0;
  width: var(--rail-w);
  height: 100vh;
  overflow-y: auto;
  padding: 40px 16px 40px 8px;
}

.rail-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 8px;
}

.rail-nav a {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-left: 2px solid var(--border);
  text-decoration: none;
  transition: all 0.15s;
}
.rail-nav a:hover { color: var(--text-dim); border-color: var(--accent); }
.rail-nav a.active { color: var(--accent); border-color: var(--accent); }

/* ─── QUICKSTART BANNER ───────────────────────────────────── */

.qs-banner {
  background: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(124,58,237,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 40px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.qs-banner-icon { font-size: 32px; flex-shrink: 0; }
.qs-banner h2 { margin: 0 0 8px; border: none; font-size: 17px; }
.qs-banner p { margin: 0; font-size: 14px; }

/* ─── PREREQS BOX ─────────────────────────────────────────── */

.prereqs {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.prereqs h4 { margin-top: 0; }
.prereqs ul { margin-bottom: 0; }

/* ─── WHAT YOU'LL BUILD ───────────────────────────────────── */

.build-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 32px 0;
}
.build-summary h4 { margin-top: 0; color: var(--green); }
.build-summary ul { margin-bottom: 0; }

/* ─── INLINE COMMAND ──────────────────────────────────────── */

.cmd-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

/* ─── METHODS LIST ────────────────────────────────────────── */

.method-list { list-style: none; padding: 0; }
.method-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.method-list li:last-child { border-bottom: none; }
.method-name { font-family: var(--font-mono); color: var(--accent); font-size: 13px; white-space: nowrap; }
.method-desc { color: var(--text-dim); }

/* ─── PROGRESS BAR ────────────────────────────────────────── */

.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 2px;
  height: 3px;
  margin-bottom: 32px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 2px;
  transition: width 0.3s;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 1100px) {
  .rail { display: none; }
  .layout { grid-template-columns: var(--sidebar-w) 1fr; grid-template-areas: "sidebar main"; }
}

@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 0 16px 60px; }
  .page-header { padding: 20px 0 20px; }
  h1.page-title { font-size: 22px; }
  .module-grid { grid-template-columns: 1fr; }
  .tutorial-nav { grid-template-columns: 1fr; }
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 200;
    width: 38px; height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 18px;
  }
}

@media (min-width: 781px) {
  .mobile-menu-btn { display: none; }
}
