/* =========================================================
   GLOBAL RESET
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    overflow-x: hidden;
}


/* =========================================================
   PAGE
========================================================= */

.invitation-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 30px 20px;

    background:
        radial-gradient(
            circle at center,
            #fffdf9 0%,
            #f8f3eb 55%,
            #eee5d9 100%
        );

    overflow: hidden;

    opacity: 0;
    animation: pageFadeIn 1.2s ease forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =========================================================
   SOFT VIGNETTE
========================================================= */

.invitation-page::after {
    content: "";
    position: absolute;
    inset: 0;

    pointer-events: none;

    background:
        radial-gradient(
            ellipse at center,
            transparent 55%,
            rgba(75, 60, 45, 0.08) 100%
        );

    z-index: 1;
}


/* =========================================================
   WEDDING INTRO
========================================================= */

.wedding-intro {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background:
        radial-gradient(
            circle at center,
            #fffdf9 0%,
            #faf5ee 55%,
            #eee4d8 100%
        );

    z-index: 1000;

    cursor: pointer;

    opacity: 1;
    visibility: visible;

    transition:
        opacity 0.9s ease,
        visibility 0.9s ease;
}


/* Intro disappears after user clicks */

.wedding-intro.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


/* =========================================================
   INTRO CONTENT
========================================================= */

.intro-content {
    position: relative;
    z-index: 10;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;

    user-select: none;

    animation:
        introContentIn 1.5s ease forwards;
}

@keyframes introContentIn {

    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* =========================================================
   ORNAMENT
========================================================= */

.intro-ornament {
    margin-bottom: 20px;

    font-size: 25px;
    line-height: 1;

    color: #b59b72;

    animation:
        ornamentFloat 3s ease-in-out infinite;
}

@keyframes ornamentFloat {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.75;
    }

    50% {
        transform: translateY(-5px);
        opacity: 1;
    }

}


/* =========================================================
   NAMES
========================================================= */

.intro-names {
    display: flex;
    flex-direction: column;
    align-items: center;

    line-height: 1;
}

.intro-name {
    font-family: Georgia, "Times New Roman", serif;

    font-size: clamp(
        3rem,
        12vw,
        5rem
    );

    font-weight: 400;

    letter-spacing: 0.03em;

    color: #65594f;

    animation:
        nameFloat 4s ease-in-out infinite;
}

.intro-name:last-child {
    animation-delay: 0.5s;
}

@keyframes nameFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }

}


/* =========================================================
   AMPERSAND
========================================================= */

.intro-ampersand {
    margin: 10px 0;

    font-family: Georgia, "Times New Roman", serif;

    font-size: clamp(
        1.5rem,
        6vw,
        2.4rem
    );

    font-weight: 300;

    color: #b59b72;

    animation:
        ampersandPulse 3s ease-in-out infinite;
}

@keyframes ampersandPulse {

    0%,
    100% {
        opacity: 0.65;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

}


/* =========================================================
   INTRO SUBTITLE
========================================================= */

.intro-subtitle {
    margin-top: 28px;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 0.78rem;

    letter-spacing: 0.18em;
    text-transform: uppercase;

    color: #81766c;

    opacity: 0;

    animation:
        subtitleIn 1.2s ease 0.7s forwards;
}

@keyframes subtitleIn {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* =========================================================
   TAP TO CONTINUE
========================================================= */

.intro-continue {
    display: flex;
    flex-direction: column;
    align-items: center;

    margin-top: 55px;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 0.72rem;

    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: #81766c;

    animation:
        continuePulse 2.2s ease-in-out infinite;
}

@keyframes continuePulse {

    0%,
    100% {
        opacity: 0.55;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-4px);
    }

}

.intro-arrow {
    margin-top: 10px;

    font-size: 1.15rem;

    color: #a89068;

    animation:
        arrowBounce 1.5s ease-in-out infinite;
}

@keyframes arrowBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(6px);
    }

}


/* =========================================================
   BOTANICAL DECORATIONS
========================================================= */

.intro-decoration,
.intro-clover {
    position: absolute;

    pointer-events: none;

    z-index: 2;
}


/* =========================================================
   SUNFLOWER
========================================================= */

.intro-sunflower {
    width: 90px;
    height: 90px;

    animation:
        sunflowerFloat 6s ease-in-out infinite;
}

.sunflower-top-left {
    top: 8%;
    left: 5%;

    transform: rotate(-18deg);
}

.sunflower-top-right {
    top: 10%;
    right: 5%;

    transform: rotate(18deg);

    animation-delay: 1s;
}

.sunflower-bottom-left {
    bottom: 7%;
    left: 7%;

    transform: rotate(12deg);

    animation-delay: 2s;
}

.sunflower-bottom-right {
    bottom: 8%;
    right: 7%;

    transform: rotate(-12deg);

    animation-delay: 3s;
}


/* Petals */

