/* 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);
}
.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; }

/* Marqueurs visiteur : cible tactile 44×44, disque visible 28×28. Le centre
 * commun reste ancré exactement sur le point normalisé du cadre. */
.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;
}
.marker__dot {
  position: absolute;
  inset: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: rgba(2, 11, 20, 0.35);
  border: 1.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.85), 0 4px 10px 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 { transform: scale(0.94); }

.marker__glyph {
  width: 16px;
  height: 16px;
  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: 80px;
  font-size: 11px;
  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: 3px;
  width: 38px;
  height: 38px;
  color: #071018;
  background: #e7ff19;
  border: 2px solid #071018;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.88), 0 5px 12px rgba(0, 0, 0, 0.42);
}
#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: 12px;
  padding: 14px 16px;
  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: 8px;
  margin-left: auto;
  pointer-events: none;
}
.chrome__btn {
  pointer-events: auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--viewer-text);
  background: var(--viewer-panel);
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  touch-action: manipulation;
}
.chrome__btn:hover { background: rgba(29, 41, 39, 0.96); }
.chrome__btn:active { transform: scale(0.96); }
.chrome__btn:focus-visible,
.facade__play:focus-visible,
.brand:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.chrome__fullscreen {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chrome__contrast {
  width: 24px;
  height: 24px;
  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: 24px;
  height: 24px;
  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 svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 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) {
  .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__photo,
  .marker,
  .marker__dot,
  .facade__play,
  .viewer-hint { transition: none; }
}
