/* =========================================================
   COMET SOUND — SCROLL SCENES
   Styling + behaviour for the scroll-scene system.
   JS: comet-scroll-scenes.js (layers) + comet-plugin.js (GUI sync).
   Each [data-scroll-scene] exposes --scene-progress (0→1).
   ========================================================= */

/* parallax layers: promote only while the scene is active */
[data-parallax-layer] {
    will-change: auto;
}

.is-scene-active [data-parallax-layer] {
    will-change: transform, opacity;
}

/* ---------- scene signal line (fills with scene progress) ---------- */
.cs-scene-line {
    position: relative;
    overflow: hidden;
    background: var(--cs-border);
    border-radius: 2px;
}

.cs-scene-line--h {
    width: 100%;
    height: 2px;
}

.cs-scene-line--v {
    width: 2px;
    height: 100%;
}

.cs-scene-line::after {
    content: "";
    position: absolute;
    background: var(--plugin-accent, var(--cs-green));
    box-shadow: 0 0 14px color-mix(in srgb, var(--plugin-accent, var(--cs-green)) 45%, transparent);
}

.cs-scene-line--h::after {
    inset: 0 auto 0 0;
    height: 100%;
    width: calc(var(--scene-progress, 0) * 100%);
}

.cs-scene-line--v::after {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(var(--scene-progress, 0) * 100%);
}

/* ---------- waveform line draws from scene progress ---------- */
[data-waveform-line] .cs-wave__after {
    stroke-dasharray: 2600;
    stroke-dashoffset: calc(2600 * (1 - var(--scene-progress, 0)));
}

/* =========================================================
   Plugin detail showcase scene
   The GUI (comet-plugin.js) zooms; the matching chapter lights up.
   ========================================================= */
.cs-pgui-showcase {
    position: relative;
}

/* vertical progress line on the GUI side */
.cs-pgui-rail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--cs-gutter) * -0.4);
    width: 2px;
}

/* chapters dim by default, the active one (synced to the GUI zoom) lights up */
.cs-pgui-chapters.is-synced .cs-pgui-chapter {
    opacity: 0.34;
    transition: opacity 0.55s ease;
}

.cs-pgui-chapters.is-synced .cs-pgui-chapter.is-active {
    opacity: 1;
}

.cs-pgui-chapter .cs-step__num {
    color: var(--cs-muted-deep);
    transition: color 0.45s ease;
}

.cs-pgui-chapters.is-synced .cs-pgui-chapter.is-active .cs-step__num {
    color: var(--plugin-accent, var(--cs-green));
}

/* a small live readout chip that tracks the active chapter */
.cs-pgui-progress {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.4rem;
    font-family: var(--cs-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cs-muted);
}

.cs-pgui-progress b {
    color: var(--plugin-accent, var(--cs-green));
    font-weight: 700;
}

/* ---------- reduced motion: everything calm and fully visible ---------- */
@media (prefers-reduced-motion: reduce) {
    [data-parallax-layer] {
        transform: none !important;
        opacity: 1 !important;
    }

    .cs-pgui-chapters.is-synced .cs-pgui-chapter,
    .cs-pgui-chapter { opacity: 1; }

    .cs-scene-line--h::after { width: 100% !important; }
    .cs-scene-line--v::after { height: 100% !important; }

    [data-waveform-line] .cs-wave__after { stroke-dashoffset: 0; }
}
