/*
 * Immersion cosmique (v2, 25/11/2026). Le fond suit la géométrie « cover » de l'image grâce aux unités de conteneur :
 * la scène a toujours les proportions de l'image (16:9 sur ordinateur, 9:16 sur téléphone), elle déborde comme un
 * « cover », et les logos sont placés en % de l'image : ils restent sur leurs astres quelle que soit la fenêtre.
 */
.has-cosmos { position: relative; isolation: isolate; overflow: hidden; }
.cosmos { position: absolute; inset: 0; z-index: -1; overflow: hidden; container-type: size; background: #070b14; pointer-events: none; }

/* Ordinateur : image 16:9, ancrée à droite (les astres sont à droite, le texte à gauche). */
.cosmos-stage {
    --ox: .78;
    --oy: .5;
    position: absolute;
    width: max(100cqw, 177.78cqh);
    height: max(100cqh, 56.25cqw);
    left: calc((100cqw - max(100cqw, 177.78cqh)) * var(--ox));
    top: calc((100cqh - max(100cqh, 56.25cqw)) * var(--oy));
}
.cosmos-stage picture, .cosmos-image { display: block; width: 100%; height: 100%; }
.cosmos-image { object-fit: cover; animation: cosmos-in 1.4s ease-out both; }

/* Le voile garde le texte lisible : sombre à gauche (zone du texte), transparent sur les astres, fondu vers la page. */
.cosmos-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(7, 11, 20, .9) 0%, rgba(7, 11, 20, .72) 32%, rgba(7, 11, 20, .18) 58%, rgba(7, 11, 20, 0) 74%),
        linear-gradient(180deg, rgba(7, 11, 20, .35) 0%, rgba(7, 11, 20, 0) 22%, rgba(7, 11, 20, 0) 74%, #0B1220 100%);
}

/* Les logos sur les astres : intégrés à l'astre (fusion « écran » avec sa lumière, lueur chaude), sans cadre ni fond.
   Le nom reste en texte masqué pour les lecteurs d'écran ; rien n'est écrit à l'écran. */
.cosmos-star {
    position: absolute;
    left: var(--dx);
    top: var(--dy);
    z-index: 1;
    display: block;
    mix-blend-mode: screen;
    opacity: .9;
    transform: translate(-50%, -50%);
    animation: cosmos-star-in 1.2s ease-out .5s both, cosmos-float 9s ease-in-out 1.7s infinite;
}
.cosmos-star img {
    display: block;
    width: auto;
    height: 58px;
    filter: drop-shadow(0 0 10px rgba(255, 176, 96, .55)) drop-shadow(0 0 22px rgba(255, 140, 60, .3));
}
.cosmos-star--lg img { height: 64px; }
.cosmos-star--emet img { filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 190, 120, .6)) drop-shadow(0 0 26px rgba(255, 150, 70, .35)); opacity: .92; }
.cosmos-star--orvan img { height: 86px; }
.cosmos-star--martha img { height: 76px; filter: brightness(1.25) drop-shadow(0 0 10px rgba(255, 176, 96, .6)) drop-shadow(0 0 22px rgba(255, 140, 60, .32)); }
/* Réalisations : ORVAN et Martha sont les grands astres de la page. */
.cosmos--realisations .cosmos-star--orvan img { height: 130px; }
.cosmos--realisations .cosmos-star--martha img { height: 104px; }
.cosmos-star-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cosmos-star:nth-of-type(2) { animation-delay: .7s, 2.4s; }
.cosmos-star:nth-of-type(3) { animation-delay: .9s, 3.2s; }

@keyframes cosmos-in { from { opacity: 0; transform: scale(1.035); } to { opacity: 1; transform: none; } }
@keyframes cosmos-star-in { from { opacity: 0; } to { opacity: .9; } }
@keyframes cosmos-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }

/* Pages intérieures : une bande pleine largeur porte le fond ; l'en-tête (.page-hero.shell) reste dedans, à gauche. */
body:not(.admin-body) .cosmos-band { display: flex; flex-direction: column; justify-content: center; min-height: clamp(460px, 44vw, 660px); }
body:not(.admin-body) .cosmos-band .page-hero::before { display: none; }
body:not(.admin-body) .cosmos-band .page-hero > * { max-width: min(640px, 56%); }
body:not(.admin-body) .cosmos-band .page-hero h1 { text-shadow: 0 2px 24px rgba(7, 11, 20, .65); }

/* Accueil : l'image remplace l'orbite dessinée et les étoiles animées d'avant. */
body:not(.admin-body) .home-hero-neutral.has-cosmos { background: #070b14; min-height: min(860px, calc(100svh - 82px)); }
body:not(.admin-body) .home-hero-neutral.has-cosmos::before { display: none; }
body:not(.admin-body) .home-hero-neutral.has-cosmos .home-hero-sky { display: none; }
body:not(.admin-body) .home-hero-neutral.has-cosmos h1 { text-shadow: 0 2px 28px rgba(7, 11, 20, .7); }

/* Téléphone : image 9:16, le texte en haut (zone calme), les astres en bas. */
@media (max-width: 760px) {
    .cosmos-stage {
        --ox: .5;
        --oy: 1;
        width: max(100cqw, 56.25cqh);
        height: max(100cqh, 177.78cqw);
        left: calc((100cqw - max(100cqw, 56.25cqh)) * var(--ox));
        top: calc((100cqh - max(100cqh, 177.78cqw)) * var(--oy));
    }
    .cosmos-veil {
        background: linear-gradient(180deg, rgba(7, 11, 20, .88) 0%, rgba(7, 11, 20, .74) 38%, rgba(7, 11, 20, .12) 62%, rgba(7, 11, 20, 0) 80%, #0B1220 100%);
    }
    .cosmos-star { left: var(--mx); top: var(--my); }
    .cosmos-star img { height: 40px; }
    .cosmos-star--lg img { height: 44px; }
    .cosmos-star--orvan img { height: 58px; }
    .cosmos-star--martha img { height: 52px; }
    .cosmos--realisations .cosmos-star--orvan img { height: 84px; }
    .cosmos--realisations .cosmos-star--martha img { height: 70px; }
    body:not(.admin-body) .cosmos-band { justify-content: flex-start; min-height: 900px; }
    body:not(.admin-body) .cosmos-band .page-hero p { text-shadow: 0 1px 14px rgba(7, 11, 20, .85); }
    body:not(.admin-body) .cosmos-band .page-hero > * { max-width: none; }
    body:not(.admin-body) .home-hero-neutral.has-cosmos { min-height: 760px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .cosmos-image, .cosmos-star { animation: none; }
}

/* Page fondateur : en-tête dense (prix, textes) → voile plus présent partout, mise en page d'origine conservée. */
body:not(.admin-body) .cosmos-band--dense { display: block; }
body:not(.admin-body) .cosmos-band--dense .page-hero > * { max-width: none; }
.cosmos-band--dense .cosmos-veil {
    background:
        linear-gradient(90deg, rgba(7, 11, 20, .9) 0%, rgba(7, 11, 20, .78) 45%, rgba(7, 11, 20, .55) 70%, rgba(7, 11, 20, .35) 100%),
        linear-gradient(180deg, rgba(7, 11, 20, .2) 0%, rgba(7, 11, 20, 0) 30%, rgba(7, 11, 20, .2) 80%, #0B1220 100%);
}
@media (max-width: 760px) { .cosmos-band--dense .cosmos-veil { background: linear-gradient(180deg, rgba(7, 11, 20, .86) 0%, rgba(7, 11, 20, .72) 70%, #0B1220 100%); } }
