/* Clips sur l'accueil (assets/js/photo/clips.js, 22/11/2026) : la VHS « CLIP » sous le lecteur,
   le lecteur qui pivote et devient le combiné télé-magnétoscope, l'écran cathodique.
   Les coordonnées sont en pixels des photos (1024 × 1536). L'écran reprend le rendu de la page OST (ost.css). */

/* ======================= Les deux faces qui pivotent ======================= */
.pstage.has-clips { perspective: 2400px; }
.cf-flip { position: absolute; inset: 0; transform-style: preserve-3d; }
.cf-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cf-face--tv, .cf-flip.is-tv { transform: rotateY(180deg); }
.cf-face[inert] { pointer-events: none; }
.cf-frame > canvas.cf-photo { position: absolute; left: 0; top: 0; }

/* étincelles du « par magie » */
.cf-spark {
  position: absolute; z-index: 21; width: 14px; height: 14px; margin: -7px; pointer-events: none;
  opacity: 0; animation: cf-spark 1.15s cubic-bezier(.2, .7, .3, 1) forwards;
}
.cf-spark::before, .cf-spark::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(closest-side, #fff 0 18%, rgba(255, 196, 120, .85) 40%, transparent 100%);
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
.cf-spark::after { rotate: 45deg; scale: .6; }
@keyframes cf-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(.2); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(120deg); }
}

