/* ───────────── PAGE « MON MONDE » ─────────────
   Reprend les couleurs et polices de ../style.css */

.page-monde .topbar {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.page-monde .topbar a[aria-current="page"] { opacity: 1; border-bottom: 1.5px solid var(--ink); }
.page-monde .topbar a.back:hover { color: var(--accent); }

.page-monde main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}

/* ── titre ── */
.m-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: clamp(32px, 6vw, 72px) 0 0;
}
.m-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); }
.m-title {
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  font-size: clamp(56px, 11vw, 160px);
  line-height: 0.85;
  letter-spacing: -0.03em;
}
.m-title span { color: var(--accent); }
.m-intro { max-width: 32ch; font-size: 18px; line-height: 1.5; color: #3A3A3A; }

/* ── scène : planète + anneau ── */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 8px 0 24px;
  /* même grille fine que le fond du hero */
  background-image:
    linear-gradient(to right, rgba(17,17,17,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17,17,17,0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 52%, #000 60%, transparent 100%);
          mask-image: radial-gradient(ellipse 75% 75% at 50% 52%, #000 60%, transparent 100%);
}

.planet {
  position: absolute;
  left: 37%;
  top: 31.2%;
  width: 26%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  z-index: 3;
  overflow: hidden;
  isolation: isolate;
  background: var(--accent);
  border: 1.5px solid var(--ink);
  /* halo d'atmosphère + ombre douce sous la planète */
  box-shadow:
    0 0 0 12px color-mix(in srgb, var(--accent) 8%, transparent),
    0 0 0 26px color-mix(in srgb, var(--accent) 4%, transparent),
    0 36px 60px -34px rgba(142, 36, 20, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
/* bandes de la planète : la texture (dessinée par monde.js) défile = la planète tourne */
.planet__surface { --spin: 90s; }
.planet__name {
  position: relative;
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  font-size: clamp(28px, 4.6vw, 64px);
  color: var(--ink);
}
.planet__sub { position: relative; color: var(--ink); font-size: 10px; }

/* l'anneau : la moitié du haut passe derrière la planète, la moitié du bas devant */
.ring { position: absolute; border-radius: 50%; box-sizing: border-box; pointer-events: none; }
.ring.back { z-index: 1; }
.ring.front { z-index: 4; clip-path: inset(50% 0 0 0); }
.ring--a { left: 2%; top: 33%; width: 96%; height: 38%; border: 1px solid rgba(17,17,17,0.25); }
.ring--b { left: 5%; top: 37%; width: 90%; height: 30%; border: 10px solid rgba(17,17,17,0.07); }
.ring--b.front { border-color: rgba(17,17,17,0.12); }
.ring--c { left: 9%; top: 40.5%; width: 82%; height: 23%; border: 1.5px dashed rgba(17,17,17,0.45); }

/* les mondes sur l'anneau */
.worlds { position: absolute; inset: 0; }
.world {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  padding: 0;
}
/* l'étiquette reste sous la planète sans élargir le bouton */
.world__label { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
.world__ball {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  background: var(--c);
  border: 1.5px solid var(--ink);
  box-shadow: 0 10px 22px -10px rgba(17, 17, 17, 0.45);
  transition: scale 0.3s cubic-bezier(.2, .8, .2, 1), background-color 0.8s, border-color 0.8s, box-shadow 0.8s;
}
.world:hover .world__ball { scale: 1.08; }
.world__label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* surface qui défile (texture posée par monde.js) : 2 largeurs de planète, on glisse d'une */
.world__surface,
.planet__surface {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  z-index: -1;
  background-size: 50% 100%;
  background-repeat: repeat-x;
  animation: m-spin var(--spin, 16s) linear infinite;
}
@keyframes m-spin { to { transform: translateX(-50%); } }
@keyframes m-turn { to { rotate: 360deg; } }

/* lumière commune : reflet en haut à gauche, nuit en bas à droite */
.world__shade,
.planet__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,0.6), rgba(255,255,255,0) 24%),
    radial-gradient(circle at 36% 32%, rgba(0,0,0,0) 42%, rgba(0,0,0,0.38) 76%, rgba(0,0,0,0.62) 100%),
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 64%, rgba(255,255,255,0.18) 70%, rgba(0,0,0,0) 72%);
}
.planet__shade {
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,0.45), rgba(255,255,255,0) 30%),
    radial-gradient(circle at 36% 32%, rgba(0,0,0,0) 48%, rgba(60,10,0,0.32) 80%, rgba(40,6,0,0.55) 100%);
}

/* Musique : un vinyle qui tourne */
.world--vinyle .world__surface {
  width: 100%;
  background:
    radial-gradient(circle, rgba(17,17,17,0.9) 0 3%, rgba(255,255,255,0.75) 3.5% 17%, rgba(17,17,17,0.5) 17.5% 19%, transparent 19.5%),
    radial-gradient(circle at 50% 36%, rgba(17,17,17,0.55) 0 2.5%, transparent 3%),
    conic-gradient(from 20deg, transparent 0 8%, rgba(255,255,255,0.28) 13%, transparent 19% 56%, rgba(255,255,255,0.2) 62%, transparent 68%),
    repeating-radial-gradient(circle, rgba(17,17,17,0.2) 0 1%, transparent 1% 3%);
  animation: m-turn 5s linear infinite;
}