.sunflower-petals {
    position: absolute;
    inset: 15px;

    border-radius: 50%;

    background:
        repeating-conic-gradient(
            from 0deg,
            #d6b66f 0deg 18deg,
            transparent 18deg 45deg
        );

    filter:
        drop-shadow(
            0 4px 8px
            rgba(100, 75, 40, 0.08)
        );

    animation:
        sunflowerRotate 18s linear infinite;
}


/* Centre */

.sunflower-center {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 31px;
    height: 31px;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            #6f5439 0%,
            #8a6944 60%,
            #a7865b 100%
        );

    box-shadow:
        inset 0 0 0 3px
        rgba(255, 255, 255, 0.12);
}

@keyframes sunflowerRotate {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}

@keyframes sunflowerFloat {

    0%,
    100% {
        margin-top: 0;
    }

    50% {
        margin-top: -10px;
    }

}


/* =========================================================
   CLOVERS
========================================================= */

.intro-clover {
    width: 45px;
    height: 45px;

    animation:
        cloverFloat 7s ease-in-out infinite;
}

.clover-one {
    top: 25%;
    left: 12%;
}

.clover-two {
    top: 30%;
    right: 13%;

    animation-delay: 2s;
}

.clover-three {
    bottom: 23%;
    right: 17%;

    animation-delay: 4s;
}

.intro-clover span {
    position: absolute;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 30%,
            #b8d09f 0%,
            #91ae79 70%,
            #7d9968 100%
        );

    opacity: 0.7;
}

.intro-clover span:nth-child(1) {
    top: 0;
    left: 50%;

    transform: translateX(-50%);
}

.intro-clover span:nth-child(2) {
    top: 50%;
    left: 0;

    transform: translateY(-50%);
}

.intro-clover span:nth-child(3) {
    top: 50%;
    right: 0;

    transform: translateY(-50%);
}

.intro-clover span:nth-child(4) {
    bottom: 0;
    left: 50%;

    transform: translateX(-50%);
}

@keyframes cloverFloat {

    0%,
    100% {
        transform:
            translateY(0)
            rotate(0deg);
    }

    50% {
        transform:
            translateY(-12px)
            rotate(8deg);
    }

}


/* =========================================================
   CARD CONTAINER
========================================================= */

.card-container {
    position: relative;

    width: min(90vw, 450px);

    aspect-ratio: 3 / 4;

    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* =========================================================
   WEDDING CARD IMAGES
========================================================= */

.wedding-card {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    border-radius: 4px;

    box-shadow:
        0 18px 45px
        rgba(70, 55, 40, 0.16);

    user-select: none;
    -webkit-user-drag: none;
}

.closed-card {
    z-index: 3;

    opacity: 1;

    transform: scale(1);

    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}

.open-card {
    z-index: 2;

    opacity: 0;

    transform: scale(0.96);

    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}


/* =========================================================
   OPENED STATE
========================================================= */

.card-container.opened .closed-card {
    opacity: 0;

    transform: scale(1.04);

    pointer-events: none;
}

.card-container.opened .open-card {
    opacity: 1;

    transform: scale(1);

    z-index: 4;
}


/* =========================================================
   SEAL BUTTON
========================================================= */

.seal-button {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 76px;
    height: 76px;

    transform: translate(-50%, -50%);

    border: none;
    border-radius: 50%;

    background: transparent;

    cursor: pointer;

    z-index: 10;

    box-shadow:
        0 0 0 1px
        rgba(255, 255, 255, 0.08),
        0 0 22px
        rgba(130, 105, 70, 0.18);

    animation:
        sealPulse 2.4s ease-in-out infinite;
}

.seal-button:focus-visible {
    outline: 2px solid #a89068;
    outline-offset: 4px;
}

@keyframes sealPulse {

    0%,
    100% {
        box-shadow:
            0 0 0 1px
            rgba(255, 255, 255, 0.08),
            0 0 22px
            rgba(130, 105, 70, 0.16);
    }

    50% {
        box-shadow:
            0 0 0 1px
            rgba(255, 255, 255, 0.12),
            0 0 32px
            rgba(130, 105, 70, 0.28);
    }

}


/* =========================================================
   SEAL DISAPPEARS DURING OPENING
========================================================= */

.card-container.opening .seal-button {
    animation:
        sealDisappear 0.45s ease forwards;
}

@keyframes sealDisappear {

    from {
        opacity: 1;
        transform:
            translate(-50%, -50%)
            scale(1);
    }

    to {
        opacity: 0;
        transform:
            translate(-50%, -50%)
            scale(1.35);
    }

}


/* =========================================================
   RIPPLE
========================================================= */

.ripple {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    border:
        1px solid
        rgba(175, 145, 100, 0.25);

    transform:
        translate(-50%, -50%)
        scale(0);

    opacity: 0;

    z-index: 8;

    pointer-events: none;
}

.card-container.opening .ripple-one {
    animation:
        rippleExpand 1.1s ease-out forwards;
}

.card-container.opening .ripple-two {
    animation:
        rippleExpand 1.1s ease-out 0.15s forwards;
}

@keyframes rippleExpand {

    0% {
        opacity: 0.8;

        transform:
            translate(-50%, -50%)
            scale(0);
    }

    100% {
        opacity: 0;

        transform:
            translate(-50%, -50%)
            scale(12);
    }

}


/* =========================================================
   OPENING ANIMATION
========================================================= */

.card-container.opening .closed-card {
    animation:
        closedCardOpen 1.2s ease forwards;
}

.card-container.opening .open-card {
    animation:
        openCardReveal 1.2s ease forwards;
}

@keyframes closedCardOpen {

    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.04);
    }

}

