/* ==========================================================================================================================
   Plan du site en plan d'architecture (lot L4b). Le site est une maison : l'accueil est le hall, chaque rubrique une pièce (lavis de sa
   teinte, fin tracé de murs, aucune ombre), chaque page une porte. Les couloirs (SVG) sont une couche DÉCORATIVE : la structure réelle est
   un nav, un h2 par pièce et une liste de liens. Animations (première entrée seulement, jamais en continu) : les couloirs se dessinent
   (stroke-dashoffset, 1,2 s), les pièces entrent en cascade (data-reveal) ; au survol ou au focus d'une pièce son couloir s'illumine
   (opacity) et ses portes se soulèvent de 2 px (transform). Mouvement réduit : tout est statique et visible.
   Bureau : hall au centre et jusqu'à huit pièces autour (grille de 3 × 3) ; les suivantes passent sur une rangée de plus, sans couloir.
   Tablette : deux colonnes et un couloir central. Mobile : un parcours vertical avec une station par pièce.
   ========================================================================================================================== */

.sitemap-page {
  padding-block: var(--s6) var(--s8);
  font-size: var(--fs-base);
}

.plan__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
  padding-left: 44px;
}

.plan__grid::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 14px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--violet-3), var(--or-clair));
}

.plan__corridors {
  display: none;
}

.plan__hall,
.plan__room {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: var(--s5);
  border: 1px solid color-mix(in srgb, var(--tint-icone, var(--violet-3)) 38%, transparent);
  border-radius: 24px;
  background: var(--tint-fond, var(--accent-concours-fond));
}

.plan__hall {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  text-align: center;
  --tint-icone: var(--violet-2);
  background: linear-gradient(135deg, var(--accent-lavande-pale), var(--or-pale));
}

/* Stations du parcours (mobile) */
.plan__hall::before,
.plan__room::before {
  content: "";
  position: absolute;
  top: 24px;
  left: -38px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--blanc);
  border-radius: 50%;
  background: var(--violet-2);
}

.plan__hall-art {
  width: min(100%, 11em);
}

.plan__hall-art img {
  display: block;
  width: 100%;
  height: auto;
}

.plan__hall-title {
  margin: 0;
  font-size: calc(26px * var(--echelle));
  font-weight: 800;
  line-height: 1.15;
}

.plan__hall-title a {
  color: var(--violet);
  text-decoration: none;
}

.plan__hall-title a:hover {
  background: linear-gradient(var(--or-clair), var(--or-clair)) 0 100% / 100% 3px no-repeat;
}

.plan__hall-text {
  max-width: 24ch;
  margin: 0;
  font-size: calc(15px * var(--echelle));
  line-height: 1.5;
  color: var(--encre-2);
}

.plan__room-title,
.plan__service-title {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s3);
  font-size: calc(22px * var(--echelle));
  font-weight: 800;
  line-height: 1.15;
  color: var(--violet);
}

.plan__room-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
}

.plan__room-icon .icon {
  width: 36px;
  height: 36px;
}

.plan__doors {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan__door {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 36px;
  padding-block: 4px;
  line-height: 1.3;
  color: var(--encre);
  text-decoration: none;
  transition: transform 0.2s;
}

.plan__door:hover {
  color: var(--violet);
}

.plan__door:hover > span {
  background: linear-gradient(var(--or-clair), var(--or-clair)) 0 100% / 100% 2px no-repeat;
}

.plan__door:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
  border-radius: 4px;
}

.plan__door .icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: var(--s1);
  vertical-align: -1px;
}

/* Porte : petite pastille en forme de porte, couleur de la pièce */
.plan__door-mark {
  flex: none;
  width: 9px;
  height: 15px;
  border-radius: 5px 5px 1px 1px;
  background: var(--tint-icone, var(--violet-3));
}

.plan__room:is(:hover, :focus-within) .plan__door {
  transform: translateY(-2px);
}

/* Zone « services » : accès, aide, légal */
.plan__services {
  display: grid;
  gap: var(--s5);
  margin-top: var(--s7);
  padding-top: var(--s6);
  background: linear-gradient(90deg, color-mix(in srgb, var(--violet-3) 55%, transparent), transparent) top / 100% 1px no-repeat;
}

.plan__service {
  padding: var(--s5);
  border-radius: 24px;
  background: var(--accent-lavande-pale);
}

.plan__service-title {
  font-size: calc(19px * var(--echelle));
}

