/* Viewer 1p1 — page publique / préviz / embed. Vanilla, sans dépendance. */
.viewer-shell,
#viewer {
  --viewer-bg: #0d1413;
  --viewer-panel: rgba(16, 23, 22, 0.92);
  --viewer-text: #f5f7f6;
  --viewer-accent: #4bb3a6;
}
* { box-sizing: border-box; }
html.viewer-shell, body.viewer-shell {
  margin: 0;
  height: 100%;
  background: var(--viewer-bg);
  color: var(--viewer-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
.viewer-shell #viewer { position: fixed; inset: 0; overflow: hidden; }

/* Conteneur centré : le cadre y est dimensionné par JS (parité géométrique). */
.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050908;
}

/* Le cadre : ratio = photoFormat ; la photo le remplit en cover. */
.frame {
  position: relative;
  overflow: hidden;
  background: #101716 center/cover no-repeat;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

/* Double calque pour transitions fluides sans flash noir */
.frame__layers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}
.frame__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  will-change: transform, opacity;
}
.frame__layer--incoming {
  opacity: 0;
  transform: scale(1.02);
}
.frame__layer.is-leaving {
  transform-origin: var(--origin-x, 50%) var(--origin-y, 50%);
  transform: scale(1.10);
  opacity: 0;
  transition: transform 320ms cubic-bezier(0.2, 0, 0.2, 1), opacity 280ms ease-out;
}
.frame__layer.is-leaving.is-fade-only {
  transform: none;
  opacity: 0;
  transition: opacity 280ms ease-out;
}
.frame__layer--incoming.is-entering {
  opacity: 1;
  transform: scale(1);
  transition: transform 320ms cubic-bezier(0.2, 0, 0.2, 1), opacity 300ms ease-out;
}
.frame__layer--incoming.is-entering.is-fade-only {
  transform: none;
  opacity: 1;
  transition: opacity 280ms ease-out;
}

.frame__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity 240ms ease;
}
.frame__photo.is-loaded { opacity: 1; }

/* Calque des marqueurs au-dessus des calques photos */
.frame__markers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  transition: opacity 160ms ease;
  /* Conteneur de requête : les repères se dimensionnent sur la photo (cqmin).
   * Pas de containment de peinture : ondes et libellés peuvent déborder. */
  container: markers / size;
}
.frame__markers > * {
  pointer-events: auto;
}
.frame__markers.is-fading-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.frame__markers.is-fading-in {
  animation: markersFadeIn 160ms ease forwards;
}
@keyframes markersFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Marqueurs visiteur : cible tactile 44×44 invariable, disque visible
 * proportionnel à la photo. Le centre commun reste ancré exactement sur le
 * point normalisé du cadre.
 *
 * Règle partagée avec l'app (lib/features/hub/domain/marker_metrics.dart) :
 *   D = clamp(18px, 3 % du plus petit côté de la photo, 32px) ≈ 27 à 1200×900
 *   glyphe = D × 16/28 (min 11px) ; contraste = min(D × 38/28, 44px)
 *   ondes ×2,8 si le petit côté ≥ 600px, sinon ×1,8
 *   libellé ≤ 80px si le petit côté ≥ 400px, sinon ≤ 64px */
.marker {
  --marker-d: clamp(18px, 3cqmin, 32px);
  --marker-contrast-d: min(calc(var(--marker-d) * 38 / 28), 44px);
  --marker-label-max: 64px;
}
@container markers (min-width: 400px) and (min-height: 400px) {
  .marker { --marker-label-max: 80px; }
}
.marker {
  position: absolute;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: var(--viewer-text);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 80ms ease;
}
/* Rayonnement « sonar » autour du disque, identique pour tous les repères.
 * Trois anneaux fins partagent une seule animation, déphasés d'un tiers de
 * cycle (délais négatifs) : à tout instant une petite onde encore nette, une
 * moyenne déjà estompée et une grande presque éteinte. Seuls transform et
 * opacity sont animés (compositeur GPU). Le disque, sa taille et son clic
 * ne sont pas touchés : le calque est derrière lui, sans pointer-events, et
 * absolu, donc sans effet sur la mise en page.
 *
 * Réglages :
 *   --marker-wave-duration : durée d'une onde (vitesse)
 *   --marker-wave-scale    : diamètre final / diamètre du disque (amplitude)
 *   --marker-wave-opacity  : opacité au départ de l'onde
 *   --marker-wave-width    : épaisseur du trait au départ
 *   --marker-wave-rgb      : couleur (triplet R G B)
 *   --marker-wave-easing   : courbe de l'expansion
 * Le diamètre de départ suit --marker-wave-size, calé sur le disque. */
