@font-face {
    font-family: "Kom Post";
    src: url("/birthday/kom-post.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "TT Norms";
    src: url("/fonts/TTNorms/TTNorms-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --birthday-bg: #0d3712;
    --birthday-cream: #ffe4a3;
    --birthday-green: #00a414;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--birthday-bg);
}

body {
    overflow-x: hidden;
    font-family: Arial, Helvetica, sans-serif;
}

button,
img {
    -webkit-tap-highlight-color: transparent;
}

.site-container {
    position: relative;
    display: grid;
    width: 100%;
    max-width: 1920px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
}

.birthday {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    background: var(--birthday-bg);
    isolation: isolate;
}

.confetti {
    position: absolute;
    z-index: 20;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.decor {
    position: absolute;
    z-index: 1;
    inset: 0 0 auto;
    height: 29vh;
    min-height: 180px;
    pointer-events: none;
}

.decor__flags {
    position: absolute;
    top: 0;
    height: auto;
    user-select: none;
}

.decor__flags--left {
    left: 0;
    width: min(38vw, 590px);
}

.decor__flags--right {
    right: 0;
    width: min(67vw, 1030px);
}

.decor__flags--mobile {
    display: none;
}

.birthday__header {
    position: relative;
    z-index: 3;
    align-self: center;
    justify-self: center;
}

.birthday__logo {
    display: block;
    width: clamp(145px, 14vw, 220px);
    height: auto;
}

.wish {
    position: relative;
    z-index: 2;
    place-self: center;
    display: grid;
    grid-template-columns: minmax(150px, 240px) minmax(420px, 570px) minmax(360px, 500px);
    align-items: center;
    justify-content: center;
    column-gap: clamp(30px, 4vw, 72px);
    width: min(1500px, 92vw);
    margin: 0 auto;
}

.wish__cake-wrap,
.wish__content {
    transition: opacity 500ms ease, transform 500ms ease, visibility 500ms;
}

.wish--leaving .wish__cake-wrap,
.wish--leaving .wish__content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-18px);
}

.wish__cake-wrap {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
}

.wish__cake-wrap::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: -8%;
    left: 50%;
    display: block;
    width: min(100%, 570px);
    height: 45%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center,
        rgba(255, 241, 148, .72) 0%,
        rgba(255, 193, 61, .46) 28%,
        rgba(255, 143, 34, .18) 50%,
        rgba(255, 125, 28, .06) 64%,
        transparent 78%);
    filter: blur(12px);
    mix-blend-mode: screen;
    opacity: .66;
    pointer-events: none;
    transform: translateX(-50%);
    animation: candle-glow 1500ms ease-in-out infinite alternate;
}

.wish__cake-wrap--extinguished::before {
    animation: candle-glow-out 500ms ease-out forwards;
}

@keyframes candle-glow {
    0% {
        opacity: .55;
    }
    100% {
        opacity: .74;
    }
}

@keyframes candle-glow-out {
    0% {
        opacity: .66;
    }
    100% {
        opacity: 0;
    }
}

.wish__smoke {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 50%;
    display: block;
    width: 63.6%;
    height: auto;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -48px) scale(.96);
    transform-origin: 50% 100%;
}

.wish__smoke--visible {
    animation: candle-smoke 1600ms ease-out forwards;
}

@keyframes candle-smoke {
    0% {
        opacity: 0;
        transform: translate(-50%, -48px) scale(.96);
    }
    22% {
        opacity: .95;
    }
    68% {
        opacity: .55;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -72px) scale(1.02);
    }
}

.wish__cake {
    position: relative;
    z-index: 1;
    display: block;
    width: min(100%, 570px);
    height: auto;
    transform-origin: 50% 72%;
    filter: drop-shadow(0 0 18px rgba(255, 180, 44, 0.12));
}

.wish__cake--pulse {
    animation: cake-wish 1050ms cubic-bezier(.4, 0, .2, 1);
}

@keyframes cake-wish {
    0%, 100% { transform: scale(1); }
    48% { transform: scale(1.025); }
    74% { transform: scale(.997); }
}

.wish__content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(32px, 5vh, 58px);
}