/* ======================= La cassette sous le lecteur ======================= */
.cf-out { position: absolute; overflow: hidden; pointer-events: none; z-index: 3; }
.cf-tape {
  position: absolute; top: 0; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  translate: 0 -105%; opacity: 1;
  transition: translate .55s cubic-bezier(.3, .7, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.cf-out.is-on .cf-tape { translate: 0 0; pointer-events: auto; }
.cf-out.is-gone .cf-tape { opacity: 0; transition: none; }
.cf-tape-img { display: block; filter: drop-shadow(0 7px 7px rgba(0, 0, 0, .32)); transition: translate .2s; }
.cf-tape:hover .cf-tape-img, .cf-tape:focus-visible .cf-tape-img { translate: 0 5px; }
.cf-tape:focus-visible { outline: none; }
.cf-tape:focus-visible .cf-tape-img { outline: 4px solid var(--signal, #ff5b1f); outline-offset: 3px; }
/* elle sort puis « appelle » une fois */
.cf-out.is-on .cf-tape-img { animation: cf-call .5s .7s ease-in-out 2 alternate; }
@keyframes cf-call { to { translate: 0 6px; } }

/* la cassette en vol (pixels du panneau) */
.cf-fly {
  position: absolute; z-index: 20; pointer-events: none;
  transition-property: left, top, width, height; transition-timing-function: cubic-bezier(.3, .7, .2, 1);
}
.cf-fly[hidden] { display: none; }
.cf-fly-img {
  display: block; width: 100%; height: 100%;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, .38));
  transition: transform .5s cubic-bezier(.3, .7, .2, 1), opacity .4s, filter .4s;
}
.cf-fly.is-lift .cf-fly-img { transform: translateY(-14px) scale(1.12) rotate(-2.5deg); filter: drop-shadow(0 26px 22px rgba(0, 0, 0, .3)); }
.cf-fly.is-in .cf-fly-img { transform: translateY(-42%) scale(.9); opacity: 0; filter: brightness(.25); }
.cf-fly.no-anim, .cf-fly.no-anim .cf-fly-img { transition: none; }

/* ======================= L'écran cathodique (comme ost.css) ======================= */
.cf-tv { position: absolute; overflow: hidden; cursor: pointer; isolation: isolate; }
.cf-tv > * { position: absolute; inset: 0; margin: 0; pointer-events: none; }
.cf-tv.is-on { background: #050607; }
.cf-tv > .cf-video, .cf-tv > .cf-blue, .cf-tv > .cf-snow, .cf-tv > .cf-osd, .cf-tv > .cf-fx { opacity: 0; }
.cf-glare { width: 100%; height: 100%; opacity: 0; transition: opacity .3s; }
.cf-tv.is-on .cf-glare { opacity: .5; }
.cf-tv.is-on .cf-fx { opacity: 1; }
.cf-tv[data-tv="pic"] .cf-video { opacity: 1; }
.cf-tv[data-tv="blue"] .cf-blue { opacity: 1; }
.cf-tv[data-tv="snow"] .cf-snow { opacity: .85; }
.cf-osd.is-on { opacity: 1; }

/* le clip dans la télé 4/3 : bandes noires, couleurs un peu baveuses de la VHS */
.cf-video { width: 100%; height: 100%; object-fit: contain; background: #000; filter: saturate(1.2) contrast(1.05) blur(.4px); }
.cf-face--tv[data-status="paused"] .cf-video { animation: cf-jitter .18s steps(2) infinite; }
@keyframes cf-jitter { 50% { translate: 0 1.5px; } }

.cf-blue {
  background: #1a2fd0; padding: 34px 40px !important;
  font: 46px/1 "VT323", ui-monospace, monospace; color: #f4f6ff; letter-spacing: .04em;
  text-shadow: 2px 0 rgba(255, 90, 90, .35), -2px 0 rgba(90, 200, 255, .35);
}
.cf-snow { width: 100%; height: 100%; image-rendering: pixelated; mix-blend-mode: screen; }
.cf-osd {
  inset: auto !important; left: 38px !important; top: 30px !important;
  font: 44px/1 "VT323", ui-monospace, monospace; color: #e9ffe9; letter-spacing: .05em;
  text-shadow: 0 0 6px rgba(120, 255, 140, .7), 2px 2px 0 rgba(0, 0, 0, .6);
  transition: opacity .1s;
}
.cf-fx {
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .2) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%);
}
.cf-fx::after {
  content: ""; position: absolute; left: 0; right: 0; height: 18%; top: -20%;
  background: linear-gradient(transparent, rgba(255, 255, 255, .05) 40%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .05) 60%, transparent);
  animation: cf-roll 9s linear infinite;
}
@keyframes cf-roll { 0%, 70% { top: -20%; } 100% { top: 105%; } }

.cf-tv.is-on-anim > :not(.cf-glare) { animation: cf-crt-on .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes cf-crt-on {
  0% { transform: scale(1, .004); filter: brightness(8); }
  35% { transform: scale(1, .004); filter: brightness(6); }
  70% { transform: scale(1, 1); filter: brightness(1.8); }
  100% { transform: none; filter: none; }
}
.cf-tv::after {
  content: ""; position: absolute; inset: 0; z-index: 9; pointer-events: none;
  background: #f8fbff; opacity: 0; border-radius: inherit;
}
.cf-tv.is-off-anim::after { animation: cf-crt-off .55s ease-in forwards; }
@keyframes cf-crt-off {
  0% { opacity: .9; transform: scale(1, 1); }
  35% { opacity: .9; transform: scale(1, .006); }
  75% { opacity: .9; transform: scale(.004, .006); }
  100% { opacity: 0; transform: scale(0, 0); }
}

/* ======================= Le magnétoscope ======================= */
.cf-flap {
  position: absolute; pointer-events: none; border-radius: 2px;
  background: linear-gradient(#000 0, rgba(0, 0, 0, 0) 100%);
  opacity: 0; transition: opacity .25s;
}
.cf-flap.is-open { opacity: .9; box-shadow: inset 0 6px 10px rgba(0, 0, 0, .9); }
.cf-display { position: absolute; pointer-events: none; filter: drop-shadow(0 0 2px rgba(110, 255, 230, .75)) drop-shadow(0 0 6px rgba(110, 255, 230, .3)); }
.cf-led { position: absolute; border-radius: 50%; pointer-events: none; background: #3a0806; }
.cf-led.is-on { background: #ff3b24; box-shadow: 0 0 5px 2px rgba(255, 50, 30, .8), 0 0 14px 5px rgba(255, 40, 20, .3); }
.cf-buttons .cf-btn { position: absolute; border-radius: 3px; }
.cf-btn svg { width: auto; height: 52%; }
.cf-btn .i-full { fill: none; stroke: rgba(214, 218, 222, .82); stroke-width: 2.4; }
.cf-btn--play .i-pause { opacity: 0; }
.cf-face--tv[data-status="playing"] .cf-btn--play .i-play { opacity: 0; }
.cf-face--tv[data-status="playing"] .cf-btn--play .i-pause { opacity: 1; }

/* ======================= Fiche du disque : « ▶ CLIP » sur les pistes ======================= */
.info-tracks.has-clips li { display: flex; align-items: center; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.info-tracks.has-clips li > button:first-child { flex: 1; min-width: 0; border-bottom: 0; }
.info-tracks .info-clip.is-none { visibility: hidden; }
.info-tracks .info-clip {
  display: inline-flex; align-items: center; flex: none; width: auto; gap: 0;
  margin: 0 2px 0 6px; padding: 4px 8px 3px; border: 1.5px solid #d8322a; border-bottom: 1.5px solid #d8322a; border-radius: 3px;
  background: #f6efdc; color: #d8322a;
  font: 400 17px/1 "VT323", ui-monospace, monospace; letter-spacing: .04em; white-space: nowrap;
  rotate: -2deg; cursor: pointer;
  transition: background .12s, color .12s, rotate .12s;
}
.info-tracks .info-clip:hover, .info-tracks .info-clip:focus-visible { background: #d8322a; color: #fff; rotate: 0deg; }

/* téléphone : incrustations plus grandes (l'écran est petit) */
@media (max-width: 760px) and (orientation: portrait) {
  .cf-osd { font-size: 56px; }
  /* la cassette agrandie (clips.js, PHONE_K) a sa place sous le lecteur : + ROOM (96 px de la photo)
     à la hauteur du panneau de photo.css ; clips.js ajoute la même chose à --reserve-bottom */
  .is-wall .panel--player:has(.has-clips) { height: calc((100vw - 60px) * (880 + 96) / 662 + 44px); }
  /* et elle rappelle qu'on peut la toucher, de temps en temps */
  .cf-out.is-on .cf-tape-img { animation: cf-call .5s .7s ease-in-out 2 alternate, cf-nudge 3.6s 3s ease-in-out infinite; }
}
@keyframes cf-nudge { 0%, 76%, 100% { translate: 0 0; } 84% { translate: 0 7px; } 92% { translate: 0 1px; } }

/* sans animation : on passe d'une face à l'autre en fondu */
@media (prefers-reduced-motion: reduce) {
  .cf-face { backface-visibility: visible; transition: opacity .3s; }
  .cf-face--tv, .cf-flip.is-tv { transform: none; }
  .cf-face--tv { opacity: 0; }
  .cf-flip.is-tv .cf-face--tv { opacity: 1; }
  .cf-flip.is-tv .cf-face--cd { opacity: 0; }
  .cf-tape, .cf-tape-img, .cf-fx::after { transition-duration: .01s; animation: none !important; }
}
