/* ============================================================
   AU FIL DES ÂMES — assets/css/ciel.css
   « Le ciel » — La Constellation des Âmes (carte des liens).
   Adapté de la maquette validée. S'appuie sur les variables de
   style.css (--accent, --accent-or, --bordure, --texte-*…) et
   ajoute une palette « nuit » locale.
   ============================================================ */

.page-ciel {
    --nuit-1: #0b1020;
    --nuit-2: #161b32;
    --nuit-3: #0a0f1c;
    --bleu-lettre: #7cb0ff;      /* réservé pour l'étape 3 (correspondances) */
}

.page-ciel .contenu-large {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 0 1rem;
}

/* Un peu d'air autour du « ← Retour à l'accueil », comme sur les autres pages. */
.page-ciel .retour-lien {
    display: inline-block;
    margin: 1.75rem 0 1.25rem;
}

/* ── En-tête ─────────────────────────────────────────────── */
.ciel-entete {
    text-align: center;
    margin: .5rem 0 1.4rem;
}
.ciel-h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(1.9rem, 5vw, 2.4rem);
    line-height: 1.15;
    margin: .2rem 0 .4rem;
    color: var(--texte-principal);
}
.ciel-chapeau {
    max-width: 44rem;
    margin: 0 auto;
    color: var(--texte-secondaire);
    font-size: clamp(.95rem, 2.2vw, 1.1rem);
}

