﻿/* Upper Floor only: measurements follow the 1440 x 900 Figma chapters. */
.qhuf-page {
    --qhuf-bg: #0F0E0C;
    --qhuf-title: #F3E5C8;
    --qhuf-body: #E2DAD1;
    --qhuf-gold: #E6C587;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: clip;
    background: var(--qhuf-bg);
    color: var(--qhuf-body);
    font-family: 'Inter', Arial, sans-serif;
}

    .qhuf-page *, .qhuf-page *::before, .qhuf-page *::after {
        box-sizing: border-box;
    }
    /* The next full-screen chapter rises over the one already being read. */
    .qhuf-page .qhuf-deck {
        position: relative;
        overflow: visible;
    }

    .qhuf-page .qhuf-hero-boundary {
        position: absolute;
        top: 0;
        left: 0;
        width: 1px;
        height: var(--qhuf-first-height, 100svh);
        pointer-events: none;
    }

    .qhuf-page .qhuf-chapter {
        --heading-height: 160px;
        --nav-space: 0px;
        position: sticky;
        top: var(--qhuf-stick-top, 0px);
        z-index: var(--qhuf-layer, 1);
        overflow: hidden;
        isolation: isolate;
        min-width: 0;
        min-height: 100vh;
        min-height: 100svh;
        /* Keep a warm dark base behind each photograph during loading. */
        background-color: #12110F;
        /* Let the browser paint normally instead of keeping six large GPU layers. */
        will-change: auto;
        transform: none;
        filter: none;
    }
        /* Only the chapter currently being covered needs the depth treatment. */
        .qhuf-page .qhuf-chapter.has-depth {
            transform-origin: 50% 0;
            transform: scale(var(--qhuf-depth-scale, 1));
            filter: brightness(var(--qhuf-depth-light, 1)) blur(var(--qhuf-depth-blur, 0px));
        }

        .qhuf-page .qhuf-chapter[data-first-chapter] {
            --nav-space: 80px;
        }

    /* Full-bleed photograph and the two Figma vignettes. */
    .qhuf-page .qhuf-photo, .qhuf-page .qhuf-vignette {
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .qhuf-page .qhuf-photo {
        z-index: 0;
        overflow: hidden;
        background-color: #12110F;
        background-image: none;
        opacity: 1;
        visibility: visible;
        transition: none;
    }
        /* Eager photographs stay painted behind the text, without fade or lazy swaps. */
        .qhuf-page .qhuf-photo > .qhuf-background-image {
            position: absolute;
            inset: 0;
            display: block;
            width: 100%;
            height: 100%;
            max-width: none;
            object-fit: cover;
            object-position: center;
            opacity: 1;
            visibility: visible;
            transition: none;
            transform: none;
            filter: none;
            box-shadow: none;
        }

    .qhuf-page .qhuf-vignette {
        z-index: 1;
        background: linear-gradient(180deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.82) 20%, transparent 42%), linear-gradient(90deg, transparent 0%, transparent 22%, rgba(0,0,0,.8) 37%, rgba(0,0,0,.84) 100%);
    }

    .qhuf-page .qhuf-chapter--portrait .qhuf-photo {
        left: -5.555556%;
        right: auto;
        width: 41.666667%;
    }

        .qhuf-page .qhuf-chapter--portrait .qhuf-photo::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(90deg, transparent 65%, var(--qhuf-bg));
        }

    /* At 1440px: 80px inset, 440px title, 60px gap, 860px story viewport. */
    .qhuf-page .qhuf-stage {
        position: relative;
        /* Text stays above the always-visible photograph and dark overlay. */
        z-index: 2;
        display: grid;
        grid-template-columns: 32.352941% minmax(0, 1fr);
        column-gap: 4.411765%;
        align-items: start;
        min-height: 100svh;
        padding: var(--nav-space) 0 72px 5.555556%;
    }

    .qhuf-page .qhuf-title {
        margin: 0;
        padding: 60px 0 0;
        color: var(--qhuf-title);
        font: 700 32px/40px 'Playfair Display', Georgia, serif;
        letter-spacing: 0;
        overflow-wrap: break-word;
    }

    .qhuf-page .qhuf-chapter[data-first-chapter] .qhuf-title {
        padding-top: 20px;
    }

    .qhuf-page .qhuf-title > span {
        display: block;
    }

    .qhuf-page .qhuf-number {
        color: var(--qhuf-gold);
    }

    .qhuf-page .qhuf-hairline {
        position: absolute;
        top: calc(var(--nav-space) + var(--heading-height));
        left: 0;
        right: 0;
        height: 1px;
        background: var(--qhuf-body);
        pointer-events: none;
        z-index: 3;
    }

    /* Only the story rail moves; the chapter title remains anchored on the left. */
    .qhuf-page .qhuf-viewport {
        min-width: 0;
        max-width: 100%;
        container-type: inline-size;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        touch-action: pan-x pan-y pinch-zoom;
        cursor: grab;
    }

        .qhuf-page .qhuf-viewport::-webkit-scrollbar {
            display: none;
        }

        .qhuf-page .qhuf-viewport:focus-visible {
            outline: 1px solid var(--qhuf-gold);
            outline-offset: -3px;
        }

        .qhuf-page .qhuf-viewport.is-moving,
        .qhuf-page .qhuf-viewport.is-dragging {
            scroll-snap-type: none;
        }

        .qhuf-page .qhuf-viewport.is-dragging {
            cursor: grabbing;
            user-select: none;
        }

        .qhuf-page .qhuf-viewport.is-static {
            cursor: auto;
        }

    .qhuf-page .qhuf-track {
        --panel-width: 65.116279cqw;
        display: flex;
        gap: 9.302326cqw;
        width: max-content;
        padding-right: calc(100cqw - var(--panel-width));
        box-sizing: content-box;
    }

    .qhuf-page .qhuf-panel {
        flex: 0 0 var(--panel-width);
        width: var(--panel-width);
        min-width: 0;
        margin: 0;
        padding: 0;
        opacity: var(--panel-opacity, .35);
        scroll-snap-align: start;
    }

    .qhuf-page .qhuf-panel-heading {
        min-height: var(--heading-height);
        margin: 0;
        padding: 62px 0 20px;
    }

        .qhuf-page .qhuf-panel-heading h3 {
            margin: 0;
            color: var(--qhuf-title);
            font: 400 28px/36px 'Playfair Display', Georgia, serif;
            letter-spacing: 0;
            overflow-wrap: break-word;
        }

    .qhuf-page .qhuf-panel-body {
        padding-top: 48px;
    }

        .qhuf-page .qhuf-panel-body p {
            margin: 0;
            color: var(--qhuf-body);
            font: 400 18px/30px 'Inter', Arial, sans-serif;
            letter-spacing: 0;
            overflow-wrap: break-word;
            white-space: normal;
            hyphens: none;
        }

    /* Only the editorial text fades in; photographs never join this animation. */
    .qhuf-page .qhuf-stage {
        opacity: 1;
        transform: none;
        transition: opacity 700ms ease, transform 700ms cubic-bezier(.22,1,.36,1);
    }

    .qhuf-page.is-enhanced .qhuf-chapter:not(.is-visible) .qhuf-stage {
        opacity: 0;
        transform: translateY(24px);
    }

    .qhuf-page :is(h2, h3, p) {
        text-decoration: none;
        text-shadow: none;
        filter: none;
    }

    .qhuf-page .qhuf-footer {
        position: relative;
        z-index: 7;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 18px;
        padding: 30px clamp(22px, 6vw, 100px);
        background: #15120F;
        border-top: 1px solid #55462F;
    }

        .qhuf-page .qhuf-footer a {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 44px;
            padding: 12px 22px;
            border: 1px solid #C9A871;
            border-radius: 28px;
            color: #F3DFB9;
            font: 500 13px/1.4 Arial, sans-serif;
            text-decoration: none;
        }

            .qhuf-page .qhuf-footer a:focus-visible {
                outline: 2px solid var(--qhuf-gold);
                outline-offset: 4px;
            }

