@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --bg-r: 17;
    --bg-g: 15;
    --bg-b: 22;

    --countdown-glow: 0.35;
}

/* =========================================
   RESET
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* =========================================
   BODY
========================================= */

body {

    min-height: 100vh;
    min-height: 100dvh;

    display: flex;

    justify-content: center;
    align-items: center;

    background: rgb(
    var(--bg-r),
    var(--bg-g),
    var(--bg-b)
    );

    color: #ffffff;

    font-family: 'Inter', sans-serif;

    overflow: hidden;

    transition:
        background-color 1.5s ease,
        color 2s ease;
}


/* =========================================
   MAIN
========================================= */

.countdown-container {

    width: 100%;

    padding: 30px;

    text-align: center;

    overflow: hidden;

}


/* =========================================
   MESSAGE
========================================= */

.small-text {

    margin-bottom: 55px;

    font-size: 14px;

    font-weight: 400;

    letter-spacing: 5px;

    opacity: 0.65;

}


/* =========================================
   COUNTDOWN
========================================= */

.countdown {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 20px;

}


/* =========================================
   TIME BOX
========================================= */

.time-box {

    display: flex;

    flex-direction: column;

    align-items: center;

}


/* =========================================
   FLIP CARD
========================================= */

.flip-card {

    position: relative;

    width: clamp(120px, 14vw, 210px);

    height: clamp(90px, 11vw, 155px);

    perspective: 1000px;

    transform-style: preserve-3d;

    font-size: clamp(65px, 9vw, 125px);

    font-weight: 600;

    line-height: 1;

    font-variant-numeric: tabular-nums;

    border-radius: 10px;

    box-shadow:
    0 0 8px rgba(220, 90, 170, var(--countdown-glow)),
    0 0 20px rgba(220, 90, 170, calc(var(--countdown-glow) * 0.7)),
    0 0 40px rgba(220, 90, 170, calc(var(--countdown-glow) * 0.35));

    transition:
        box-shadow 1.5s ease;

}


/* =========================================
   STATIC HALVES
========================================= */

.card-half {

    position: absolute;

    left: 0;

    width: 100%;

    height: 50%;

    overflow: hidden;

    display: flex;

    justify-content: center;

    background: #24212b;

    z-index: 1;

}


/* =========================================
   STATIC TOP
========================================= */

.card-half.top {

    top: 0;

    align-items: flex-end;

    border-radius: 10px 10px 3px 3px;

}


/* =========================================
   STATIC BOTTOM
========================================= */

.card-half.bottom {

    bottom: 0;

    align-items: flex-start;

    border-radius: 3px 3px 10px 10px;

}


/* =========================================
   STATIC NUMBERS
========================================= */

.card-half span {

    position: absolute;

    width: 100%;

    height: 200%;

    display: flex;

    justify-content: center;

    align-items: center;

    line-height: 1;

}


.card-half.top span {
    top: 0;
}


.card-half.bottom span {
    bottom: 0;
}


/* =========================================
   COMMON FLIP HALF
========================================= */

.flip-half {

    position: absolute;

    left: 0;

    width: 100%;

    height: 50%;

    overflow: hidden;

    display: flex;

    justify-content: center;

    background: #2a2732;

    z-index: 10;

    backface-visibility: hidden;

    -webkit-backface-visibility: hidden;

    transform-style: preserve-3d;

}


/* =========================================
   TOP FLAP
========================================= */

.flip-top {

    top: 0;

    align-items: flex-end;

    border-radius: 10px 10px 3px 3px;

    transform-origin: bottom;

    transform: rotateX(0deg);

}


/* =========================================
   BOTTOM FLAP
========================================= */

.flip-bottom {

    bottom: 0;

    align-items: flex-start;

    border-radius: 3px 3px 10px 10px;

    transform-origin: top;

    /*
       It starts folded backward.
       The animation will bring it to 0deg.
    */

    transform: rotateX(-90deg);

    z-index: 11;

}


/* =========================================
   FLIP NUMBERS
========================================= */

.flip-half span {

    position: absolute;

    width: 100%;

    height: 200%;

    display: flex;

    justify-content: center;

    align-items: center;

    line-height: 1;

}


.flip-top span {
    top: 0;
}


.flip-bottom span {
    bottom: 0;
}


/* =========================================
   TOP FLIP
========================================= */

.flip-card.flipping .flip-top {

    animation:
        flipTop
        0.50s
        linear
        forwards;

}


/* =========================================
   BOTTOM FLIP
========================================= */

.flip-card.flipping .flip-bottom {

    animation:
        flipBottom
        0.50s
        linear

        forwards;

}


/* =========================================
   TOP KEYFRAME
========================================= */

@keyframes flipTop {

    0% {

        transform: rotateX(0deg);

    }

    100% {

        transform: rotateX(-90deg);

    }

}


/* =========================================
   BOTTOM KEYFRAME
========================================= */

@keyframes flipBottom {

    0% {

        transform: rotateX(-90deg);

    }

    100% {

        transform: rotateX(0deg);

    }

}


/* =========================================
   CENTER SEAM
========================================= */

.flip-card::after {

    content: "";

    position: absolute;

    left: 0;

    right: 0;

    top: 50%;

    height: 3px;

    transform: translateY(-50%);

    background: rgba(0, 0, 0, 0.65);

    z-index: 30;

}


/* =========================================
   SHADOW
========================================= */

.flip-top,
.flip-bottom {

    box-shadow:
        0 5px 12px rgba(0, 0, 0, 0.28);

}


/* =========================================
   LABELS
========================================= */

.label {

    margin-top: 20px;

    font-size: 11px;

    letter-spacing: 4px;

    opacity: 0.45;

}


/* =========================================
   COLONS
========================================= */

.colon {

    margin-bottom: 30px;

    font-size: clamp(50px, 8vw, 100px);

    font-weight: 300;

    opacity: 0.4;

}


/* =========================================
   HEART
========================================= */

.bottom-text {

    margin-top: 55px;

    font-size: 22px;

    opacity: 0.45;

    animation:
        heartbeat
        2.5s
        infinite
        ease-in-out;

}


@keyframes heartbeat {

    0%,
    100% {

        transform: scale(1);

        opacity: 0.35;

    }

    50% {

        transform: scale(1.20);

        opacity: 0.7;

    }

}


/* =========================================
   BIRTHDAY STATE
========================================= */

body.done {

    background: #241520;

}


body.done .small-text {

    opacity: 1;

}


/* =========================================
   REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: 0.01ms !important;

        animation-delay: 0s !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;

    }

}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

    .countdown {

        gap: 6px;

    }


    .flip-card {

        width: 68px;

        height: 55px;

        font-size: 38px;

    }


    .colon {

        font-size: 38px;

        margin-bottom: 20px;

    }


    .label {

        margin-top: 12px;

        font-size: 7px;

        letter-spacing: 2px;

    }


    .small-text {

        margin-bottom: 35px;

        font-size: 10px;

        letter-spacing: 3px;

    }


    .bottom-text {

        margin-top: 40px;

    }

}