/* ============================================================
   VISITE 3D — styles scopés, tout est préfixé .atlas-3d.
   Les mesures reprennent celles de `visite-virtuelle.css` (scène
   16/9 arrondie à 20 px, boutons ronds de 38, mini-plan à droite,
   pastilles de pièces dessous) : les deux parcours vivent dans le
   même bloc de la fiche et un écart de gabarit se verrait au
   changement d'onglet.
   ============================================================ */
.atlas-3d { --a3-accent: var(--theme-color, #ff4136); margin-bottom: 10px; }

.atlas-3d__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    overflow: hidden;
    background: #101010;
    user-select: none;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
}

.atlas-3d__cv {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    outline: none;
    touch-action: none;   /* sinon le navigateur mange le glissé */
}
.atlas-3d.is-dragging .atlas-3d__cv { cursor: grabbing; }
.atlas-3d__cv:focus-visible { box-shadow: inset 0 0 0 3px var(--a3-accent); }

/* Tant que la première pièce n'est pas chargée, la scène reste noire :
   un voile d'attente vaut mieux qu'un rectangle vide sans explication. */
.atlas-3d__wait {
    position: absolute; inset: 0;
    /* au-dessus des anneaux (6) et du bandeau (4) : pendant le chargement il
       n'y a ni nom de pièce ni repère à montrer */
    z-index: 7;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, .8);
    font-size: 13px; letter-spacing: .04em;
    background: #101010;
    transition: opacity .4s ease;
}
.atlas-3d.is-pret .atlas-3d__wait { opacity: 0; pointer-events: none; }
.atlas-3d__wait i { animation: atlas3dTourne 1.1s linear infinite; }
@keyframes atlas3dTourne { to { transform: rotate(360deg); } }

/* --- Anneaux au sol -------------------------------------------------
   Le disque est basculé en perspective pour se lire comme peint sur le
   plancher ; l'étiquette reste face à la caméra. `--d` est le diamètre,
   calculé par le moteur d'après la distance réelle : un repère lointain
   est petit, c'est ce qui donne la profondeur. */
.atlas-3d__pins { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.atlas-3d__pin {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 0; border: 0; background: none;
    pointer-events: auto;
    display: none;
    transition: opacity .25s ease;
}
.atlas-3d__ring {
    display: block;
    width: var(--d, 46px); height: calc(var(--d, 46px) * .46);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .92);
    background: rgba(255, 255, 255, .16);
    box-shadow: 0 3px 14px rgba(0, 0, 0, .45), inset 0 0 12px rgba(255, 255, 255, .3);
    animation: atlas3dPulse 2.4s ease-out infinite;
}
@keyframes atlas3dPulse {
    0%   { box-shadow: 0 3px 14px rgba(0, 0, 0, .45), inset 0 0 12px rgba(255, 255, 255, .3); }
    55%  { box-shadow: 0 3px 14px rgba(0, 0, 0, .45), inset 0 0 22px rgba(255, 255, 255, .55); }
    100% { box-shadow: 0 3px 14px rgba(0, 0, 0, .45), inset 0 0 12px rgba(255, 255, 255, .3); }
}
.atlas-3d__pin:hover .atlas-3d__ring,
.atlas-3d__pin:focus-visible .atlas-3d__ring {
    border-color: var(--a3-accent);
    background: rgba(255, 255, 255, .3);
}
.atlas-3d__tag {
    position: absolute;
    left: 50%; bottom: calc(100% + 6px);
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 5px 11px;
    border-radius: 30px;
    font-size: 12px; line-height: 1;
    color: #fff;
    background: rgba(16, 16, 16, .68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .2s ease;
}
.atlas-3d__pin:hover .atlas-3d__tag,
.atlas-3d__pin:focus-visible .atlas-3d__tag { opacity: 1; }

/* --- Bandeau haut ---------------------------------------------------- */
.atlas-3d__topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 4;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}
.atlas-3d__label { color: #fff; }
.atlas-3d__room { display: block; font-size: 17px; font-weight: 600; line-height: 1.25; }
.atlas-3d__sub {
    display: block;
    font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
    opacity: .72; margin-top: 2px;
}
.atlas-3d__tools { display: flex; gap: 8px; pointer-events: auto; }
.atlas-3d__btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(16, 16, 16, .45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background .25s ease, border-color .25s ease;
}
.atlas-3d__btn:hover,
.atlas-3d__btn[aria-pressed="true"] {
    background: var(--a3-accent);
    border-color: var(--a3-accent);
}

/* --- Mini-plan ------------------------------------------------------
   Il est en SVG et non en image : les mêmes rectangles que le relevé, donc
   il ne peut pas dériver de la scène. L'unité du viewBox est le MÈTRE. */
.atlas-3d__map {
    position: absolute;
    right: 16px; bottom: 16px;
    z-index: 5;
    width: 208px;
    padding: 8px 8px 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    border: 2px solid rgba(255, 255, 255, .9);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .38);
    transition: opacity .3s ease, transform .3s ease;
}
.atlas-3d__map.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
/* Un anneau tombe dans le coin : le plan s'efface dessous au lieu de le couper. */
.atlas-3d__map.is-efface { opacity: .22; pointer-events: none; }
.atlas-3d__plan { display: block; width: 100%; height: auto; color: var(--a3-accent); }

