/* ══════════════════════════════════════════════════════════
   HYDE PARK LUMBER — Scroll-Driven History Section
   Full-bleed · Cinematic Ken Burns · Apple-style
   ══════════════════════════════════════════════════════════ */

:root {
    --hs-amber:    #b8924a;
    --hs-amber-lt: #d4b06a;
    --hs-dark:     #0b1724;
    --hs-border:   rgba(255, 255, 255, 0.055);
}

/* ── Section Wrapper ──────────────────────────────────────── */

.history-scroll {
    position: relative;
    height: 700vh; /* 7 chapters × 100vh each */
    background: var(--hs-dark);
    /* Prevent the cream background from bleeding through */
    isolation: isolate;
}

/* ── Sticky Viewport — Full Canvas ───────────────────────── */

.hs-sticky {
    position: sticky;
    top: var(--nav-h, 112px);
    height: calc(100vh - var(--nav-h, 112px));
    overflow: hidden;
    background: var(--hs-dark);
    /* Full canvas — no grid split */
}

/* ── Top Progress Bar ─────────────────────────────────────── */

.hs-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    z-index: 20;
    pointer-events: none;
}

.hs-progress-bar__fill {
    height: 100%;
    width: 0%;
    background: var(--hs-amber);
    transition: width 0.07s linear;
}

/* ── Background Stage (right panel → full-bleed canvas) ───── */

.hs-panel-right {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--hs-dark);
}

/* ── Image Slots — Full Bleed + Ken Burns ─────────────────── */

.hs-img-slot {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.07);
    transition:
        opacity   0.95s cubic-bezier(0.4, 0, 0.2, 1),
        transform 9s   cubic-bezier(0.0, 0, 0.2, 1);
    will-change: opacity, transform;
    pointer-events: none;
}

.hs-img-slot.active {
    opacity: 1;
    transform: scale(1.0);
    pointer-events: auto;
}

/* Cinematic gradient: heavy on left (text), opens on right (image) */
.hs-img-slot::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg,
            rgba(11, 23, 36, 0.96)  0%,
            rgba(11, 23, 36, 0.78) 28%,
            rgba(11, 23, 36, 0.30) 55%,
            rgba(11, 23, 36, 0.08) 100%),
        linear-gradient(to top,
            rgba(11, 23, 36, 0.65) 0%,
            transparent 38%);
    z-index: 1;
    pointer-events: none;
}

.hs-img-slot > img,
.hs-img-slot > picture > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── Placeholder images inside .hs-placeholder__inner
   When a real <img> is present, promote it to full-bleed.  ─ */

.hs-placeholder:has(img) {
    position: absolute;
    inset: 0;
    padding: 0;
    background: none;
}

.hs-placeholder:has(img)::after { content: none; }

.hs-placeholder:has(img) .hs-placeholder__inner {
    position: absolute;
    inset: 0;
    padding: 0;
    gap: 0;
    align-items: stretch;
    justify-content: stretch;
}

.hs-placeholder:has(img) .hs-placeholder__inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.hs-placeholder:has(img) .hs-placeholder__label {
    display: none;
}

/* ── Left Panel — Transparent Floating Text Overlay ─────── */

.hs-panel-left {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(570px, 52%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5.5rem 2.5rem 3.5rem 5rem;
    background: none;
    border-right: none;
    overflow: visible;
}

.hs-panel-left::before {
    content: none;
}

/* ── Permanent Section Eyebrow (always visible) ───────────── */

.hs-eyebrow {
    position: absolute;
    top: 2.4rem;
    left: 5rem;
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.67rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    line-height: 1;
    z-index: 2;
    pointer-events: none;
}

/* ── Timeline (vertical dots + animated line) ─────────────── */

.hs-timeline {
    position: absolute;
    left: 1.75rem;
    top: 0;
    bottom: 0;
    width: 22px;
    z-index: 2;
}

.hs-timeline__line {
    position: absolute;
    left: 50%;
    top: 5rem;
    bottom: 5rem;
    width: 1px;
    background: rgba(255, 255, 255, 0.09);
    transform: translateX(-50%);
}

.hs-timeline__line-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--hs-amber-lt), var(--hs-amber));
    transition: height 0.1s ease;
}

