/* vhs.css — After-School Special / VHS dread. */

body.style-vhs {
  background: #000;
  color: #f4f4f4;
  --invert: #000;
}

body.style-vhs #stage {
  position: relative;
}

/* scanlines + chromatic aberration overlay */
body.style-vhs #stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.35) 3px,
    rgba(0, 0, 0, 0.35) 4px
  );
  mix-blend-mode: multiply;
  z-index: 2;
}

body.style-vhs #stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 3px
    );
  z-index: 3;
  animation: vhs-flicker 5s steps(8) infinite;
}

@keyframes vhs-flicker {
  0%, 100% { opacity: 0.85; }
  3%       { opacity: 0.45; transform: translateX(2px); }
  4%       { opacity: 0.85; transform: translateX(0); }
  47%      { opacity: 0.8; }
  48%      { opacity: 0.5; transform: translateY(-1px); }
  49%      { opacity: 0.85; transform: translateY(0); }
}

body.style-vhs .case {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  color: #f4f4f4;
}

body.style-vhs .case-header {
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

body.style-vhs .case-header-line {
  display: block;
}

body.style-vhs .case-header-line::before {
  content: "▓▒░ ";
}
body.style-vhs .case-header-line::after {
  content: " ░▒▓";
}

body.style-vhs .case-quote {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-shadow:
    -1.5px 0 rgba(255, 0, 80, 0.55),
    1.5px 0 rgba(0, 255, 255, 0.55);
  word-spacing: 0.1em;
}

/* typewriter cursor (only while typing) */
body.style-vhs .case-quote.is-typing::after {
  content: "_";
  display: inline-block;
  margin-left: 4px;
  animation: vhs-blink 700ms steps(2) infinite;
}

@keyframes vhs-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

body.style-vhs .case-submitted-label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(0.7rem, 0.95vw, 0.85rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ff3344;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  text-shadow:
    -1px 0 rgba(255, 0, 80, 0.4),
    1px 0 rgba(0, 255, 255, 0.4);
}

body.style-vhs .case-context {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-style: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 0;
}

body.style-vhs .case-annotation {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(0.8rem, 1.1vw, 0.95rem);
  letter-spacing: 0.05em;
  opacity: 0.8;
  border-top: 1px dashed rgba(255, 255, 255, 0.3);
  padding-top: 1rem;
  max-width: 50ch;
}

body.style-vhs .case-footer-text {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #ff3344;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-shadow:
    -1px 0 rgba(255, 0, 80, 0.5),
    1px 0 rgba(0, 255, 255, 0.5);
}

/* the [REC ●] chyron */
body.style-vhs .vhs-rec {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #ff3344;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.style-vhs .vhs-rec .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3344;
  box-shadow: 0 0 8px #ff3344;
  animation: vhs-rec-blink 1.4s steps(2) infinite;
}

@keyframes vhs-rec-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0.15; }
}

body.style-vhs .vhs-stamp {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #f4f4f4;
  opacity: 0.85;
  z-index: 50;
}

body.style-vhs .chrome { color: #f4f4f4; }

/* ─── small viewport adjustments ──────────────────────────── */
@media (max-width: 720px), (max-height: 600px) {
  body.style-vhs .vhs-rec,
  body.style-vhs .vhs-stamp {
    font-size: 0.65rem;
    top: 0.5rem;
  }
  body.style-vhs .vhs-rec { left: 0.5rem; }
  body.style-vhs .vhs-stamp { right: 0.5rem; }
  body.style-vhs .vhs-rec .dot { width: 7px; height: 7px; }
  body.style-vhs .case-header {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    margin-bottom: 1.25rem;
  }
  body.style-vhs .case-header-line::before,
  body.style-vhs .case-header-line::after { content: ""; }  /* drop the ▓▒░ wraps on narrow screens to save room */
  body.style-vhs .case-submitted-label {
    letter-spacing: 0.12em;
    font-size: 0.65rem;
  }
  body.style-vhs .case-annotation {
    font-size: 0.85rem;
    letter-spacing: 0;
  }
  body.style-vhs .case-footer-text {
    letter-spacing: 0.08em;
    font-size: 0.7rem;
  }
}
