/* ===== Aaron Thoué : Liquid Glass ===== */
:root {
  --ink: #f7f7fa;
  --ink-soft: rgba(247, 247, 250, .74);
  --ink-faint: rgba(247, 247, 250, .52);
  --gold: #ecd49a;
  --w: min(92vw, 400px);
  --r: 34px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #07070b;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---------- Arrière-plan vidéo ---------- */
.bg {
  position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background: #07070b url("https://i.ytimg.com/vi/_eBOLNZbYqQ/maxresdefault.jpg") center / cover no-repeat;
}
/* l’iframe est agrandie pour couvrir l’écran et rogner les bords où YouTube affiche son interface */
.frame {
  position: absolute; left: 50%; top: 50%;
  width: max(100vw, calc(100vh * 16 / 9));
  height: max(100vh, calc(100vw * 9 / 16));
  transform: translate(-50%, -50%) scale(1.16);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.frame.on { opacity: 1; }
.frame iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
@supports (height: 100dvh) {
  .frame {
    width: max(100vw, calc(100dvh * 16 / 9));
    height: max(100dvh, calc(100vw * 9 / 16));
  }
}
/* voile léger : garde la vidéo bien visible mais protège la lisibilité */
.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(0, 0, 0, .38) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, .22));
}

/* ---------- Écran d’entrée ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: rgba(8, 8, 14, .28);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
  backdrop-filter: blur(26px) saturate(1.4);
  transition: opacity 1s ease, backdrop-filter 1s ease, -webkit-backdrop-filter 1s ease;
}
.gate.out { opacity: 0; -webkit-backdrop-filter: blur(0) saturate(1); backdrop-filter: blur(0) saturate(1); pointer-events: none; }
.gate-hint { margin: 0; font-size: .85rem; color: var(--ink-faint); letter-spacing: .01em; }

.enter {
  position: relative; cursor: pointer;
  padding: 18px 54px; border-radius: 999px; border: 0;
  background: linear-gradient(150deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .07) 50%, rgba(255, 255, 255, .16));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .7),
    inset 0 -1px 0 rgba(255, 255, 255, .18),
    inset 0 0 24px rgba(255, 255, 255, .12),
    0 18px 50px rgba(0, 0, 0, .45);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.enter:hover { transform: scale(1.06); }
.enter:active { transform: scale(.96); }
.enter-label { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; letter-spacing: .01em; text-shadow: 0 1px 12px rgba(0, 0, 0, .4); }
.enter-ring {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1.5px solid rgba(255, 255, 255, .55);
  animation: ring 2.8s ease-out infinite;
}
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.5, 1.9); opacity: 0; } }

/* ---------- Scène 3D ---------- */
.stage {
  position: relative; z-index: 5;
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 28px 0;
  perspective: 1300px;
  perspective-origin: 50% 45%;
}
.rig {
  --mx: 30%; --my: 12%; --px: 0; --py: 0;
  position: relative; width: var(--w);
  display: grid; gap: 14px;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------- Matière Liquid Glass ---------- */
.glass-bg {
  position: absolute; inset: 0; z-index: 0; border-radius: var(--r); overflow: hidden;
  background: linear-gradient(150deg, rgba(255, 255, 255, .17) 0%, rgba(255, 255, 255, .04) 42%, rgba(255, 255, 255, .11) 100%);
  -webkit-backdrop-filter: blur(16px) saturate(1.9) brightness(.92);
  backdrop-filter: blur(16px) saturate(1.9) brightness(.92);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .6),
    inset 0 -1px 0 rgba(255, 255, 255, .14),
    inset 1px 0 0 rgba(255, 255, 255, .16),
    inset 0 0 26px rgba(255, 255, 255, .09),
    0 30px 70px rgba(0, 0, 0, .38),
    0 3px 10px rgba(0, 0, 0, .22);
}
.refract .glass-bg {
  -webkit-backdrop-filter: url(#lg-refract) blur(6px) saturate(1.9) brightness(.92);
  backdrop-filter: url(#lg-refract) blur(6px) saturate(1.9) brightness(.92);
}
/* liseré lumineux qui suit la lumière */
.glass-bg::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: linear-gradient(140deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .06) 32%, rgba(255, 255, 255, .06) 62%, rgba(255, 255, 255, .75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
/* reflet spéculaire mobile */
.glass-bg::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(280px circle at var(--mx) var(--my), rgba(255, 255, 255, .30), rgba(255, 255, 255, .06) 45%, transparent 70%);
  mix-blend-mode: soft-light;
}

/* ---------- Carte ---------- */
.card {
  position: relative; transform-style: preserve-3d;
  padding: 30px 24px 24px; border-radius: var(--r);
  display: grid; justify-items: center; text-align: center;
}
.card > .l { position: relative; z-index: 1; }

.avatar {
  width: 112px; height: 112px; border-radius: 50%; overflow: hidden;
  transform: translateZ(70px);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, .55),
    0 0 0 8px rgba(255, 255, 255, .10),
    0 0 0 9px rgba(236, 212, 154, .35),
    0 20px 38px rgba(0, 0, 0, .5);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }

h1 {
  margin: 20px 0 0; font-family: var(--serif);
  font-size: clamp(2.1rem, 9vw, 2.6rem); line-height: 1.05; font-weight: 600; letter-spacing: -.02em;
  transform: translateZ(48px);
  text-shadow: 0 2px 22px rgba(0, 0, 0, .45);
}
.handle {
  margin: 6px 0 0; font-size: .95rem; color: var(--gold);
  transform: translateZ(40px); text-shadow: 0 1px 10px rgba(0, 0, 0, .5);
}
.bio {
  margin: 16px 0 0; max-width: 32ch; font-size: .98rem; line-height: 1.5; color: var(--ink);
  transform: translateZ(30px); text-shadow: 0 1px 12px rgba(0, 0, 0, .55);
}

.chips {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  transform: translateZ(34px);
}
.chips li {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; font-size: .84rem; font-weight: 500;
  background: rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(255, 255, 255, .08), 0 4px 14px rgba(0, 0, 0, .22);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.flag {
  width: 17px; height: 11px; border-radius: 3px;
  background: linear-gradient(90deg, #0055a4 0 33.3%, #fff 33.3% 66.6%, #ef4135 66.6%);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .5);
}

.facts {
  list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 7px;
  font-size: .88rem; color: var(--ink-soft);
  transform: translateZ(26px); text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
.facts li { display: flex; align-items: center; justify-content: center; gap: 8px; }
.facts svg { width: 16px; height: 16px; fill: currentColor; flex: none; opacity: .85; }

.links {
  margin-top: 22px; width: 100%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  transform: translateZ(44px);
}
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 10px; border-radius: 22px; font-size: .95rem; font-weight: 600;
  background: linear-gradient(160deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .08));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .6), inset 0 -1px 0 rgba(255, 255, 255, .12), 0 10px 24px rgba(0, 0, 0, .3);
  transition: transform .45s var(--ease), background .3s ease, box-shadow .45s var(--ease);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .4);
}
.btn img { width: 28px; height: 28px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35)); }
.btn:hover { transform: translateY(-3px) scale(1.04); background: linear-gradient(160deg, rgba(255, 255, 255, .36), rgba(255, 255, 255, .12)); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .8), inset 0 -1px 0 rgba(255, 255, 255, .16), 0 16px 32px rgba(0, 0, 0, .36); }
.btn:active { transform: scale(.96); }

