/* ==========================================================================
   Portfolio voix off — styles

   Toutes les couleurs se règlent dans :root : fond noir, bleu en accent.
   Les photos s'affichent telles quelles, coins arrondis.
   Le cadre de la liste reprend ceux de WACC43 : filet fin, étiquette en
   capitales à chasse fixe, lignes séparées d'un trait.
   ========================================================================== */

:root {
  --fond: #000;
  --surface: #0c0c0e;       /* cadres */
  --tuile: #121215;         /* lignes de la liste */
  --tuile-survol: #18181c;
  --tuile-actif: #1d1d22;
  --encre: #f4f4f5;
  --doux: #8e8e98;
  --pale: #5c5c66;
  --filet: rgb(255 255 255 / .09);
  --bleu: #4b76ff;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --rayon: 14px;
  --marge: 40px;
  --haut: 118px;     /* espace réservé à l'en-tête */
  --barre: 97px;     /* hauteur réelle de l'en-tête, mesurée par app.js */
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.verrou { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--encre);
  font: 300 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, iframe { display: block; max-width: 100%; }

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 1px solid var(--bleu); outline-offset: 4px; }

::selection { background: var(--bleu); color: #fff; }

[hidden] { display: none !important; }

/* Petites capitales espacées, comme sur la référence. */
.barre-droite, .retour {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* Étiquette des cadres, comme sur WACC43. */
.etiquette {
  margin: 0;
  font: 400 10.5px/1 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--doux);
}

/* ---------- En-tête ---------- */

.barre {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  align-items: start;
  gap: 24px;
  padding: 30px var(--marge);
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  --ligne-nom: 24px; /* la première ligne du nom : les deux côtés s'y alignent */
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.barre-gauche, .barre-droite { height: var(--ligne-nom); display: flex; align-items: center; }
.barre-gauche { position: relative; gap: 22px; min-width: 0; }

/* « Portfolio », en blanc, un peu plus grand que le nom. */
.marque {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -.01em;
  color: #fff;
  white-space: nowrap;
  transition: opacity .4s var(--ease);
}

/* Le bouton retour n'apparaît que dans une rubrique, pendant que la photo
   s'installe ; il s'efface dès qu'on repart. */
.retour {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 12px;
  border: 1px solid var(--filet);
  border-radius: 999px;
  color: var(--doux);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity .4s var(--ease), transform .6s var(--ease), color .3s, border-color .3s, visibility 0s .4s;
}
.retour.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .6s var(--ease) .25s, transform .8s var(--ease) .25s, color .3s, border-color .3s, visibility 0s;
}
.retour:hover { color: var(--encre); border-color: rgb(255 255 255 / .22); }
.retour-fleche {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .5s var(--ease);
}
.retour:hover .retour-fleche { transform: translateX(-3px); }

.barre-nom { display: grid; justify-items: center; line-height: 1; white-space: nowrap; }
.barre-nom-texte { font-size: var(--ligne-nom); font-weight: 300; letter-spacing: .04em; }
.barre-metier { margin-top: 8px; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--bleu); }

.barre-droite { justify-content: flex-end; gap: 28px; }
.contact-icone { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.barre-droite a { color: var(--doux); transition: color .4s; }
.barre-droite a:hover { color: var(--encre); }

/* ---------- Accueil ---------- */

.accueil { padding: var(--haut) var(--marge) var(--marge); }
.accueil.cache { visibility: hidden; }

.bande {
  display: flex;
  gap: 25px;
  height: calc(100vh - var(--haut) - var(--marge));
  min-height: 420px;
}

.panneau {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: opacity .8s var(--ease);
}
.bande:has(.panneau:hover) .panneau:not(:hover) { opacity: .4; }

/* La photo, arrondie ; la même classe habille la copie qui vole. */
.visuel {
  position: relative;
  display: block;
  flex: 1;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size; /* le titre se règle sur la largeur de la photo */
  border-radius: var(--rayon);
  background: var(--surface);
}
.visuel > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.8s var(--ease), opacity .9s var(--ease);
}
.visuel > img.fondu:not(.vue) { opacity: 0; }

.panneau:hover .visuel > img, .panneau:focus-visible .visuel > img { transform: scale(1.03); }
.panneau:focus-visible { outline: none; }
.panneau:focus-visible .visuel { outline: 1px solid var(--bleu); outline-offset: 4px; }

/* Au survol, la photo se voile et son titre monte, en grand, de derrière un
   cache. Sur les écrans tactiles, sans survol, il reste affiché. */
