/* =========================
   BASE
========================= */
:root {
  --traveloptim-green: #3aa689;
  --traveloptim-green-dark: #287a68;
  --background: #f4f7f7;
  --surface: #ffffff;
  --text: #203438;
  --text-light: #687b7f;
  --border: #d8e3e3;
  --radius: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Arial,
    Helvetica,
    sans-serif;
  color: var(--text);
  background: var(--background);
}
button {
  font: inherit;
}
/* =========================
   LOGO TRAVELOPTIM
========================= */
.museum-logo {
  display: block;
  height: 50px;
  width: auto;
  margin-bottom: 12px;
}
/* =========================
   APPLICATION
========================= */
.museum-app {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 20px;
}
/* =========================
   EN-TÊTE
========================= */
.museum-header {
  margin-bottom: 18px;
}
.museum-brand {
  margin: 0 0 5px;
  color: var(--traveloptim-green-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.museum-title {
  margin: 0;
  font-size: clamp(
    26px,
    4vw,
    42px
  );
  line-height: 1.15;
}
.museum-introduction {
  max-width: 800px;
  margin: 10px 0 0;
  color: var(--text-light);
  line-height: 1.6;
}
/* =========================
   ONGLETS DES ÉTAGES
========================= */
.floor-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.floor-tab {
  min-height: 48px;
  padding: 10px 16px;
  border:
    1px solid
    var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.floor-tab.active {
  border-color:
    var(--traveloptim-green);
  background:
    var(--traveloptim-green);
  color: #ffffff;
}
/* =========================
   ESPACE DE TRAVAIL
========================= */
.museum-workspace {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr);
  gap: 16px;
  transition:
    grid-template-columns
    0.3s ease;
}
.museum-workspace.panel-open {
  grid-template-columns:
    minmax(0, 1fr)
    minmax(300px, 350px);
}
.map-column {
  min-width: 0;
}
/* =========================
   CADRE DU PLAN
========================= */
.map-viewport {
  position: relative;
  width: 100%;
  height: 760px;
  overflow: hidden;
  border:
    1px solid
    var(--border);
  border-radius:
    var(--radius);
  background:
    var(--surface);
  cursor: grab;
  touch-action: none;
}
.map-viewport.is-dragging {
  cursor: grabbing;
}
/* =========================
   PLAN ZOOMABLE
========================= */
.map-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 355px;
  height: 729px;
  transform:
    translate(-50%, -50%);
  transform-origin: center;
   touch-action: none;
will-change: transform;
}
.museum-map {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
/* =========================
   CONTRÔLES DU PLAN
========================= */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.map-control-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border:
    1px solid
    var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  box-shadow:
    0 5px 15px
    rgba(25, 65, 70, 0.16);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}
.map-control-button:hover {
  background:
    var(--traveloptim-green);
  color: #ffffff;
}
.reset-map-button {
  font-size: 21px;
}
/* =========================
   FLÈCHES DIRECTIONNELLES
========================= */
.direction-controls {
  display: grid;
  grid-template-columns:
    repeat(3, 36px);
  grid-template-rows:
    repeat(3, 36px);
  gap: 3px;
  width: 114px;
  margin:
    0 auto 6px;
}
.direction-controls
.map-control-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
}
.direction-up {
  grid-column: 2;
  grid-row: 1;
}
.direction-left {
  grid-column: 1;
  grid-row: 2;
}
.direction-right {
  grid-column: 3;
  grid-row: 2;
}
.direction-down {
  grid-column: 2;
  grid-row: 3;
}
/* =========================
   ASSOMBRISSEMENT DES ÉTAGES
========================= */
.floor-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.shade {
  position: absolute;
  background:
    rgba(18, 34, 38, 0.62);
  transition:
    top 0.32s ease,
    left 0.32s ease,
    width 0.32s ease,
    height 0.32s ease,
    opacity 0.32s ease;
}
/* =========================
   CALQUE DES PALETTES
========================= */
.artwork-markers {
  position: absolute;
  inset: 0;
  /*
   * Les palettes sont placées sous
   * le calque d’assombrissement.
   * Elles s’assombrissent donc avec
   * les étages inactifs.
   */
  z-index: 4;
  pointer-events: none;
}
/* =========================
   PALETTE D’UNE ŒUVRE
========================= */
.artwork-marker {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border:
    2px solid
    #ffffff;
  border-radius: 50%;
  background:
    var(--traveloptim-green);
  box-shadow:
    0 4px 10px
    rgba(15, 42, 46, 0.38);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  /*
   * Le conteneur général ne reçoit
   * pas les clics, mais chaque
   * palette reste interactive.
   */
  pointer-events: auto;
  transform:
    translate(-50%, -50%)
    scale(
      var(
        --marker-scale,
        1
      )
    );
  transform-origin: center;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}
