/* ================================================================
   AXIOM-STEM — Left sidebar drawer, edge-peek launcher, theme toggle
   Shared across all pages. Load after colors.css/base.css.
   ================================================================ */

/* ── Backdrop ────────────────────────────────────────────────── */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 298;
  background: rgba(10,12,14,0.6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity 280ms var(--ease-out), visibility 280ms var(--ease-out);
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }

/* ── Panel ───────────────────────────────────────────────────── */
.axiom-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 299;
  width: 340px; max-width: 88vw;
  background: #142B40;
  border-right: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 320ms var(--ease-out), background 220ms var(--ease-out);
  overflow-y: auto;
}
.axiom-sidebar.open { transform: translateX(0); }

.axiom-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.axiom-sidebar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.axiom-sidebar-brand img { height: 30px; width: auto; display: block; flex-shrink: 0; }
.axiom-sidebar-close {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border-default);
  color: var(--text-secondary); cursor: pointer;
  transition: background 200ms, color 200ms, border-color 200ms, box-shadow 200ms;
}
.axiom-sidebar-close:hover {
  color: var(--color-precision-gold);
  background: rgba(216,247,68,0.14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-color: rgba(216,247,68,0.4);
  box-shadow: 0 0 14px rgba(216,247,68,0.35), inset 0 1px 0 rgba(216,247,68,0.15);
}

.axiom-sidebar-body { padding: 22px 20px 28px; flex: 1; }

.axiom-sidebar-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}

.axiom-sidebar-links { display: flex; flex-direction: column; gap: 2px; }
.axiom-sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 6px;
  font-family: var(--font-sans); font-weight: 600; font-size: 13.5px;
  color: var(--text-secondary); text-decoration: none;
  background: none; border: 1px solid transparent; width: 100%; text-align: left; cursor: pointer; font: inherit;
  transition: background 200ms, color 200ms, border-color 200ms, box-shadow 200ms;
}
.axiom-sidebar-link.active { color: var(--color-precision-gold); background: rgba(216,247,68,0.08); }
.axiom-sidebar-link:hover {
  color: var(--color-precision-gold);
  background: rgba(216,247,68,0.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-color: rgba(216,247,68,0.35);
  box-shadow: 0 0 16px rgba(216,247,68,0.35), inset 0 1px 0 rgba(216,247,68,0.15);
}
.axiom-sidebar-link-icon {
  width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(74,127,168,0.12); color: var(--color-circuit-blue);
  transition: background 200ms, box-shadow 200ms;
}
.axiom-sidebar-link-icon svg { width: 13px; height: 13px; }
.axiom-sidebar-link:hover .axiom-sidebar-link-icon {
  background: rgba(216,247,68,0.18);
  box-shadow: 0 0 10px rgba(216,247,68,0.35);
}
.axiom-sidebar-link-chevron { margin-left: auto; flex-shrink: 0; transition: transform 200ms var(--ease-out); color: var(--text-muted); }
.axiom-sidebar-link.expandable[aria-expanded="true"] .axiom-sidebar-link-chevron { transform: rotate(180deg); }

.axiom-sidebar-submenu {
  max-height: 0; overflow: hidden;
  transition: max-height 280ms var(--ease-out);
  display: flex; flex-direction: column; padding-left: 42px;
}
.axiom-sidebar-submenu.open { max-height: 320px; }
.axiom-sidebar-sublink {
  display: block; padding: 7px 9px; border-radius: 5px;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted); text-decoration: none;
  border: 1px solid transparent;
  transition: background 200ms, color 200ms, border-color 200ms, box-shadow 200ms;
}
.axiom-sidebar-sublink:hover {
  color: var(--color-precision-gold);
  background: rgba(216,247,68,0.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-color: rgba(216,247,68,0.3);
  box-shadow: 0 0 12px rgba(216,247,68,0.3), inset 0 1px 0 rgba(216,247,68,0.12);
}

.axiom-sidebar-divider { height: 1px; background: var(--border-subtle); margin: 22px 0; }

.axiom-sidebar-connect { display: flex; flex-direction: column; gap: 2px; }
.axiom-sidebar-connect-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 6px; text-decoration: none;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 200ms, color 200ms, border-color 200ms, box-shadow 200ms;
}
.axiom-sidebar-connect-item:hover {
  color: var(--color-precision-gold);
  background: rgba(216,247,68,0.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-color: rgba(216,247,68,0.35);
  box-shadow: 0 0 16px rgba(216,247,68,0.35), inset 0 1px 0 rgba(216,247,68,0.15);
}
.axiom-sidebar-connect-icon {
  width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(216,247,68,0.1); color: var(--color-precision-gold);
  transition: background 200ms, box-shadow 200ms;
}
.axiom-sidebar-connect-icon svg { width: 13px; height: 13px; }
.axiom-sidebar-connect-item:hover .axiom-sidebar-connect-icon {
  background: rgba(216,247,68,0.22);
  box-shadow: 0 0 10px rgba(216,247,68,0.4);
}

.axiom-sidebar-cta { margin-top: 22px; }
.axiom-sidebar-cta .btn {
  width: 100%; justify-content: center;
  padding: 9px 18px; font-size: 13px;
  transition: box-shadow 200ms var(--ease-out), background 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.axiom-sidebar-cta .btn:hover { box-shadow: 0 0 20px rgba(216,247,68,0.55), 0 0 48px rgba(216,247,68,0.3); transform: translateY(-1px); }

.axiom-sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border-subtle); flex-shrink: 0;
}
.theme-toggle-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.theme-toggle-row svg { color: var(--text-muted); flex-shrink: 0; transition: color 200ms; }
.theme-toggle-row svg.is-active { color: var(--color-precision-gold); }

