/* ---------------------------------------------------------
   BASE
--------------------------------------------------------- */

body {
  margin: 0;
  background: #02030a;
  color: white;
  font-family: Inter, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

/* Global pulse timing (randomized by JS) */
:root {
  --pulse-speed: 3.6s;
}

/* ---------------------------------------------------------
   HERO STRUCTURE
--------------------------------------------------------- */

.hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

/* Parallax layers */
.hero-parallax,
.hero-layer {
  position: absolute;
  inset: 0;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* BACK LAYER */
.layer-back {
  background: url('../img/layer_back.png') center/cover no-repeat;
  animation: envPulse var(--pulse-speed) ease-in-out infinite paused;
}

/* MID LAYER (main breathing layer) */
.hero-layer.layer-mid {
  opacity: 0.42;
  background: url('../img/layer_mid.png') center/contain no-repeat;
  filter:
    brightness(1.25)
    blur(2.6px)
    drop-shadow(0 0 12px rgba(150, 220, 255, 0.25));
  animation:
    beamPulseSoft var(--pulse-speed) ease-in-out infinite paused,
    envPulse       var(--pulse-speed) ease-in-out infinite paused;
}

/* FRONT LAYER */
.layer-front {
  background: url('../img/layer_front.png') center/cover no-repeat;
  opacity: 0.4;
  animation: envPulse var(--pulse-speed) ease-in-out infinite paused;
}

/* Center content */
.hero-inner {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Overlay gradients */
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(to bottom, rgba(0,0,0,0.15), rgba(0,0,0,0.35));
  pointer-events: none !important;
}

/* Disable hero layer pointer capture */
.hero-bg,
.hero-mask,
.hero-image,
.parallax,
.parallax-layer {
  pointer-events: none !important;
}

/* ---------------------------------------------------------
   PULSE STATE CLASSES
--------------------------------------------------------- */

/* When the site is breathing */
.pulse-active .hero-layer {
  animation-play-state: running;
}

/* Fade 300ms before pausing */
.fade-pausing .hero-layer.layer-mid {
  opacity: 0.32;
}

/* Fully paused state */
.pulse-paused .hero-layer.layer-mid {
  animation-play-state: paused;
  opacity: 0.38;
}

/* Fade-in when resuming */
.pulse-resuming .hero-layer.layer-mid {
  opacity: 0.46;
}

/* ---------------------------------------------------------
   KEYFRAMES
--------------------------------------------------------- */

@keyframes envPulse {
  0%,100% { filter: brightness(1) contrast(1.02); }
  50%     { filter: brightness(1.22) contrast(1.08); }
}

@keyframes beamPulse {
  0%,100% {
    opacity: .55;
    filter: brightness(1.4) drop-shadow(0 0 14px rgba(120,200,255,.4));
  }
  50% {
    opacity: .75;
    filter: brightness(1.9) drop-shadow(0 0 26px rgba(150,220,255,.9));
  }
}

@keyframes glyphPulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.08); }
}

@keyframes beamPulseSoft {
  0%, 100% {
    opacity: 0.38;
    filter:
      brightness(1.15)
      blur(2.8px)
      drop-shadow(0 0 10px rgba(150, 220, 255, 0.22));
  }
  50% {
    opacity: 0.50;
    filter:
      brightness(1.35)
      blur(3.4px)
      drop-shadow(0 0 14px rgba(150, 220, 255, 0.33));
  }
}

/* ---------------------------------------------------------
   BOTTOM INFO PANEL
--------------------------------------------------------- */

.hero-bottom-info {
  position: absolute;
  right: 2.5rem;
  bottom: 2.5rem;
  z-index: 12;
  text-align: right;
  max-width: 380px;
  animation: envPulse var(--pulse-speed) ease-in-out infinite paused;
}

.hero-bottom-info .desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(240, 245, 255, 0.82);
  margin: 0 0 0.75rem 0;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.55);
}

.hero-bottom-info .copy {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: rgba(200, 210, 230, 0.55);
  margin: 0;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.55);
}