/* Apprendre : un anneau incliné (moitié derrière, moitié devant) */
.world__ring {
  position: absolute;
  left: -44%;
  top: 33%;
  width: 188%;
  height: 34%;
  z-index: 0;
  border-radius: 50%;
  /* anneau clair bordé d'encre : il reste visible devant une planète sombre */
  border: 3px solid #E4D9C4;
  box-shadow: 0 0 0 1px var(--ink), inset 0 0 0 1px var(--ink);
  rotate: -16deg;
  pointer-events: none;
}
.world__ring--front { z-index: 2; clip-path: inset(50% 0 0 0); }

/* Découverte : une petite lune (placée par monde.js) */
.world__moon {
  position: absolute;
  width: 26%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 34% 30%, #FFFFFF, #D9D5CB 50%, #8F8B80 100%);
  border: 1px solid var(--ink);
  pointer-events: none;
}

/* monde choisi : orbite pointillée qui tourne autour */
.world::before {
  content: "";
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  border: 1px dashed var(--ink);
  opacity: 0;
  scale: 0.8;
  transition: opacity 0.3s, scale 0.4s cubic-bezier(.2, .8, .2, 1);
  animation: m-turn 14s linear infinite;
  pointer-events: none;
}
.world.is-active::before { opacity: 0.55; scale: 1; }
.world.is-active .world__ball { border-width: 2px; }
.world.is-active .world__label { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.world:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }

/* ── fiche du monde choisi ── */
.detail {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding: clamp(24px, 4vw, 48px);
  margin-bottom: clamp(64px, 8vw, 120px);
  background: var(--paper);
  border-radius: 28px;
}
.detail__main { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.detail__side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.detail__meta { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.detail__dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c, var(--accent)); border: 1.5px solid var(--ink); }
.detail__title {
  font-weight: 900;
  font-stretch: 120%;
  text-transform: uppercase;
  font-size: clamp(40px, 6vw, 84px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}
.detail__text { font-size: 19px; line-height: 1.55; color: #2A2A2A; max-width: 46ch; }
.detail__items { list-style: none; }
.detail__items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.detail__items li span:last-child { color: var(--muted); }
.detail__nav { display: flex; gap: 10px; }
.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-size: 18px;
  transition: background 0.2s, color 0.2s;
}
.round:hover { background: var(--ink); color: var(--paper); }

/* ── rendu 3D (monde3d.js) ──
   Le canvas dessine les planètes et les orbites ; le DOM garde les boutons,
   les étiquettes et le nom « Léo ». Sans WebGL, tout ce bloc reste inactif. */
.stage { touch-action: pan-y; }
.stage.is-dragging { cursor: grabbing; }
.stage__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.stage--3d .stage__canvas { opacity: 1; }

.ring, .planet__surface, .planet__shade, .world__surface, .world__shade, .world__ring, .world__moon { transition: opacity 0.8s ease; }
.planet { transition: background-color 0.8s, border-color 0.8s, box-shadow 0.8s; }
.stage--3d .ring,
.stage--3d .planet__surface,
.stage--3d .planet__shade,
.stage--3d .world__surface,
.stage--3d .world__shade,
.stage--3d .world__ring,
.stage--3d .world__moon { opacity: 0; }
.stage--3d .planet {
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
  overflow: visible;
  pointer-events: none;
}
/* le nom se lit sur la surface détaillée */
.stage--3d .planet__name { text-shadow: 0 1px 18px rgba(255, 190, 160, 0.35); }
.stage--3d .planet__sub {
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.stage--3d .world { min-width: 0; transition: opacity 0.3s; }
/* zone de clic un peu plus large que la planète (doigt sur mobile) */
.stage--3d .world::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.stage--3d .world__ball { background-color: transparent; border-color: transparent; box-shadow: none; }
.stage--3d .world:hover .world__ball { scale: 1; }
.stage--3d .world__label {
  opacity: calc(0.55 + var(--depth, 1) * 0.45);
  transition: opacity 0.3s, background 0.2s, color 0.2s, border-color 0.2s;
}
.stage--3d .world:hover .world__label { border-color: var(--ink); opacity: 1; }
.stage--3d .world.is-active .world__label { opacity: 1; }
.stage--3d .world.is-active::before { opacity: 0.4; }
.stage--3d .world.is-active .world__ball { border-width: 0; }
.stage--3d .world.is-hidden { opacity: 0; pointer-events: none; }
.stage--3d .world.is-behind:not(:hover):not(:focus-visible) .world__label { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .world__surface, .planet__surface, .world::before { animation: none; }
  .stage__canvas { transition: none; }
}

@media (max-width: 700px) {
  .stage { aspect-ratio: 4 / 5; }
  .planet { left: 28%; top: 30%; width: 44%; }
  .ring--a { top: 36%; height: 32%; }
  .ring--b { top: 39%; height: 26%; }
  .ring--c { top: 42%; height: 20%; }
  /* sur téléphone, seule l'étiquette du monde devant reste visible */
  .world__label { display: none; font-size: 10px; }
  .world.is-active .world__label { display: block; }
  /* en 3D, la scène n'a pas besoin d'autant de hauteur */
  .stage.stage--3d { aspect-ratio: 1 / 1; }
  /* le lien « ← Léo Maloigne » suffit pour revenir aux projets */
  .page-monde .topbar__links a[href="../#top"] { display: none; }
}