/* ── Bascule Global / Mon ciel ───────────────────────────── */
.ciel-controls {
    display: flex;
    justify-content: center;
    margin: 0 0 1rem;
}
.ciel-controls .seg {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--bordure);
    border-radius: 999px;
    padding: 4px;
    box-shadow: 0 1px 2px rgba(30, 28, 26, .04);
}
.ciel-controls .seg button {
    font-family: var(--font-sans);
    font-size: .9rem;
    font-weight: 500;
    color: var(--texte-secondaire);
    background: transparent;
    border: 0;
    border-radius: 999px;
    padding: .55rem 1.15rem;
    cursor: pointer;
    transition: background .2s, color .2s;
    white-space: nowrap;
}
.ciel-controls .seg button.on { background: var(--nuit-2); color: #fff; }
.ciel-controls .seg button:not(.on):hover { color: var(--accent); }

/* ── La scène nocturne ───────────────────────────────────── */
.page-ciel .panel {
    position: relative;
    width: 100%;
    aspect-ratio: 1000 / 640;
    border-radius: var(--rayon-lg, 16px);
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 30% 0%,  #1b2347 0%, rgba(27, 35, 71, 0) 55%),
        radial-gradient(130% 120% at 85% 100%, #141a35 0%, rgba(20, 26, 53, 0) 50%),
        linear-gradient(160deg, var(--nuit-1) 0%, var(--nuit-3) 100%);
    box-shadow: 0 14px 40px rgba(11, 16, 32, .35), inset 0 0 120px rgba(5, 8, 18, .6);
    /* Pas de sélection de texte accidentelle quand on fait glisser le ciel. */
    user-select: none;
    -webkit-user-select: none;
}
/* Quand il y a de quoi se déplacer (surtout mobile), on prend la main sur le
   geste (touch-action: none) et on montre le curseur « main ». */
.page-ciel .panel.can-pan { cursor: grab; touch-action: none; }
.page-ciel .panel.can-pan.panning { cursor: grabbing; }
.page-ciel svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Étoiles ─────────────────────────────────────────────── */
.page-ciel .etoile { cursor: pointer; transition: opacity .25s; outline: none; }
.page-ciel .etoile:focus,
.page-ciel .etoile:focus-visible { outline: none; }
.page-ciel .etoile:focus-visible .grp { transform: scale(1.3); }
.page-ciel .grp { transform-box: fill-box; transform-origin: center; transition: transform .2s; }
.page-ciel .etoile:hover .grp,
.page-ciel .etoile.active .grp { transform: scale(1.3); }

.page-ciel .label {
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 400;
    fill: #8e97b4;
    paint-order: stroke;
    stroke: #0a0f1c;
    stroke-width: 2.5px;
    stroke-linejoin: round;
    transition: fill .2s;
    pointer-events: none;
}
.page-ciel .etoile:hover .label,
.page-ciel .etoile.active .label { fill: #fff; }
.page-ciel .etoile.moi .label { font-size: 15px; font-weight: 600; fill: #e7eeff; }

/* ── Fils ────────────────────────────────────────────────── */
.page-ciel .fil { transition: opacity .25s, stroke-width .2s; }
/* Doré = tout lien partagé ; « voile » = une lettre d'autrui (toujours dorée). */
.page-ciel .fil-affinite,
.page-ciel .fil-voile { stroke: var(--accent-or, #c9a24b); stroke-width: 1.6; opacity: .42; }
/* Bleu = TA correspondance (visible seulement dans « mon ciel »). */
.page-ciel .fil-lettre {
    stroke: var(--bleu-lettre);
    stroke-width: 2.6;
    opacity: .85;
    filter: drop-shadow(0 0 6px rgba(124, 176, 255, .85));
}

.page-ciel #sky.focus .etoile { opacity: .2; }
.page-ciel #sky.focus .etoile.hi { opacity: 1; }
.page-ciel #sky.focus .fil { opacity: .04; }
.page-ciel #sky.focus .fil.hi { opacity: .95; }

/* ── La fiche (aperçu / épinglée) ────────────────────────── */
.page-ciel .tip {
    position: absolute;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    background: rgba(252, 250, 245, .98);
    color: var(--texte-principal);
    border-radius: 11px;
    padding: 11px 14px;
    box-shadow: 0 10px 30px rgba(5, 8, 18, .45);
    /* Largeur FIXE et identique dans tous les états (seule la hauteur varie). */
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    border: 1px solid rgba(201, 162, 75, .35);
    /* La hauteur max éventuelle est posée en JS ; si la fiche défile, le défilement
       reste à l'intérieur (ne « fuit » pas vers la page). */
    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.page-ciel .tip.show { opacity: 1; }
.page-ciel .tip.pinned {
    pointer-events: auto;
    box-shadow: 0 12px 34px rgba(5, 8, 18, .55);
    border-color: rgba(74, 103, 65, .5);
}
.page-ciel .tip strong {
    display: block;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 1px;
}
.page-ciel .tip a.profil {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 1px;
}
.page-ciel .tip a.profil:hover { text-decoration: underline; }
.page-ciel .tip .ligne { display: block; font-size: 13px; color: var(--texte-secondaire); }
.page-ciel .tip .ligne.lien-compte { color: var(--accent); font-weight: 600; }
.page-ciel .tip .ligne.reliee { color: var(--texte-discret); }
.page-ciel .tip .ligne.interaction { color: var(--accent); }
.page-ciel .tip .ligne.interaction::before { content: '✦ '; color: var(--accent-or, #c9a24b); }
.page-ciel .tip .pts {
    display: block;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--bordure);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13.5px;
    color: var(--accent-or, #c9a24b);
}
.page-ciel .tip .moi {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    font-family: var(--font-sans);
    font-weight: 600;
}
/* Mention « ✉ Vous échangez des lettres » — sous les liens, hors du détail. */
.page-ciel .tip .lettre-note {
    display: block;
    margin-top: 6px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13px;
    color: #4d6fa8;
}

/* Chip « N liens avec toi » + liste dépliable (scroll interne). */
.page-ciel .liens-wrap { display: inline-block; margin-top: 6px; cursor: pointer; }
.page-ciel .chip {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    border-bottom: 1px dashed var(--accent-doux);
    padding-bottom: 1px;
}
.page-ciel .communs {
    display: none;
    margin-top: 7px;
    padding: 8px 10px;
    background: #efece5;
    border-radius: 8px;
    max-height: 150px;
    overflow: auto;
    cursor: default;
}
.page-ciel .liens-wrap:hover .communs,
.page-ciel .liens-wrap:focus .communs,
.page-ciel .liens-wrap.open .communs { display: block; }
.page-ciel .commun { font-size: 12.5px; color: var(--texte-secondaire); padding: 2px 0; }
.page-ciel .commun::before { content: '✦ '; color: var(--accent-or, #c9a24b); }

/* ── Légende ─────────────────────────────────────────────── */
.page-ciel .legende {
    margin-top: 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--texte-secondaire);
}
.page-ciel .legende .item { display: inline-flex; align-items: center; gap: 8px; }
.page-ciel .legende .mini { color: var(--texte-discret); font-style: italic; }
.page-ciel .dot { display: inline-block; border-radius: 50%; }
.page-ciel .dot-moi {
    width: 14px; height: 14px;
    background: radial-gradient(circle, #fff 15%, rgba(180, 210, 255, .6) 50%, transparent 78%);
    box-shadow: 0 0 0 2px rgba(180, 210, 255, .35);
}
.page-ciel .trait { display: inline-block; width: 26px; height: 0; }
.page-ciel .trait-int { border-top: 2px solid var(--accent-or, #c9a24b); }
.page-ciel .trait-let { border-top: 3px solid #7cb0ff; }

/* ── Ciel vide ───────────────────────────────────────────── */
.page-ciel .ciel-vide {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--texte-secondaire);
}

@media (max-width: 560px) {
    .page-ciel .label { font-size: 15px; }
    .ciel-controls .seg button { padding: .5rem .85rem; font-size: .85rem; }
    /* Marge latérale : le ciel, le chapeau et la légende ne touchent plus les
       bords de l'écran. */
    .page-ciel .contenu-large { padding-left: 1rem; padding-right: 1rem; }
    /* Fenêtre du ciel raccourcie (~1/3 de moins qu'en 4/5) pour laisser voir le
       haut de la page du dessous et pouvoir la faire défiler aussi. Le contenu
       reste rendu plus haut que la fenêtre (SKY_K en JS) → on le parcourt au doigt. */
    .page-ciel .panel { aspect-ratio: 6 / 5; }
}