/* ── sk-toc-sidebar.css v1.0 | Skymoon Infotech ─────────────────────────────
   Upload to: /wp-content/themes/YOUR-CHILD-THEME/assets/sk-toc-sidebar.css
   WP Rocket will minify + combine this automatically.

   CONTENTS
   ─────────
   1.  CSS variables
   2.  TOC container + glass card
   3.  TOC progress bar
   4.  TOC header (title, icon, tag pills, toggle)
   5.  TOC body + scroll
   6.  TOC items (link, number, text, dot, indent levels)
   7.  TOC active + hover states
   8.  TOC collapse animation
   9.  TOC sticky enhanced shadow
   10. About Skymoon card
   11. Responsive (≤768px)

   PERFORMANCE
   ────────────
   • Zero backdrop-filter on any item (only on wrapper — 1 composited layer)
   • Transitions: opacity + transform only — GPU, no reflow
   • No JS in this file
   • All layout uses flexbox — no grid reflow edge cases
   • CLS-safe: sk-toc has explicit min-height so nothing shifts on load
   ─────────────────────────────────────────────────────────────────────────── */


/* ── 1. CSS variables ─────────────────────────────────────────────────────── */

.sk-toc,
.sk-about {
    --brand:        #006CFF;
    --brand-light:  rgba(0, 108, 255, .08);
    --brand-border: rgba(0, 108, 255, .18);
    --purple:       #745EFF;
    --text-primary: #0f172a;
    --text-muted:   #64748b;
    --text-dim:     #94a3b8;
    --border:       rgba(147, 178, 255, .45);
    --border-light: rgba(147, 178, 255, .28);
    --glass-bg:     rgba(255, 255, 255, .78);
    --radius-card:  16px;
    --radius-item:  10px;
    --shadow-card:  0 1px 0 rgba(255,255,255,.4) inset,
                    0 1px 2px rgba(16,24,40,.06),
                    0 10px 28px rgba(2,33,89,.05);
    --shadow-sticky: 0 1px 0 rgba(255,255,255,.4) inset,
                     0 4px 16px rgba(2,33,89,.10),
                     0 16px 40px rgba(2,33,89,.08);
    font-family: "REM", system-ui, sans-serif;
}


/* ── 2. TOC container ─────────────────────────────────────────────────────── */

.sk-toc {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    overflow: hidden;
    margin-bottom: 20px;
    /* CLS fix: reserve minimum height so page doesn't shift on first paint */
    min-height: 56px;
    /* Smooth shadow transition when it becomes sticky */
    transition: box-shadow .3s, border-color .3s;
}

/* Sticky enhanced shadow — class added by JS when stuck */
.sk-toc.is-sticky {
    box-shadow: var(--shadow-sticky);
    border-color: rgba(147, 178, 255, .58);
}


/* ── 3. Reading progress bar ──────────────────────────────────────────────── */

.sk-toc__progress {
    height: 3px;
    background: rgba(147, 178, 255, .2);
    position: relative;
    overflow: hidden;
}
.sk-toc__progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--brand), var(--purple));
    border-radius: 0 2px 2px 0;
    /* JS animates width — we transition it smoothly */
    transition: width .15s linear;
    will-change: width;
}


/* ── 4. TOC header ────────────────────────────────────────────────────────── */

.sk-toc__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 13px 16px 11px;
    background: linear-gradient(to bottom, rgba(255,255,255,.65), rgba(255,255,255,.45));
    border-bottom: 1px solid var(--border-light);
}

.sk-toc__header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sk-toc__icon {
    display: flex;
    align-items: center;
    color: var(--brand);
    flex-shrink: 0;
}
.sk-toc__icon svg { display: block }

.sk-toc__title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sk-toc__header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Tag pills — show which heading levels are included */
.sk-toc__tag-pill {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    font-size: 9.5px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .04em;
}

/* Collapse toggle button */
.sk-toc__toggle {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .85);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .2s, color .2s, box-shadow .2s;
    flex-shrink: 0;
}
.sk-toc__toggle:hover {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 2px 8px rgba(16,24,40,.10);
}
.sk-toc__toggle svg {
    display: block;
    /* JS toggles data-collapsed on .sk-toc, CSS rotates the chevron */
    transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sk-toc[data-collapsed="true"] .sk-toc__toggle svg {
    transform: rotate(180deg);
}


/* ── 5. TOC body ──────────────────────────────────────────────────────────── */

.sk-toc__body {
    /* JS sets max-height for animation — fallback if JS fails */
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    /* Thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,108,255,.22) transparent;
    /* Collapse animation via max-height — JS toggles the attribute */
    transition: max-height .3s cubic-bezier(.4,0,.2,1),
                opacity .25s;
    opacity: 1;
}
.sk-toc__body::-webkit-scrollbar       { width: 4px }
.sk-toc__body::-webkit-scrollbar-track { background: transparent }
.sk-toc__body::-webkit-scrollbar-thumb { background: rgba(0,108,255,.22); border-radius: 8px }

/* Collapsed state — JS adds data-collapsed="true" to .sk-toc */
.sk-toc[data-collapsed="true"] .sk-toc__body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.sk-toc__items {
    padding: 8px 10px 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Item count footer */
.sk-toc__count {
    padding: 6px 16px 10px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: right;
    letter-spacing: .02em;
}


/* ── 6. TOC items ─────────────────────────────────────────────────────────── */

.sk-toc__link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px 9px 12px;
    border-radius: var(--radius-item);
    border: none;
    /* Left accent line — transparent by default, brand when active */
    border-left: 3px solid transparent;
    text-decoration: none;
    color: #334155;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    background: transparent;
    cursor: pointer;
    /* GPU-only transitions — no layout reflow */
    transition: background .15s, color .15s, border-color .15s;
    /* Remove browser outline — we set our own focus state */
    outline: none;
}
.sk-toc__link:focus-visible {
    outline: 2px solid rgba(0,108,255,.4);
    outline-offset: 1px;
}

/* Number badge */
.sk-toc__num {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-dim);
    min-width: 20px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    transition: color .15s;
}