/* ---- Tablette : deux colonnes, couloir vertical central ---- */
@media (min-width: 48em) {
  .plan__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s6) var(--s7);
    padding-left: 0;
  }

  .plan__grid::before {
    top: 0;
    bottom: 0;
    left: calc(50% - 1px);
    width: 2px;
  }

  .plan__hall {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(100%, 24em);
  }

  .plan__hall::before,
  .plan__room::before {
    display: none;
  }

  .plan__services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Bureau : le plan ---- */
@media (min-width: 64em) {
  .plan__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--s7);
  }

  .plan__grid::before {
    display: none;
  }

  .plan__corridors {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .plan__hall {
    grid-area: 2 / 2;
    width: auto;
    justify-self: stretch;
    align-content: center;
  }

  .plan__room[data-slot="1"] {
    grid-area: 1 / 1;
  }

  .plan__room[data-slot="2"] {
    grid-area: 1 / 2;
  }

  .plan__room[data-slot="3"] {
    grid-area: 1 / 3;
  }

  .plan__room[data-slot="4"] {
    grid-area: 2 / 1;
  }

  .plan__room[data-slot="5"] {
    grid-area: 2 / 3;
  }

  .plan__room[data-slot="6"] {
    grid-area: 3 / 1;
  }

  .plan__room[data-slot="7"] {
    grid-area: 3 / 2;
  }

  .plan__room[data-slot="8"] {
    grid-area: 3 / 3;
  }

  .plan__room:not([data-slot]) {
    grid-column: auto;
  }

  .plan__services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Couloirs, nœuds et illumination ---- */
.plan__corridor,
.plan__glow {
  fill: none;
  stroke-linecap: round;
}

.plan__corridor {
  stroke: var(--violet-3);
  stroke-width: 1.6;
  transition-duration: 1.2s;
}

.plan__glow {
  stroke: var(--or-clair);
  stroke-width: 3.2;
  opacity: 0;
  transition: opacity 0.25s;
}

.plan__node,
.plan__node-glow {
  fill: none;
  stroke-linecap: round;
  stroke-width: 9px;
  vector-effect: non-scaling-stroke;
}

.plan__node {
  stroke: var(--violet-2);
}

.plan__node-glow {
  stroke: var(--or-clair);
  opacity: 0;
  transition: opacity 0.25s;
}

.plan:has(.plan__room[data-slot="1"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="1"],
.plan:has(.plan__room[data-slot="2"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="2"],
.plan:has(.plan__room[data-slot="3"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="3"],
.plan:has(.plan__room[data-slot="4"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="4"],
.plan:has(.plan__room[data-slot="5"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="5"],
.plan:has(.plan__room[data-slot="6"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="6"],
.plan:has(.plan__room[data-slot="7"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="7"],
.plan:has(.plan__room[data-slot="8"]:is(:hover, :focus-within)) :is(.plan__glow, .plan__node-glow)[data-slot="8"] {
  opacity: 1;
}

/* ---- Impression : la liste des pièces et de leurs liens, sans le dessin ---- */
@media print {
  .plan__corridors,
  .plan__grid::before,
  .plan__hall::before,
  .plan__room::before,
  .plan__hall-art {
    display: none;
  }

  .plan__grid {
    display: block;
    padding-left: 0;
  }

  .plan__hall,
  .plan__room,
  .plan__service {
    margin-bottom: var(--s4);
    padding: 0;
    border: 0;
    background: none;
    break-inside: avoid;
  }

  .plan__hall {
    justify-items: start;
    text-align: left;
  }
}

/* Pièces à peu de portes : le pictogramme de la rubrique, en grand et en filigrane, remplit l'espace libre (les rangées gardent la même
   hauteur pour que les couloirs visent le centre des pièces). Décoratif, sans effet sur la lecture. */
.plan__room {
  overflow: clip;
}

.plan__room > :not(.plan__room-mark) {
  position: relative;
  z-index: 1;
}

.plan__room-mark {
  position: absolute;
  right: var(--s4);
  bottom: var(--s4);
  width: 6.5em;
  height: 6.5em;
  color: var(--tint-icone, var(--violet-3));
  opacity: 0.24;
  pointer-events: none;
}

.plan__room-mark .icon {
  width: 100%;
  height: 100%;
}

@media print {
  .plan__room-mark {
    display: none;
  }
}

/* Mobile : le pictogramme en filigrane se place en haut à droite de la pièce, à côté du titre, pour ne jamais passer derrière les portes. */
@media (max-width: 47.99em) {
  .plan__room-mark {
    top: var(--s4);
    right: var(--s4);
    bottom: auto;
    width: 4.5em;
    height: 4.5em;
  }

  /* Le titre de la pièce laisse la place du filigrane : un titre long passe à la ligne au lieu de se glisser derrière. */
  .plan__room-title {
    padding-inline-end: 5.5rem;
  }
}
