/*
================================================
  Underground Noize — Backmasking Styles
  Clean, consolidated, and commented
  - Tooltip (Released/Comments) always visible
  - Dark-green frame + brighter glow on hover
  - Labels vs values separated for precise colors
================================================
*/

/* ---------------------------------------------
   Root variables (brand palette)
--------------------------------------------- */
:root {
  --neon-green: #39ff14; /* signature green */
  --neon-red: #ff003c; /* accent red (headers/buttons) */
  --dark-bg: #0a0a0a; /* page background */
  --light-gray: #aaa; /* meta/value text (Album/Song/Values) */
  --mid-gray: #444;
  --dark-gray: #222;
  --almost-black: #111;
}

/* ---------------------------------------------
   Base & Typography
--------------------------------------------- */
html {
  background: var(--dark-bg);
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  background: transparent; /* show global bg art if present */
  color: var(--neon-green);
  font-family: "IBM Plex Mono", monospace;
}

h1,
h2,
h3,
h4 {
  color: var(--neon-red);
  font-family: "Orbitron", sans-serif;
  text-align: center;
}

a {
  color: #0f0;
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--neon-red);
}

/* ---------------------------------------------
   Generic layout bits
--------------------------------------------- */
.slogan {
  margin-bottom: 2em;
  color: #888;
  font-size: 1.1em;
  text-align: center;
}

.intro-text {
  max-width: 720px;
  margin: 2em auto;
  padding: 1em;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--dark-gray);
  box-shadow: 0 0 20px rgba(255, 0, 60, 0.1);
  color: var(--light-gray);
  font-size: 1em;
  line-height: 1.6;
  text-align: center;
  backdrop-filter: blur(2px);
}

.intro-text strong {
  color: var(--neon-red);
}

.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  padding: 2em;
}

.menu a {
  padding: 1.2em 2em;
  background: var(--almost-black);
  border: 2px solid var(--mid-gray);
  box-shadow: 0 0 10px #0f0;
  font-family: "Press Start 2P", monospace;
}

.menu a:hover {
  background: var(--dark-gray);
  color: var(--neon-red);
  box-shadow: 0 0 20px var(--neon-red);
  transform: scale(1.1);
}

/* ---------------------------------------------
   Backmasking page header
--------------------------------------------- */
.glitch-header {
  margin: 2em 0;
  color: var(--neon-red);
  font-family: "Butcherman", cursive;
  text-align: center;
  text-shadow: 0 0 10px var(--neon-green);
  animation: glitchFlicker 2.5s infinite alternate;
}

.glitch-header .main-title {
  display: block;
  margin-bottom: -0.2em;
  font-size: 6em;
  letter-spacing: 0.05em;
}

.glitch-header .slogan {
  margin-top: -0.3em;
  color: #2bff00;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.2em;
  text-shadow: 0 0 2px var(--neon-red);
  animation: glitchSlogan 1.2s infinite;
}

/* ---------------------------------------------
   Backmasking cards
--------------------------------------------- */
.backmask-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;

  max-width: 880px;
  margin: 2em auto;
  padding: 1.5em;

  background-color: #050505;
  background-image: url("../gpx/textures/static-glitch-tile.png");
  background-size: 256px 256px;
  background-repeat: repeat;
  background-blend-mode: overlay;

  border: 1px solid var(--almost-black);
  border-radius: 6px;

  /* Subtle red outer / green inner to fit site vibe */
  box-shadow:
    0 0 8px #ff003c22,
    0 0 20px #39ff1422 inset;

  overflow: visible;
  backdrop-filter: blur(1px);
  transition:
    box-shadow 0.4s ease,
    transform 0.3s ease;
}

.backmask-card:hover {
  box-shadow:
    0 0 12px #ff003c44,
    0 0 30px #39ff1444 inset;
  transform: scale(1.015);
}

.backmask-card::before {
  /* faint diagonal film—keeps the card alive without busy-ness */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 0, 60, 0.02) 60%,
    rgba(0, 255, 150, 0.03) 90%
  );
  pointer-events: none;
}

/* Album art column */
.backmask-album {
  isolation: isolate; /* new stacking context to prevent bleed-through */
  position: relative;
  z-index: 2;
  width: 220px;
  flex-shrink: 0;
}

.backmask-album img {
  width: 100%;
  border: 2px solid var(--dark-gray);
  box-shadow: 0 0 10px #000;
  filter: grayscale(30%) contrast(120%);
  transition:
    filter 0.3s ease,
    transform 0.3s ease;
}

