/* ═══════════════════════════════════════════════════════════════
   pano-hkh.css — Override branding HKH du viewer hkh-tour-kit
   Surcharge les CSS custom properties exposées par hkh-tour-kit
   et ajuste les éléments Pannellum natifs au registre HKH.
   ═══════════════════════════════════════════════════════════════ */

.hkh-tour {
  --hkh-tour-accent: var(--copper, #b87333);
  --hkh-tour-accent-soft: rgba(184, 115, 51, 0.85);
  --hkh-tour-bg: var(--paper, #faf7f2);
  --hkh-tour-text: var(--dark, #1a1a1a);
  --hkh-tour-font: var(--sans, "Söhne", system-ui, sans-serif);
  --hkh-tour-hotspot-size: 30px;
  --hkh-tour-hotspot-ring: 2px;
  --hkh-tour-controls-bg: rgba(0, 0, 0, 0.5);
  --hkh-tour-controls-text: #fff;
  --hkh-tour-transition: 200ms ease-out;
  background: #000;
  /* Icônes plein écran — SVG inline en data-URI, zéro police, zéro requête
     externe (CSP-safe). Un data-URI est une chaîne figée : impossible d'y
     référencer var(--copper) ou currentColor, d'où 2 variantes couleur par
     état (repos blanc / hover copper — #b87333 = valeur de repli --copper
     utilisée partout ailleurs dans ce fichier). */
  --hkh-tour-fs-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 5.6 L2 2 L5.6 2 M8.4 2 L12 2 L12 5.6 M2 8.4 L2 12 L5.6 12 M12 8.4 L12 12 L8.4 12' fill='none' stroke='rgba(255,255,255,.85)' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hkh-tour-fs-expand-copper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 5.6 L2 2 L5.6 2 M8.4 2 L12 2 L12 5.6 M2 8.4 L2 12 L5.6 12 M12 8.4 L12 12 L8.4 12' fill='none' stroke='%23b87333' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hkh-tour-fs-collapse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M5 2.7 L5 5 L2.7 5 M9 2.7 L9 5 L11.3 5 M5 11.3 L5 9 L2.7 9 M9 11.3 L9 9 L11.3 9' fill='none' stroke='rgba(255,255,255,.85)' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hkh-tour-fs-collapse-copper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M5 2.7 L5 5 L2.7 5 M9 2.7 L9 5 L11.3 5 M5 11.3 L5 9 L2.7 9 M9 11.3 L9 9 L11.3 9' fill='none' stroke='%23b87333' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  /* Icône gyroscope — arc de rotation avec pointe de flèche, même trait
     que l'icône plein écran (1.4 / round / round). Un pictogramme
     "téléphone incliné" littéral a été testé : à 13 px (taille réelle
     du bouton) le rectangle + arc se lit comme une tache, illisible.
     L'arc de rotation seul reste net à cette taille et porte le même
     sens (orientation/rotation du capteur) — repos blanc, actif et
     survol cuivre : cf. §Pannellum controls plus bas. */
  --hkh-tour-orient: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M11 4.2 A5 5 0 1 0 12 8' fill='none' stroke='rgba(255,255,255,.85)' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M8.6 2.2 L11.2 4 L9.4 6.4' fill='none' stroke='rgba(255,255,255,.85)' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hkh-tour-orient-copper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M11 4.2 A5 5 0 1 0 12 8' fill='none' stroke='%23b87333' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M8.6 2.2 L11.2 4 L9.4 6.4' fill='none' stroke='%23b87333' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Rail thumbnails — bandeau scrollable bas du viewer (pattern Matterport) */
.hkh-tour-rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  background: rgba(0, 0, 0, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  pointer-events: auto;
  transform: translateY(0);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}
.hkh-tour-rail::-webkit-scrollbar {
  display: none;
}
.hkh-tour-rail--hidden {
  transform: translateY(100%);
  pointer-events: none;
}

.hkh-tour-rail__btn {
  flex: 0 0 auto;
  position: relative;
  width: 124px;
  height: 70px;
  background-color: #0a0a09;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  padding: 0;
  margin: 0;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.25s ease, filter 0.25s ease, transform 0.25s ease;
  filter: brightness(0.55) saturate(0.85);
  scroll-snap-align: start;
}
.hkh-tour-rail__btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 55%);
  pointer-events: none;
  z-index: 1;
}
.hkh-tour-rail__btn:hover {
  filter: brightness(0.85) saturate(0.95);
  border-color: rgba(184, 115, 51, 0.55);
}
.hkh-tour-rail__btn[aria-current="true"] {
  filter: brightness(1) saturate(1);
  border-color: var(--copper, #b87333);
  transform: translateY(-2px);
}
.hkh-tour-rail__btn:focus-visible {
  outline: 2px solid var(--copper, #b87333);
  outline-offset: 2px;
}

.hkh-tour-rail__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  z-index: 2;
  text-align: center;
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 0.56rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.hkh-tour-rail__btn[aria-current="true"] .hkh-tour-rail__label {
  color: var(--copper, #b87333);
}

@media (max-width: 768px) {
  .hkh-tour-rail {
    padding: 0.6rem 0.8rem;
    gap: 0.4rem;
    justify-content: flex-start;
  }
  .hkh-tour-rail__btn {
    width: 96px;
    height: 54px;
  }
  .hkh-tour-rail__label {
    font-size: 0.5rem;
    letter-spacing: 0.14em;
    bottom: 3px;
  }
}

/* Toggle bandeau — onglet copper sobre au-dessus du rail */
.hkh-tour-toggle {
  position: absolute;
  left: 50%;
  bottom: calc(70px + 1.7rem);
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 26px;
  padding: 0 0.85rem;
  background: rgba(10, 10, 9, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(184, 115, 51, 0.4);
  border-bottom: none;
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 0.54rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: bottom 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.25s ease, border-color 0.25s ease;
}
.hkh-tour-toggle:hover {
  color: var(--copper, #b87333);
  border-color: var(--copper, #b87333);
}
.hkh-tour-toggle:focus-visible {
  outline: 1px solid var(--copper, #b87333);
  outline-offset: 2px;
}
.hkh-tour-toggle--low {
  bottom: 1.2rem;
  border: 1px solid rgba(184, 115, 51, 0.4);
}
.hkh-tour-toggle__arrow {
  display: inline-block;
  width: 9px;
  height: 9px;
  transition: transform 0.3s ease;
}
.hkh-tour-toggle--low .hkh-tour-toggle__arrow {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .hkh-tour-toggle {
    bottom: calc(54px + 1.2rem);
  }
  .hkh-tour-toggle--low {
    bottom: 0.8rem;
  }
}

/* Bouton plan — icône+label, visible uniquement rail masqué */
.hkh-tour-plan-btn {
  position: absolute;
  left: 1.2rem;
  top: 1.2rem;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 36px;
  padding: 0 0.95rem;
  background: rgba(10, 10, 9, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 0.56rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s ease, color 0.25s ease;
}
.hkh-tour-plan-btn--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.hkh-tour-plan-btn:hover,
.hkh-tour-plan-btn[aria-expanded="true"] {
  border-color: var(--copper, #b87333);
  color: var(--copper, #b87333);
}
.hkh-tour-plan-btn:focus-visible {
  outline: 1px solid var(--copper, #b87333);
  outline-offset: 2px;
}
.hkh-tour-plan-btn__icon {
  display: inline-block;
  width: 12px;
  height: 12px;
}

@media (max-width: 600px) {
  .hkh-tour-plan-btn {
    left: 0.6rem;
    top: 0.6rem;
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.52rem;
  }
}

/* Popover plan — déployé par click sur .hkh-tour-plan-btn */
.hkh-tour-aside {
  position: absolute;
  left: 1.2rem;
  top: calc(36px + 1.2rem + 0.5rem);
  z-index: 5;
  width: 138px;
  max-height: calc(100% - 8rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  background: rgba(10, 10, 9, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(184, 115, 51, 0.32);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 115, 51, 0.5) transparent;
  transform: translateX(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.28s ease;
}
.hkh-tour-aside--visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.hkh-tour-aside::-webkit-scrollbar {
  width: 3px;
}
.hkh-tour-aside::-webkit-scrollbar-thumb {
  background: rgba(184, 115, 51, 0.5);
}
.hkh-tour-aside__btn {
  flex: 0 0 auto;
  position: relative;
  width: 100%;
  height: 64px;
  background-color: #0a0a09;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  filter: brightness(0.6) saturate(0.85);
  transition: border-color 0.25s ease, filter 0.25s ease;
}
.hkh-tour-aside__btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.6) 0%,
    transparent 60%
  );
  pointer-events: none;
}
.hkh-tour-aside__btn:hover {
  filter: brightness(0.92);
  border-color: rgba(184, 115, 51, 0.55);
}
.hkh-tour-aside__btn[aria-current="true"] {
  filter: brightness(1) saturate(1);
  border-color: var(--copper, #b87333);
}
.hkh-tour-aside__btn:focus-visible {
  outline: 1px solid var(--copper, #b87333);
  outline-offset: 2px;
}
.hkh-tour-aside__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  z-index: 1;
  text-align: center;
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 3px;
}
.hkh-tour-aside__btn[aria-current="true"] .hkh-tour-aside__label {
  color: var(--copper, #b87333);
}

/* Variante popover plan SVG (au lieu des thumbs) */
.hkh-tour-aside--with-plan {
  width: 220px;
  gap: 0.55rem;
  padding: 0.7rem;
}

.hkh-tour-plan {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.hkh-tour-plan__head {
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 0.5rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--copper, #b87333);
  border-bottom: 1px solid rgba(184, 115, 51, 0.25);
  padding-bottom: 0.5rem;
  text-align: center;
}
.hkh-tour-plan__svg {
  display: block;
  width: 100%;
  height: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hkh-tour-plan__zone {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 0.8;
  cursor: pointer;
  transition: fill 0.25s ease, stroke 0.25s ease;
  outline: none;
}
.hkh-tour-plan__zone:hover {
  fill: rgba(184, 115, 51, 0.18);
  stroke: var(--copper, #b87333);
}
.hkh-tour-plan__zone.is-active {
  fill: rgba(184, 115, 51, 0.32);
  stroke: var(--copper, #b87333);
  stroke-width: 1.3;
}
.hkh-tour-plan__zone:focus-visible {
  stroke: var(--copper, #b87333);
  stroke-width: 1.6;
}
.hkh-tour-plan__lbl {
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 7px;
  fill: rgba(255, 255, 255, 0.72);
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 400;
  transition: fill 0.25s ease;
}
.hkh-tour-plan__lbl.is-active {
  fill: var(--copper, #b87333);
  font-weight: 500;
}
.hkh-tour-plan__caption {
  margin: 0;
  font-family: var(--serif, "Old Standard TT", serif);
  font-style: italic;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.3;
}

@media (max-width: 600px) {
  .hkh-tour-aside {
    left: 0.6rem;
    top: calc(32px + 0.6rem + 0.4rem);
    width: 108px;
  }
  .hkh-tour-aside--with-plan {
    width: 178px;
  }
  .hkh-tour-aside__btn {
    height: 54px;
  }
}

/* Pannellum controls — refonte propre, plus de doublon */
.hkh-tour .pnlm-controls-container {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  bottom: auto;
  left: auto;
  display: flex !important;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 5;
  width: auto;
  margin: 0;
  padding: 0;
}

/* Hide boussole — pas pertinent pour visite habitat */
.hkh-tour .pnlm-compass {
  display: none !important;
}

/* Zoom controls = container des 2 sous-boutons + et - */
.hkh-tour .pnlm-zoom-controls {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Tous les boutons cliquables — design éditorial HKH (ghost + copper hover) */
.hkh-tour .pnlm-zoom-in,
.hkh-tour .pnlm-zoom-out,
.hkh-tour .pnlm-fullscreen-toggle-button,
.hkh-tour .pnlm-orientation-button {
  display: block !important;
  width: 36px !important;
  height: 36px !important;
  background-color: rgba(10, 10, 9, 0.7) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 0 !important;
  cursor: pointer;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.hkh-tour .pnlm-zoom-in {
  border-bottom: none !important;
}

/* Icônes custom — remplace le sprite Pannellum */
.hkh-tour .pnlm-zoom-in::before,
.hkh-tour .pnlm-zoom-out::before,
.hkh-tour .pnlm-fullscreen-toggle-button::before,
.hkh-tour .pnlm-orientation-button::before {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans, system-ui), sans-serif;
  line-height: 1;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 300;
  transition: color 0.25s ease;
}
.hkh-tour .pnlm-zoom-in::before {
  content: "+";
  font-size: 18px;
}
.hkh-tour .pnlm-zoom-out::before {
  content: "−";
  font-size: 18px;
}

/* Bouton plein écran — icône SVG (data-URI), plus de glyphe typographique.
   ⤢/⤡ (U+2921/U+2922) n'existent dans aucune police iOS : Safari affichait
   un carré vide (tofu). Deux états (expand/collapse) × 2 couleurs (repos/hover). */
.hkh-tour .pnlm-fullscreen-toggle-button::before {
  content: "";
  background-image: var(--hkh-tour-fs-expand);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 13px;
}
.hkh-tour .pnlm-fullscreen-toggle-button-active::before {
  background-image: var(--hkh-tour-fs-collapse);
}

/* Bouton orientation (gyroscope) — même trait, icône téléphone incliné.
   N'existe dans le DOM que sur mobile avec capteur d'orientation
   (ajouté par Pannellum lui-même) : absent en desktop, jamais un bug. */
.hkh-tour .pnlm-orientation-button::before {
  content: "";
  background-image: var(--hkh-tour-orient);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 13px;
}
.hkh-tour .pnlm-orientation-button-active::before {
  background-image: var(--hkh-tour-orient-copper);
}

/* Autorisation refusée/indisponible (cf. pano-orientation-guard.js) —
   estompé et non cliquable plutôt que muet : mieux vaut un contrôle
   absent que vivant en apparence mais sans effet. */
.hkh-tour .pnlm-orientation-button.is-unavailable {
  opacity: 0.32;
  pointer-events: none;
  cursor: not-allowed;
}

.hkh-tour .pnlm-zoom-in:hover,
.hkh-tour .pnlm-zoom-out:hover,
.hkh-tour .pnlm-fullscreen-toggle-button:hover,
.hkh-tour .pnlm-orientation-button:hover {
  border-color: var(--copper, #b87333) !important;
  background-color: rgba(184, 115, 51, 0.18) !important;
}
.hkh-tour .pnlm-zoom-in:hover::before,
.hkh-tour .pnlm-zoom-out:hover::before {
  color: var(--copper, #b87333);
}
.hkh-tour .pnlm-fullscreen-toggle-button:hover::before {
  background-image: var(--hkh-tour-fs-expand-copper);
}
.hkh-tour .pnlm-fullscreen-toggle-button-active:hover::before {
  background-image: var(--hkh-tour-fs-collapse-copper);
}
.hkh-tour .pnlm-orientation-button:hover::before {
  background-image: var(--hkh-tour-orient-copper);
}

/* Cacher le sprite natif (on a nos propres glyphs) */
.hkh-tour .pnlm-sprite {
  background-image: none !important;
}

.hkh-tour .pnlm-load-box {
  background: rgba(10, 10, 9, 0.88);
  color: #fff;
  border: 1px solid rgba(184, 115, 51, 0.4);
  font-family: var(--sans, system-ui), sans-serif;
  letter-spacing: 0.05em;
}
.hkh-tour .pnlm-load-box p,
.hkh-tour .pnlm-lbox {
  color: var(--copper, #b87333);
}
.hkh-tour .pnlm-load-button {
  display: none;
}
.hkh-tour .pnlm-about-msg {
  display: none !important;
}
.hkh-tour .pnlm-panorama-info {
  bottom: calc(70px + 2rem);
  left: 1.2rem;
}