.marker {
  --marker-wave-size: var(--marker-d);
  --marker-wave-duration: 2s;
  --marker-wave-scale: 1.8;
  --marker-wave-opacity: 0.5;
  --marker-wave-width: 1.25px;
  --marker-wave-rgb: 255 255 255;
  /* Décélération douce, moins brusque que (0.2, 0.6, 0.3, 1) : avec trois
   * ondes déphasées d'un tiers, les rayons restent bien espacés (≈ 1 ; 1,9 ;
   * 2,6 × le disque) au lieu de s'agglutiner en bout de course. */
  --marker-wave-easing: cubic-bezier(0.3, 0.4, 0.5, 1);
}
.marker__waves {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}
.marker__wave {
  position: absolute;
  left: calc(var(--marker-wave-size) / -2);
  top: calc(var(--marker-wave-size) / -2);
  width: var(--marker-wave-size);
  height: var(--marker-wave-size);
  border-radius: 50%;
  border: var(--marker-wave-width) solid rgb(var(--marker-wave-rgb));
  /* Halo léger dans la couleur de l'onde + liseré sombre très discret pour
   * rester lisible sur un mur clair comme sur une zone sombre. */
  box-shadow:
    0 0 6px rgb(var(--marker-wave-rgb) / 0.45),
    0 0 0 0.5px rgb(3 10 16 / 0.28);
  opacity: 0;
  transform: scale(1);
  animation:
    markerWaveGrow var(--marker-wave-duration) var(--marker-wave-easing) infinite,
    markerWaveFade var(--marker-wave-duration) linear infinite;
}
.marker__wave:nth-child(2) {
  animation-delay: calc(var(--marker-wave-duration) / -3);
}
.marker__wave:nth-child(3) {
  animation-delay: calc(var(--marker-wave-duration) * -2 / 3);
}
@keyframes markerWaveGrow {
  from { transform: scale(1); }
  to { transform: scale(var(--marker-wave-scale)); }
}
@keyframes markerWaveFade {
  from { opacity: var(--marker-wave-opacity); }
  to { opacity: 0; }
}
@container markers (min-width: 600px) and (min-height: 600px) {
  .marker { --marker-wave-scale: 2.8; }
}
/* Sans container queries : valeurs calculées par app.js sur le cadre
 * (sizeFrame), à défaut le rendu historique. */
@supports not (container-type: size) {
  .marker {
    --marker-d: var(--marker-d-js, 28px);
    --marker-label-max: var(--marker-label-max-js, 80px);
    --marker-wave-scale: var(--marker-wave-scale-js, 2.8);
  }
}
#viewer.is-markers-hidden .marker__wave {
  animation-play-state: paused;
}

.marker__dot {
  position: absolute;
  inset: calc((44px - var(--marker-d)) / 2);
  width: var(--marker-d);
  height: var(--marker-d);
  border-radius: 50%;
  color: #fff;
  background: rgba(2, 11, 20, 0.35);
  /* Bordure et ombres au prorata du disque historique de 28px. */
  border: max(1px, calc(var(--marker-d) * 1.5 / 28)) solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 max(1px, calc(var(--marker-d) * 1.5 / 28)) rgba(0, 0, 0, 0.85),
    0 calc(var(--marker-d) * 4 / 28) calc(var(--marker-d) * 10 / 28) rgba(0, 0, 0, 0.34);
  transition: background-color 140ms ease, transform 140ms ease, opacity 120ms ease;
}
.marker:hover .marker__dot,
.marker:focus-visible .marker__dot {
  background: rgba(2, 11, 20, 0.62);
  transform: scale(1.06);
}
.marker:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.7);
}
.marker:active .marker__dot,
.marker.is-active .marker__dot {
  transform: scale(0.94);
}
.marker.is-loading .marker__dot {
  animation: markerPulse 700ms ease-in-out infinite alternate;
}
@keyframes markerPulse {
  from { transform: scale(0.94); opacity: 0.7; }
  to { transform: scale(1.12); opacity: 1; }
}

