/* ============================================
   LA CONSTELLATION

   Les portraits ne bougent pas. Seuls les objets tournent
   autour d'eux. Un portrait sert à être LU, le mouvement
   sert à donner VIE — mêlés, chacun sabotait l'autre.
============================================ */

.cst {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2.5rem;
    align-items: center;
}

.cst__scene {
    position: relative;
    height: 720px;
    overflow: hidden;
    border-radius: 20px;
}

.cst.en-edition .cst__scene { cursor: crosshair; }

/* --- Les traits --- */

.cst__traits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.cst.en-edition .cst__traits { pointer-events: auto; }
.cst.sans-traits .cst__traits { opacity: 0; }
.cst__traits { transition: opacity 400ms ease; }

.cst__trait {
    stroke: rgba(198, 208, 255, 0.32);
    stroke-width: 1;
    stroke-linecap: round;
}

.cst.en-edition .cst__trait { stroke-width: 1.4; }

.cst__trait--fantome {
    stroke: rgba(0, 212, 255, 0.6);
    stroke-dasharray: 4 5;
    pointer-events: none;
}

/* Les nœuds : visibles en permanence. Ce sont eux qui donnent
   l'allure d'une carte du ciel tracée à la main. */
.cst__noeud {
    fill: rgba(120, 210, 255, 0.8);
    stroke: rgba(0, 212, 255, 0.18);
    stroke-width: 5;
    filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.7));
}

/* Une zone de prise invisible et large : viser un trait de un pixel
   de large est presque impossible autrement. */
.cst__prise {
    stroke: transparent;
    stroke-width: 14;
    pointer-events: none;
}