.hs-timeline__dots {
    position: absolute;
    left: 50%;
    top: 5rem;
    bottom: 5rem;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

/* Clickable timeline dots */
.hs-tdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    cursor: pointer;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

.hs-tdot:hover {
    border-color: rgba(255, 255, 255, 0.55);
    transform: scale(1.4);
}

.hs-tdot.past {
    background: var(--hs-amber);
    border-color: var(--hs-amber);
    opacity: 0.5;
}

.hs-tdot.active {
    width: 10px;
    height: 10px;
    background: var(--hs-amber);
    border-color: var(--hs-amber);
    box-shadow: 0 0 0 4px rgba(184, 146, 74, 0.22), 0 0 10px rgba(184, 146, 74, 0.3);
    opacity: 1;
}

/* ── Chapter Content Area ─────────────────────────────────── */

.hs-chapters {
    position: relative;
    flex: 1;
    z-index: 1;
    min-height: 0;
}

/* Default: hidden, shifted down */
.hs-chapter {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity   0.65s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    will-change: opacity, transform;
}

/* Even-indexed chapters enter from above */
.hs-chapter:nth-child(even) {
    transform: translateY(-30px);
}

.hs-chapter.active {
    opacity: 1;
    transform: translateY(0) !important;
    pointer-events: auto;
}

/* Decorative Roman numeral — bleeds past panel edge into image */
.hs-chapter::after {
    content: attr(data-num);
    position: absolute;
    bottom: -2.5rem;
    right: -5rem;
    font-family: var(--font-serif);
    font-size: clamp(9rem, 15vw, 16rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.04);
    line-height: 1;
    pointer-events: none;
    user-select: none;
    letter-spacing: -0.04em;
    z-index: 0;
}

/* ── Chapter Typography — staggered cascade ───────────────── */

.hs-chapter__year,
.hs-chapter__headline,
.hs-chapter__body,
.hs-chapter__counter,
.hs-scroll-hint {
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hs-chapter.active .hs-chapter__year     { opacity: 1; transition-delay: 0.10s; }
.hs-chapter.active .hs-chapter__headline { opacity: 1; transition-delay: 0.20s; }
.hs-chapter.active .hs-chapter__body     { opacity: 1; transition-delay: 0.32s; }
.hs-chapter.active .hs-chapter__counter  { opacity: 1; transition-delay: 0.44s; }
.hs-chapter.active .hs-scroll-hint       { opacity: 1; transition-delay: 0.50s; }

.hs-chapter__year {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--hs-amber);
    margin-bottom: 1.1rem;
    line-height: 1;
}

.hs-chapter__headline {
    font-family: var(--font-serif);
    font-size: clamp(1.9rem, 3vw, 2.85rem);
    font-weight: 400;
    color: #fff;
    line-height: 1.14;
    letter-spacing: -0.018em;
    margin: 0 0 1.4rem;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}

.hs-chapter__headline em {
    font-style: italic;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.72);
}

.hs-chapter__body {
    font-family: var(--font-sans);
    font-size: clamp(0.875rem, 1.05vw, 0.97rem);
    line-height: 1.86;
    color: rgba(255, 255, 255, 0.58);
    max-width: 420px;
    margin: 0;
}

.hs-chapter__body strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.hs-chapter__body em {
    color: rgba(255, 255, 255, 0.72);
    font-style: italic;
}

.hs-chapter__counter {
    margin-top: 2rem;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.2);
    line-height: 1;
}

.hs-scroll-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 2rem;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
}

.hs-scroll-hint__arrow {
    width: 14px;
    height: 14px;
    animation: hs-bounce 1.8s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes hs-bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(4px); }
}

/* ── Placeholder (no image yet) ───────────────────────────── */

.hs-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8%;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.hs-placeholder::after {
    content: '';
    position: absolute;
    inset: 3rem;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    pointer-events: none;
}

.hs-placeholder__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    z-index: 1;
    padding: 1.5rem;
    text-align: center;
}

.hs-placeholder__icon {
    width: 44px;
    height: 44px;
    color: rgba(255, 255, 255, 0.09);
}

.hs-placeholder__label {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.16);
    line-height: 1.7;
    max-width: 180px;
}

/* ── YouTube Video Embed Slot ─────────────────────────────── */

.hs-video-embed {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    /* push video to right half so text panel doesn't obscure it */
    padding: 3rem 3.5rem 3rem 42%;
}

.hs-video-embed iframe {
    width: 100%;
    height: 100%;
    max-height: 420px;
    border-radius: 10px;
    display: block;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.65);
}

/* ── Responsive: Tablet & Mobile ──────────────────────────── */

@media (max-width: 900px) {
    .history-scroll {
        height: 840vh;
    }

    .hs-panel-left {
        width: 100%;
        top: auto;
        left: 0;
        bottom: 0;
        height: 56%;
        justify-content: flex-end;
        padding: 2.5rem 1.5rem 2.5rem 3.5rem;
        /* gradient backing for legibility over image */
        background: linear-gradient(to top,
            rgba(11, 23, 36, 0.97) 65%,
            rgba(11, 23, 36, 0.65) 100%);
        pointer-events: none;
    }

    /* On mobile the panel gradient covers everything; kill the per-slot overlay */
    .hs-img-slot::after {
        background: none;
    }

    .hs-eyebrow {
        display: none;
    }

    .hs-timeline {
        left: 1rem;
        pointer-events: auto;
    }

    .hs-chapter__headline {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .hs-chapter__body {
        font-size: 0.875rem;
        max-width: 100%;
    }

    .hs-chapter__counter {
        margin-top: 1rem;
    }

    .hs-scroll-hint {
        margin-top: 1.2rem;
    }

    .hs-video-embed {
        padding: 1.5rem;
    }

    .history-scroll.hs-video-active .hs-panel-left {
        height: 42%;
        padding-top: 1.25rem;
        padding-bottom: 1.35rem;
        background: rgba(11, 23, 36, 0.97);
        pointer-events: auto;
    }

    .history-scroll.hs-video-active .hs-video-embed {
        align-items: flex-start;
        padding: 1rem 1rem calc(42% + 1rem);
    }

    .history-scroll.hs-video-active .hs-video-embed iframe {
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: none;
    }
}

@media (max-width: 560px) {
    .hs-panel-left {
        padding: 1.75rem 1.25rem 2rem 3rem;
        height: 60%;
    }

    .hs-timeline {
        left: 0.6rem;
    }

    .hs-tdot {
        width: 7px;
        height: 7px;
    }

    .hs-tdot.active {
        width: 9px;
        height: 9px;
    }

    .history-scroll.hs-video-active .hs-panel-left {
        height: 44%;
        padding: 1rem 1rem 1.15rem 2.6rem;
    }

    .history-scroll.hs-video-active .hs-video-embed {
        padding: 0.75rem 0.75rem calc(44% + 0.75rem);
    }
}
