/* THE VEIL — IMMERSIVE EDITION */

:root {
    --bg: #090909;
    --ivory: #eeeae2;
    --muted: rgba(238, 234, 226, 0.48);
    --champagne: #bda97b;
    --display: "Bodoni Moda", serif;
    --body: "Manrope", sans-serif;
    --ease: cubic-bezier(.16, 1, .3, 1);
}

/* RESET */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ivory);
    font-family: var(--body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* MAIN */

.invitation {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    isolation: isolate;
    background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.035), transparent 42%), var(--bg);
}

/* ATMOSPHERE */

.ambient {
    position: absolute;
    width: 45vw;
    height: 45vw;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(120px);
    opacity: .09;
    z-index: -2;
    animation: ambientFloat 14s ease-in-out infinite;
}

.ambient-one {
    top: -20%;
    left: -15%;
    background: #c4a86d;
}

.ambient-two {
    right: -15%;
    bottom: -20%;
    background: #77717c;
    animation-delay: -7s;
}

@keyframes ambientFloat {
    0%,
    100% {
        transform: translate3d(0,0,0) scale(1);
    }

    50% {
        transform: translate3d(4%,-3%,0) scale(1.08);
    }
}

/* SPOTLIGHT */

.spotlight {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: .55;
    background: radial-gradient(circle 260px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,.045), transparent 70%);
    transition: opacity .8s ease;
}

/* INTRO */

.intro {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    pointer-events: none;
    animation: introExit 1.6s ease forwards;
    animation-delay: 2.8s;
}

.intro-content {
    text-align: center;
    animation: introBreath 4s ease-in-out infinite;
}

.intro-mark {
    width: 36px;
    margin: 0 auto 25px;
    color: var(--champagne);
    opacity: 0;
    animation: introElement 1.4s var(--ease) forwards;
}

.intro-mark svg {
    width: 100%;
    display: block;
}

.intro-label {
    color: rgba(238,234,226,.65);
    font-size: 8px;
    font-weight: 400;
    letter-spacing: .42em;
    line-height: 2.2;
    opacity: 0;
    animation: introElement 1.4s var(--ease) forwards;
    animation-delay: .25s;
}

.intro-label + .intro-label {
    animation-delay: .45s;
}

@keyframes introElement {
    from {
        opacity: 0;
        transform: translateY(14px) blur(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0) blur(0);
    }
}

@keyframes introBreath {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes introExit {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* ENVELOPE STAGE */

.envelope-stage {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 30px;
    transition: opacity 1.4s ease;
}

.envelope-button {
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.envelope-button:focus-visible {
    outline: 1px solid rgba(189,169,123,.7);
    outline-offset: 14px;
}

/* ENVELOPE OBJECT */

.envelope {
    position: relative;
    width: min(78vw, 370px);
    aspect-ratio: 1.5;
    transform-style: preserve-3d;
    perspective: 1200px;
    transition: transform 1.2s var(--ease);
}

.envelope::after {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: -30px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,.8);
    filter: blur(20px);
    transition: transform 1.2s var(--ease), opacity .8s ease;
}

.envelope-button:hover .envelope {
    transform: translateY(-9px) rotateX(2deg);
}

.envelope-button:hover .envelope::after {
    transform: scale(.85);
    opacity: .7;
}

/* LETTER */

.letter {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 3%;
    height: 92%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    background: linear-gradient(145deg, #f1eee7, #dcd6ca);
    color: #24221e;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    transform: translateZ(1px);
    transition: transform 1.25s var(--ease);
}

.letter::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .16;
    pointer-events: none;
    background-image: radial-gradient(rgba(0,0,0,.35) .4px, transparent .5px);
    background-size: 4px 4px;
    mix-blend-mode: multiply;
}

.letter-mark {
    width: 32px;
    color: #806b45;
}

.letter-mark svg {
    width: 100%;
}

.letter-title {
    font-family: var(--display);
    font-size: 17px;
    letter-spacing: .28em;
    text-transform: uppercase;
}

/* FRONT */

.envelope-front {
    position: absolute;
    inset: 0;
    z-index: 3;
    overflow: hidden;
    background: linear-gradient(145deg, #302c27, #171615);
}

/* FOLDS */

.envelope-fold {
    position: absolute;
    inset: 0;
    opacity: .9;
}

.envelope-fold.left {
    background: linear-gradient(135deg, transparent 49.4%, rgba(255,255,255,.045) 49.7%, transparent 50%);
}

.envelope-fold.right {
    transform: scaleX(-1);
    background: linear-gradient(135deg, transparent 49.4%, rgba(255,255,255,.035) 49.7%, transparent 50%);
}

.envelope-fold.bottom {
    background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.28));
    clip-path: polygon(0 100%, 50% 34%, 100% 100%);
}

/* FLAP */

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 65%;
    z-index: 5;
    transform-origin: top center;
    background: linear-gradient(145deg, #39342e, #201e1b);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transition: transform 1.3s var(--ease);
}

/* SEAL */

.wax-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    color: #211d16;
    background: radial-gradient(circle at 35% 30%, #d2bc8c, #806b43);
    box-shadow: 0 9px 28px rgba(0,0,0,.5), inset 0 1px 2px rgba(255,255,255,.3);
    transition: transform .9s var(--ease), opacity .5s ease;
}

.wax-seal svg {
    width: 70%;
    animation: sealBreath 4s ease-in-out infinite;
}

@keyframes sealBreath {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.035);
    }
}