.cst.en-edition .cst__prise { pointer-events: stroke; cursor: pointer; }
.cst.en-edition .cst__prise:hover + .cst__trait {
    stroke: var(--rose, #ff2d95);
    stroke-width: 2;
}

/* --- Les astres --- */

.cst__gens { position: absolute; inset: 0; z-index: 4; }

.cst__astre {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
}

.cst.en-edition .cst__astre { cursor: grab; }
.cst__astre.est-deplace { cursor: grabbing; z-index: 20; }

.cst__bouton {
    display: block;
    position: relative;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.cst__disque {
    display: block;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.16);
    background: #14121f;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
    transition: border-color 260ms ease, box-shadow 260ms ease, transform 260ms ease;
}

.cst__disque img { display: block; width: 100%; height: 100%; object-fit: cover; }

.cst__astre:hover .cst__disque { transform: scale(1.06); }

.cst__nom {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: var(--sourdine, #8888aa);
    white-space: nowrap;
    transition: color 260ms ease;
}

.cst__astre.est-choisi .cst__disque {
    border-color: var(--bleu, #00d4ff);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.16),
                0 16px 48px rgba(0, 212, 255, 0.22);
}

.cst__astre.est-choisi .cst__nom { color: var(--encre, #e0e0ff); }

/* --- Les tailles ---
   La taille dit l'importance. La position dit le reste. */

.cst__astre[data-taille="centre"] .cst__disque { width: 168px; height: 168px;
    border-color: rgba(0, 212, 255, 0.5); }
.cst__astre[data-taille="grand"] .cst__disque { width: 116px; height: 116px; }
.cst__astre[data-taille="petit"] .cst__disque { width: 84px; height: 84px; }

.cst__astre[data-taille="centre"] .cst__nom {
    font-size: 0.92rem; letter-spacing: 0.24em; color: var(--encre, #e0e0ff);
}

/* --- Les objets ---
   Ils tournent, eux seuls. Chacun dit quelque chose de son
   personnage : le papillon d'Odette est son esprit guide. */

.cst__objet {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    pointer-events: none;
    border-radius: 8px;
    opacity: 0.85;
    transition: opacity 400ms ease;
}

.cst.sans-objets .cst__objet { opacity: 0; }

/* Tes icônes. Elles sont recadrées sur leur dessin : les fichiers
   d'origine avaient beaucoup de vide autour, et à quarante pixels
   chaque pixel perdu se voit — l'épée serait devenue un trait. */
.cst__objet {
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border-radius: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.cst__objet--logo       { background-image: url("./objets/noe.webp"); }
.cst__objet--cookie     { background-image: url("./objets/calyne.webp"); }
.cst__objet--guitare    { background-image: url("./objets/ari.webp"); }
.cst__objet--rune       { background-image: url("./objets/sarah.webp"); }
.cst__objet--carte      { background-image: url("./objets/sacha.webp"); }
.cst__objet--casque     { background-image: url("./objets/ren.webp"); }
.cst__objet--papillon   { background-image: url("./objets/odette.webp"); }
.cst__objet--coquillage { background-image: url("./objets/nemo.webp"); }
.cst__objet--aile       { background-image: url("./objets/nott.webp"); }
.cst__objet--epee       { background-image: url("./objets/eirik.webp"); }
.cst__objet--plume      { background-image: url("./objets/skuld.webp"); }

/* L'épée et la plume sont très allongées : à taille égale elles
   paraissent deux fois plus petites que le cookie ou le papillon. */
.cst__objet--epee,
.cst__objet--plume { transform-origin: center; width: 50px; height: 50px;
                     margin: -25px 0 0 -25px; }

/* --- L'aide en édition --- */

.cst__aide {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 30;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: rgba(12, 10, 24, 0.9);
    border: 1px solid var(--trait, #2b2540);
    font-size: 0.74rem;
    color: var(--sourdine, #8888aa);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.cst__aide.est-visible { opacity: 1; }

/* --- Odin --- */

.cst__odin {
    position: absolute;
    left: 50%;
    top: 58%;
    width: 170%;
    /* Le cadre suit le format de l'image au lieu d'être plus haut que
       large : sinon le recadrage automatique lui coupait le crâne. */
    aspect-ratio: 16 / 9;
    transform: translate(-50%, -50%) scale(1.04);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition: opacity 1800ms ease, transform 2400ms ease;
}

.cst__odin img {
    width: 100%; height: 100%;
    object-fit: cover;
    /* On cale sur le HAUT de l'illustration : sa tête y est entière,
       et c'est le bas de l'image qui se retrouve coupé — ce qui ne
       coûte rien, il n'y a que de la pierre et de la poussière. */
    object-position: 50% 0%;
    filter: saturate(0.75) brightness(0.8) blur(2px);
    -webkit-mask-image: radial-gradient(ellipse 44% 46% at 50% 44%,
        #000 0%, rgba(0,0,0,0.92) 26%, rgba(0,0,0,0.62) 44%,
        rgba(0,0,0,0.28) 62%, rgba(0,0,0,0.08) 78%, transparent 92%);
    mask-image: radial-gradient(ellipse 44% 46% at 50% 44%,
        #000 0%, rgba(0,0,0,0.92) 26%, rgba(0,0,0,0.62) 44%,
        rgba(0,0,0,0.28) 62%, rgba(0,0,0,0.08) 78%, transparent 92%);
}

.cst__odin.est-visible { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }

/* Sur un écran étroit, la scène est plus haute que large : le cadre
   doit s'élargir pour que le visage reste entier. */
@media (max-width: 980px) {
    .cst__odin { width: 240%; }
}

.cst__odin-titre {
    position: absolute;
    left: 50%;
    top: 1.2rem;
    z-index: 25;
    transform: translateX(-50%) translateY(-8px);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1400ms ease, transform 1400ms ease;
}

.cst__odin-titre.est-visible { opacity: 1; transform: translateX(-50%); }

.cst.odin-presence .cst__disque { filter: saturate(0.7) brightness(0.88); }
.cst__disque { transition: filter 1200ms ease; }

/* --- La fiche --- */

.cst__fiche {
    align-self: center;
    min-height: 280px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 340ms ease, transform 340ms ease;
}

.cst__fiche.est-ouverte { opacity: 1; transform: none; }
.cst__fiche-nom { margin: 0; font-size: 1.55rem; letter-spacing: 0.1em; font-weight: 500; }
.cst__fiche-sous { margin: 0.25rem 0 0.9rem; font-size: 0.76rem;
    letter-spacing: 0.12em; color: var(--sourdine, #8888aa); }
.cst__fiche-texte { margin: 0 0 0.9rem; font-size: 0.92rem; line-height: 1.7; opacity: 0.87; }
.cst__fiche-aime { margin: 0; font-size: 0.85rem; color: var(--rose, #ff2d95); }
.cst__fiche-aime b { font-weight: 500; }

.cst__porte {
    margin-top: 1.4rem; padding: 1.1rem;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px; background: rgba(139, 92, 246, 0.09);
}

.cst__porte-lien {
    display: inline-block; margin-top: 0.4rem; padding: 0.48rem 1.15rem;
    border-radius: 999px; border: 1px solid var(--violet, #8b5cf6);
    color: var(--encre, #e0e0ff); font-size: 0.85rem; text-decoration: none;
    transition: background 240ms ease;
}

.cst__porte-lien:hover { background: rgba(139, 92, 246, 0.25); }

/* --- Mobile --- */

@media (max-width: 980px) {
    .cst { grid-template-columns: 1fr; gap: 1.2rem; }
    .cst__scene { height: 480px; }
    .cst__astre[data-taille="centre"] .cst__disque { width: 104px; height: 104px; }
    .cst__astre[data-taille="grand"] .cst__disque { width: 70px; height: 70px; }
    .cst__astre[data-taille="petit"] .cst__disque { width: 54px; height: 54px; }
    .cst__nom { font-size: 0.6rem; }
    .cst__objet { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
    .cst__fiche { min-height: 0; }
}

/* Le titre de l'œuvre, dans l'encart. */
.cst__porte-titre {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.9);
}


/* Le nom d'Odin, seul et doré. Pas de sous-titre : il n'a pas
   besoin d'être présenté. */
.cst__odin-titre .sys__odin-nom {
    font-size: 1.3rem;
    letter-spacing: 0.5em;
    text-indent: 0.5em;
    color: #d4af37;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.95),
                 0 0 30px rgba(212, 175, 55, 0.35);
}