.voile {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgb(0 0 0 / .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s var(--ease);
}
.visuel-texte {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
.visuel-titre { display: block; max-width: 100%; overflow: hidden; padding: 4px 8px 12px; }
.visuel-titre > span {
  display: block;
  font-size: clamp(28px, 12cqi, 76px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 2px 28px rgb(0 0 0 / .35);
  transform: translateY(130%);
  transition: transform .5s var(--ease);
}
.visuel-compte {
  font: 400 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgb(255 255 255 / .8);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.panneau:hover .voile, .panneau:focus-visible .voile { opacity: 1; }
.panneau:hover .visuel-titre > span, .panneau:focus-visible .visuel-titre > span { transform: none; transition-duration: .9s; }
.panneau:hover .visuel-compte, .panneau:focus-visible .visuel-compte {
  opacity: 1;
  transform: none;
  transition-duration: .7s, .9s;
  transition-delay: .15s;
}

@media (hover: none) {
  .voile { opacity: 1; background: rgb(0 0 0 / .3); }
  .visuel-titre > span { transform: none; }
  .visuel-compte { opacity: 1; transform: none; }
}

.volant { position: fixed; z-index: 55; margin: 0; pointer-events: none; }

/* ---------- Rubrique ouverte : le cadre de la liste et le lecteur ---------- */

.focus {
  --gouttiere: 28px;
  /* Le lecteur : la place qui reste à côté d'une liste de 380 px au moins,
     sans dépasser la hauteur de l'écran (légende comprise). */
  --lc: min(
    calc(100vw - 2 * var(--marge) - var(--gouttiere) - 380px),
    calc((100vh - var(--haut) - var(--marge) - 120px) * 16 / 9)
  );
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(300px, 520px) var(--lc);
  grid-template-areas: "carte cadre" ". cartel";
  justify-content: center;
  align-content: start;
  column-gap: var(--gouttiere);
  padding: var(--haut) var(--marge) var(--marge);
  overflow-y: auto;
  scrollbar-width: none;
}
.focus::-webkit-scrollbar { display: none; }


/* Le cadre de la liste prend la hauteur du lecteur, pas davantage : sa
   propre hauteur ne compte pas (contain), la ligne est celle du lecteur. */
.carte {
  grid-area: carte;
  contain: size;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 22px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--filet);
  border-radius: var(--rayon);
}
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.carte-compte { font: 400 10.5px/1 var(--mono); letter-spacing: .09em; color: var(--pale); font-variant-numeric: tabular-nums; }
.carte-titre {
  margin: 6px 0 0;
  font-size: clamp(28px, 2.5vw, 38px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.02em;
}
.carte-intro { margin: -4px 0 0; font-size: 13px; line-height: 1.5; color: var(--doux); text-wrap: pretty; }

/* Les lignes, séparées d'un trait, dans un cadre arrondi, calées au bas du
   cadre : le titre en haut, la liste alignée sur le bas du lecteur. */
.liste {
  position: relative;
  flex: 0 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 1px;
  margin: auto 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  background: var(--filet);
  border: 1px solid var(--filet);
  border-radius: 10px;
  scrollbar-width: none;
}
.liste::-webkit-scrollbar { display: none; }
/* Plus de lignes que de place : la liste s'efface vers le bas. */
.liste.deborde {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 40px), transparent);
}
.liste li { background: var(--tuile); }

.oeuvre {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  color: var(--doux);
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
.oeuvre:hover { background: var(--tuile-survol); }
.oeuvre[aria-current="true"] { background: var(--tuile-actif); }
.oeuvre-num { font: 400 11px/1 var(--mono); color: var(--pale); font-variant-numeric: tabular-nums; transition: color .35s var(--ease); }
.oeuvre-titre {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  color: rgb(244 244 245 / .8);
  transition: color .35s var(--ease);
}
.oeuvre-fin { display: flex; align-items: center; gap: 10px; font: 400 11.5px/1 var(--mono); font-variant-numeric: tabular-nums; }
.oeuvre:hover .oeuvre-titre, .oeuvre[aria-current="true"] .oeuvre-titre { color: var(--encre); }
.oeuvre[aria-current="true"] .oeuvre-num, .oeuvre[aria-current="true"] .oeuvre-info { color: var(--bleu); }
.carte-vide { margin-top: auto; padding: 16px 2px 2px; color: var(--pale); }

/* ---------- Le lecteur : la photo, puis la réalisation choisie ---------- */

.cadre {
  grid-area: cadre;
  position: relative;
  width: var(--lc);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--rayon);
  background: var(--surface);
}
.cadre-image, .scene { position: absolute; inset: 0; }
.cadre-image > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.scene { z-index: 4; pointer-events: none; }
.scene > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  opacity: 0;
  pointer-events: auto;
  transition: opacity .7s var(--ease);
}
.scene > .pret { opacity: 1; }
video.lecteur { object-fit: contain; }
.scene-erreur { display: grid; place-items: center; padding: 24px; background: rgb(0 0 0 / .75); font-size: 15px; text-align: center; }

.chargeur {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1.5px solid rgb(255 255 255 / .18);
  border-top-color: rgb(255 255 255 / .85);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  animation: tourner .9s linear infinite paused;
}
.cadre.charge .chargeur { opacity: 1; transition-delay: .35s; animation-play-state: running; }
@keyframes tourner { to { transform: rotate(1turn); } }

/* Lecteur audio : une barre posée au bas de la photo. */
.audio-ui {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
  padding: 80px clamp(16px, 2.6vw, 32px) clamp(16px, 2.4vw, 28px);
  background: linear-gradient(to top, rgb(0 0 0 / .72), rgb(0 0 0 / 0));
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .45s var(--ease), transform .7s var(--ease), visibility 0s .45s;
}
.cadre.mode-audio .audio-ui { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.audio-bouton {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #000;
  transition: transform .4s var(--ease), opacity .3s;
}
.audio-bouton:hover { transform: scale(1.06); }
.audio-bouton:disabled { opacity: .35; cursor: default; transform: none; }

.onde { position: relative; flex: 1; height: 52px; cursor: pointer; touch-action: pan-y; }
.onde-couche { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; pointer-events: none; }
.onde-couche i {
  flex: 1 1 0;
  min-width: 1px;
  height: calc(var(--h, .06) * 100%);
  min-height: 2px;
  border-radius: 1px;
  background: rgb(255 255 255 / .3);
  transition: height .8s var(--ease) calc(var(--i, 0) * 4ms);
}
.onde-lue { clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0); }
.onde-lue i { background: #fff; }
.audio-temps { flex: none; min-width: 84px; text-align: right; font: 400 12px/1 var(--mono); color: rgb(255 255 255 / .85); font-variant-numeric: tabular-nums; }

.bascule { position: relative; display: block; width: 20px; height: 20px; }
.bascule svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; transition: opacity .25s var(--ease), transform .45s var(--ease); }
.bascule .i-lecture { transform: translateX(1px); }
.bascule .i-pause { opacity: 0; transform: scale(.6); }
.joue .bascule .i-lecture { opacity: 0; transform: scale(.6); }
.joue .bascule .i-pause { opacity: 1; transform: none; }

/* Petit égaliseur : signale la réalisation en cours de lecture. */
.egaliseur { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; color: var(--bleu); opacity: 0; transition: opacity .5s var(--ease); }
.egaliseur i { width: 2px; height: 100%; border-radius: 1px; background: currentColor; transform: scaleY(.3); transform-origin: bottom; }
.oeuvre.joue .egaliseur { opacity: 1; }
.oeuvre.joue .egaliseur i { animation: egaliser .8s ease-in-out infinite alternate; }
.oeuvre.joue .egaliseur i:nth-child(2) { animation-duration: .62s; animation-delay: -.3s; }
.oeuvre.joue .egaliseur i:nth-child(3) { animation-duration: 1.05s; animation-delay: -.55s; }
@keyframes egaliser { from { transform: scaleY(.25); } to { transform: scaleY(1); } }

/* ---------- Légende sous le lecteur ---------- */

.cartel { grid-area: cartel; min-height: 96px; padding-top: 20px; }
.cartel-titre { margin: 0; font-size: clamp(20px, 1.8vw, 26px); font-weight: 300; line-height: 1.2; letter-spacing: -.01em; }
.cartel-meta { margin: 8px 0 0; font: 400 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--doux); }
.cartel-texte { max-width: 68ch; margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: rgb(244 244 245 / .72); }
.cartel.vide > :not(.cartel-invite), .cartel:not(.vide) > .cartel-invite { display: none; }