.artwork-marker:hover {
  z-index: 10;
  background:
    var(--traveloptim-green-dark);
  transform:
    translate(-50%, -50%)
    scale(
      calc(
        var(
          --marker-scale,
          1
        ) * 1.2
      )
    );
  box-shadow:
    0 7px 16px
    rgba(15, 42, 46, 0.48);
}
.artwork-marker:focus-visible {
  z-index: 10;
  outline:
    4px solid
    rgba(58, 166, 137, 0.35);
  outline-offset: 3px;
  transform:
    translate(-50%, -50%)
    scale(
      calc(
        var(
          --marker-scale,
          1
        ) * 1.22
      )
    );
}
/* Palette sélectionnée */
.artwork-marker.selected {
  z-index: 11;
  background:
    var(--traveloptim-green-dark);
  box-shadow:
    0 0 0 5px
    rgba(58, 166, 137, 0.32),
    0 7px 18px
    rgba(15, 42, 46, 0.5);
  transform:
    translate(-50%, -50%)
    scale(
      calc(
        var(
          --marker-scale,
          1
        ) * 1.22
      )
    );
}
/* =========================
   INFOBULLE DES PALETTES
========================= */
.artwork-marker::after {
  content:
    attr(data-title);
  position: absolute;
  left: 50%;
  bottom:
    calc(100% + 9px);
  width: max-content;
  max-width: 190px;
  padding: 6px 9px;
  border-radius: 7px;
  background:
    rgba(24, 47, 51, 0.96);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform:
    translateX(-50%)
    translateY(4px);
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease,
    transform 0.18s ease;
}
.artwork-marker:hover::after,
.artwork-marker:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform:
    translateX(-50%)
    translateY(0);
}
/* =========================
   FICHE DE L’ŒUVRE
========================= */
.artwork-panel {
  position: relative;
  width: 340px;
  height: 760px;
  overflow: hidden;
  border-radius: 18px;
  background: #ffffff;
  box-shadow:
    0 18px 45px
    rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform:
    translateX(110px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease,
    visibility
    0s linear 0.55s;
}
.museum-workspace.panel-open
.artwork-panel {
  opacity: 1;
  visibility: visible;
  transform:
    translateX(0);
  transition-delay: 0s;
}
/* =========================
   BOUTON DE FERMETURE
========================= */
.panel-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border:
    1px solid
    var(--border);
  border-radius: 50%;
  background:
    rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.panel-close-button:hover {
  background:
    var(--traveloptim-green);
  color: #ffffff;
}
/* =========================
   CONTENU DE LA FICHE
========================= */
.artwork-panel-content {
  height: 100%;
  padding: 22px;
  overflow-y: auto;
}
.panel-artwork-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 24px;
  border-radius: 12px;
  object-fit: cover;
  background: #f4f4f4;
}
.panel-artwork-title {
  margin: 0;
  color: #222222;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}
.panel-artwork-artist {
  margin-top: 8px;
  margin-bottom: 26px;
  color: #6b6b6b;
  font-size: 17px;
}
.panel-artwork-details {
  display: grid;
  gap: 10px;
  margin: 0;
}
.artwork-detail {
  padding: 12px 0;
  border-bottom:
    1px solid
    #ececec;
}
.artwork-detail:last-child {
  border-bottom: none;
}
.artwork-detail dt {
  margin-bottom: 4px;
  color: #888888;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.artwork-detail dd {
  margin: 0;
  color: #222222;
  font-size: 16px;
  line-height: 1.5;
}
/* =========================
   LIEN VERS L’ARTICLE
========================= */
.panel-article-link {
  display: block;
  margin-top: 20px;
  padding: 13px 16px;
  border-radius: 10px;
  background:
    var(--traveloptim-green);
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.panel-article-link[hidden] {
  display: none;
}
/* =========================
   RESPONSIVE
========================= */
@media (max-width: 700px) {
  .museum-app {
    padding: 12px;
  }
  .floor-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.floor-tab {
  min-width: 0;
  padding: 12px 4px;
  font-size: 14px;
  white-space: nowrap;
}
  .museum-workspace,
  .museum-workspace.panel-open {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* =========================
     FICHE MOBILE SUPERPOSÉE
  ========================= */
  .artwork-panel {
    position: absolute;
    top: 75px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 100%;
    height: auto;
    max-height:
      calc(100% - 75px);
    margin: 0;
    border-radius:
      18px 18px 0 0;
    opacity: 0;
    visibility: hidden;
    transform:
      translateY(100%);
    transition:
      opacity 0.55s ease,
      transform 0.55s ease,
      visibility
      0s linear 0.55s;
  }
  .museum-workspace.panel-open
  .artwork-panel {
    opacity: 1;
    visibility: visible;
    transform:
      translateY(0);
    transition-delay: 0s;
  }
  .artwork-panel-content {
    height: 100%;
    overflow-y: auto;
  }
  /* Contrôles mobiles */
  .map-controls {
    top: 10px;
    right: 10px;
  }
  .direction-controls {
    width: 102px;
    grid-template-columns:
      repeat(3, 32px);
    grid-template-rows:
      repeat(3, 32px);
  }
  .direction-controls
  .map-control-button {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .map-control-button {
    width: 40px;
    height: 40px;
  }
}
/* =========================
   COMMANDE DU PARCOURS
========================= */
.route-toolbar {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.toggle-route-button {
  min-height: 46px;
  padding: 11px 22px;
  border:
    1px solid
    var(--traveloptim-green);
  border-radius: 12px;
  background: #ffffff;
  color: var(--traveloptim-green-dark);
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}
.toggle-route-button:hover {
  transform: translateY(-1px);
  background:
    var(--traveloptim-green);
  color: #ffffff;
}
.toggle-route-button.is-active {
  background:
    var(--traveloptim-green);
  color: #ffffff;
}
/* =========================
   TRACÉ DU PARCOURS
========================= */
.traveloptim-route {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.traveloptim-route.is-visible {
  opacity: 1;
  visibility: visible;
}
.traveloptim-route-line {
  fill: none;
  stroke: #2563EB;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.9;
  filter:
    drop-shadow(
      0 1px 2px rgba(0,0,0,.25)
    );
}
/* =========================
   ICÔNES DU PARCOURS
========================= */
.traveloptim-route-markers {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.traveloptim-route-markers.is-visible {
  opacity: 1;
  visibility: visible;
}
.traveloptim-route-marker {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  box-shadow:
    0 4px 10px
    rgba(15, 42, 46, 0.38);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transform:
    translate(-50%, -50%)
    scale(
      var(
        --route-marker-scale,
        1
      )
    );
  transform-origin: center;
}
.traveloptim-route-marker-end {
  background: #2563eb;
}
/* =========================
   ŒUVRES INCONTOURNABLES
========================= */
.artwork-marker-featured {
  width: 46px;
  height: 46px;
  padding: 0;
  border:
    3px solid #ffffff;
  background: #ffffff;
  overflow: visible;
}
/* Image miniature */
.artwork-marker-featured img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}
/* Étoile */
.artwork-marker-featured::before {
  content: "★";
  position: absolute;
  top: -10px;
  right: -7px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border:
    2px solid #ffffff;
  border-radius: 50%;
  background: #f5b942;
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  box-shadow:
    0 2px 5px
    rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

/* =========================================================
   MOBILE : NAVIGATION SOUPLE ET DÉFILEMENT DE LA PAGE
   ========================================================= */
@media (max-width: 700px) {
  .map-viewport {
    height: min(760px, 72dvh);
    min-height: 420px;
    touch-action: none;
    overscroll-behavior: contain;
  }
  .map-stage { touch-action: none; }
}
[hidden] { display: none !important; }
