:root {
  --page-bg: #02050a;
  --panel-bg: rgba(11, 16, 25, 0.96);
  --panel-border: rgba(255, 226, 139, 0.48);
  --text: #f8f2df;
  --muted: #c8c3b7;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body.home-page {
  min-height: 100svh;
  overflow: hidden;
}

.knowledge-map {
  width: 100vw;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

/*
  Le cadre conserve exactement les proportions 1365 × 768 de l’illustration.
  Les zones cliquables restent donc parfaitement alignées, quelle que soit
  la taille de la fenêtre ou les bandes noires autour de l’image.
*/
.knowledge-map__frame {
  position: relative;
  width: min(100vw, calc(100svh * 1365 / 768));
  aspect-ratio: 1365 / 768;
  flex: none;
}

.knowledge-map__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.knowledge-map__hotspots {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.folder-link,
.folder-hit,
.object-hit {
  cursor: pointer;
}

.folder-hit,
.object-hit {
  fill: rgba(255, 255, 255, 0.001);
  stroke: transparent;
  stroke-width: 0;
  outline: none;
}

/*
  La copie découpée de chaque dossier est invisible au repos.
  Au survol, elle pulse au-dessus de l’image originale : seul le dossier
  clignote, sans rectangle gris ni zone surdimensionnée.
*/
.folder-highlight {
  pointer-events: none;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.folder-link:hover .folder-highlight,
.folder-link:focus .folder-highlight,
.folder-link:focus-visible .folder-highlight {
  animation: folderBlink 920ms ease-in-out infinite;
}

.folder-link:focus-visible .folder-hit {
  stroke: rgba(255, 240, 183, 0.95);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

@keyframes folderBlink {
  0%, 100% {
    opacity: 0.08;
    filter: brightness(1.05) saturate(1.02);
  }
  50% {
    opacity: 0.58;
    filter:
      brightness(1.55)
      saturate(1.28)
      drop-shadow(0 0 9px rgba(255, 231, 142, 0.96))
      drop-shadow(0 0 20px rgba(255, 199, 74, 0.62));
  }
}

/* Les objets secondaires restent discrets : aucun grand effet au survol. */
.object-hit:focus-visible {
  stroke: rgba(255, 240, 183, 0.95);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.object-hit--sound[aria-pressed="true"] {
  fill: rgba(255, 244, 191, 0.12);
  stroke: rgba(255, 235, 156, 0.85);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px rgba(255, 244, 191, 0.9));
}

.home-page.is-leaving .knowledge-map {
  animation: pageFadeOut 420ms ease forwards;
}

@keyframes pageFadeOut {
  to { opacity: 0; transform: scale(1.015); }
}

.contact-dialog {
  width: min(92vw, 540px);
  color: var(--text);
  background:
    linear-gradient(rgba(12, 17, 25, 0.95), rgba(8, 12, 19, 0.98)),
    radial-gradient(circle at 50% 0%, rgba(255, 220, 126, 0.25), transparent 55%);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 34px 34px 30px;
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.7), 0 0 35px rgba(255, 219, 113, 0.18);
  text-align: center;
}

.contact-dialog::backdrop {
  background: rgba(0, 4, 10, 0.72);
  backdrop-filter: blur(5px);
}

.contact-dialog h1 {
  margin: 0 0 16px;
  font-size: clamp(1.55rem, 4vw, 2.2rem);
}

.contact-dialog p {
  color: var(--muted);
  line-height: 1.55;
}

.contact-dialog__mail {
  display: inline-block;
  margin-top: 12px;
  color: #fff0bb;
  text-underline-offset: 5px;
}

.contact-dialog__close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
}

/* Pages internes, volontairement très épurées. */
.inner-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(41, 69, 103, 0.28), transparent 48%),
    linear-gradient(#060b13, #010308);
}

.inner-page__panel {
  width: min(92vw, 880px);
  text-align: center;
}

.inner-page h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 6vw, 4.6rem);
  line-height: 1.05;
  text-shadow: 0 0 26px rgba(255, 223, 139, 0.18);
}

.inner-page__placeholder {
  color: var(--muted);
  margin: 0 0 34px;
  font-family: system-ui, sans-serif;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: system-ui, sans-serif;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}

.back-link:hover { background: rgba(255,255,255,.09); }

/* Diagnostic facultatif : index.html?debug=1 */
.debug .folder-hit,
.debug .object-hit {
  fill: rgba(255, 0, 0, 0.16);
  stroke: rgba(255, 70, 70, 0.98);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
