/*
 * Fejléc-tartalomjegyzék – prémium megjelenés (1.4.1).
 *
 * A style.css „FEJLÉC-TARTALOMJEGYZÉK” fejezetére épül: méret, elhelyezés és
 * működés változatlan, ez a fájl a látványt finomítja.
 *  - gomb: üveghatású, kék–cián kiemelés, körbefutó olvasási haladásjelző
 *  - panel: rétegzett sötét üveg, fényes felső él, haladássáv
 *  - lista: idővonal a sorszámok mögött, megjárt / aktív / következő állapot
 *  - nyitáskor egymás után beúszó elemek
 * A --cc-toc-p (0–1) értéket az assets/js/cc-toc.js frissíti görgetéskor.
 */

.site-header .cc-header-toc {
    --toc-accent: #60a5fa;
    --toc-accent-2: #22d3ee;
    --toc-ink: #f5f9ff;
    --toc-soft: rgba(191, 219, 254, 0.62);
    --toc-line: rgba(148, 180, 255, 0.16);
    --cc-toc-p: 0;
}

/* Helyfoglaló: a gomb helye megvan, de nem látszik és nem kattintható. */
.site-header .cc-header-toc--placeholder {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* --------------------------------------------------------------------------
 * Gomb
 * ----------------------------------------------------------------------- */

.site-header .cc-header-toc__toggle {
    border-color: rgba(147, 197, 253, 0.2);
    border-radius: 12px;
    color: #eaf3ff;
    background:
        radial-gradient(120% 90% at 20% 0%, rgba(96, 165, 250, 0.22), transparent 60%),
        linear-gradient(160deg, rgba(23, 45, 86, 0.92), rgba(9, 19, 38, 0.96));
    box-shadow:
        0 10px 26px -10px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    overflow: visible;
}

/* A régi fényvillanás helyett: körbefutó haladásjelző a gomb peremén. */
.site-header .cc-header-toc__toggle::before {
    content: "";
    position: absolute;
    inset: -1px;
    top: -1px;
    left: -1px;
    width: auto;
    height: auto;
    padding: 1.5px;
    border-radius: 12px;
    background: conic-gradient(
        from 0deg,
        var(--toc-accent-2) 0turn,
        var(--toc-accent) calc(var(--cc-toc-p) * 1turn),
        transparent calc(var(--cc-toc-p) * 1turn)
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    transform: none;
    opacity: 0.95;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.site-header .cc-header-toc__toggle:hover::before {
    left: -1px;
}

.site-header .cc-header-toc__toggle:hover,
.site-header .cc-header-toc.is-open .cc-header-toc__toggle {
    border-color: rgba(147, 197, 253, 0.42);
    background:
        radial-gradient(120% 90% at 20% 0%, rgba(96, 165, 250, 0.32), transparent 60%),
        linear-gradient(160deg, rgba(29, 56, 107, 0.96), rgba(11, 23, 46, 0.98));
    box-shadow:
        0 14px 32px -12px rgba(0, 0, 0, 0.65),
        0 0 0 4px rgba(96, 165, 250, 0.08),
        0 0 24px rgba(96, 165, 250, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.site-header .cc-header-toc__icon {
    border: 0;
    border-radius: 8px;
    color: #bfdbfe;
    background: rgba(96, 165, 250, 0.12);
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.14);
}

.site-header .cc-header-toc__icon::after {
    background: var(--toc-accent-2);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 8px rgba(34, 211, 238, 0.8);
}

.site-header .cc-header-toc__toggle-text {
    font-weight: 700;
    letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
 * Panel
 * ----------------------------------------------------------------------- */

.site-header .cc-header-toc__panel {
    padding: 14px 12px 12px;
    border: 1px solid rgba(148, 180, 255, 0.16);
    border-radius: 20px;
    color: var(--toc-ink);
    background:
        radial-gradient(120% 70% at 100% 0%, rgba(59, 130, 246, 0.17), transparent 58%),
        radial-gradient(90% 60% at 0% 100%, rgba(34, 211, 238, 0.07), transparent 62%),
        linear-gradient(180deg, #0f1b33, #070e1d);
    box-shadow:
        0 34px 80px -24px rgba(0, 0, 0, 0.78),
        0 0 0 1px rgba(255, 255, 255, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    transform: translateY(-10px) scale(0.98);
    transition:
        opacity 0.26s ease,
        visibility 0.26s ease,
        transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-color: rgba(96, 165, 250, 0.3) transparent;
}

@media (min-width: 769px) {
    .site-header .cc-header-toc__panel {
        width: min(372px, calc(100vw - 24px));
    }
}

/* Fényes felső él */
.site-header .cc-header-toc__panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22px;
    right: 22px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.9), rgba(34, 211, 238, 0.9), transparent);
    opacity: 0.85;
    pointer-events: none;
}

.site-header .cc-header-toc__panel::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.3);
}

/* Fejléc */
.site-header .cc-header-toc__head {
    align-items: center;
    padding: 4px 6px 12px;
    border-bottom: 0;
}

.site-header .cc-header-toc__eyebrow {
    margin-bottom: 5px;
    color: #7dd3fc;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.site-header .cc-header-toc__head strong {
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.site-header .cc-header-toc__count {
    padding: 5px 9px;
    border: 1px solid rgba(147, 197, 253, 0.22);
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.12);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* Haladássáv */
.site-header .cc-header-toc__progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 6px 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--toc-line);
}

.site-header .cc-header-toc__progress-track {
    position: relative;
    flex: 1 1 auto;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 180, 255, 0.12);
    overflow: hidden;
}

