/*
 * Mark Fry: holding page
 *
 * The site's wordmark writes itself letter by letter, then the footer beads
 * are strung beneath it. Nothing moves for visitors who prefer reduced motion.
 */

@font-face {
    font-display: swap;
    font-family: "Libre Baskerville";
    font-style: normal;
    font-weight: 400;
    src: url("fonts/libre-baskerville-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Libre Baskerville";
    font-style: italic;
    font-weight: 400;
    src: url("fonts/libre-baskerville-latin-400-italic.woff2") format("woff2");
}

:root {
    --ink: #1b1817;
    --muted: #5f5955;
    --oxblood: #5a1b15;
    --plum: #66173a;
    --rule: #c9bfb7;
    --paper: #fff;
    --ease-out: cubic-bezier(.2, .7, .2, 1);
}

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

html {
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    background-color: var(--paper);
}

body {
    color: var(--ink);
    display: grid;
    font-family: "Libre Baskerville", Baskerville, Georgia, serif;
    font-size: 1.0625rem;
    grid-template-rows: 1fr auto;
    line-height: 1.75;
    min-height: 100vh;
    min-height: 100dvh;
}

.holding {
    align-content: center;
    display: grid;
    justify-items: center;
    padding: 3rem clamp(1.25rem, 5vw, 4rem);
    text-align: center;
}

.holding__title {
    color: var(--oxblood);
    font-size: clamp(3.25rem, 11vw, 7rem);
    line-height: 1;
}

.wordmark {
    display: block;
    height: 1.13em;
    overflow: visible;
    width: auto;
}

.wordmark path {
    fill: currentColor;
    stroke: currentColor;
    stroke-dasharray: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-opacity: 0;
    stroke-width: 22;
}

.beads {
    height: auto;
    margin: clamp(1.75rem, 4vw, 2.5rem) 0 clamp(1.75rem, 4vw, 2.75rem);
    overflow: visible;
    width: min(15rem, 60vw);
}

.beads__string {
    stroke: var(--rule);
    stroke-dasharray: 1;
    stroke-width: 1;
}

.beads__bead {
    transform-box: fill-box;
    transform-origin: center;
}

.beads__bead--teal { fill: #1aa3c3; }
.beads__bead--green { fill: #19a676; }
.beads__bead--yellow { fill: #c3a600; }
.beads__bead--pink { fill: #d75c82; }
.beads__bead--slate { fill: #34485c; }

.holding__lede {
    color: var(--plum);
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    font-style: italic;
    letter-spacing: .01em;
    line-height: 1.4;
}

.holding__note {
    color: var(--muted);
    margin-top: 1rem;
    max-width: 30rem;
}

.holding__note a {
    color: var(--ink);
    text-decoration-color: var(--rule);
    text-decoration-thickness: 1px;
    text-underline-offset: .25em;
    transition: color .2s, text-decoration-color .2s;
}

.holding__note a:hover {
    color: var(--plum);
    text-decoration-color: currentColor;
}

a:focus-visible {
    border-radius: 2px;
    outline: 3px solid var(--plum);
    outline-offset: 3px;
}

.holding__footer {
    color: var(--muted);
    font-size: .875rem;
    padding: 0 1.25rem 1.75rem;
    text-align: center;
}

/*
 * The entrance: the wordmark writes itself, the thread is drawn, the beads
 * pop on, then the words fade up. A slow wave keeps passing along the beads.
 */

@media (prefers-reduced-motion: no-preference) {
    .wordmark path {
        animation: write 1s cubic-bezier(.45, .1, .3, 1) both;
        animation-delay: calc(var(--n) * 140ms + 250ms);
    }

    .beads__string {
        animation: draw 1s var(--ease-out) 1.4s both;
    }

    .beads__bead {
        animation:
            pop .6s cubic-bezier(.3, 1.7, .5, 1) calc(var(--n) * 75ms + 1.7s) both,
            bob 6s ease-in-out calc(var(--n) * 130ms + 3.2s) infinite;
    }

    .holding__lede,
    .holding__note,
    .holding__footer {
        animation: rise .8s var(--ease-out) both;
    }

    .holding__lede { animation-delay: 2.3s; }
    .holding__note { animation-delay: 2.5s; }
    .holding__footer { animation-delay: 2.7s; }
}

@keyframes write {
    0% {
        fill-opacity: 0;
        stroke-dashoffset: 1;
        stroke-opacity: 1;
    }
    45% {
        fill-opacity: 0;
    }
    70% {
        stroke-dashoffset: 0;
        stroke-opacity: 1;
    }
    100% {
        fill-opacity: 1;
        stroke-dashoffset: 0;
        stroke-opacity: 0;
    }
}

@keyframes draw {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

@keyframes pop {
    from {
        opacity: 0;
        scale: 0;
    }
    to {
        opacity: 1;
        scale: 1;
    }
}

@keyframes bob {
    0%,
    16%,
    100% { translate: 0 0; }
    8% { translate: 0 -3px; }
}

@keyframes rise {
    from {
        opacity: 0;
        translate: 0 .6rem;
    }
}