/* ---------------------------------------------------------
   LORE GLYPHS (BOTTOM)
--------------------------------------------------------- */

.encoded-lore-line {
  position: absolute;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  max-width: 82vw;
  opacity: 0.78;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: linear-gradient(
    rgba(0,0,0,0.35),
    rgba(0,0,0,0.25)
  );
  animation: envPulse var(--pulse-speed) ease-in-out infinite paused;
}

.g {
  height: 22px;
  width: auto;
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.55))
          drop-shadow(0 0 6px rgba(255,255,255,0.25));
  mix-blend-mode: screen;
}

.hero-glyph {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  left: auto !important;
  transform: none !important;
  z-index: 50; /* above background, below click glyphs */
  pointer-events: none;
}

/* ---------------------------------------------------------
   MOBILE
--------------------------------------------------------- */

@media (max-width: 768px) {
    .hero-glyph {
    top: 1.2rem;
    right: 10.2rem;
    width: 22px;    /* scale down slightly */
    opacity: 0.85; /* soft, unobtrusive */
  }
  .parallax-container {
    background-attachment: scroll !important;
    transform: none !important;
    perspective: none !important;
  }
  .hero-content {
    position: relative;
    z-index: 10 !important;
  }
  .parallax-layer {
    position: absolute;
    z-index: 0 !important;
    opacity: 0.2;
  }
  .rd-glyph-cluster {
    position: absolute !important;
    top: 35% !important;
    left: 1.2rem !important;
    transform: translateY(-50%) !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 1.1rem !important;

    width: auto !important;
    height: auto !important;
  }

  .rd-glyph-cluster .rd-g {
    width: 34px;
  }
  
  /* Push encoded line down */
  .encoded-lore-line {
    position: static !important;
    margin-top: 2rem;
    margin-bottom: 1rem;
    transform: none !important;
    width: 100% !important;
    justify-content: center;
  }

  /* Push bottom-right info below the hero */
  .hero-bottom-info {
    position: static !important;
    text-align: center !important;
    margin: 1.5rem auto 0 auto;
    max-width: 90%;
    transform: none !important;
  }

  /* Add spacing under the hero */
  .hero {
    padding-bottom: 4rem !important;
  }
}

@media (max-width: 420px) {
  .rd-glyph-cluster .rd-g {
    width: 30px;
  }
}


/* ---------------------------------------------------------
   SIGNAL GLYPH CLUSTER (TOP EASTER EGG)
--------------------------------------------------------- */

.rd-glyph-cluster {
  position: absolute;
  top: 18vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.2rem;
  opacity: 0.85;
  z-index: 9999;
  pointer-events: auto;
}

.rd-glyph-cluster .rd-g {
  width: 62px;
  cursor: pointer;
  transition: transform 0.28s ease, filter 0.28s ease;
  filter:
    drop-shadow(0 0 4px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 10px rgba(20, 20, 40, 0.35));
}

.rd-glyph-cluster .rd-g:hover {
  transform: translateY(-2px) scale(1.03);
  filter:
    drop-shadow(0 0 6px rgba(255,255,255,0.75))   /* inner soft glow */
    drop-shadow(0 0 28px rgba(150,200,255,0.35)); /* ambient outer halo */
}

.rd-g.disabled {
  pointer-events: none;
  opacity: 0.35;
  filter: grayscale(1) blur(1px);
}

.rd-g.locked {
  transform: translateY(-3px) scale(1.12);

  /* The glyph becomes bright white */
  filter:
    brightness(2.3)
    drop-shadow(0 0 6px rgba(255,255,255,0.75))   /* inner soft glow */
    drop-shadow(0 0 14px rgba(200,220,255,0.55))  /* mid halo */
    drop-shadow(0 0 28px rgba(150,200,255,0.35)); /* ambient outer halo */

  opacity: 1;
  transition: transform 0.25s ease, filter 0.25s ease;
  animation: lockedPulse 2.6s ease-in-out infinite;
  pointer-events: none;  /* prevent further clicking */
}

