/* OnlyLessons design system.
   One source of truth for color, type, surfaces, and the sidebar shell.
   Pages should style their own content only — never the shell, never layout
   margins. Replaces navbar.css, stylesbeta.css, and per-page inline shells. */

:root {
  --bg: #06080d;
  --surface: rgba(10, 14, 23, 0.72);
  --surface-raised: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(125, 211, 252, 0.08);
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.3);

  --text: #e8f2ff;
  --text-dim: rgba(226, 232, 240, 0.66);
  --text-faint: rgba(226, 232, 240, 0.42);

  --sky: #7dd3fc;
  --teal: #2dd4bf;
  --violet: #a78bfa;
  --danger: #f87171;
  --accent: linear-gradient(135deg, var(--sky), var(--teal));

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --rail: 76px;
  --rail-open: 240px;
  --gap: 16px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

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

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -8%, rgba(125, 211, 252, 0.1), transparent 60%),
    radial-gradient(900px 500px at 92% 8%, rgba(45, 212, 191, 0.08), transparent 55%),
    radial-gradient(700px 500px at 60% 100%, rgba(167, 139, 250, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: rgba(125, 211, 252, 0.28); }

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Ambient particle field, owned by js/particles.js. Sits behind everything;
   body's background propagates to the viewport canvas, so it still shows. */
#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Shell ────────────────────────────────────────────────── */
/* The sidebar is fixed; the stage owns its own margin. Nothing else may
   set margins on the stage — that was the old ads.js !important bug. */

.ol-stage {
  margin-left: var(--rail);
  padding: 28px clamp(16px, 3vw, 32px) 96px;
  transition: margin-left 0.18s ease;
}
body.rail-open .ol-stage { margin-left: var(--rail-open); }

.ol-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--rail);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(8, 11, 18, 0.86);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: width 0.18s ease;
  overflow: hidden;
}
body.rail-open .ol-sidebar { width: var(--rail-open); }

.ol-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 6px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
}
.ol-brand img { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.ol-brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ol-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}
.ol-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.ol-link:hover { background: var(--surface-hover); color: var(--text); }

.ol-link.active { color: #061019; font-weight: 600; }
.ol-link.active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  z-index: -1;
}
.ol-link.active svg { color: #061019; }

/* Labels collapse to zero width on the rail, so icons stay centred. */
.ol-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.16s ease, max-width 0.18s ease;
}
body.rail-open .ol-label { opacity: 1; max-width: 150px; }

.ol-spacer { flex: 1; min-height: 12px; }

.ol-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.ol-toggle:hover { background: var(--surface-hover); color: var(--text); }
/* Chevron points the way the click goes: right to expand, left to collapse. */
.ol-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transform: rotate(180deg);
  transition: transform 0.18s ease;
}
body.rail-open .ol-toggle svg { transform: rotate(0deg); }

/* ── Surfaces ─────────────────────────────────────────────── */

.ol-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.ol-panel-pad { padding: clamp(16px, 2.4vw, 24px); }

.ol-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.ol-h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.04; letter-spacing: -0.03em; }
.ol-h2 { font-size: 18px; letter-spacing: -0.01em; }
.ol-sub { color: var(--text-dim); font-size: 14px; line-height: 1.6; }

/* ── Controls ─────────────────────────────────────────────── */

.ol-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
.ol-btn:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.ol-btn:active { transform: translateY(1px); }
.ol-btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #061019;
  font-weight: 600;
}
.ol-btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.ol-btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); }
.ol-btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; }

.ol-input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.ol-input::placeholder { color: var(--text-faint); }
.ol-input:focus { border-color: rgba(125, 211, 252, 0.5); background: rgba(0, 0, 0, 0.4); }

/* ── Legal links, home only ───────────────────────────────── */

.ol-legal {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  gap: 8px;
}
.ol-legal a {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(14px);
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.ol-legal a:hover { color: var(--text); border-color: var(--line-strong); }

/* ── Responsive: rail becomes a bottom bar ────────────────── */

@media (max-width: 820px) {
  .ol-sidebar {
    inset: auto 0 0 0;
    width: 100% !important;
    height: 62px;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .ol-brand, .ol-spacer, .ol-toggle { display: none; }
  .ol-link { flex: 1; justify-content: center; padding: 0; min-height: 46px; }
  .ol-label { display: none; }
  .ol-stage, body.rail-open .ol-stage { margin-left: 0; padding-bottom: 86px; }
  .ol-legal { bottom: 72px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
