/* =============================================================
   Scrollspy-Dot-Navigation (Desktop) plus Hamburger-Overlay (Mobile).
   AllWhisper-Pattern: Group-Hover auf gesamter Sidebar zeigt alle
   Labels gleichzeitig (Fitts's Law plus Recognition statt Recall).
   Mobile-Overlay als kompakter Sprung-Index mit Monats-Gruppierung
   (Empfehlung UX-Subagent: Liste-Page bleibt parallel als Read-View).
   Tokens-only, Light/Dark via [data-theme]-Override automatisch.
   ============================================================= */

/* ===== Sidebar (Desktop ab 900px) =========================== */
.scrollspy {
  position: fixed;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: none;
  /* Grosszuegiges Padding als Hover-Hit-Zone (Fitts's Law) */
  padding: 1.5rem 1.75rem;
}
@media (min-width: 900px) {
  .scrollspy { display: block; }
}
/* Fade-Maske oben/unten als Pseudo-Element auf der Sidebar
   (statt mask-image auf der Liste, das clippt absolute Tooltips). */
.scrollspy::before,
.scrollspy::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2.5rem;
  pointer-events: none;
  z-index: 1;
}
.scrollspy::before {
  top: 0;
  background: linear-gradient(to bottom, var(--color-bg-page), transparent);
}
.scrollspy::after {
  bottom: 0;
  background: linear-gradient(to top, var(--color-bg-page), transparent);
}
.scrollspy__list {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  /* KEIN overflow-y:auto und max-height: das wuerde die Tooltips
     (absolute, links der Sidebar) clippen. Bei aktueller Test-Eintraege-
     Zahl (8-20) passt die Liste in den Viewport. Bei 50+ Eintraegen
     muss die Sidebar auf Monats-Marker umstellen, das ist der naechste
     Skalierungs-Schritt. */
  position: relative;
  z-index: 2;
}

.scrollspy__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.scrollspy__dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text-soft);
  opacity: 0.55;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: opacity 180ms var(--ease-out),
              transform 180ms var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
/* Hit-Target groesser als visuelles Dot (Fitts's Law) */
.scrollspy__dot::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
}

/* Meilenstein: gleiche Groesse wie Standard, aber Plakat-Gold und
   Border-Ring damit es klar erkennbar ist. */
.scrollspy__item--milestone .scrollspy__dot {
  background: var(--color-accent);
  opacity: 0.95;
  box-shadow: 0 0 0 2px var(--color-bg-page);
}

.scrollspy__item.is-active .scrollspy__dot {
  opacity: 1;
  transform: scale(1.6);
  background: var(--color-primary);
}
.scrollspy__item--milestone.is-active .scrollspy__dot {
  background: var(--color-accent);
  transform: scale(1.45);
}

/* Group-Hover Pattern (AllWhisper-Stil): wenn die Sidebar als Ganzes
   gehovert wird, werden ALLE Dots heller und ALLE Labels gleichzeitig
   eingeblendet mit Slide-In von rechts. */
.scrollspy:hover .scrollspy__dot,
.scrollspy:focus-within .scrollspy__dot {
  opacity: 0.9;
}
.scrollspy__dot:hover,
.scrollspy__dot:focus-visible {
  opacity: 1;
  transform: scale(1.5);
  outline: none;
}

/* ===== Tooltip-Label ======================================== */
.scrollspy__label {
  position: absolute;
  right: calc(100% + 0.85rem);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  white-space: nowrap;
  background: var(--color-primary);
  color: #fff;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out),
              transform 180ms var(--ease-out);
  text-transform: uppercase;
}
.scrollspy__label::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: var(--color-primary);
}
.scrollspy__label-meta {
  display: block;
  margin-top: 3px;
  color: var(--color-accent);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
/* Group-Hover zeigt ALLE Labels (AllWhisper-Pattern). Plus
   Dot-Hover als Fallback damit der Tooltip auch beim direkten
   Hover ueber einen einzelnen Dot zuverlaessig erscheint. */
.scrollspy:hover .scrollspy__label,
.scrollspy:focus-within .scrollspy__label,
.scrollspy__dot:hover .scrollspy__label,
.scrollspy__dot:focus-visible .scrollspy__label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ===== Hamburger-Button =====================================
   Auf Mobile sticky-fixed oben links (bleibt beim Scrollen
   sichtbar). Auf Desktop ab 900px ausgeblendet, weil dort die
   Scrollspy-Sidebar rechts uebernimmt.
*/
.nav-toggle {
  position: fixed;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border: 1px solid var(--color-primary-deep);
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-md);
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.nav-toggle:hover {
  background: var(--color-accent-hover-bg);
  border-color: var(--color-accent-hover-border);
}
.nav-toggle__bars {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  position: relative;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
}
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top: 6px; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
}

/* ===== Mobile-Overlay (Sprung-Index mit Monats-Gruppen) ==== */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}
.nav-overlay[hidden] { display: none; }
.nav-overlay__inner {
  background: var(--color-surface);
  width: 100%;
  max-width: 480px;
  margin: var(--space-md);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--color-accent);
  padding: var(--space-xl);
  overflow-y: auto;
  position: relative;
  align-self: center;
  max-height: calc(100vh - 2 * var(--space-md));
  box-shadow: var(--shadow-lg);
}
.nav-overlay__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.nav-overlay__close:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.nav-overlay__eyebrow {
  margin: 0 0 0.25rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--color-primary);
}
.nav-overlay__title {
  margin: 0 0 var(--space-lg);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 32;
  font-size: 1.65rem;
  color: var(--color-primary);
  font-weight: 600;
  letter-spacing: var(--tracking-headline);
}
.nav-overlay__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Monats-Header trennt Eintraege visuell */
.nav-overlay__month {
  margin: var(--space-md) 0 0.4rem;
  padding-bottom: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-soft);
  border-bottom: 1px solid var(--color-hairline);
}
.nav-overlay__month:first-child { margin-top: 0; }

.nav-overlay__item {
  /* Kein Border-Bottom mehr - Monats-Header trennen */
}
.nav-overlay__item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  min-height: 32px;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-sans);
  transition: color var(--dur-fast) var(--ease-out);
}
.nav-overlay__item a:hover {
  color: var(--color-primary);
}
.nav-overlay__day {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  min-width: 1.8em;
  text-align: right;
  opacity: 0.65;
}
.nav-overlay__milestone {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.nav-overlay__item--standard .nav-overlay__milestone {
  color: var(--color-text);
  font-weight: 400;
}
.nav-overlay__item--milestone .nav-overlay__milestone {
  color: var(--color-primary);
  font-weight: 600;
}
.nav-overlay__item--milestone {
  background: linear-gradient(to right, var(--color-accent-soft) 0%, transparent 70%);
  border-left: 3px solid var(--color-accent);
  padding-left: 0.55rem;
  margin-left: calc(var(--space-sm) * -1);
}
.nav-overlay__chevron {
  color: var(--color-text-soft);
  font-size: 0.95rem;
  flex-shrink: 0;
  opacity: 0.5;
}
