:root {
    --ease-smooth: cubic-bezier(.22, .9, .35, 1);
    --logo-top-dest: 2rem;
}

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

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

html, body {
    overflow-x: hidden;
    position: relative;
}

body {
    min-height: 100vh;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    font-family: 'Montserrat', Arial, Helvetica, sans-serif;
    color: #fff;
}

body:not(.has-splash) {
    opacity: 0;
}

body:not(.has-splash).loaded {
    animation: pageFadeIn 0.8s var(--ease-smooth) forwards;
}

/* --- SPLASH SCREEN --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: block;
    pointer-events: none;
    animation: splashBgFadeOut 1s var(--ease-smooth) forwards 2.5s,
               splashHide 0s linear forwards 3.5s;
}

.splash-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(60vw, 400px);
    height: auto;
    clip-path: inset(0 100% 0 0);
    animation: 
        logoReveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) forwards 0.3s,
        logoMove 0.6s var(--ease-smooth) forwards 1.9s;
}

@keyframes logoReveal {
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes logoMove {
    to {
        top: var(--logo-top-dest);
        transform: translate(-50%, 0);
    }
}

@keyframes splashBgFadeOut {
    to {
        background-color: rgba(0, 0, 0, 0);
    }
}

@keyframes splashHide {
    to {
        visibility: hidden;
    }
}

/* Staggered Content Reveal */
body.has-splash .tagline-field,
body.has-splash .footer__link {
    opacity: 0;
    animation: contentFadeIn 0.8s var(--ease-smooth) forwards;
}

/* Buttons fade in one by one */
body.has-splash .tagline-field:nth-child(1) { animation-delay: 2.6s; }
body.has-splash .tagline-field:nth-child(2) { animation-delay: 3.0s; }

/* Footer links reveal sequentially */
body.has-splash .footer__link:nth-child(1) { animation-delay: 3.6s; }
body.has-splash .footer__link:nth-child(2) { animation-delay: 3.8s; }
body.has-splash .footer__link:nth-child(3) { animation-delay: 4.0s; }
body.has-splash .footer__link:nth-child(4) { animation-delay: 4.2s; }

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

.hero {
    width: 100%;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
}

.hero__logo {
    max-width: min(60vw, 400px);
    height: auto;
}

.taglines {
    width: 100%;
    margin-top: 40px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10vh;
}

.tagline-field {
    position: relative;
    width: min(62vw, 480px);
    padding: 3.5rem 0;
    display: flex;
    justify-content: center;
    border-radius: 260px;
    background: transparent;
    border: none;
    box-shadow: none;
    --field-visibility: 0;
}

.tagline-field::before {
    content: '';
    position: absolute;
    top: -140%;
    left: -140%;
    right: -140%;
    bottom: -140%;
    background: radial-gradient(circle at calc(36.8% + var(--pointer-x, 50%) * 0.263) calc(36.8% + var(--pointer-y, 50%) * 0.263),
        var(--field-glow-inner, rgba(255, 255, 255, 0.35)) 0%,
        var(--field-glow-mid, rgba(255, 255, 255, 0.08)) calc(10% + (1 - var(--pointer-intensity, 0)) * 5%),
        rgba(0, 0, 0, 0) 50%);
    -webkit-mask-image: radial-gradient(circle at calc(36.8% + var(--pointer-x, 50%) * 0.263) calc(36.8% + var(--pointer-y, 50%) * 0.263), rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 15%, rgba(0, 0, 0, 0) 35%);
    mask-image: radial-gradient(circle at calc(36.8% + var(--pointer-x, 50%) * 0.263) calc(36.8% + var(--pointer-y, 50%) * 0.263), rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 15%, rgba(0, 0, 0, 0) 35%);
    opacity: calc(var(--pointer-intensity, 0) * var(--field-visibility) * 0.35);
    transition: opacity 0.3s var(--ease-smooth), filter 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
    filter: blur(calc(20px - (var(--pointer-intensity, 0) * 6px)));
    transform: scale(calc(0.78 + var(--pointer-intensity, 0) * 0.1));
    pointer-events: none;
    mix-blend-mode: screen;
}

.tagline-field.is-active {
    --field-visibility: 1;
}

.tagline {
    display: inline-block;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.12em;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    background-size: 250% 250%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: gradientFlow;
    animation-duration: var(--gradient-speed, 10s);
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    text-shadow:
        0 0 12px var(--glow-color-a, rgba(255, 255, 255, 0.15)),
        0 0 30px var(--glow-color-b, rgba(255, 255, 255, 0.1));
    cursor: pointer;
    transition: text-shadow 0.4s var(--ease-smooth),
                transform 0.4s var(--ease-smooth),
                animation-duration 0.3s linear;
    outline: none;
}

.tagline--immagine {
    background-image: linear-gradient(135deg, #ff3131 0%, #ff914d 100%);
    --gradient-speed: 7s;
    --gradient-speed-hover: 3s;
    --glow-color-a: rgba(255, 49, 49, 0.45);
    --glow-color-b: rgba(255, 145, 77, 0.3);
}

.tagline--cognitiva {
    background-image: linear-gradient(135deg, #7c8ce9 0%, #7550a8 100%);
    --gradient-speed: 11s;
    --gradient-speed-hover: 4s;
    --glow-color-a: rgba(124, 140, 233, 0.45);
    --glow-color-b: rgba(117, 80, 168, 0.3);
}

.tagline-field--immagine {
    --field-glow-inner: rgba(255, 49, 49, 0.45);
    --field-glow-mid: rgba(255, 145, 77, 0.08);
}

.tagline-field--cognitiva {
    --field-glow-inner: rgba(124, 140, 233, 0.45);
    --field-glow-mid: rgba(117, 80, 168, 0.08);
}

.tagline:hover,
.tagline:focus-visible {
    text-shadow:
        0 0 18px var(--glow-color-a, rgba(255, 255, 255, 0.3)),
        0 0 42px var(--glow-color-b, rgba(255, 255, 255, 0.24));
    transform: scale(1.05);
    animation-duration: var(--gradient-speed-hover, 4s);
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@media (max-width: 768px) {
    :root {
        --logo-top-dest: 1rem;
    }

    .hero {
        padding: 1rem 0;
    }

    .taglines {
        margin-top: 0;
        gap: 3rem;
    }

    .tagline-field {
        width: 90vw;
        padding: 1.5rem 0;
    }

    body.has-splash .footer {
        flex-wrap: nowrap;
        gap: 1rem;
        padding: 1.5rem 0;
    }
    .footer__link {
        font-size: 0.75rem;
    }
}

.footer {
    width: 100%;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: auto;
    flex-shrink: 0;
}

.footer__link {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-style: italic;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.footer__link:hover {
    opacity: 1;
}