.backmask-album img:hover {
  filter: brightness(1.2) hue-rotate(15deg);
  transform: scale(1.03) rotate(-1deg);
}

/* Content column */
.backmask-content {
  flex: 1;
  z-index: 2;
  padding-left: 1.5em;
}

.backmask-content h2 {
  margin: 0 0 0.2em;
  color: var(--neon-red);
  font-size: 1.1em;
  font-weight: normal;
  text-shadow: 0 0 4px #ff003c44;
}

.backmask-content .artist {
  color: var(--neon-green);
  font-size: 1em;
  font-weight: bold;
  text-shadow: 0 0 3px #0f0;
}

.backmask-content .meta {
  margin-bottom: 0.8em;
  color: var(--light-gray); /* gray matches tooltip values */
  font-size: 0.9em;
}

.meta strong,
.lyrics strong {
  color: #00ff1a;
  font-weight: bold;
}

.backmask-content .lyrics {
  margin-top: 0.5em;
  padding: 0.8em;
  background-color: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--dark-gray);
  color: #ccc;
  font-size: 0.9em;
  line-height: 1.4;
  white-space: pre-line; /* preserve line breaks from PHP */
}

/* ---------------------------------------------
   Player & Transport
--------------------------------------------- */
.cassette-player-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1em;
  margin-top: 1em;
}

.cassette-player {
  width: 100%;
  height: 64px;
}

.backmask-audio {
  width: 100%;
  margin-top: 1em;
  background: var(--almost-black);
  border: 1px solid var(--dark-gray);
  filter: brightness(1.2) contrast(1.1);
}

.play-btn {
  padding: 0.5em 1em;
  background-color: var(--almost-black);
  border: 2px solid var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
  color: var(--neon-green);
  cursor: pointer;
  font-family: "Press Start 2P", monospace;
  font-size: 0.9em;
  text-shadow: 0 0 5px var(--neon-green);
  transition: all 0.2s ease-in-out;
}

.play-btn:hover {
  background-color: var(--dark-gray);
  color: var(--neon-red);
  box-shadow: 0 0 15px var(--neon-red);
}

.play-btn.playing {
  background-color: var(--neon-red);
  color: #000;
  box-shadow:
    0 0 8px var(--neon-red),
    0 0 15px var(--neon-red) inset;
  animation: flicker 0.12s infinite;
}

/* ---------------------------------------------
   Pagination
--------------------------------------------- */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 2em;
}

.pagination {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0.8em 1.2em;
  background: var(--almost-black);
  border: 1px solid var(--dark-gray);
  border-radius: 4px;
  box-shadow: 0 0 10px #0f08;
  transition: all 0.4s ease;
}

.pagination a {
  padding: 0.5em 0.8em;
  background: var(--dark-bg);
  border: 1px solid #333;
  color: var(--neon-green);
  font-size: 0.9em;
  text-decoration: none;
  transition: all 0.4s ease;
}

.pagination a:hover {
  background: var(--dark-gray);
  color: var(--neon-red);
  box-shadow: 0 0 8px #ff003c88;
  transform: scale(1.1);
}

.pagination a.active {
  background-color: var(--neon-red);
  color: var(--dark-bg);
  box-shadow: 0 0 15px var(--neon-red);
  font-weight: bold;
  pointer-events: none;
}

/* ---------------------------------------------
   Tooltip (Released / Comments mini-box)
   Always visible + dark green frame
   (glow intensifies on hover)
--------------------------------------------- */

/* If you wrap the box in a container, this rule no longer hides it.
   We keep it only to avoid legacy side effects. */
.album-tooltip-container {
  position: relative;
  display: inline-block;
}

