:root {
    --night: #050505;
    --yellow: #ffd84a;
    --green: #65d46e;
    --aqua: #64f5db;
    --soft-white: #fff9dd;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 38%, rgba(255, 216, 74, 0.055), transparent 28rem), var(--night);
    color: var(--soft-white);
    font-family: Georgia, "Times New Roman", serif;
}

.scene {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    width: 100%;
    height: 100svh;
    min-height: 540px;
    isolation: isolate;
}

.para-pao {
    position: fixed;
    z-index: 2;
    top: 1.4rem;
    left: 1.5rem;
    color: rgba(255, 249, 221, 0.62);
    font-size: 0.82rem;
    font-style: italic;
    letter-spacing: 0.08em;
    opacity: 0;
    transform: rotate(-2deg);
    animation: appear 1.5s ease 2.4s forwards;
}

.sunflower {
    width: min(78vw, 520px);
    height: min(76svh, 700px);
    align-self: end;
    overflow: visible;
    filter: drop-shadow(0 0 7px rgba(255, 216, 74, 0.14));
}

.draw {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: trace 2s cubic-bezier(0.5, 0, 0.25, 1) forwards;
}

.plant-lines,
.grass-lines {
    stroke: var(--green);
}
.draw-stem {
    stroke-width: 5;
    animation-delay: 0.15s;
}
.draw-leaf {
    stroke-width: 3.2;
    animation-delay: 0.7s;
}
.draw-leaf-detail {
    stroke-width: 2;
    animation-delay: 1.1s;
}
.petal-lines,
.flower-ring {
    stroke: var(--yellow);
}
.petal {
    stroke-width: 3;
    animation-delay: 1.25s;
}
.flower-ring {
    stroke-width: 3.5;
    animation-delay: 1.55s;
}
.flower-center {
    stroke: #ffb92e;
    stroke-width: 3;
    animation-delay: 1.75s;
}
.seed {
    stroke: #ffc640;
    stroke-width: 2;
    animation-delay: 2.05s;
}
.grass {
    stroke-width: 2.5;
    animation-delay: 1.8s;
}
.ground {
    stroke-width: 2;
    animation-delay: 1.6s;
}

.flower-head {
    transform-box: view-box;
    transform-origin: 260px 285px;
    animation: breathe 5.2s ease-in-out 3.1s infinite;
}

.dedication {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -5.3rem;
    padding: 0 1rem 1.1rem;
    opacity: 0;
    animation: appear 1.4s ease 2.7s forwards;
}

.dedication p {
    margin: 0;
    text-align: center;
    font-size: clamp(1rem, 3.8vw, 1.45rem);
    letter-spacing: 0.035em;
    text-shadow: 0 0 12px rgba(255, 249, 221, 0.22);
}

.dedication small {
    margin-top: -0.1rem;
    color: rgba(255, 249, 221, 0.55);
    font-size: clamp(0.68rem, 2.5vw, 0.8rem);
    font-style: italic;
    letter-spacing: 0.06em;
}

.heart {
    width: 48px;
    margin-top: 0.35rem;
    overflow: visible;
}
.heart-path {
    stroke: var(--aqua);
    stroke-width: 4;
    animation-delay: 3s;
    filter: drop-shadow(0 0 5px rgba(100, 245, 219, 0.4));
}

.falling-petals {
    position: fixed;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.falling-petal {
    --drift: 40px;
    position: absolute;
    top: -45px;
    left: var(--left);
    width: var(--size);
    height: calc(var(--size) * 1.9);
    border: 1.8px solid var(--yellow);
    border-radius: 80% 12% 80% 12%;
    opacity: 0;
    filter: drop-shadow(0 0 3px rgba(255, 216, 74, 0.25));
    animation: fall var(--duration) linear var(--delay) infinite;
}

@keyframes trace {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes breathe {
    0%,
    100% {
        transform: rotate(-1.2deg) scale(1);
    }
    50% {
        transform: rotate(1.5deg) scale(1.018);
    }
}

@keyframes appear {
    to {
        opacity: 1;
    }
}

@keyframes fall {
    0% {
        opacity: 0;
        transform: translate3d(0, -5vh, 0) rotate(0deg);
    }
    10% {
        opacity: 0.85;
    }
    55% {
        transform: translate3d(var(--drift), 52vh, 0) rotate(230deg);
    }
    100% {
        opacity: 0;
        transform: translate3d(calc(var(--drift) * -0.5), 110vh, 0) rotate(520deg);
    }
}

@media (max-height: 650px) {
    .sunflower {
        height: 83svh;
    }
    .dedication {
        margin-top: -4.5rem;
        padding-bottom: 0.4rem;
    }
    .heart {
        width: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .draw {
        stroke-dashoffset: 0;
        animation: none;
    }
    .flower-head {
        animation: none;
    }
    .dedication {
        opacity: 1;
        animation: none;
    }
    .falling-petal {
        display: none;
    }
}
