*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --gutter: clamp(1.25rem, 4vw, 3rem);
    /* Heights of the sticky title bar and umbrella strip on mobile and tablet */
    --title-h: clamp(3.5rem, 14vw, 5rem);
    --visual-h: clamp(140px, 26vh, 240px);
    /* Viewport offset where paragraphs come to rest while they are in focus */
    --read-gap: 4vh;
    --read-top: calc(var(--title-h) + var(--visual-h) + var(--read-gap));
    /* Each text section owns one step. The step height gives the page its scroll range */
    --step-h: 100vh;
}

@supports (height: 1svh) {
    :root {
        --visual-h: clamp(140px, 26svh, 240px);
    }
}

body {
    margin: 0;
    background-color: #0b0b18;
    color: #fff;
    font-family: 'Poppins', sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url(./background.webp) center / cover no-repeat;
}

.stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 0 var(--gutter);
}

/* Title */

.masthead {
    display: flex;
    align-items: center;
    height: var(--title-h);
}

.title {
    display: inline-block;
    margin: 0;
    padding-right: 0.15em;
    background: linear-gradient(to right, #1988CD 0%, #6B3894 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: #1988CD;
    -webkit-text-fill-color: transparent;
    font-size: clamp(1.5rem, 7.5vw, 2.75rem);
    font-style: italic;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

/* Umbrella */

.visual {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--visual-h);
}

.umbrella-reveal {
    height: 100%;
    max-width: 100%;
    aspect-ratio: 764 / 603;
}

.umbrella-art {
    position: relative;
    width: 100%;
    height: 100%;
    /* Clips the transparent corners of the rotating image, not the artwork */
    overflow: hidden;
}

.umbrellas-navy {
    display: block;
    width: 100%;
    height: 100%;
}

/* Placed so its hub sits on the hub of the umbrella in the artwork below */
.umbrella-red {
    position: absolute;
    top: 6.25%;
    left: 25.94%;
    width: 71.57%;
    height: auto;
    transform-origin: 49.89% 51.07%;
}

/* Text */

.copy {
    padding: var(--read-gap) 0 4rem;
}

.step + .step {
    margin-top: 3rem;
}

.section {
    max-width: 30em;
    font-size: clamp(1.125rem, 0.95rem + 0.9vw, 1.75rem);
}

.section h2 {
    margin: 0 0 0.4em;
    color: #1988CD;
    font-size: 1.2em;
    font-style: italic;
    font-weight: 800;
    line-height: 1.25;
}

.section p {
    margin: 0;
    line-height: 1.6;
    letter-spacing: 0.5px;
}

/* Animated mode. Without it the page is a compact, plain document: nothing is
   sticky on small screens, so text never passes under the title or the umbrella. */

.anim .copy {
    padding-bottom: 0;
}

.anim .step {
    height: var(--step-h);
    margin-top: 0;
}

.intro-pending .title,
.intro-pending .umbrella-reveal {
    opacity: 0;
}

.spin .masthead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.spin .visual {
    position: sticky;
    top: var(--title-h);
    z-index: 1;
}

.spin .section {
    position: sticky;
    top: var(--read-top);
}

/* Scroll cue */

.scroll-cue {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    z-index: 2;
    margin: 0;
    padding: 0.4rem 0.9rem;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background-color: rgba(11, 11, 24, 0.7);
    color: #cfe6f7;
    font-size: 0.8rem;
    letter-spacing: 1px;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.scroll-cue::after {
    content: "";
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    margin-left: 0.6em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.2em) rotate(45deg);
}

.spin .scroll-cue {
    display: block;
}

.spin.scrolled .scroll-cue {
    opacity: 0;
}

/* Desktop: title and text on the left, umbrella sticky on the right */

@media (min-width: 992px) {
    :root {
        --title-h: calc(var(--gutter) + 5rem);
        --read-top: max(30vh, calc(var(--title-h) + 2.5rem));
    }

    .stage {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
        column-gap: var(--gutter);
        align-items: start;
    }

    .masthead {
        grid-area: 1 / 1;
        align-items: flex-end;
    }

    .title {
        font-size: clamp(2.5rem, 4.4vw, 4rem);
    }

    .visual,
    .spin .visual {
        grid-area: 1 / 2;
        position: sticky;
        top: 0;
        height: 100vh;
        padding: var(--gutter) 0;
    }

    .umbrella-reveal {
        width: min(100%, 540px, (100vh - 2 * var(--gutter)) * 764 / 603);
        height: auto;
    }

    .copy {
        grid-area: 1 / 1;
        padding-top: var(--read-top);
    }
}