/* Base tooltip: visible with muted dark-green frame */
.album-tooltip,
.album-tooltip-portal {
  text-align: left;
  background: #000 !important; /* solid black to prevent bleed */
  color: var(--neon-green);
  mix-blend-mode: normal;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 9999;

  /* IMPORTANT: visible by default */
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;

  /* Dark, muted green frame + soft inner/outer halo */
  border: 2px solid rgba(0, 80, 0, 0.8);
  box-shadow:
    0 0 6px rgba(0, 100, 0, 0.3),
    /* outer faint green */ 0 0 25px rgba(0, 50, 0, 0.4) inset,
    0 0 30px rgba(0, 0, 0, 1) !important;

  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

/* If you render a fixed “portal” version, keep it consistent */
.album-tooltip-portal {
  position: fixed !important;
  width: 260px;
  padding: 12px;
  color: var(--neon-green) !important;
}

/* Backdrop helper to harden contrast against busy art */
.album-tooltip::before {
  content: "";
  position: absolute;
  inset: -4px; /* slightly outside the tooltip silhouette */
  z-index: -1;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 6px;
  backdrop-filter: blur(3px);
}

/* Hover: only amplify the glow/border intensity */
.album-tooltip:hover,
.album-tooltip-portal:hover,
.album-tooltip-container:hover .album-tooltip {
  border-color: rgba(0, 150, 0, 0.85);
  box-shadow:
    0 0 12px rgba(0, 150, 0, 0.5),
    0 0 25px rgba(0, 255, 100, 0.3),
    0 0 40px rgba(0, 0, 0, 1) !important;
}

/* Labels and values inside the box */
.album-tooltip .label,
.album-tooltip-portal .label {
  color: var(--neon-green);
  font-weight: 700;
}

.album-tooltip .value,
.album-tooltip-portal .value {
  color: var(--light-gray); /* same gray as Album/Song meta */
}

/* ---------------------------------------------
   Utilities
--------------------------------------------- */
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.hidden {
  display: none;
}
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------------------------------------------
   Animations
--------------------------------------------- */
@keyframes glitch {
  0% {
    text-shadow:
      1px 0 red,
      -1px 0 lime;
  }
  25% {
    text-shadow:
      -1px 0 cyan,
      1px 0 magenta;
  }
  50% {
    text-shadow:
      1px 0 #00f,
      -1px 0 #f0f;
  }
  75% {
    text-shadow:
      -1px 0 red,
      1px 0 green;
  }
  100% {
    text-shadow:
      1px 0 red,
      -1px 0 lime;
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

@keyframes glitchFlicker {
  0% {
    text-shadow:
      2px 0 var(--neon-red),
      -2px 0 var(--neon-green);
    opacity: 1;
  }
  20% {
    text-shadow:
      -2px -1px var(--neon-red),
      2px 1px var(--neon-green);
  }
  40% {
    opacity: 0.9;
  }
  60% {
    text-shadow:
      2px -2px var(--neon-green),
      -1px 1px var(--neon-red);
    opacity: 0.85;
  }
  80% {
    text-shadow:
      0 0 5px var(--neon-red),
      0 0 10px var(--neon-green);
    opacity: 1;
  }
  100% {
    text-shadow:
      1px 0 var(--neon-red),
      -1px 0 var(--neon-green);
    opacity: 0.95;
  }
}

/* ---------------------------------------------
   Page scoping / responsive
--------------------------------------------- */
@media (max-width: 1024px) {
  body {
    padding-top: 240px;
  } /* adjust if header overlaps */
}

body.backmasking-page {
  display: block;
  height: auto;
}

#backmasking {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* =========================================================
   BACKMASKING flankers (creepy heads)
   - slide in on load
   - dark green glow
   - left is mirrored to face inward
   - gentle hover lean
   - responsive handling
========================================================= */

.with-flankers {
  position: relative;
  display: grid;
  grid-template-columns: minmax(80px, 210px) 1fr minmax(80px, 210px);
  align-items: center;
  gap: 12px;
  max-width: 1100px;
  margin: 2.5rem auto 1.5rem;
  padding: 0 8px;
}

.with-flankers .title-wrap {
  position: relative;
  z-index: 2;
}

/* Use a CSS variable for rotation so hover-specific rules don't fight with transform ordering.
   This avoids transform property overrides and makes rotations reliable.
*/
.flanker {
  /* Let images scale without layout jank */
  width: 100%;
  max-width: 210px;
  height: auto;
  align-self: center;
  justify-self: center;

  /* Dark, sickly green glow that fits the page */
  filter: drop-shadow(0 0 6px rgba(0, 100, 0, 0.35)) drop-shadow(0 0 16px rgba(0, 60, 0, 0.35));
  opacity: 0; /* start hidden for slide-in */

  /* rotation variable (default 0deg) */
  --flanker-rotate: 0deg;

  /* compose transforms using the rotation var so different rules can only change the variable */
  transform: translateY(6px) scale(0.98) rotate(var(--flanker-rotate));
  animation-fill-mode: forwards;
  pointer-events: auto; /* allow hover to trigger rotation reliably */

  /* Smoother transform & filter transitions for hover animations
     - longer duration and a softened curve for less jank */
  transition:
    transform 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.5s ease;
  transform-origin: center center;
  will-change: transform, filter;
  backface-visibility: hidden;
}

/* Flip the left one so it faces inward; apply rotation before scaleX so the
   mirrored element still rotates in the expected direction. */
.flanker-left {
  transform: translateX(-32px) translateY(6px) rotate(var(--flanker-rotate)) scaleX(-1) scale(0.98);
  animation: slideInLeft 900ms cubic-bezier(0.22, 0.9, 0.24, 1.08) 150ms forwards;
}

/* Right one enters from the right – apply rotate before scale so rotation is consistent */
.flanker-right {
  transform: translateX(32px) translateY(6px) rotate(var(--flanker-rotate)) scale(0.98);
  animation: slideInRight 900ms cubic-bezier(0.22, 0.9, 0.24, 1.08) 250ms forwards;
}

/* Keep the gentle hover lean (small resting angle) */
.with-flankers:hover .flanker-left {
  filter: drop-shadow(0 0 10px rgba(0, 170, 0, 0.5)) drop-shadow(0 0 24px rgba(0, 110, 0, 0.45));
  transform: translateX(-20px) translateY(4px) rotate(var(--flanker-rotate)) scaleX(-1) scale(1);
  --flanker-rotate: -2deg;
}
.with-flankers:hover .flanker-right {
  filter: drop-shadow(0 0 10px rgba(0, 170, 0, 0.5)) drop-shadow(0 0 24px rgba(0, 110, 0, 0.45));
  transform: translateX(20px) translateY(4px) rotate(var(--flanker-rotate)) scale(1);
  --flanker-rotate: 2deg;
}

/* Strong hover rotations — swapped so each head turns the visually-correct way.
   Left: 45deg (clockwise when mirrored), Right: -45deg (counter-clockwise).
*/
.with-flankers:hover .flanker-left:hover,
.flanker-left:hover {
  --flanker-rotate: 45deg; /* swapped: left now 45deg */
  filter: drop-shadow(0 0 14px rgba(0, 200, 0, 0.6)) drop-shadow(0 0 34px rgba(0, 120, 0, 0.55));
  pointer-events: auto;
}

.with-flankers:hover .flanker-right:hover,
.flanker-right:hover {
  --flanker-rotate: -45deg; /* swapped: right now -45deg */
  filter: drop-shadow(0 0 14px rgba(0, 200, 0, 0.6)) drop-shadow(0 0 34px rgba(0, 120, 0, 0.55));
  pointer-events: auto;
}

/* Update keyframes so rotate() appears before scaleX/scale in the animated transform
   so the rotation var is respected during and after the animation. */
@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-38px) translateY(10px) rotate(var(--flanker-rotate)) scaleX(-1)
      scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateX(6px) translateY(0) rotate(var(--flanker-rotate)) scaleX(-1) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(-32px) translateY(6px) rotate(var(--flanker-rotate)) scaleX(-1)
      scale(0.98);
  }
}
@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(38px) translateY(10px) rotate(var(--flanker-rotate)) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateX(-6px) translateY(0) rotate(var(--flanker-rotate)) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(32px) translateY(6px) rotate(var(--flanker-rotate)) scale(0.98);
  }
}