:is(a, button, input):focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- Lecteur ---------- */
.player {
  position: relative; transform-style: preserve-3d;
  height: 70px; border-radius: 28px;
  transform: translateZ(36px);
}
.player .glass-bg { border-radius: 28px; }
.pbody {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px; padding: 0 14px 4px 12px;
}
.pbtn {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .1));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .7), inset 0 -1px 0 rgba(255, 255, 255, .14), 0 6px 16px rgba(0, 0, 0, .3);
  transition: transform .4s var(--ease);
}
.pbtn:hover { transform: scale(1.1); }
.pbtn:active { transform: scale(.92); }
.pbtn.small { width: 34px; height: 34px; }
.pbtn svg { width: 20px; height: 20px; fill: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4)); }
.pbtn.small svg { width: 17px; height: 17px; }
.i-pause, .i-mute { display: none; }
.player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }
.player.muted .i-vol { display: none; }
.player.muted .i-mute { display: block; }

.meta { flex: 1; min-width: 0; display: grid; text-align: left; line-height: 1.25; }
.meta strong { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 8px rgba(0, 0, 0, .45); }
.meta span { font-size: .78rem; color: var(--ink-soft); }

.eq { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: rgba(255, 255, 255, .85); transform-origin: bottom; transform: scaleY(.25); }
.player.playing .eq i { animation: eq 1s ease-in-out infinite; }
.player.playing .eq i:nth-child(2) { animation-duration: .8s; animation-delay: -.3s; }
.player.playing .eq i:nth-child(3) { animation-duration: 1.2s; animation-delay: -.6s; }
.player.playing .eq i:nth-child(4) { animation-duration: .9s; animation-delay: -.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

/* barre de progression en verre */
.seek {
  -webkit-appearance: none; appearance: none; position: absolute; z-index: 2;
  left: 22px; right: 22px; bottom: 7px; width: auto; height: 12px; margin: 0; background: transparent; cursor: pointer;
}
.seek::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(255, 255, 255, .9) var(--p, 0%), rgba(255, 255, 255, .22) var(--p, 0%)); }
.seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
.seek::-moz-range-progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .9); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.seek::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .45); }

