/* The story uses the existing Refactia palette, font and primary button. */
.landing-page-wrapper:has(.rf-story) {
    overflow-x: clip;
}

/* Keep navigation over the film; its normal surface returns with the final scene. */
.landing-page-wrapper:has(.rf-story) .navbar-showcase.is-story {
    background: transparent;
    backdrop-filter: none;
    border-bottom-color: transparent;
    box-shadow: none;
}

.landing-page-wrapper:has(.rf-story) .navbar-showcase.is-story .logo-text,
.landing-page-wrapper:has(.rf-story) .navbar-showcase.is-story .nav-links a {
    color: #eaf0ff;
    text-shadow: 0 1px 8px #070a12, 0 1px 3px #070a12;
}

.landing-page-wrapper:has(.rf-story) .navbar-showcase.is-story .nav-links a:hover {
    color: var(--primary);
}

.landing-page-wrapper:has(.rf-story) .navbar-showcase.is-story .btn-secondary {
    background: rgba(7, 10, 18, .64);
    color: #eaf0ff;
    border-color: rgba(255, 255, 255, .14);
}

.rf-story {
    --story-final: 1;
    --story-brand: 1;
    --story-progress: 1;
    --story-gutter: clamp(24px, 4.5vw, 80px);
    position: relative;
    background: #070a12;
    color: #eaf0ff;
}

.rf-story.is-enhanced {
    height: 340svh;
}

.rf-story__stage {
    position: sticky;
    top: 0;
    height: 100svh;
    min-height: 680px;
    overflow: hidden;
    isolation: isolate;
}

.rf-story__media,
.rf-story__video,
.rf-story__poster,
.rf-story__shade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.rf-story__media {
    z-index: -1;
    pointer-events: none;
}

.rf-story__loading {
    position: absolute;
    z-index: 5;
    right: var(--story-gutter);
    bottom: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: calc(100% - 2 * var(--story-gutter));
    color: #eaf0ff;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    pointer-events: none;
}

.rf-story__loading-card {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 50px;
    background: rgba(7, 10, 18, .64);
}

.rf-story__spinner {
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid rgba(234, 240, 255, .25);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rf-story-loading .8s linear infinite;
}

@keyframes rf-story-loading {
    to { transform: rotate(360deg); }
}

.rf-story__video,
.rf-story__poster {
    object-fit: cover;
    object-position: 38% center;
}

.rf-story__video {
    opacity: 0;
}

.rf-story.is-enhanced .rf-story__video--intro {
    opacity: 1;
}

.rf-story.is-looping .rf-story__video--loop {
    opacity: 1;
}

.rf-story.is-static .rf-story__video--intro {
    opacity: 0;
}

.rf-story__shade--dark {
    background: linear-gradient(90deg, rgba(7, 10, 18, .06) 20%, rgba(7, 10, 18, .38) 49%, rgba(7, 10, 18, .84) 100%);
    opacity: calc(1 - var(--story-final));
}

.rf-story__shade--light {
    background: linear-gradient(90deg, transparent 25%, rgba(249, 250, 251, .68) 57%, rgba(249, 250, 251, .97) 100%);
    opacity: var(--story-final);
}

/* Let the final office frame dissolve into the presentation below. */
.rf-story__shade--light::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: clamp(56px, 10svh, 96px);
    background: linear-gradient(transparent, var(--bg-light));
}

.rf-story__copy {
    position: absolute;
    top: calc(50% + var(--showcase-nav-height, 80px) / 3);
    right: var(--story-gutter);
    width: min(46%, 640px);
    display: grid;
    transform: translateY(-50%);
}

.rf-story__scene {
    grid-area: 1 / 1;
    align-self: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    will-change: opacity, transform;
}

.rf-story__scene--final {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    color: var(--text-main);
}

.rf-story__eyebrow {
    margin: 0 0 24px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.rf-story__title {
    margin: 0 0 24px;
    font-size: clamp(44px, 5.2vw, 80px);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -.055em;
    text-wrap: balance;
}

.rf-story__title span {
    color: var(--primary);
}

.rf-story__scene--final .rf-story__title {
    font-size: clamp(34px, 3.7vw, 60px);
}

.rf-story__scene--final .rf-story__title span {
    color: #347a76;
}

.rf-story__scene--final .rf-story__eyebrow {
    margin-bottom: 12px;
    letter-spacing: .08em;
}

.rf-story__description {
    max-width: 40ch;
    margin: 0;
    font-size: clamp(15px, 1.2vw, 18px);
    line-height: 1.6;
    text-wrap: pretty;
}

.rf-story__brand {
    margin: 0 0 28px;
    font-size: clamp(28px, 2.4vw, 38px);
    font-weight: 800;
    letter-spacing: -.04em;
    opacity: var(--story-brand);
    transform: translateY(calc((1 - var(--story-brand)) * 22px));
    will-change: opacity, transform;
}

.rf-story__brand span {
    color: #347a76;
}

.rf-story__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 28px;
}

.rf-story__text-link {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    text-underline-offset: 5px;
}

.rf-story__text-link span {
    margin-left: 5px;
}