/* ===== Backmasking page navbar color overrides ===== */

/* 1) Make sure the hover variable exists (use site red) */
:root {
  --navbar-hover: var(--neon-red);
}

/* 2) Base link color: neon green (covers normal + visited) */
body.backmasking-page .navbar a,
body.backmasking-page .navbar a:visited {
  color: var(--neon-green) !important;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.4);
}

/* 3) Hover to red (parent dropdown link + any nav link) */
body.backmasking-page .navbar a:hover,
body.backmasking-page .dropdown:hover > a {
  color: var(--navbar-hover) !important; /* red */
  text-shadow:
    0 0 8px rgba(255, 0, 60, 0.7),
    0 0 20px rgba(255, 0, 60, 0.4);
  transform: scale(1.1);
}

/* 4) Active/click: red */
body.backmasking-page .navbar a:active {
  color: var(--neon-red) !important;
}

/* 5) Dropdown links: green by default */
body.backmasking-page .dropdown-content a,
body.backmasking-page .dropdown-content a:visited {
  color: var(--neon-green) !important;
}

/* 6) Dropdown links on hover: red, slight dark bg */
body.backmasking-page .dropdown-content a:hover,
body.backmasking-page .dropdown-content a:focus {
  color: var(--neon-red) !important;
  background-color: rgba(25, 25, 25, 0.85);
  text-shadow:
    0 0 8px rgba(255, 0, 60, 0.7),
    0 0 20px rgba(255, 0, 60, 0.4);
}

/* 7) Keep your accessibility outline */
body.backmasking-page .navbar a:focus,
body.backmasking-page .dropdown-content a:focus {
  outline: 2px solid var(--neon-green);
  outline-offset: 2px;
}