.atlas-3d__cell-bg { fill: #f1f0ee; stroke: #d9d6d1; stroke-width: .09; }
.atlas-3d__cell.is-off .atlas-3d__cell-bg { fill: transparent; }
.atlas-3d__cell.is-on  .atlas-3d__cell-bg { fill: #fff; stroke: var(--a3-accent); }
.atlas-3d__cell { cursor: pointer; outline: none; }
.atlas-3d__cell:hover .atlas-3d__cell-bg { fill: #fff; }
.atlas-3d__cell:focus-visible .atlas-3d__cell-bg { stroke: var(--a3-accent); stroke-width: .16; }
.atlas-3d__cell.is-off { cursor: default; }
.atlas-3d__cell-lbl {
    font-size: .8px; text-anchor: middle; fill: #6d6a66;
    font-family: inherit; pointer-events: none;
}
.atlas-3d__cell.is-on .atlas-3d__cell-lbl { fill: #15181b; font-weight: 600; }
.atlas-3d__cut { stroke: #fff; stroke-width: .16; }
.atlas-3d__cone path   { fill: var(--a3-accent); fill-opacity: .22; }
.atlas-3d__cone circle { fill: var(--a3-accent); }

.atlas-3d__levels { display: flex; gap: 4px; margin-top: 5px; }
.atlas-3d__level {
    flex: 1;
    border: 1px solid #e4e4e4; background: #fff; color: #6d6a66;
    font-size: 10px; line-height: 1; padding: 5px 4px;
    border-radius: 20px;
    transition: all .2s ease;
}
.atlas-3d__level[aria-selected="true"] {
    background: var(--a3-accent); border-color: var(--a3-accent); color: #fff;
}

/* --- Indication de prise en main ------------------------------------- */
.atlas-3d__hint {
    position: absolute;
    left: 50%; bottom: 16px;
    transform: translateX(-50%);
    z-index: 4;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    color: #fff;
    background: rgba(16, 16, 16, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity .4s ease;
    pointer-events: none;
}
.atlas-3d__hint.is-gone { opacity: 0; }

/* --- Sélecteur de pièces --------------------------------------------- */
.atlas-3d__tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.atlas-3d__tabs-cap {
    width: 100%;
    font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
    color: #8a8781;
    margin-top: 4px;
}
.atlas-3d__tabs-cap:first-child { margin-top: 0; }
.atlas-3d__tab {
    border: 1px solid #e4e4e4;
    background: #fff;
    color: #4d5053;
    font-size: 13px; line-height: 1;
    padding: 10px 15px;
    border-radius: 30px;
    transition: all .25s ease;
}
.atlas-3d__tab:hover { border-color: var(--a3-accent); color: var(--a3-accent); }
.atlas-3d__tab[aria-selected="true"] {
    background: var(--a3-accent); border-color: var(--a3-accent); color: #fff;
}

/* --- Repli sans WebGL 2 ----------------------------------------------
   Le moteur pose `is-nogl` et s'arrête. On ne montre pas une scène morte :
   on dit pourquoi, et la visite photo est dans l'onglet d'à côté. */
.atlas-3d__nogl { display: none; }
.atlas-3d.is-nogl .atlas-3d__stage,
.atlas-3d.is-nogl .atlas-3d__tabs { display: none; }
.atlas-3d.is-nogl .atlas-3d__nogl {
    display: block;
    padding: 28px 24px;
    border: 1px solid #e4e4e4;
    border-radius: 20px;
    background: #fafafa;
    color: #4d5053;
    font-size: 14px;
}

/* --- Plein écran ----------------------------------------------------- */
.atlas-3d:fullscreen { background: #101010; display: flex; align-items: center; }
.atlas-3d:fullscreen .atlas-3d__stage { border-radius: 0; aspect-ratio: auto; height: 100vh; }
.atlas-3d:fullscreen .atlas-3d__tabs { display: none; }

@media (max-width: 991px) {
    .atlas-3d__map { width: 164px; right: 12px; bottom: 12px; }
}
@media (max-width: 767px) {
    .atlas-3d__stage { border-radius: 14px; }
    .atlas-3d__room { font-size: 15px; }
    .atlas-3d__topbar { padding: 12px 14px; }
    .atlas-3d__map { width: 124px; padding: 6px 6px 4px; }
    .atlas-3d__level { font-size: 9px; padding: 4px 3px; }
    .atlas-3d__hint { font-size: 11px; bottom: 10px; padding: 7px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .atlas-3d__ring { animation: none; }
    .atlas-3d__wait i { animation: none; }
}

/* ============================================================
   SÉLECTEUR DE PARCOURS — n'apparaît que sur un bien qui porte
   les deux visites. Aujourd'hui le bien 1 seulement.
   ============================================================ */
.atlas-tour-switch { display: flex; flex-wrap: wrap; gap: 10px; }
.atlas-tour-switch__btn {
    display: flex; align-items: center; gap: 9px;
    padding: 12px 20px;
    border: 1px solid #e4e4e4;
    background: #fff;
    color: #4d5053;
    font-size: 14px; line-height: 1.2;
    border-radius: 30px;
    transition: all .25s ease;
}
.atlas-tour-switch__btn span {
    font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
    opacity: .6;
}
.atlas-tour-switch__btn:hover { border-color: var(--theme-color, #ff4136); }
.atlas-tour-switch__btn.is-on {
    background: var(--theme-color, #ff4136);
    border-color: var(--theme-color, #ff4136);
    color: #fff;
}
.atlas-tour-switch__btn.is-on span { opacity: .82; }

/* ⚠️ Le volet caché ne l'est PAS par `display: none`.
   `visite-virtuelle.js` place ses étiquettes en comparant des
   `getBoundingClientRect()` : dans un volet en `display: none` tout vaut zéro,
   `chevauche()` ne détecte plus aucun recouvrement, et la visite photo
   s'ouvrirait avec ses étiquettes empilées jusqu'au changement de pièce.
   Hauteur nulle + débordement masqué : le volet ne prend plus de place mais
   ses enfants gardent leur géométrie, donc les mesures restent justes. */
.atlas-pane.is-hidden {
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}