@keyframes openCardReveal {

    0% {
        opacity: 0;
        transform: scale(0.96);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }

}


/* =========================================================
   TAP TO OPEN
========================================================= */

.tap-to-open {
    position: relative;

    margin-top: 24px;

    display: flex;
    flex-direction: column;
    align-items: center;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 0.72rem;

    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: #81766c;

    z-index: 5;

    opacity: 1;

    transition:
        opacity 0.35s ease;
}

.tap-to-open.hidden {
    opacity: 0;
    pointer-events: none;
}

.tap-arrow {
    margin-top: 8px;

    font-size: 1.1rem;

    color: #a89068;

    animation:
        tapArrowBounce 1.5s ease-in-out infinite;
}

@keyframes tapArrowBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }

}


/* =========================================================
   INVITATION CONTROLS
========================================================= */

.invitation-controls {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    margin-top: 18px;

    z-index: 20;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(8px);

    transition:
        opacity 0.4s ease,
        transform 0.4s ease,
        visibility 0.4s ease;
}

.invitation-controls.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
}


/* =========================================================
   CONTROL BUTTONS
========================================================= */

.control-button {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border:
        1px solid
        rgba(100, 85, 70, 0.18);

    border-radius: 50%;

    background:
        rgba(255, 253, 249, 0.9);

    color: #655b52;

    cursor: pointer;

    box-shadow:
        0 4px 14px
        rgba(70, 55, 40, 0.08);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
}

.control-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 7px 18px
        rgba(70, 55, 40, 0.12);

    background:
        rgba(255, 255, 255, 0.98);
}

.control-button:active {
    transform: translateY(0) scale(0.96);
}

.control-button:focus-visible {
    outline: 2px solid #a89068;
    outline-offset: 3px;
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.close-button {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 1.55rem;

    font-weight: 300;

    line-height: 1;
}


/* =========================================================
   MUSIC BUTTON
========================================================= */

.music-button {
    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 1.15rem;

    line-height: 1;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
}

.music-button.playing {
    box-shadow:
        0 0 0 3px
        rgba(181, 155, 114, 0.08),
        0 7px 18px
        rgba(70, 55, 40, 0.12);
}


/* =========================================================
   CLOSING ANIMATION
========================================================= */

.card-container.closing .open-card {
    animation:
        openCardClose 0.7s ease forwards;
}

.card-container.closing .closed-card {
    animation:
        closedCardReturn 0.7s ease forwards;
}

@keyframes openCardClose {

    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.96);
    }

}

@keyframes closedCardReturn {

    from {
        opacity: 0;
        transform: scale(1.04);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }

}


/* =========================================================
   CLOSE RIPPLE
========================================================= */

.card-container.closing .ripple-one {
    animation:
        rippleClose 0.7s ease-out forwards;
}

@keyframes rippleClose {

    0% {
        opacity: 0.45;

        transform:
            translate(-50%, -50%)
            scale(1);
    }

    100% {
        opacity: 0;

        transform:
            translate(-50%, -50%)
            scale(5);
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .invitation-page {
        padding:
            25px 15px;
    }

    .wedding-intro {
        padding:
            25px 20px;
    }

    .intro-name {
        font-size:
            clamp(
                2.8rem,
                14vw,
                4.5rem
            );
    }

    .intro-subtitle {
        font-size: 0.68rem;
        letter-spacing: 0.15em;
    }

    .intro-continue {
        margin-top: 48px;
    }

    .intro-sunflower {
        width: 70px;
        height: 70px;
    }

    .sunflower-center {
        width: 25px;
        height: 25px;
    }

    .intro-clover {
        width: 38px;
        height: 38px;
    }

    .intro-clover span {
        width: 17px;
        height: 17px;
    }

    .card-container {
        width: min(
            94vw,
            450px,
            calc(75vh * 0.75)
        );
    }

    .seal-button {
        width: 70px;
        height: 70px;
    }

}


/* =========================================================
   SMALL HEIGHT DEVICES
========================================================= */

@media (max-height: 650px) {

    .invitation-page {
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .intro-continue {
        margin-top: 35px;
    }

    .intro-subtitle {
        margin-top: 20px;
    }

    .card-container {
        width: min(
            75vw,
            380px
        );
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

}