.rd-g.locked.freeze {
  animation: none !important;
  filter:
    brightness(2.8)
    drop-shadow(0 0 10px rgba(255,255,255,0.75))
    drop-shadow(0 0 20px rgba(200,220,255,0.55))
    drop-shadow(0 0 34px rgba(140,180,255,0.35));
}


.rd-g.ctrl.active {
  opacity: 1;
  animation: glyphPulseCosmic 2.8s ease-in-out infinite;
}

@keyframes glyphPulseCosmic {
  0% {
    /* BLUE glow */
    filter:
      brightness(2.4)
      drop-shadow(0 0 10px rgba(130,180,255,0.75))
      drop-shadow(0 0 22px rgba(100,160,255,0.55))
      drop-shadow(0 0 40px rgba(80,130,255,0.35));
  }

  25% {
    /* WHITE ignition peak */
    filter:
      brightness(3.2)
      drop-shadow(0 0 14px rgba(255,255,255,0.9))
      drop-shadow(0 0 30px rgba(255,255,255,0.6))
      drop-shadow(0 0 50px rgba(255,255,255,0.35));
  }

  50% {
    /* ORANGE glow */
    filter:
      brightness(2.8)
      drop-shadow(0 0 12px rgba(255,160,80,0.75))
      drop-shadow(0 0 28px rgba(255,130,50,0.55))
      drop-shadow(0 0 46px rgba(255,100,30,0.35));
  }

  75% {
    /* WHITE again before cooling */
    filter:
      brightness(3.0)
      drop-shadow(0 0 14px rgba(255,255,255,0.85))
      drop-shadow(0 0 30px rgba(255,255,255,0.55))
      drop-shadow(0 0 46px rgba(255,255,255,0.35));
  }

  100% {
    /* Back to BLUE glow */
    filter:
      brightness(2.4)
      drop-shadow(0 0 10px rgba(130,180,255,0.75))
      drop-shadow(0 0 22px rgba(100,160,255,0.55))
      drop-shadow(0 0 40px rgba(80,130,255,0.35));
  }
}

@keyframes glyphPulseColor {
  0% {
    filter:
      brightness(2.2)
      drop-shadow(0 0 6px rgba(120,200,255,0.55))
      drop-shadow(0 0 14px rgba(80,180,255,0.4));
  }
  50% {
    filter:
      brightness(2.8)
      drop-shadow(0 0 10px rgba(255,255,255,0.8))
      drop-shadow(0 0 24px rgba(200,230,255,0.55))
      drop-shadow(0 0 40px rgba(150,200,255,0.4));
  }
  100% {
    filter:
      brightness(2.2)
      drop-shadow(0 0 6px rgba(120,200,255,0.55))
      drop-shadow(0 0 14px rgba(80,180,255,0.4));
  }
}

@keyframes ctrlPulse {
  0%, 100% {
    transform: scale(1.08);
    filter:
      saturate(2.5)
      hue-rotate(45deg)
      brightness(1.8)
      drop-shadow(0 0 6px rgba(255,255,255,0.6))
      drop-shadow(0 0 14px rgba(160,220,255,0.45));
  }
  50% {
    transform: scale(1.24);
    filter:
      saturate(2.5)
      hue-rotate(45deg)
      brightness(2.2)
      drop-shadow(0 0 12px rgba(255,255,255,0.85))
      drop-shadow(0 0 26px rgba(180,240,255,0.55));
  }
}


@keyframes lockedPulse {
  0%, 100% {
    filter:
      brightness(2.25)
      drop-shadow(0 0 6px rgba(255,255,255,0.75))
      drop-shadow(0 0 14px rgba(200,220,255,0.55))
      drop-shadow(0 0 28px rgba(150,200,255,0.35));
  }
  50% {
    filter:
      brightness(2.65)
      drop-shadow(0 0 12px rgba(255,255,255,0.85))
      drop-shadow(0 0 24px rgba(220,240,255,0.65))
      drop-shadow(0 0 36px rgba(160,220,255,0.45));
  }
}


