/* Self-hosted Outfit (SIL OFL 1.1), Latin subset: no request to Google */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/outfit-latin-400.woff2') format('woff2');
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    /* Fond de l'espace profond : les nébuleuses sont sur body::before et ::after */
    background-color: #030308;
    color: white;
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    /* On empêche le scroll généré par le canvas ou le contenu */
    overflow: hidden;
    height: 100vh;
    /* Mobile browsers: exclude the dynamic address bar (ignored where unsupported) */
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Nebulae: two palettes cross-faded behind the star field. Only the opacity of
   ::after is animated, which the GPU composites without repainting the gradients */
body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

body::before {
    background-image:
        radial-gradient(circle at 15% 30%, rgba(74, 20, 140, 0.45) 0%, transparent 45%), /* Violet profond */
        radial-gradient(circle at 85% 70%, rgba(0, 160, 180, 0.35) 0%, transparent 50%), /* Cyan lunaire */
        radial-gradient(circle at 50% 80%, rgba(136, 14, 79, 0.35) 0%, transparent 45%), /* Rose stellaire */
        radial-gradient(circle at 80% 10%, rgba(13, 71, 161, 0.4) 0%, transparent 40%); /* Bleu profond */
}

body::after {
    /* Logo colors: orange, blue, purple */
    background-image:
        radial-gradient(circle at 80% 25%, rgba(245, 135, 2, 0.30) 0%, transparent 45%),
        radial-gradient(circle at 20% 75%, rgba(8, 124, 197, 0.40) 0%, transparent 50%),
        radial-gradient(circle at 55% 15%, rgba(99, 21, 142, 0.45) 0%, transparent 45%),
        radial-gradient(circle at 70% 90%, rgba(245, 171, 15, 0.20) 0%, transparent 40%);
    opacity: 0;
    animation: nebulaShift 24s ease-in-out infinite alternate;
    will-change: opacity;
}

#spaceOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.content {
    position: relative;
    z-index: 10;
    text-align: center;
    /* No card behind the content: a backdrop-filter over the animated canvas
       had to be re-blurred on every frame */
    padding: 0 16px;
    animation: slideUp 1.5s ease-out forwards;
}

.logo {
    margin-bottom: 20px;
    line-height: 0;
}

.logo img {
    display: block;
    width: 605px;
    /* Never wider than the screen minus the 16px side gutters */
    max-width: calc(100vw - 32px);
    height: auto;
    margin: 0 auto;
    animation: float 5s ease-in-out infinite;
    /* Soft glow around the logo. will-change gives the logo its own layer, so the
       blur is rendered once and the float animation only moves that layer */
    filter: drop-shadow(0 0 25px rgba(126, 87, 194, 0.4));
    will-change: transform;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 12px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    /* Animation d'apparition */
    animation: fadeIn 2s ease-out 1.2s forwards;
    opacity: 0;
    margin-left: 12px; /* compense le letter-spacing */
}

.site-link {
    display: inline-block;
    margin-top: 2rem;
    font-size: 0.95rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-bottom: 1px solid rgba(79, 172, 254, 0.4);
    padding-bottom: 2px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
    animation: fadeIn 2s ease-out 1.8s forwards;
    opacity: 0;
}

.site-link:hover,
.site-link:focus-visible {
    color: #4facfe;
    border-color: #4facfe;
}

/* --- Animations --- */

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

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

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

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* --- Responsive UI --- */

@media (max-width: 768px) {
    .subtitle {
        font-size: 0.9rem;
        letter-spacing: 6px;
        margin-left: 6px; /* offset trailing letter-spacing */
    }
}

/* Short screens (phones in landscape): shrink the content to fit the height */
@media (max-height: 500px) {
    .logo {
        margin-bottom: 12px;
    }
    .logo img {
        width: 403px;
    }
    .subtitle {
        font-size: 0.9rem;
        letter-spacing: 8px;
        margin-left: 8px; /* offset trailing letter-spacing */
    }
    .site-link {
        margin-top: 1rem;
    }
}

/* Very small phones (320px wide) */
@media (max-width: 360px) {
    .subtitle {
        letter-spacing: 4px;
        margin-left: 4px;
    }
}

/* Respect the OS "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}