.rf-story__proof {
    position: absolute;
    left: var(--story-gutter);
    bottom: 64px;
    display: grid;
    gap: 8px;
    width: clamp(160px, 17vw, 240px);
}

.rf-story__proof img {
    display: block;
    width: 100%;
    height: auto;
}

.rf-story__proof > span {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 8px #070a12, 0 1px 3px #070a12;
}

body:has(.showcase-launch-banner) .rf-story {
    --story-controls-offset: 84px;
}

.rf-story__controls {
    position: absolute;
    top: calc(var(--showcase-nav-height, 80px) + var(--story-controls-offset, 24px));
    right: var(--story-gutter);
}

.rf-story__control,
.rf-story__scroll {
    border: 0;
    padding: 10px 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.rf-story.is-final .rf-story__control,
.rf-story.is-final .rf-story__scroll,
.rf-story:not(.is-enhanced) .rf-story__control {
    color: var(--text-main);
}

.rf-story__control:hover,
.rf-story__text-link:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.rf-story__control {
    padding: 8px 12px;
    border-radius: 50px;
    background: rgba(7, 10, 18, .64);
}

.rf-story.is-final .rf-story__control {
    background: rgba(249, 250, 251, .94);
}

.rf-story__control:focus-visible,
.rf-story__scroll:focus-visible,
.rf-story__text-link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 6px;
}

.rf-story__scroll {
    position: absolute;
    right: var(--story-gutter);
    bottom: 22px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.rf-story__arrow {
    font-size: 24px;
    line-height: 1;
}

.rf-story [hidden] {
    display: none;
}

.rf-story__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, .16);
}

.rf-story__progress span {
    display: block;
    height: 100%;
    background: var(--primary);
    transform: scaleX(var(--story-progress));
    transform-origin: left;
}

#refactia-presentation {
    scroll-margin-top: calc(var(--showcase-nav-height, 80px) + 20px);
}

@media (max-width: 767px) {
    .rf-story {
        --story-gutter: 24px;
    }

    .rf-story.is-enhanced {
        height: 310svh;
    }

    .rf-story__stage {
        min-height: 640px;
    }

    .rf-story__video,
    .rf-story__poster {
        height: 65%;
        object-position: center bottom;
    }

    .rf-story__shade--dark {
        background: linear-gradient(180deg, rgba(7, 10, 18, .1) 20%, rgba(7, 10, 18, .42) 45%, rgba(7, 10, 18, .96) 100%);
    }

    .rf-story__shade--light {
        background: linear-gradient(180deg, transparent 16%, rgba(249, 250, 251, .72) 39%, #f9fafb 68%);
    }

    .rf-story__copy {
        top: auto;
        bottom: 178px;
        right: var(--story-gutter);
        left: var(--story-gutter);
        width: auto;
        transform: none;
    }

    .rf-story__title {
        font-size: clamp(42px, 11vw, 62px);
        margin-bottom: 18px;
    }

    .rf-story__scene--final .rf-story__title {
        font-size: clamp(30px, 8.2vw, 44px);
        line-height: 1.07;
    }

    .rf-story__eyebrow {
        font-size: 10px;
        margin-bottom: 16px;
    }

    .rf-story__brand {
        margin-bottom: 14px;
        font-size: 22px;
    }

    .rf-story__description {
        font-size: 14px;
        line-height: 1.5;
    }

    .rf-story__actions {
        gap: 14px;
        margin-top: 20px;
    }

    .rf-story__actions .btn {
        padding: 12px 18px;
        font-size: 13px;
    }

    .rf-story__text-link {
        font-size: 12px;
    }

    .rf-story__proof {
        width: 150px;
        bottom: 64px;
    }

    .rf-story__proof > span {
        font-size: 9px;
    }

    .rf-story.is-final .rf-story__proof > span,
    .rf-story:not(.is-enhanced) .rf-story__proof > span {
        color: var(--text-muted);
        text-shadow: none;
    }

    .rf-story__scroll {
        bottom: 13px;
        left: var(--story-gutter);
        justify-content: space-between;
    }
}

@media (max-height: 680px) and (min-width: 768px) {
    .rf-story__stage {
        min-height: 580px;
    }

    .rf-story__copy {
        top: 55%;
    }

    .rf-story__scene--final .rf-story__title {
        font-size: 36px;
    }

    .rf-story__brand {
        margin-bottom: 12px;
        font-size: 26px;
    }

    .rf-story__proof {
        width: 170px;
    }
}

@media (max-width: 767px) and (max-height: 740px) {
    .rf-story__copy {
        bottom: 155px;
    }

    .rf-story__scene--final .rf-story__title {
        font-size: 30px;
        margin-bottom: 14px;
    }

    .rf-story__description {
        font-size: 13px;
    }

    .rf-story__actions {
        margin-top: 16px;
        gap: 10px;
    }

    .rf-story__proof {
        width: 125px;
        bottom: 55px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rf-story__spinner {
        animation: none;
    }

    .rf-story.is-enhanced {
        height: auto;
    }

    .rf-story__scene {
        will-change: auto;
    }
}