.marker__glyph {
  width: max(11px, calc(var(--marker-d) * 16 / 28));
  height: max(11px, calc(var(--marker-d) * 16 / 28));
  display: block;
  filter: drop-shadow(0 1px 2px #000);
}

.marker__label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 3px;
  width: max-content;
  max-width: var(--marker-label-max);
  /* 11px par défaut, suit la taille de police choisie dans le navigateur. */
  font-size: max(11px, 0.6875rem);
  font-weight: 700;
  text-align: center;
  padding: 2px 5px;
  border-radius: 6px;
  color: #fff;
  background: rgba(2, 7, 12, 0.70);
  white-space: normal;
  overflow: hidden;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  pointer-events: none;
}
.marker.is-near-bottom .marker__label {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
}
.marker.is-near-left .marker__label {
  left: 50%;
  transform: none;
}
.marker.is-near-right .marker__label {
  right: 50%;
  left: auto;
  transform: none;
}

/* Variante choisie par le visiteur : géométrie et navigation inchangées,
 * disque jaune proche du rendu historique et sans statut de production. */
#viewer[data-marker-style="contrast"] .marker__dot {
  inset: calc((44px - var(--marker-contrast-d)) / 2);
  width: var(--marker-contrast-d);
  height: var(--marker-contrast-d);
  color: #071018;
  background: #e7ff19;
  /* Au prorata du disque contraste historique de 38px. */
  border: max(1px, calc(var(--marker-contrast-d) * 2 / 38)) solid #071018;
  box-shadow:
    0 0 0 max(1px, calc(var(--marker-contrast-d) * 1.5 / 38)) rgba(255, 255, 255, 0.88),
    0 calc(var(--marker-contrast-d) * 5 / 38) calc(var(--marker-contrast-d) * 12 / 38) rgba(0, 0, 0, 0.42);
}
#viewer[data-marker-style="contrast"] .marker {
  --marker-wave-size: var(--marker-contrast-d);
  --marker-wave-rgb: 231 255 25;
  --marker-wave-opacity: 0.55;
  --marker-wave-width: 1.5px;
}
#viewer[data-marker-style="contrast"] .marker__glyph { filter: none; }
#viewer[data-marker-style="contrast"] .marker__label {
  background: rgba(2, 7, 12, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

/* Titre + bouton plein écran. */
.chrome {
  position: absolute;
  z-index: 5;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.4), transparent);
  pointer-events: none;
}
.chrome__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.chrome__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  pointer-events: none;
}
.chrome__btn {
  position: relative;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--viewer-text);
  background: rgba(16, 23, 22, 0.64);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  touch-action: manipulation;
  transition: background-color 140ms ease, transform 140ms ease, border-color 140ms ease;
}
/* Hitbox tactile 48x48 px sans alourdir la pastille visuelle de 36 px */
.chrome__btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}
.chrome__actions .chrome__btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
}
.chrome__btn:hover {
  background: rgba(29, 41, 39, 0.85);
  border-color: rgba(255, 255, 255, 0.28);
}
.chrome__btn:active { transform: scale(0.94); }
.chrome__btn:focus-visible,
.facade__play:focus-visible,
.brand:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.chrome__fullscreen {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chrome__contrast {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.chrome__contrast path {
  fill: currentColor;
  stroke: none;
}
.chrome__marker-style[aria-pressed="true"] { color: #e7ff19; }
.chrome__hide-markers {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chrome__btn.chrome__peek-markers {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.chrome__btn.chrome__peek-markers[aria-pressed="true"] {
  color: #e7ff19;
}
#viewer.is-markers-hidden .marker,
#viewer.is-markers-hidden .viewer-hint {
  opacity: 0;
  pointer-events: none;
}
#viewer[data-external-controls="true"] .chrome { display: none; }
#viewer[data-external-controls="true"] .facade__title { display: none; }
.chrome__back {
  height: 36px;
  min-height: 36px;
  padding: 0 12px 0 8px;
}
.chrome__back svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Bouton d'accès au plan de visite dans le chrome */
.chrome__actions .chrome__plan-toggle {
  width: auto;
  min-width: 70px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px 0 8px;
  gap: 5px;
  border-radius: 999px;
}
.chrome__plan-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chrome__plan-label {
  font-size: 13px;
  font-weight: 500;
}
.chrome__plan-toggle.is-active {
  background: rgba(213, 184, 118, 0.24);
  color: #f5d993;
  border-color: rgba(213, 184, 118, 0.45);
}

/* Visite auto : bouton de lancement et export vidéo (préviz du propriétaire) */
.chrome__actions .chrome__auto,
.chrome__actions .chrome__video {
  width: auto;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 11px 0 9px;
  gap: 5px;
  border-radius: 999px;
}
.chrome__auto-icon,
.chrome__video-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}
.chrome__auto-icon { fill: currentColor; }
.chrome__video-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chrome__auto-label,
.chrome__video-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chrome__auto { color: #f5d993; border-color: rgba(213, 184, 118, 0.45); }
.chrome__auto.is-loading,
.chrome__video.is-busy { opacity: 0.75; cursor: progress; }
.chrome__video[aria-disabled="true"]:not(.is-busy) { opacity: 0.55; }

/* Lecture auto : le film recouvre le viewer et garde son format (16:9 ou 9:16). */
#viewer.is-autotour .chrome,
#viewer.is-autotour .viewer-plan,
#viewer.is-autotour .viewer-hint,
#viewer.is-autotour .brand { display: none; }
.autotour {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  cursor: pointer;
}
.autotour__canvas { display: block; }
.autotour__btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #f3efe6;
  background: rgba(14, 14, 15, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  touch-action: manipulation;
}
.autotour__btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.autotour__btn:hover { background: rgba(30, 30, 32, 0.85); }
.autotour__btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.autotour__btn--primary {
  color: #121212;
  background: #d9b871;
  border-color: #d9b871;
}
.autotour__btn--primary:hover { background: #e4c88a; }
.autotour__exit {
  position: absolute;
  top: 12px;
  right: 14px;
}
.autotour__end {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}
.autotour__end[hidden] { display: none; }
.autotour.is-ended .autotour__exit { display: none; }

/* Plan de visite interactif (Sommaire des pièces nommées) */
.viewer-plan {
  --plan-bg: rgba(14, 21, 20, 0.94);
  --plan-border: rgba(255, 255, 255, 0.08);
  --plan-text: var(--viewer-text);
  --plan-muted: rgba(245, 247, 246, 0.55);
  --plan-gold: #d5b876;
  --plan-gold-strong: #e0c98f;
  --plan-active-bg: rgba(213, 184, 118, 0.16);
  --plan-active-border: rgba(213, 184, 118, 0.35);
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 240ms ease;
  font-family: inherit;
  color: var(--plan-text);
}

.viewer-plan.is-open {
  pointer-events: auto;
  visibility: visible;
}

.viewer-plan__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 240ms ease;
  cursor: pointer;
}

.viewer-plan.is-open .viewer-plan__scrim {
  opacity: 1;
}

.viewer-plan__panel {
  display: flex;
  flex-direction: column;
  background: var(--plan-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--plan-border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
}

.viewer-plan__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--plan-border);
}
.viewer-plan__title {
  margin: 0;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plan-muted);
}
.viewer-plan__close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  background: transparent;
  border: 0;
  color: var(--plan-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 140ms ease, color 140ms ease;
  touch-action: manipulation;
}
.viewer-plan__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.viewer-plan__content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.viewer-plan__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.viewer-plan__group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--viewer-accent);
  padding: 2px 8px 4px;
}