.theme-toggle {
  position: relative; width: 46px; height: 26px; border-radius: 999px;
  background: var(--color-circuit-blue); border: 1px solid rgba(0,0,0,0.2);
  cursor: pointer; flex-shrink: 0; padding: 0;
  transition: background 220ms var(--ease-out);
}
.theme-toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-precision-gold);
  box-shadow: 0 0 8px rgba(216,247,68,0.5);
  transition: transform 220ms var(--ease-out);
}

/* ── Sidebar-only toggle theme ──────────────────────────────────
   Scoped to the sidebar panel itself via [data-theme] on
   #axiom-sidebar. Nothing outside this element is affected —
   the rest of the site stays on the fixed dark theme.
   Sun side (default, above) = blue panel. Moon side (below) =
   black panel. Text/borders stay the same light tones in both,
   since neither state is a light/white background. ──────────── */
.axiom-sidebar[data-theme="light"] { background: #000000; }
.axiom-sidebar[data-theme="light"] .theme-toggle { background: #000000; border-color: rgba(0,0,0,0.5); }
.axiom-sidebar[data-theme="light"] .theme-toggle-thumb { transform: translateX(20px); }

/* ── Edge-peek launcher tab ─────────────────────────────────── */
.sidebar-edge-tab {
  position: fixed; left: 0; top: 50%; z-index: 210;
  transform: translate(-26px, -50%);
  width: 40px; height: 64px;
  background: var(--color-steel);
  border: 1px solid var(--border-default);
  border-left: none;
  border-radius: 0 10px 10px 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 260ms var(--ease-out), background 200ms var(--ease-out), box-shadow 260ms var(--ease-out);
}
.sidebar-edge-tab svg:not(.edge-tab-ring) { color: var(--color-precision-gold); flex-shrink: 0; margin-left: 8px; transition: margin 200ms var(--ease-out); }
.sidebar-edge-tab:hover,
.sidebar-edge-tab:focus-visible {
  transform: translate(0, -50%);
  box-shadow: var(--glow-gold-sm), var(--shadow-md);
}
.sidebar-edge-tab:hover svg:not(.edge-tab-ring),
.sidebar-edge-tab:focus-visible svg:not(.edge-tab-ring) { margin-left: 0; }
.sidebar-edge-tab.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
/* A short glowing segment traces the tab's own outline — same technique
   as the nav-burger and marquee-box traces — so it reads as "tap me". */
.edge-tab-ring {
  position: absolute; inset: -1px; z-index: 1;
  pointer-events: none; overflow: visible;
}
.edge-tab-ring rect {
  fill: none;
  stroke: var(--color-precision-gold);
  stroke-width: 1.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2.5px rgba(216,247,68,0.85));
}

@media (max-width: 480px) {
  .axiom-sidebar { width: 300px; }
  .sidebar-edge-tab { width: 32px; height: 56px; }
}