@media (min-width: 761px) and (max-width: 1100px) {
    .qhuf-page .qhuf-title {
        font-size: 26px;
        line-height: 34px;
    }

    .qhuf-page .qhuf-panel-heading h3 {
        font-size: 24px;
        line-height: 32px;
    }

    .qhuf-page .qhuf-panel-body p {
        font-size: 16px;
        line-height: 28px;
    }
}

@media (max-width: 760px) {
    .qhuf-page .qhuf-chapter {
        --heading-height: 116px;
    }

        .qhuf-page .qhuf-chapter[data-first-chapter] {
            --nav-space: 84px;
        }

    .qhuf-page .qhuf-stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding-left: 22px;
        padding-bottom: 56px;
    }

    .qhuf-page .qhuf-title,
    .qhuf-page .qhuf-chapter[data-first-chapter] .qhuf-title {
        padding: 24px 22px 28px 0;
        font-size: 28px;
        line-height: 36px;
    }

    .qhuf-page .qhuf-viewport {
        background-image: linear-gradient(var(--qhuf-body), var(--qhuf-body));
        background-size: 100% 1px;
        background-position: 0 var(--heading-height);
        background-repeat: no-repeat;
    }

    .qhuf-page .qhuf-track {
        --panel-width: 82cqw;
        gap: 6cqw;
    }

    .qhuf-page .qhuf-panel-heading {
        padding-top: 20px;
    }

        .qhuf-page .qhuf-panel-heading h3 {
            font-size: 24px;
            line-height: 32px;
        }

    .qhuf-page .qhuf-panel-body {
        padding-top: 28px;
    }

        .qhuf-page .qhuf-panel-body p {
            font-size: 16px;
            line-height: 28px;
        }

    .qhuf-page .qhuf-hairline {
        display: none;
    }

    .qhuf-page .qhuf-vignette {
        background: linear-gradient(180deg, rgba(0,0,0,.78), rgba(0,0,0,.84));
    }

    .qhuf-page .qhuf-chapter--portrait .qhuf-photo {
        left: 0;
        width: 100%;
    }

    .qhuf-page .qhuf-footer {
        flex-direction: column;
        align-items: stretch;
    }
}
/* With less motion requested, read chapters normally without sticky depth effects. */
@media (prefers-reduced-motion: reduce) {
    .qhuf-page .qhuf-chapter, .qhuf-page .qhuf-chapter.has-depth {
        position: relative;
        top: auto;
        transform: none;
        filter: none;
    }

    .qhuf-page .qhuf-stage {
        transition: none;
    }

    .qhuf-page.is-enhanced .qhuf-chapter:not(.is-visible) .qhuf-stage {
        opacity: 1;
        transform: none;
    }
}