/* ---------- Sphères de verre ---------- */
.orb {
  --d: 14; --z: 0px;
  position: absolute; z-index: 2; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .75) 0 6%, rgba(255, 255, 255, .22) 18%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .02) 55%, rgba(255, 255, 255, .26) 100%);
  -webkit-backdrop-filter: blur(5px) saturate(1.8);
  backdrop-filter: blur(5px) saturate(1.8);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, .7),
    inset 0 -8px 16px rgba(255, 255, 255, .12),
    inset 0 0 0 1px rgba(255, 255, 255, .25),
    0 18px 36px rgba(0, 0, 0, .35);
  transform: translate3d(calc(var(--px) * var(--d) * 1px), calc(var(--py) * var(--d) * 1px), var(--z));
  animation: drift 7s ease-in-out infinite;
}
.o1 { width: 92px; height: 92px; left: -46px; top: 38px; --d: 26; --z: 110px; }
.o2 { width: 124px; height: 124px; right: -52px; bottom: 112px; --d: 34; --z: 160px; animation-duration: 9s; animation-delay: -3s; }
.o3 { width: 42px; height: 42px; right: 26px; top: -22px; --d: 18; --z: 90px; animation-duration: 6s; animation-delay: -1.5s; }
@keyframes drift {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -16px; }
}

/* ---------- Apparition orchestrée (une seule fois, après « Entrer ») ---------- */
.glass-bg, .orb, .l { opacity: 0; }
.live .glass-bg { animation: glassIn 1.2s var(--ease) .05s both; }
.live .orb { animation: orbIn 1.4s var(--ease) .5s both, drift 7s ease-in-out 1.9s infinite; }
.live .o2 { animation: orbIn 1.4s var(--ease) .7s both, drift 9s ease-in-out 2.1s infinite; }
.live .o3 { animation: orbIn 1.4s var(--ease) .9s both, drift 6s ease-in-out 2.3s infinite; }
.live .l { animation: leafIn .9s var(--ease) calc(.25s + var(--i, 0) * .07s) both; }
@keyframes glassIn { from { opacity: 0; scale: .9; } to { opacity: 1; scale: 1; } }
@keyframes orbIn { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
@keyframes leafIn { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); z-index: 60;
  padding: 12px 20px; border-radius: 999px; font-size: .9rem; font-weight: 500;
  background: rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(18px) saturate(1.8); backdrop-filter: blur(18px) saturate(1.8);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .6), 0 14px 34px rgba(0, 0, 0, .4);
  transform: translate(-50%, 24px) scale(.94); opacity: 0; pointer-events: none;
  transition: transform .5s var(--ease), opacity .4s ease;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* ---------- Petits écrans ---------- */
@media (max-width: 420px) {
  :root { --r: 30px; }
  .card { padding: 26px 18px 20px; }
  .o1 { left: -20px; width: 70px; height: 70px; }
  .o2 { right: -22px; width: 92px; height: 92px; }
  .o3 { right: 14px; }
}
@media (max-height: 700px) { .stage { align-items: start; } }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .orb, .live .orb, .live .o2, .live .o3 { animation: orbIn .01s both !important; }
  .live .glass-bg, .live .l { animation-duration: .01s !important; animation-delay: 0s !important; }
  .enter-ring, .player.playing .eq i { animation: none; }
  .player.playing .eq i { transform: scaleY(.6); }
}
