/*
 * Ferdinand, temporary page: the photo and the animation of "Wake up in a park. Soon."
 * Layout and colours are Tailwind classes in index.html; this file holds the sizes that follow the screen and the motion.
 *
 * Motion, in order:
 * 1. The photo settles in (a slow zoom out and fade in).
 * 2. The three lines of the headline rise one after the other out of a mask; "Soon." waits a beat longer.
 * 3. "Open in" fades in and the oval around 2027 opens like an eye waking up, then blinks now and then.
 * 4. The logo and ferdinand.gent fade in.
 * With "reduce motion" everything is in place right away.
 */

:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* The headline fills about half the width, like the banner; on narrow, upright screens it takes the full width. */
.headline {
    font-size: min(23vw, 14svh);
    line-height: 0.88;
}

@media (min-width: 40rem) {
    .headline {
        font-size: min(13vw, 19svh);
    }
}

/* The size of "Open in"; 2027 is 2.9 times as large. */
.opening {
    font-size: min(5vw, 3.2svh);
}

@media (min-width: 40rem) {
    .opening {
        font-size: min(2.6vw, 4.2svh);
    }
}

/* 1. The photo */
.photo {
    animation: settle 2.8s var(--ease-out) both;
}

@keyframes settle {
    from {
        opacity: 0;
        transform: scale(1.06);
    }
}

/* 2. The headline: each line is a mask with its text rising inside it. The padding keeps the tops of the letters in view. */
.reveal {
    display: block;
    overflow: clip;
    padding-block: 0.06em;
    margin-block: -0.06em;
}

.reveal > span {
    display: block;
    animation: rise 1.2s var(--ease-out) both;
    animation-delay: calc(0.35s + var(--i) * 0.16s);
}

.reveal--late > span {
    animation-delay: 1.05s;
}

@keyframes rise {
    from {
        transform: translateY(105%);
    }
}

/* 3 and 4. Fade in after the delay in --d. */
.fade {
    animation: fade 1s ease-out both;
    animation-delay: var(--d, 0s);
}

@keyframes fade {
    from {
        opacity: 0;
    }
}

/* The oval opens (as an eyelid, from a line to the full oval), then blinks once every 7 seconds. */
.eye {
    transform-origin: center;
    animation:
        eye-open 0.9s var(--ease-out) 1.7s both,
        eye-blink 7s ease-in-out 4s infinite;
}

@keyframes eye-open {
    from {
        transform: scaleY(0.04);
    }
}

@keyframes eye-blink {
    0%,
    94%,
    100% {
        transform: scaleY(1);
    }
    97% {
        transform: scaleY(0.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .photo,
    .reveal > span,
    .fade,
    .eye {
        animation: none;
    }
}