.viewer-plan__item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(245, 247, 246, 0.82);
  font-size: 14px;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  touch-action: manipulation;
}
.viewer-plan__item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.viewer-plan__close:focus-visible,
.viewer-plan__item:focus-visible {
  outline: 3px solid var(--plan-gold-strong);
  outline-offset: 2px;
}
.viewer-plan__item.is-active {
  background: var(--plan-active-bg);
  color: var(--plan-gold-strong);
  font-weight: 600;
  border-color: var(--plan-active-border);
}
.viewer-plan__item.is-active::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--plan-gold-strong);
  box-shadow: 0 0 6px var(--plan-gold);
  flex-shrink: 0;
  margin-left: 8px;
}
.viewer-plan__item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-plan__footer {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--plan-muted);
  border-top: 1px solid var(--plan-border);
  line-height: 1.4;
}

.viewer-plan__group-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Responsive Desktop (>= 900px) : Volet latéral droit en overlay */
@media (min-width: 900px) {
  .viewer-plan__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85%;
    height: 100%;
    border-left: 1px solid var(--plan-border);
    transform: translateX(100%);
    transition: transform 260ms cubic-bezier(0.2, 0, 0, 1);
  }
  .viewer-plan.is-open .viewer-plan__panel {
    transform: translateX(0);
  }
}

