/* SandOS — theme switcher, nav reorder edit mode, animated background. */

/* ── Animated background canvas ─────────────────────────────────────────── */
#anim-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Base opacity — JS overrides per context via canvas.style.opacity */
  opacity: .38;
  transition: opacity var(--dur-slow) var(--ease);
}
/* Dashboard: pull back so it doesn't compete with content */
.app #anim-bg { opacity: .10; }

/* Light theme */
[data-theme="light"] #anim-bg    { opacity: .22; }
[data-theme="light"] .app #anim-bg { opacity: .08; }

/* Auth card must sit above the canvas (z-index:0 positioned element) */
.auth__card {
  position: relative;
  z-index: 1;
}

/* ── Sidebar edit mode ───────────────────────────────────────────────────── */

/* Drag handle — always in the DOM, hidden by default */
.nav-drag-handle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  cursor: grab;
  touch-action: none;   /* prevents scroll hijack on mobile while dragging */
  user-select: none;
  -webkit-user-select: none;
}
.sidebar--edit .nav-drag-handle {
  display: flex;
}
.nav-drag-handle:active { cursor: grabbing; }

/* Prevent iOS from treating touches inside the sidebar as scroll gestures
   so our touchmove listener can call preventDefault() reliably. */
.sidebar--edit {
  touch-action: none;
}

.sidebar--edit .nav-item {
  border: 1px dashed var(--border);   /* always visible, not just on :hover */
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.sidebar--edit .nav-item:hover {
  border-color: var(--accent);
}
.nav-item--dragging {
  opacity: .45;
}
.nav-drop-indicator {
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 2px var(--s3);
  box-shadow: 0 0 6px var(--accent);
  pointer-events: none;
}

/* Edit mode toggle button */
.btn-edit-nav {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-edit-nav:hover { color: var(--text-muted); background: var(--surface-2); }
.btn-edit-nav.is-active { color: var(--accent); }

/* ── Theme picker swatches ───────────────────────────────────────────────── */
.theme-grid {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--s2);
  border-radius: var(--radius);
  transition: background var(--dur) var(--ease);
}
.theme-swatch:hover { background: var(--surface-2); }
.theme-swatch__preview {
  width: 64px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  overflow: hidden;
  display: grid;
  grid-template-columns: 28px 1fr;
  transition: border-color var(--dur) var(--ease);
}
.theme-swatch.is-active .theme-swatch__preview {
  border-color: var(--accent);
}
.theme-swatch__sidebar { height: 100%; }
.theme-swatch__content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 3px;
}
.theme-swatch__bar {
  border-radius: 2px;
  height: 4px;
}
.theme-swatch__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.theme-swatch.is-active .theme-swatch__label { color: var(--accent); }
