* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg-1: #030303;
    --bg-2: #0a0f1e;
    --bg-3: #120d18;
    --glow: rgba(255,255,255,0.04);
    --text: #f4f4f4;
}

html,
body {
    width: 100%;
    height: 100%;
    background: var(--bg-1);
    font-family: "Inter", "Söhne", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    text-align: center;
}

body::before,
body::after {
    content: "";
    position: absolute;
    width: 80vmax;
    height: 80vmax;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(75,126,255,0.25), transparent 60%),
                radial-gradient(circle at 70% 40%, rgba(255,91,182,0.2), transparent 55%),
                radial-gradient(circle at 50% 70%, rgba(255,200,120,0.18), transparent 50%);
    filter: blur(30px);
    animation: float 28s ease-in-out infinite alternate;
    z-index: -3;
}

body::after {
    animation-direction: alternate-reverse;
    opacity: 0.65;
}

.gradient {
    position: fixed;
    inset: -5%;
    /* stronger, more visible gradient variant */
    z-index: 0;
    background: conic-gradient(from 30deg,
        rgba(62, 99, 255, 0.22),
        rgba(255, 118, 197, 0.18),
        rgba(255, 196, 137, 0.15),
        rgba(62, 99, 255, 0.22)
    );
    /* less blur so colors are more visible */
    filter: blur(40px);
    /* increase opacity for visibility */
    opacity: 0.75;
    animation: gradient-rotate 60s linear infinite;
    pointer-events: none;
    /* overlay tends to produce richer colors on dark backgrounds */
    mix-blend-mode: overlay;
    transform: translateZ(0);
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    /* keep grain above the gradient so noise is visible */
    z-index: 1;
    background-image: url("data:image/svg+xml,\
    <svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'>\
    <filter id='noise'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/></filter>\
    <rect width='100%' height='100%' filter='url(%23noise)' opacity='0.06'/></svg>");
    mix-blend-mode: soft-light;
}

@keyframes float {
    0%   { transform: translate(-10%, -10%) scale(1); }
    50%  { transform: translate(5%, 10%) scale(1.1); }
    100% { transform: translate(15%, -15%) scale(1.2); }
}

@keyframes gradient-rotate {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1); }
}

h1 {
    font-size: clamp(4rem, 14vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    text-transform: lowercase;
    text-shadow: 0 20px 80px var(--glow);
    animation: fade 2.2s ease forwards;
    position: relative;
    z-index: 2;
}

@keyframes fade {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.text-roll {
    display: inline-flex;
    gap: 0.02em;
    position: relative;
    --roll-duration: 600ms;
    --roll-stagger: 110ms;
    --roll-exit-gap: 220ms;
    --roll-ease: cubic-bezier(0.33, 0.05, 0.24, 0.99);
}

.text-roll__letter {
    position: relative;
    display: inline-block;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.text-roll__face {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: inline-block;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.text-roll__face--enter {
    transform-origin: 50% 25%;
    transform: rotateX(0deg);
}

.text-roll__face--exit {
    transform-origin: 50% 100%;
    transform: rotateX(90deg);
    opacity: 0;
}

.text-roll__face--static {
    visibility: hidden;
    position: relative;
    display: inline-block;
}

@keyframes text-roll-enter {
    from { transform: rotateX(0deg); opacity: 1; }
    to   { transform: rotateX(90deg); opacity: 0; }
}

@keyframes text-roll-exit {
    from { transform: rotateX(90deg); opacity: 0; }
    to   { transform: rotateX(0deg); opacity: 1; }
}

.text-roll--active .text-roll__face--enter {
    animation: text-roll-enter var(--roll-duration) var(--roll-ease) forwards;
}

.text-roll--active .text-roll__face--exit {
    animation: text-roll-exit var(--roll-duration) var(--roll-ease) forwards;
}

.text-roll--active .text-roll__letter {
    --delay-base: calc(var(--roll-stagger) * var(--index, 0));
}

.text-roll--active .text-roll__letter .text-roll__face--enter {
    animation-delay: var(--delay-base);
}

.text-roll--active .text-roll__letter .text-roll__face--exit {
    animation-delay: calc(var(--delay-base) + var(--roll-exit-gap));
}
