/* ═══════════════════════════════════════════════════
   CICADA 33 — INTRO LAYER
   Remove <link href="intro.css">, <script src="intro.js">,
   and #cicada-intro from index.html to disable entirely.
   ═══════════════════════════════════════════════════ */

#cicada-intro {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: #000;
  overflow: hidden;
  touch-action: none;
}

/* ── Canvases ──────────────────────────────────── */
#ci-noise,
#ci-reveal-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#ci-noise         { z-index: 1; }
#ci-spirits       {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  mix-blend-mode: screen;
  pointer-events: none;
  transition: opacity 1.2s;
}
#ci-reveal-canvas { z-index: 3; opacity: 0; }

/* ── Title ─────────────────────────────────────── */
#ci-title {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.ci-33 {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: clamp(110px, 30vw, 260px);
  line-height: 0.9;
  letter-spacing: -.02em;
  color: #f3f1ec;
  user-select: none;
}

.ci-cicada {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: clamp(13px, 3.6vw, 32px);
  letter-spacing: 0.52em;
  color: #c8ff2e;
  text-transform: uppercase;
  margin-top: 10px;
  user-select: none;
}

/* ── Tagline ────────────────────────────────────── */
#ci-tagline {
  position: absolute;
  top: 14%;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  opacity: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(13px, 3.6vw, 20px);
  letter-spacing: 0.12em;
  color: #f3f1ec;
  padding: 0 24px;
  pointer-events: none;
  min-height: 1.4em;
}

/* ── WHO ARE YOU + Swarm ───────────────────────── */
#ci-question {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
}

#ci-question.active {
  pointer-events: auto;
}

.ci-who {
  position: absolute;
  top: 55%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  font-size: clamp(13px, 3.6vw, 20px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3f1ec;
  line-height: 1.9;
  user-select: none;
  pointer-events: none;
}

/* Prevent dynamically-created child spans from capturing pointer events */
.ci-who span, .ci-who br {
  pointer-events: none;
}

#ci-swarm {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Decode strip ───────────────────────────────── */
#ci-decode {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 110px;
  z-index: 7;
  opacity: 0;
}

#ci-decode-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: col-resize;
}

.ci-drag-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.5em;
  color: #7d7a72;
  opacity: 0.3;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Touch prompt ───────────────────────────────── */
#ci-tap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.42em;
  color: #7d7a72;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s;
  white-space: nowrap;
  user-select: none;
}

#ci-tap.show {
  opacity: 1;
  animation: ci-tap-pulse 2.2s ease-in-out infinite;
}

#ci-tap.hide {
  opacity: 0 !important;
  animation: none;
  transition: opacity 0.25s;
}

@keyframes ci-tap-pulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  #ci-tap.show { animation: none; opacity: 0.55; }
}

/* ── Sound toggle ───────────────────────────────── */
#ci-snd {
  position: absolute;
  bottom: 22px;
  left: 22px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(125,122,114,0.35);
  background: transparent;
  color: #7d7a72;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.5s, color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

#ci-snd.show { opacity: 1; }
#ci-snd.on   { color: #c8ff2e; border-color: rgba(200,255,46,0.55); }

/* ── Skip button ────────────────────────────────── */
#ci-skip {
  position: absolute;
  bottom: 22px;
  right: 22px;
  z-index: 10;
  background: none;
  border: none;
  color: #7d7a72;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.5s, color 0.2s;
  padding: 10px 4px;
  -webkit-tap-highlight-color: transparent;
}

#ci-skip.show { opacity: 1; }

#ci-skip:hover,
#ci-skip:focus {
  color: #f3f1ec;
  outline: none;
}

/* ── Warp exit ──────────────────────────────────── */
@keyframes ci-warp-out {
  0%   { opacity: 1; transform: scale(1);    filter: brightness(1); }
  38%  { opacity: 1; transform: scale(1.03); filter: brightness(2.8); }
  100% { opacity: 0; transform: scale(0.96); filter: brightness(0); }
}

#cicada-intro.warping {
  animation: ci-warp-out 0.85s ease-in forwards;
  pointer-events: none;
}

/* ── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #cicada-intro.warping {
    animation: none;
    opacity: 0;
    transition: opacity 0.3s;
  }
}
