/* ═══════════════════════════════════════════════════════════════
   Line Sidebar — section nav (main page only, left edge)
   Layout is FIXED: only transform/opacity are animated (from JS),
   so hovering never resizes or re-centres the list.
   ═══════════════════════════════════════════════════════════════ */

.line-sidebar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;                    /* above page effects, below navbar (1000) */
  padding: 0.85rem 0.9rem 0.85rem 0.9rem;
  pointer-events: none;            /* never blocks the page */
  --ls-accent: var(--accent, #c4a0d0);
  --ls-text: color-mix(in srgb, var(--text, #e8e3f0) 82%, var(--text-muted, #8b85a1));   /* brighter than plain muted */
  --ls-text-active: var(--text, #e8e3f0);
  --ls-marker: var(--text-faint, #504a63);
}

/* Roomy screens: the pill is a glass pane (see /glass-surface.js): a clear,
   mirror-like surface that refracts what is behind it on Chromium and falls
   back to frosted glass elsewhere. A low tint keeps it see-through; the label
   halo below keeps the text legible over any effect. */
.line-sidebar:not(.is-compact) {
  --glass-tint: 2%;                /* enough page colour behind the text to read it */
  --glass-sat: 1.15;
  --glass-bright: 1;
  --glass-sheen: 0.05;              /* softer reflection streak */
  border-radius: 0 16px 16px 0;
}

/* Chromium (Helium, Chrome, Edge…): keep the refracted edge, but blur what
   is behind the pane so the ascii-water glyphs are not mirrored sharply
   underneath the labels. */
.line-sidebar:not(.is-compact).nu-glass--svg {
  -webkit-backdrop-filter: var(--glass-filter) blur(10px) saturate(var(--glass-sat)) brightness(var(--glass-bright));
  backdrop-filter: var(--glass-filter) blur(10px) saturate(var(--glass-sat)) brightness(var(--glass-bright));
}
/* Firefox / Safari: frosted fallback, stronger blur */
.line-sidebar:not(.is-compact).nu-glass--fallback {
  --glass-blur: 16px;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
}
/* no backdrop-filter support at all: near-opaque so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .line-sidebar:not(.is-compact).nu-glass { background: color-mix(in srgb, var(--bg, #16141d) 88%, transparent); }
}

/* Compact = markers only: strip the glass (the host element carries its paint) */
.line-sidebar.is-compact.nu-glass {
  background: none;
  border-color: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.line-sidebar.is-compact .nu-glass__filter,
.line-sidebar.is-compact .nu-glass__sheen,
.line-sidebar.is-compact .nu-glass__rim { display: none; }

/* Slide away / back (transform only, so the glass keeps its backdrop) */
.line-sidebar {
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}
.line-sidebar.is-hidden {
  transform: translate(-112%, -50%);
  visibility: hidden;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.55s;
}
.line-sidebar.no-anim,
.line-sidebar.no-anim.is-hidden { transition: none; }

/* Sling button that collapses / restores the sidebar */
.line-sidebar-toggle {
  position: fixed;
  left: 14px;
  top: 50%;
  z-index: 201;
  padding: 0;
}
.line-sidebar:not(.is-compact) ~ .line-sidebar-toggle { left: 14px; }
.line-sidebar.is-compact ~ .line-sidebar-toggle { left: 8px; }

.line-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;                       /* enough room for the enlarged active label */
}

.line-sidebar__item {
  height: 24px;                    /* fixed row height — never changes */
  display: block;
}

.line-sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding-right: 14px;             /* slightly larger click target */
  pointer-events: auto;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* Fixed-width slot so the marker growing never pushes the label */
.line-sidebar__slot {
  flex: none;
  width: 30px;
  display: flex;
  align-items: center;
}

.line-sidebar__marker {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ls-text) 85%, transparent);
  transform-origin: left center;
  transform: scaleX(0.3);
  opacity: 0.35;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  will-change: transform, opacity;
}

.line-sidebar__label {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  white-space: nowrap;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;               /* constant: size change is done with scale() */
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ls-text);
  /* halo in the page colour keeps text crisp over busy backgrounds */
  text-shadow: 0 0 8px var(--bg, #16141d), 0 0 3px var(--bg, #16141d), 0 1px 1px var(--bg, #16141d);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transform-origin: left center;
  transform: scale(0.88);
  opacity: 0.42;
  transition: color 0.3s ease;
  will-change: transform, opacity;
}

.line-sidebar__index {
  font-size: 0.72em;
  opacity: 0.65;
  min-width: 1.4em;
}

/* Active section: accent marker + bright label (size handled in JS) */
.line-sidebar__item.is-active .line-sidebar__marker {
  background: var(--ls-accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ls-accent) 55%, transparent);
}
.line-sidebar__item.is-active .line-sidebar__label {
  color: var(--ls-text-active);
  font-weight: 600;
}

.line-sidebar__link:hover .line-sidebar__label,
.line-sidebar__link:focus-visible .line-sidebar__label {
  color: var(--ls-text-active);
}
.line-sidebar__link:focus-visible .line-sidebar__marker {
  background: var(--ls-accent);
}

/* Compact mode (set by JS below ~1500px wide): the page content starts close
   to the left edge here, so only the line markers stay visible — the active
   label and the labels near the cursor appear on top of them. The label's
   invisible area never blocks clicks on the page. */
.line-sidebar.is-compact {
  padding-left: 0.6rem;
}
.line-sidebar.is-compact .line-sidebar__link {
  width: 44px;
  padding-right: 0;
}
.line-sidebar.is-compact .line-sidebar__marker {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg, #16141d) 70%, transparent);
}

/* Hide on narrow screens — the mobile menu covers navigation */
@media (max-width: 1000px) {
  .line-sidebar,
  .line-sidebar-toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .line-sidebar,
  .line-sidebar__marker,
  .line-sidebar__label { transition: none; }
}
