/* Concept : un seul CD à la fois, qui émerge d'un lac sous la lune ; chaque cover teinte la nuit. */
:root {
  color-scheme: dark;
  --night: #02060b;          /* le ciel au zénith */
  --bone: #e9eef0;           /* texte, traits */
  --bone-dim: rgba(233, 238, 240, .32);
  --ink: #010307;            /* silhouettes */
  --accent: #8fc8e0;         /* remplacé en direct par la couleur de la cover */
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
}

html, body { background: var(--night); height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--bone);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
body.is-pointing { cursor: pointer; }
body.is-open { cursor: grab; }

.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

/* ---------- Silhouettes au premier plan ---------- */

.silhouette {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  filter: blur(.7px);
  will-change: transform;
}
.silhouette--branch {
  top: -2%;
  right: -3%;
  width: clamp(260px, 52vw, 820px);
  aspect-ratio: 4 / 3;
  transform-origin: 100% 0;
}
.silhouette--reeds {
  bottom: -2%;
  left: -2%;
  width: clamp(150px, 30vw, 460px);
  aspect-ratio: 3 / 4;
  transform-origin: 0 100%;
}
@media (max-aspect-ratio: 4/5) {
  .silhouette--branch { width: 78vw; top: -4%; }
  .silhouette--reeds { width: 44vw; }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 75% at 50% 48%, transparent 52%, rgba(0, 2, 5, .72) 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 3;
  pointer-events: none;
  opacity: .1;
  mix-blend-mode: overlay;
  background-size: 200px 200px;
  animation: grain .8s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-5%, 4%); }
  50% { transform: translate(4%, -6%); }
  75% { transform: translate(-3%, 7%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Signature : discrète en coin, après l'intro ---------- */

.brand {
  position: fixed;
  z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 22px);
  left: max(22px, calc(env(safe-area-inset-left, 0px) + 22px));
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.02em;
  font-variation-settings: "opsz" 96;
  color: var(--bone);
  pointer-events: none;
  white-space: nowrap;
}
.brand span { display: inline-block; opacity: 0; }
.brand.is-on span { animation: letterIn 1.4s cubic-bezier(.2, .7, .1, 1) forwards; }
.brand.is-on span:nth-child(1) { animation-delay: .05s; }
.brand.is-on span:nth-child(2) { animation-delay: .2s; }
.brand.is-on span:nth-child(3) { animation-delay: .12s; }
.brand.is-on span:nth-child(4) { animation-delay: .28s; }
.brand.is-on span:nth-child(5) { animation-delay: .18s; }
@keyframes letterIn {
  0% { opacity: 0; filter: blur(10px); transform: translateY(.25em); }
  40% { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: none; }
}

/* ---------- Points de navigation ---------- */

.dots {
  position: fixed;
  z-index: 5;
  right: max(10px, calc(env(safe-area-inset-right, 0px) + 10px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity 1s ease;
}
.dots.is-on { opacity: 1; }
body.is-open .dots { opacity: .25; }
.dot {
  appearance: none;
  border: 0;
  background: transparent;
  width: 28px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.dot::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bone-dim);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), background-color .5s ease, box-shadow .5s ease;
}
.dot:hover::before { background: var(--bone); }
.dot[aria-current="true"]::before {
  background: var(--bone);
  transform: scale(1.9);
  box-shadow: 0 0 8px var(--accent), 0 0 2px var(--accent);
}
.dot:focus-visible { outline: 1px solid var(--bone); outline-offset: -2px; border-radius: 4px; }

/* ---------- Indice de défilement (sans texte) ---------- */

.hint {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  width: 1px;
  height: 46px;
  margin-left: -.5px;
  background: linear-gradient(180deg, transparent, var(--bone-dim));
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
  overflow: hidden;
}
.hint.is-on { opacity: 1; }
.hint span {
  position: absolute;
  left: -1px;
  top: -10px;
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: var(--bone);
  animation: hint 2.2s cubic-bezier(.6, 0, .3, 1) infinite;
}
@keyframes hint {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(56px); opacity: 0; }
}

/* ---------- Bouton de fermeture ---------- */

.close {
  position: fixed;
  z-index: 6;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: max(14px, calc(env(safe-area-inset-right, 0px) + 14px));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(233, 238, 240, .28);
  background: rgba(2, 6, 11, .35);
  color: var(--bone);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s, border-color .3s ease;
}
body.is-open .close { opacity: .85; visibility: visible; transition: opacity .6s ease .7s, visibility 0s, border-color .3s ease; }
.close:hover { border-color: rgba(233, 238, 240, .7); opacity: 1; }
.close:focus-visible { outline: 1.5px solid var(--bone); outline-offset: 3px; }

/* ---------- Sans WebGL : simple galerie ---------- */

html.no-gl, html.no-gl body { overflow: auto; height: auto; }
.fallback {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  padding-block: 120px 60px;
  max-width: 1100px;
  margin-inline: auto;
}
.fallback img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

@media (prefers-reduced-motion: reduce) {
  .grain, .hint span { animation: none; }
  .brand.is-on span { animation-duration: .01s; animation-delay: 0s !important; }
}