/* Responsive Mobile (< 900px) : Bottom Sheet coulissante */
@media (max-width: 899px) {
  .viewer-plan {
    position: fixed;
    inset: 0;
    z-index: 100;
  }
  .viewer-plan__panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 75vh;
    max-height: 75dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.55);
    transform: translateY(100%);
    transition: transform 260ms cubic-bezier(0.2, 0, 0, 1);
  }
  .viewer-plan.is-open .viewer-plan__panel {
    transform: translateY(0);
  }
  .viewer-plan__header::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.28);
  }
  .viewer-plan__item {
    min-height: 44px;
    font-size: 15px;
  }
}

/* Façade click-to-load (embed) : poster + bouton lecture. */
.facade {
  position: absolute;
  inset: 0;
  background: #050908 center/cover no-repeat;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.facade__scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15), rgba(0,0,0,0.55));
}
.facade__play {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  background: rgba(231, 255, 25, 0.95); /* accent */
  color: #071018;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease;
  touch-action: manipulation;
}
.facade:hover .facade__play { transform: scale(1.06); }
.facade__play svg { width: 40px; height: 40px; fill: currentColor; margin-left: 4px; }
.facade__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 0 16px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.facade__prompt {
  position: absolute;
  top: calc(50% + 58px);
  left: 50%;
  transform: translateX(-50%);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: 999px;
  color: #071018;
  background: rgba(231, 255, 25, 0.96);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .chrome__auto-label { display: none; }
  .chrome__actions .chrome__auto { padding: 0; width: 36px; }
  .facade__play {
    width: 44px;
    height: 44px;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4);
  }
  .facade__play svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
  }
  .facade__prompt {
    top: calc(50% + 30px);
    min-height: 22px;
    padding: 4px 8px;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  }
  .facade__title {
    bottom: 28px;
    font-size: 12px;
    padding: 0 12px;
  }
}

/* Branding discret « Propulsé par 1p1 » (embed). */
.brand {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 5;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(2, 7, 12, 0.55);
}
.brand:hover { color: #fff; }

.viewer-hint {
  position: absolute;
  top: 68px;
  left: 14px;
  z-index: 4;
  max-width: calc(100% - 32px);
  min-height: 36px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(2, 12, 10, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px) saturate(1.15);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease, transform 180ms ease;
}
.viewer-hint::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #68e0a5;
  box-shadow: 0 0 0 4px rgba(104, 224, 165, 0.16);
  content: "";
}
.viewer-hint.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
}
.viewer-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* États plein écran (chargement / erreur). */
.state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.state__title { font-size: 18px; font-weight: 700; }
.state__msg { font-size: 14px; opacity: 0.82; max-width: 30ch; }
.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--viewer-accent);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .frame__layer.is-leaving {
    transform: none !important;
    transition: opacity 180ms ease-out !important;
  }
  .frame__layer--incoming.is-entering {
    transform: none !important;
    transition: opacity 180ms ease-out !important;
  }
  .marker.is-loading .marker__dot { animation: none; }
  /* Sans mouvement : un seul halo statique, à mi-chemin de l'expansion. */
  .marker__wave { animation: none; }
  .marker__wave:first-child {
    opacity: calc(var(--marker-wave-opacity) * 0.6);
    transform: scale(1.45);
  }
  .frame__markers.is-fading-in { animation: none; opacity: 1; }
  .viewer-plan,
  .viewer-plan__panel,
  .viewer-plan__scrim,
  #viewer.has-plan .stage {
    transition: none !important;
  }
  .frame__photo,
  .marker,
  .marker__dot,
  .facade__play,
  .viewer-hint { transition: none; }
}