.wish__title,
.fulfillment__title {
    margin: 0;
    color: var(--birthday-cream);
    font-family: "Kom Post", cursive;
    font-weight: 400;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.wish__title {
    font-size: clamp(50px, 5vw, 110px);
    line-height: .8;
}

.wish__button {
    min-height: 68px;
    padding: 12px 30px 15px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    background: var(--birthday-green);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    font: 400 clamp(24px, 2vw, 34px)/1.15 "TT Norms", Arial, Helvetica, sans-serif;
    cursor: pointer;
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.wish__button:hover:not(:disabled) {
    background: #08b51d;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
    transform: translateY(-2px);
}

.wish__button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}

.wish__button:active:not(:disabled) {
    transform: translateY(1px) scale(.99);
}

.wish__button:disabled {
    color: rgba(255, 255, 255, .7);
    background: #8a9b8c;
    cursor: default;
}

.fulfillment {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 190px 24px 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(22px);
    transition: opacity 650ms ease, transform 650ms ease, visibility 650ms;
}

.fulfillment--visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.fulfillment__title {
    z-index: 1;
    max-width: 900px;
    font-size: clamp(25px, 3vw, 48px);
    line-height: 1.3;
    text-align: center;
}

.fulfillment__cow {
    display: block;
    width: min(62vw, 760px);
    max-height: 62vh;
    margin-top: clamp(2px, 1.5vh, 18px);
    object-fit: contain;
}

@media (max-width: 1100px) {
    .decor {
        height: 178px;
        min-height: 0;
    }

    .decor__flags--left {
        display: none;
    }

    .decor__flags--right {
        display: none;
    }

    .decor__flags--mobile {
        display: block;
        top: 0;
        left: 0;
        width: 100%;
    }

    .birthday__header {
        position: absolute;
        top: 23px;
        right: 28px;
        left: auto;
        transform: none;
    }

    .birthday__logo {
        width: 145px;
    }

    .wish {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        grid-template-areas: "title" "cake" "button";
        gap: 20px;
        width: 100%;
        min-height: 100svh;
        margin: 0;
        padding: 202px 30px max(30px, env(safe-area-inset-bottom));
    }

    .wish__content {
        display: contents;
    }

    .wish__title,
    .wish__button {
        transition: opacity 650ms ease, transform 650ms ease, visibility 0s linear 650ms;
        will-change: opacity, transform;
    }

    .wish--leaving .wish__content {
        visibility: visible;
        transform: none;
    }

    .wish--leaving .wish__title,
    .wish--leaving .wish__button {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-14px);
    }

    .wish__title {
        grid-area: title;
        align-self: end;
        font-size: clamp(47px, 12vw, 61px);
        line-height: .8;
        text-align: center;
    }

    .wish__cake-wrap {
        grid-area: cake;
        align-self: center;
    }

    .wish__cake-wrap::before {
        width: min(82vw, 430px, 39.53vh);
    }

    .wish__cake {
        width: min(82vw, 430px);
        max-height: 40vh;
        object-fit: contain;
    }

    .wish__button {
        grid-area: button;
        align-self: end;
        width: min(100%, 355px);
        min-height: 68px;
        margin: 15px auto 0;
        border-radius: 17px;
        font-size: 29px;
    }

    .fulfillment {
        justify-content: flex-start;
        padding: 268px 18px 25px;
    }

    .fulfillment__title {
        max-width: 390px;
        font-size: clamp(18px, 4.8vw, 23px);
        line-height: 1.4;
    }

    .fulfillment__cow {
        width: min(85vw, 570px);
        max-width: none;
        max-height: none;
        margin-top: 35px;
    }
}

@media (max-width: 390px), (max-height: 820px) and (max-width: 1100px) {
    .birthday__header {
        top: 18px;
        right: 22px;
    }

    .birthday__logo {
        width: 125px;
    }

    .wish {
        gap: 8px;
        padding-top: 155px;
    }

    .wish__title {
        font-size: clamp(40px, 11vw, 51px);
    }

    .wish__cake {
        width: min(76vw, 360px);
        max-height: 37vh;
    }

    .wish__cake-wrap::before {
        width: min(76vw, 360px, 36.56vh);
    }

    .wish__button {
        min-height: 58px;
        font-size: 24px;
    }

    .fulfillment {
        padding-top: 215px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .confetti {
        display: none;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