.site-header .cc-header-toc__progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--cc-toc-p) * 100%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--toc-accent), var(--toc-accent-2));
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
    transition: width 0.18s linear;
}

.site-header .cc-header-toc__progress-label {
    flex: 0 0 auto;
    color: var(--toc-soft);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.site-header .cc-header-toc__progress-label [data-cc-toc-progress] {
    color: #e0f2fe;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
 * Lista – idővonal
 * ----------------------------------------------------------------------- */

.site-header .cc-header-toc__nav {
    margin-top: 0;
}

.site-header .cc-header-toc__list {
    position: relative;
    gap: 2px;
}

.site-header .cc-header-toc__list::before {
    content: "";
    position: absolute;
    top: 26px;
    bottom: 26px;
    left: 23px;
    width: 1px;
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.45), rgba(96, 165, 250, 0.08));
    pointer-events: none;
}

.site-header .cc-header-toc__item {
    grid-template-columns: 32px minmax(0, 1fr) 14px;
    gap: 12px;
    min-height: 56px;
    padding: 8px 10px 8px 7px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: rgba(226, 236, 252, 0.82);
    background: transparent;
    box-shadow: none;
}

.site-header .cc-header-toc__item:hover {
    color: #ffffff;
    border-color: rgba(147, 197, 253, 0.12);
    background: rgba(96, 165, 250, 0.07);
    box-shadow: none;
    transform: none;
}

.site-header .cc-header-toc__number {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 180, 255, 0.24);
    border-radius: 50%;
    color: #93c5fd;
    background: #0b1730;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.site-header .cc-header-toc__copy strong {
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: -0.005em;
}

.site-header .cc-header-toc__copy small {
    margin-top: 3px;
    color: var(--toc-soft);
    font-size: 0.66rem;
}

/* Jobb oldali nyíl a pötty helyett */
.site-header .cc-header-toc__status {
    justify-self: end;
    width: 7px;
    height: 7px;
    border: 0;
    border-top: 1.5px solid rgba(191, 219, 254, 0.7);
    border-right: 1.5px solid rgba(191, 219, 254, 0.7);
    border-radius: 1px;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    transform: translateX(-4px) rotate(45deg);
    transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
    animation: none;
}

.site-header .cc-header-toc__item:hover .cc-header-toc__status,
.site-header .cc-header-toc__item:focus-visible .cc-header-toc__status {
    opacity: 1;
    transform: translateX(0) rotate(45deg);
}

/* Már elolvasott szekciók */
.site-header .cc-header-toc__item.is-passed .cc-header-toc__number {
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.55);
    background: linear-gradient(160deg, #13284f, #0c1a36);
}

/* Aktív szekció */
.site-header .cc-header-toc__item.is-active {
    color: #ffffff;
    border-color: rgba(96, 165, 250, 0.26);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.24), rgba(37, 99, 235, 0.05) 80%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.site-header .cc-header-toc__item.is-active .cc-header-toc__number {
    color: #ffffff;
    border-color: transparent;
    background: linear-gradient(140deg, #2563eb, #06b6d4);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), 0 6px 18px -4px rgba(6, 182, 212, 0.6);
}

.site-header .cc-header-toc__item.is-active .cc-header-toc__copy small {
    color: rgba(186, 230, 253, 0.8);
}

.site-header .cc-header-toc__item.is-active .cc-header-toc__status {
    opacity: 1;
    transform: translateX(0) rotate(45deg);
    border-color: var(--toc-accent-2);
    background: transparent;
    box-shadow: none;
    animation: none;
}

/* Nyitáskor egymás után beúszó elemek */
.site-header .cc-header-toc__list > li {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.32s ease, transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header .cc-header-toc.is-open .cc-header-toc__list > li {
    opacity: 1;
    transform: none;
    transition-delay: calc(0.05s + var(--i, 0) * 0.035s);
}

/* Lábléc */
.site-header .cc-header-toc__foot {
    justify-content: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 11px 6px 2px;
    border-top: 1px solid var(--toc-line);
    color: rgba(191, 219, 254, 0.5);
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.site-header .cc-header-toc__foot > span {
    background: var(--toc-accent-2);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1), 0 0 8px rgba(34, 211, 238, 0.6);
}

.site-header .cc-header-toc__kbd {
    margin-left: auto;
    padding: 3px 6px;
    border: 1px solid rgba(148, 180, 255, 0.22);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: #cfe0fb;
    background: rgba(255, 255, 255, 0.04);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
}

@media (max-width: 768px) {
    .site-header .cc-header-toc__panel {
        border-radius: 18px;
    }

    .site-header .cc-header-toc__kbd {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header .cc-header-toc__list > li {
        opacity: 1;
        transform: none;
    }
}
