/*
 * Phase 141 — Encycléde des seuils.
 * La constellation devient le mode d'exploration principal ; le répertoire
 * descriptif historique demeure intact derrière « Toutes les portes ».
 */

/* Le répertoire technique de la phase 140 reste alimenté par le script pour
   la carte, mais n'est plus présenté comme une navigation concurrente. */
.c3d-directory[hidden] {
  display: none !important;
}

#constellation-navigation-3d .c3d-workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "map";
}

#constellation-navigation-3d .c3d-map-column {
  width: 100%;
}

#constellation-navigation-3d .c3d-stage {
  height: clamp(520px, 58vw, 680px);
}

.c3d-map-fallback {
  display: none;
}

.c3d-no-canvas .c3d-workspace {
  display: block;
}

.c3d-no-canvas .c3d-map-fallback {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.8rem;
  padding: clamp(1.4rem, 5vw, 3rem);
  border: 1px solid rgba(201, 168, 76, 0.24);
  background:
    radial-gradient(circle at 50% 30%, rgba(110, 220, 242, 0.08), transparent 45%),
    rgba(5, 7, 15, 0.84);
  color: var(--texte-dim);
  text-align: center;
}

.c3d-map-fallback strong {
  color: var(--or-pale);
  font: 400 clamp(1.35rem, 3vw, 2rem)/1.1 "Cormorant Garamond", Georgia, serif;
}

.c3d-map-fallback span {
  max-width: 560px;
  font-size: 0.72rem;
  line-height: 1.7;
}

.c3d-map-fallback button,
.c3d-detailed-link {
  appearance: none;
  min-height: 44px;
  border: 1px solid rgba(201, 168, 76, 0.32);
  background: rgba(201, 168, 76, 0.07);
  color: var(--or-pale);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.c3d-map-fallback button {
  margin-top: 0.3rem;
  padding: 0.72rem 1rem;
  font-size: 0.58rem;
}

.c3d-detailed-link {
  justify-content: center;
  padding: 0.62rem 0.9rem;
  font-size: 0.59rem;
}

.c3d-map-fallback button:hover,
.c3d-map-fallback button:focus-visible,
.c3d-detailed-link:hover,
.c3d-detailed-link:focus-visible {
  border-color: rgba(232, 213, 163, 0.8);
  background: rgba(201, 168, 76, 0.14);
  color: #fff;
  outline: none;
}

.c3d-map-fallback button:focus-visible,
.c3d-detailed-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Troisième profondeur : le répertoire narratif est choisi, jamais imposé. */
.portes-registry {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.25rem auto 3.4rem;
  overflow: clip;
  border: 1px solid rgba(201, 168, 76, 0.24);
  background:
    radial-gradient(circle at 12% 0%, rgba(201, 168, 76, 0.07), transparent 28%),
    linear-gradient(155deg, rgba(14, 16, 31, 0.96), rgba(5, 7, 15, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  scroll-margin-top: 28px;
}

.portes-registry > summary {
  min-height: 142px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.portes-registry > summary::-webkit-details-marker {
  display: none;
}

.portes-registry > summary::marker {
  content: "";
}

.portes-registry > summary:hover {
  background: rgba(201, 168, 76, 0.045);
}

.portes-registry > summary:focus-visible {
  background: rgba(201, 168, 76, 0.075);
  box-shadow: inset 0 0 0 2px rgba(232, 213, 163, 0.9);
  outline: none;
}

.portes-registry-index {
  width: clamp(54px, 7vw, 80px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 168, 76, 0.34);
  border-radius: 50%;
  color: var(--or);
  font: 300 clamp(1.5rem, 3vw, 2.2rem)/1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.08em;
}

.portes-registry-copy {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.portes-registry-kicker {
  color: var(--or);
  font-size: 0.57rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.portes-registry-copy > strong {
  color: var(--or-pale);
  font: 300 clamp(2rem, 4vw, 3.05rem)/1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.03em;
}

.portes-registry-copy > span:last-child {
  max-width: 760px;
  color: var(--texte-dim);
  font-size: 0.7rem;
  line-height: 1.7;
  letter-spacing: 0.025em;
}

.portes-registry-action {
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  color: var(--or-pale);
  font-size: 0.57rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portes-registry-chevron {
  display: inline-block;
  color: var(--or);
  font-size: 1.4rem;
  line-height: 1;
  transform: translateY(-0.12rem);
  transition: transform 0.28s ease;
}

.portes-registry[open] .portes-registry-chevron {
  transform: rotate(180deg) translateY(0.12rem);
}

.portes-registry-content {
  padding: clamp(1rem, 3vw, 2rem) 0 0;
  border-top: 1px solid rgba(201, 168, 76, 0.18);
  animation: portes-reveal 0.34s ease both;
}

.portes-registry-content > #navigation-principale {
  width: calc(100% - 2rem);
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

@keyframes portes-reveal {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  #constellation-navigation-3d .c3d-stage {
    height: min(430px, 108vw);
  }

  .portes-registry {
    width: calc(100% - 1rem);
    margin-bottom: 2.4rem;
  }

  .portes-registry > summary {
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem 1rem;
    padding: 1.1rem;
  }

  .portes-registry-index {
    width: 48px;
    align-self: start;
  }

  .portes-registry-kicker {
    font-size: 0.5rem;
    letter-spacing: 0.16em;
  }

  .portes-registry-copy > strong {
    font-size: clamp(1.65rem, 8vw, 2.25rem);
  }

  .portes-registry-copy > span:last-child {
    font-size: 0.64rem;
  }

  .portes-registry-action {
    grid-column: 1 / -1;
    justify-content: flex-end;
    min-height: 34px;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(201, 168, 76, 0.12);
  }

  .portes-registry-content > #navigation-principale {
    width: calc(100% - 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .c3d-map-fallback button,
  .c3d-detailed-link,
  .portes-registry > summary,
  .portes-registry-chevron {
    transition: none;
  }

  .portes-registry-content {
    animation: none;
  }
}

/* Audit V04: readable labels and complete descriptions on small screens. */
#constellation-navigation-3d .c3d-view{font-size:.72rem;letter-spacing:.04em}
#constellation-navigation-3d .c3d-stage-meta{font-size:.65rem}
#constellation-navigation-3d .c3d-selection>span{font-size:.68rem}
#constellation-navigation-3d .c3d-selection>small{font-size:.76rem;line-height:1.5}
#constellation-navigation-3d .c3d-selection>a{font-size:.72rem}
#constellation-navigation-3d .c3d-live{font-size:.8rem;background:rgba(5,7,16,.9);padding:4px 8px}
#constellation-navigation-3d .c3d-door-status{white-space:normal;overflow:visible}
@media(max-width:390px){#constellation-navigation-3d .c3d-view{font-size:.68rem}}
.collab-contact{max-width:100%;overflow-wrap:anywhere;word-break:break-word;white-space:normal}
#seuil{overflow:hidden}
/* Rotating decorative lines must not enlarge the mobile viewport. */
html,body{overflow-x:clip}
