/* ═══════════════════════════════════════════════════════════
   HR — scroll-linked frame sequence ("Od nápadu k výplatě")
   Reuses tokens from style.css (--fg / --muted / --border / --gold).
   ═══════════════════════════════════════════════════════════ */

.seq {
    background: var(--bg);
    border-top: 1px solid var(--border);
}

/* ── Intro (normal flow, above the sticky stage) ── */
.seq-intro {
    max-width: 720px;
    padding: 96px 52px 0;
}

.seq-intro .seq-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}

.seq-intro h1,
.seq-intro h2 {
    font-size: clamp(34px, 4.6vw, 62px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1;
}

.seq-intro p {
    margin-top: 24px;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--muted);
    max-width: 56ch;
}

/* ── Scroll track: its height IS the scrub length ── */
.seq {
    display: grid;
}
.seq-track {
    position: relative;
    grid-area: 1 / 1;
    height: 400vh;
    margin-top: 0;
}

.seq-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center;
    column-gap: 64px;
    padding: 0 52px 96px;
    overflow: hidden;
}
.seq-stage--copy { pointer-events: none; }
.seq-stage--copy .seq-chapters { pointer-events: auto; }
.seq-stage--viz .seq-visual { grid-column: 2; }
.seq-stage--viz .seq-rail { grid-column: 1 / -1; }

/* ── Visual ── */
.seq-visual {
    position: relative;
    z-index: 2;
    height: min(72svh, 620px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seq-chapters { z-index: 1; min-width: 0; }

.seq-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    transform-origin: 50% 54%;
    will-change: transform;
}

/* Warm plate laid OVER the frames — multiply keeps the white seamless with the
   page, so no canvas rectangle shows. Sytost roste s tím, jak přibývá zlato. */
.seq-visual::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 54%;
    width: 74%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(180, 83, 9, 0.09) 0%,
        rgba(180, 83, 9, 0.04) 42%,
        rgba(180, 83, 9, 0) 68%);
    opacity: var(--seq-glow, 0);
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* ── Chapters (stacked, cross-faded) ── */
.seq-chapters {
    display: grid;
}

.seq-chapter {
    grid-area: 1 / 1;
    align-self: center;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.7s var(--ease-expo);
    pointer-events: none;
}

.seq-chapter.is-active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.seq-step {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 20px;
}

.seq-chapter h2 {
    font-size: clamp(26px, 3.2vw, 44px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.06;
    max-width: 18ch;
}

.seq-chapter p {
    margin-top: 16px;
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--muted);
    max-width: 46ch;
}

/* Selektor musí být silnější než `.seq-chapter p` (0,1,1), jinak
   se velikost částky neprojeví a číslo splyne s běžným odstavcem. */
.seq-chapter p.seq-figure {
    margin-top: 20px;
    font-size: clamp(22px, 2.4vw, 32px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--gold);
}

.seq-duo {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}
.seq-duo > div {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
}
.seq-duo h3 {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}
.seq-duo p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    max-width: none;
}

/* ── Progress rail ── */
.seq-rail {
    position: absolute;
    z-index: 3;
    left: 52px;
    right: 52px;
    bottom: 40px;
}

.seq-rail-line {
    position: relative;
    height: 1px;
    background: var(--border);
}

.seq-rail-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: var(--fg);
}

/* Popisky sedí na svém prahu na liště, ne rovnoměrně rozprostřené. */
.seq-rail-ticks {
    position: relative;
    height: 12px;
    margin-top: 14px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--border);
}

.seq-rail-ticks span {
    position: absolute;
    top: 0;
    left: var(--at);
    white-space: nowrap;
    transition: color 0.35s ease;
}

.seq-rail-ticks span + span { transform: translateX(-50%); }

.seq-rail-ticks span.is-active {
    color: var(--fg);
}

.seq-rail-ticks span.is-past {
    color: var(--muted);
}

/* Loading readout — replaces the ticks until enough frames are decoded. */
.seq-load {
    position: absolute;
    left: 0;
    bottom: -2px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    transform: translateY(100%);
    padding-top: 14px;
}

.seq.is-ready .seq-load { display: none; }
.seq:not(.is-ready) .seq-rail-ticks { visibility: hidden; }

/* ── Mobile: rychlý full-screen scrub animace, potom kapitoly ── */
@media (max-width: 900px) {
    .seq {
        display: flex;
        flex-direction: column-reverse;
    }
    .seq-track { grid-area: auto; }
    .seq-track--viz { height: 170vh; }
    .seq-track--copy { height: 300vh; }

    .seq-stage {
        grid-template-columns: 1fr;
        padding: 12px var(--pad, 24px) 28px;
        overflow: hidden;
    }

    .seq-stage--viz {
        display: flex;
        flex-direction: column;
        justify-content: stretch;
    }
    .seq-stage--viz .seq-visual {
        grid-column: auto;
        flex: 1;
        height: auto;
        min-height: 0;
        order: 0;
    }
    .seq-stage--viz .seq-rail {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 12px;
        flex-shrink: 0;
    }
    .seq-rail-ticks { display: none; }

    .seq-stage--copy {
        pointer-events: auto;
        display: flex;
        align-items: center;
        padding: 28px var(--pad, 24px) 40px;
    }
    .seq-chapters { width: 100%; }

    .seq-chapter h2 { max-width: none; }
    .seq-chapter p { margin-top: 12px; font-size: 0.95rem; }
    .seq-duo { gap: 10px; margin-top: 12px; }
    .seq-duo > div { padding: 12px 14px; }
    .seq-chapter.is-active {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 460px) {
    .seq-rail-ticks span:nth-child(2),
    .seq-rail-ticks span:nth-child(3),
    .seq-rail-ticks span:nth-child(4) { display: none; }
    .seq-rail-ticks span:last-child { transform: translateX(-100%); }
}

/* Scrubbing is user-driven, but the cross-fade travel is not — drop it. */
@media (prefers-reduced-motion: reduce) {
    .seq-chapter {
        transform: none;
        transition: opacity 0.2s linear;
    }
    .seq-canvas { transform: none !important; }
}