/* OPEN LABEL */

.open-label {
    color: rgba(238,234,226,.48);
    font-size: 8px;
    letter-spacing: .38em;
    transition: color .4s ease, transform .4s ease;
}

.envelope-button:hover .open-label {
    color: var(--champagne);
    transform: translateY(-3px);
}

/* OPENING STATE */

.envelope-button.is-opening {
    pointer-events: none;
}

.envelope-button.is-opening .envelope {
    transform: translateY(8px) scale(.985);
}

.envelope-button.is-opening .envelope-flap {
    transform: rotateX(180deg);
}

.envelope-button.is-opening .wax-seal {
    transform: translate(-50%, -50%) scale(.15) rotate(30deg);
    opacity: 0;
}

.envelope-button.is-opening .letter {
    transform: translateY(-35%) translateZ(20px);
}

.envelope-button.is-opening .open-label {
    opacity: 0;
}

/* REVEAL */

.reveal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.035);
    background: radial-gradient(circle at center, rgba(255,255,255,.035), transparent 50%), var(--bg);
    transition: opacity 1.6s ease, transform 2s var(--ease), visibility 1.6s;
}

.reveal.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* REVEAL CONTENT */

.reveal-content {
    width: min(90vw, 700px);
    text-align: center;
    opacity: 0;
    transform: translateY(35px);
    transition: opacity 1.5s ease .35s, transform 1.5s var(--ease) .35s;
}

.reveal.is-visible .reveal-content {
    opacity: 1;
    transform: translateY(0);
}

/* MARK */

.reveal-mark {
    width: 32px;
    margin: 0 auto 27px;
    color: var(--champagne);
    opacity: .85;
}

.reveal-mark svg {
    width: 100%;
}

/* SMALL TEXT */

.reveal-small {
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: .42em;
}

/* NAMES */

.names {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.name {
    display: block;
    font-family: var(--display);
    font-size: clamp(65px, 13vw, 118px);
    font-weight: 400;
    line-height: .78;
    letter-spacing: -.045em;
    opacity: 0;
    filter: blur(14px);
    transform: translateY(35px);
    transition: opacity 1.4s var(--ease), filter 1.8s var(--ease), transform 1.4s var(--ease);
}

.reveal.is-visible .name-one {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    transition-delay: .65s;
}

.reveal.is-visible .name-two {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    transition-delay: .9s;
}

.ampersand {
    margin: 22px 0;
    color: var(--champagne);
    font-family: var(--display);
    font-size: 27px;
    font-weight: 400;
    opacity: 0;
    transform: scale(.7);
    transition: opacity 1s ease .78s, transform 1.1s var(--ease) .78s;
}

.reveal.is-visible .ampersand {
    opacity: 1;
    transform: scale(1);
}

/* MESSAGE */

.reveal-message {
    max-width: 380px;
    margin: 42px auto 0;
    color: rgba(238,234,226,.55);
    font-size: 11px;
    font-weight: 300;
    line-height: 2;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(15px);
    transition: opacity 1.2s ease 1.3s, filter 1.4s ease 1.3s, transform 1.2s var(--ease) 1.3s;
}

.reveal.is-visible .reveal-message {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* DATE */

.reveal-date {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 17px;
    margin-top: 35px;
    font-family: var(--display);
    font-size: 18px;
    letter-spacing: .12em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease 1.5s, transform 1s var(--ease) 1.5s;
}

.reveal.is-visible .reveal-date {
    opacity: 1;
    transform: translateY(0);
}

.reveal-date i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--champagne);
}

/* LOCATION */

.reveal-location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 30px;
    color: rgba(238,234,226,.38);
    font-size: 7px;
    letter-spacing: .32em;
    opacity: 0;
    transition: opacity 1s ease 1.65s;
}

.reveal.is-visible .reveal-location {
    opacity: 1;
}

.reveal-location svg {
    width: 13px;
    height: 13px;
}

/* MOBILE */

@media (max-width: 600px) {
    .envelope {
        width: min(82vw, 350px);
    }

    .wax-seal {
        width: 55px;
        height: 55px;
    }

    .name {
        font-size: clamp(63px, 20vw, 92px);
    }

    .ampersand {
        margin: 20px 0;
    }

    .reveal-message {
        max-width: 300px;
        font-size: 10px;
    }

    .reveal-location {
        margin-top: 25px;
    }
}

/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}