/* Heading text */
.sk-toc__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Active indicator dot — hidden by default */
.sk-toc__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand);
    flex-shrink: 0;
    /* Scale from 0 → 1 when active, reverse when inactive */
    transform: scale(0);
    opacity: 0;
    transition: transform .2s, opacity .2s;
}

/* Indent levels for H3, H4, H5, H6 */
.sk-toc__item--indent-1 { padding-left: 24px }
.sk-toc__item--indent-2 { padding-left: 36px; font-size: 12.5px }
.sk-toc__item--indent-3 { padding-left: 48px; font-size: 12px; color: var(--text-muted) }
.sk-toc__item--indent-4 { padding-left: 60px; font-size: 11.5px; color: var(--text-dim) }

.sk-toc__item--indent-1 .sk-toc__num { font-size: 10px }
.sk-toc__item--indent-2 .sk-toc__num { font-size: 9.5px; min-width: 16px }


/* ── 7. Active + hover states ─────────────────────────────────────────────── */

.sk-toc__link:hover {
    background: rgba(0,108,255,.04);
    color: var(--brand);
}
.sk-toc__link:hover .sk-toc__num {
    color: var(--brand);
}

.sk-toc__link.is-active {
    background: var(--brand-light);
    border-left-color: var(--brand);
    color: var(--brand);
    font-weight: 600;
}
.sk-toc__link.is-active .sk-toc__num {
    color: var(--brand);
}
.sk-toc__link.is-active .sk-toc__dot {
    transform: scale(1);
    opacity: 1;
}


/* ── 8. Collapse animation ────────────────────────────────────────────────── */
/* Handled via max-height transition on .sk-toc__body above */


/* ── 9. Sticky shadow (class toggled by JS IntersectionObserver) ──────────── */
/* .sk-toc.is-sticky handled in section 2 above */


/* ════════════════════════════════════════════════════════════════════════════
   10. ABOUT SKYMOON CARD
   ════════════════════════════════════════════════════════════════════════════ */

.sk-about {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 20px;
    /* Dark-mode gradient card matching JSX SidebarCTA */
    background: linear-gradient(145deg, #0f172a 0%, #1a2744 55%, #0f2050 100%);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 4px 24px rgba(0,0,0,.28);
}

/* Decorative orbs — pure CSS, zero DOM overhead */
.sk-about__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.sk-about__orb {
    position: absolute;
    border-radius: 50%;
}
.sk-about__orb--1 {
    width: 160px;
    height: 160px;
    top: -48px;
    right: -48px;
    background: radial-gradient(circle, rgba(0,108,255,.22) 0%, transparent 70%);
}
.sk-about__orb--2 {
    width: 120px;
    height: 120px;
    bottom: -32px;
    left: -24px;
    background: radial-gradient(circle, rgba(116,94,255,.18) 0%, transparent 70%);
}

/* Content */
.sk-about__body {
    position: relative;
    z-index: 1;
    padding: 22px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Badge pill */
.sk-about__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.15);
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.80);
    letter-spacing: .07em;
    text-transform: uppercase;
    width: fit-content;
}
.sk-about__badge svg { flex-shrink: 0; opacity: .85 }

/* Heading */
.sk-about__heading {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -.02em;
}

/* Body text */
.sk-about__text {
    font-size: 13px;
    color: rgba(255,255,255,.68);
    line-height: 1.65;
    margin: 0;
}

/* CTA button */
.sk-about__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    padding: 11px 0;
    border-radius: 10px;
    background: #ffffff;
    color: var(--brand);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -.01em;
    box-shadow: 0 2px 10px rgba(0,0,0,.14);
    /* GPU transition — no layout change */
    transition: transform .18s cubic-bezier(.22,1,.36,1),
                box-shadow .18s;
    -webkit-tap-highlight-color: transparent;
}
.sk-about__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.sk-about__btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.sk-about__btn svg {
    flex-shrink: 0;
    transition: transform .18s;
}
.sk-about__btn:hover svg {
    transform: translateX(2px);
}


/* ── 11. Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sk-toc {
        margin-bottom: 16px;
    }
    .sk-toc__title {
        font-size: 13.5px;
    }
    .sk-toc__link {
        font-size: 12.5px;
        padding: 8px 10px 8px 10px;
    }
    .sk-toc__item--indent-1 { padding-left: 20px }
    .sk-toc__item--indent-2 { padding-left: 30px }
    .sk-about__heading { font-size: 16px }
    .sk-about__btn     { font-size: 13px }
}

@media (prefers-reduced-motion: reduce) {
    .sk-toc__progress-fill,
    .sk-toc__body,
    .sk-toc__link,
    .sk-toc__toggle svg,
    .sk-toc__dot,
    .sk-about__btn,
    .sk-about__btn svg {
        transition: none;
    }
}
