"use client"; import { useEffect, useRef, useState } from "react"; export type TOCSection = { id: string; title: string }; // How long a click "wins" over the scroll-spy observer — long enough to // cover the native smooth-scroll animation triggered by the anchor href, // so sections passing through the viewport mid-scroll can't flicker the // active state away from what was actually clicked. const CLICK_OVERRIDE_MS = 1000; // lg:-only sidebar — same "wide fixed-width block next to content" shape // as the cart's order-summary sidebar (see figma-to-nextjs skill Gotcha // #5): a 360px TOC card plus a readable content column already exceeds // the 768px Tablet floor, so md: wouldn't leave room for a real 2-column // split at Tablet widths. // // Generic over `sections` — originally written just for /versand // (VersandTOC), generalized once /datenschutz needed the identical // scroll-spy sidebar but driven by CMS-authored headings instead of a // hardcoded array. Any future long legal/content page reuses this too. // // Not sticky itself — Impressum/Datenschutz put an extra card below this // in the same sidebar column, and if only this