/* ============================================================
   VHS SCREEN EFFECTS — compiled from SCSS
   Scoped to .screen-container so nothing bleeds outside
   the video layer.
   ============================================================ */

/* dat.GUI panel stays on top */
.dg.ac {
  z-index: 10001 !important;
}

/* ---- container wrapping injected by ScreenEffect.render() ---- */
/* Full viewport — the TV frame (frame-cutout.png) at z-999 sits on top
   and naturally masks VHS effects outside the transparent screen hole. */

.screen-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.screen-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ---- #screen (the video wrapper div) ---- */
/* TEST ONLY — remove background-image when real video src is set */
#screen {
  width: 100%;
  height: 100%;
  background-image: url("test-bg.png");
  background-size: cover;
  background-position: center;
  position: relative;
}

/* ---- canvas elements injected by ScreenEffect ---- */

.screen-container canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9998;
  width: 100%;
  height: 100%;
}

.screen-container canvas.snow {
  background-color: #aaa;
  opacity: 0.2;
}

/* ---- effect nodes ---- */

.vcr {
  opacity: 0.6;
}

.video {
  filter: blur(1px);
  width: 100%;
  height: 100%;
}

.image {
  width: 100%;
  height: auto;
  filter: blur(1.2px);
}

/* fill mixin expanded inline */
.vignette {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/86186/crt.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: 10000;
}

/* scanlines — $screen-background: #121010
   transparentize(#121010, 1)               → rgba(18,16,16,0)
   transparentize(darken(#121010,10), 0.75) → rgba(0,0,0,0.25)
   transparentize(#ff0000, 0.94)            → rgba(255,0,0,0.06)
   transparentize(#00ff00, 0.98)            → rgba(0,255,0,0.02)
   transparentize(#0000ff, 0.94)            → rgba(0,0,255,0.06)  */
.scanlines {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9999;
  background:
    linear-gradient(
      rgba(18, 16, 16, 0) 50%,
      rgba(0, 0, 0, 0.25) 50%
    ),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
}

/* ---- wobble animations ---- */

.wobblex {
  animation: wobblex 100ms infinite;
}

.wobbley {
  animation: wobbley 100ms infinite;
}

@keyframes wobblex {
  50%  { transform: translateX(1px); }
  51%  { transform: translateX(0); }
}

@keyframes wobbley {
  0%   { transform: translateY(1px); }
  100% { transform: translateY(0); }
}

/* ---- glitch animation ---- */

.glitch {
  animation: 5s ease 2000ms normal none infinite running glitch;
}

@keyframes glitch {
  30% {}
  40% {
    opacity: 1;
    transform: skew(0, 0) scale(1, 1);
  }
  41% {
    opacity: 0.8;
    transform: skew(80deg, 0) scale(1, 1.2);
  }
  42% {
    opacity: 0.8;
    transform: skew(-50deg, 0) scale(1, 1.2);
  }
  43% {
    opacity: 1;
    transform: skew(0, 0) scale(1, 1);
  }
  65% {}
}

@keyframes glitch1 {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(0); }
  31%  { transform: translateX(10px); }
  32%  { transform: translateX(0); }
  98%  { transform: translateX(0); }
  100% { transform: translateX(10px); }
}

.text span:nth-child(2) {
  animation: glitch2 1s infinite;
}

@keyframes glitch2 {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(0); }
  31%  { transform: translateX(-10px); }
  32%  { transform: translateX(0); }
  98%  { transform: translateX(0); }
  100% { transform: translateX(-10px); }
}

.overlay .text {
  animation: 5s ease 2000ms normal none infinite running glitch;
}

/* ---- TV on/off animations ---- */

.on > .screen-wrapper {
  animation: 3000ms linear 0ms normal forwards 1 running on;
}

.off > .screen-wrapper {
  animation: 750ms cubic-bezier(0.230, 1.000, 0.320, 1.000) 0ms normal forwards 1 running off;
}

@keyframes on {
  0% {
    transform: scale(1, 0.8) translate3d(0, 0, 0);
    filter: brightness(4);
    opacity: 1;
  }
  3.5% {
    transform: scale(1, 0.8) translate3d(0, 100%, 0);
  }
  3.6% {
    transform: scale(1, 0.8) translate3d(0, -100%, 0);
    opacity: 1;
  }
  9% {
    transform: scale(1.3, 0.6) translate3d(0, 100%, 0);
    filter: brightness(4);
    opacity: 0;
  }
  11% {
    transform: scale(1, 1) translate3d(0, 0, 0);
    filter: contrast(0) brightness(0);
    opacity: 0;
  }
  100% {
    transform: scale(1, 1) translate3d(0, 0, 0);
    filter: contrast(1) brightness(1.2) saturate(1.3);
    opacity: 1;
  }
}

@keyframes off {
  0%   { transform: scale(1, 1);        filter: brightness(1); }
  40%  { transform: scale(1, 0.005);    filter: brightness(100); }
  70%  { transform: scale(1, 0.005); }
  90%  { transform: scale(0.005, 0.005); }
  100% { transform: scale(0, 0); }
}

/* ---- roll animation ---- */

.roller {
  position: relative;
  animation: 2000ms linear 0ms forwards infinite roll;
}

@keyframes roll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -50%, 0); }
}