/* ---------- Petits écrans ---------- */

@media (max-width: 899px) {
  :root { --marge: 16px; --haut: 88px; --rayon: 12px; }

  /* Le nom reste au centre : le retour se réduit à sa flèche, le contact
     à une enveloppe, les réseaux se retirent. */
  .barre { gap: 12px; padding: 16px var(--marge); --ligne-nom: 17px; }
  .marque { font-size: clamp(14px, 4.2vw, 17px); }
  .barre-metier { margin-top: 7px; font-size: 9px; letter-spacing: .26em; }
  .barre-droite a:not(.contact) { display: none; }
  .contact-texte, .retour-texte { display: none; }
  .contact-icone { display: block; }
  /* Dans une rubrique, la flèche de retour prend la place de « Portfolio ». */
  .retour { position: absolute; left: 0; top: calc(50% - 17px); padding: 8px; }
  .barre.en-rubrique .marque { opacity: 0; pointer-events: none; }

  .bande { flex-direction: column; height: auto; min-height: 0; gap: 40px; }
  .visuel { flex: none; aspect-ratio: 4 / 5; }

  /* Pas de marge haute sur le conteneur qui défile : Chrome y mesure la
     position collante du lecteur depuis l'intérieur de cette marge. */
  .focus { display: flex; flex-direction: column; justify-content: flex-start; padding-top: 0; padding-bottom: 48px; }
  .focus > * { flex: none; }
  .cadre { order: 2; position: sticky; top: var(--barre); z-index: 2; width: 100%; margin-top: var(--haut); }
  .cartel { order: 3; min-height: 0; }
  .carte { order: 4; contain: none; margin-top: 24px; }
  .liste { overflow: hidden; } /* toute la liste s'affiche ; les coins restent arrondis */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}
