/* ═══════════════════════════════════════════════════════════════
   EXPANDZA — INTRO / BOOT SEQUENCE OVERLAY
   Three-beat reveal: terminal → lock-on → curtain pull.
═══════════════════════════════════════════════════════════════ */

#intro-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #050505;
  color: var(--cream);
  font-family: var(--font-display);
  display: flex; flex-direction: column;
  pointer-events: all;
  overflow: hidden;
}
#intro-overlay.intro-done {
  pointer-events: none;
}

/* hide page underneath while intro runs */
html.intro-active body { overflow: hidden; }
html.intro-active #navbar,
html.intro-active section,
html.intro-active footer,
html.intro-active .marquee-section { 
  opacity: 0;
}
html.intro-revealing #navbar,
html.intro-revealing section,
html.intro-revealing footer,
html.intro-revealing .marquee-section {
  opacity: 1;
  transition: opacity 0.6s var(--ease);
}

/* scanning grid bg */
.intro-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(126,255,197,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126,255,197,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 90%);
  pointer-events: none;
  opacity: 0;
  animation: introGridIn 0.6s var(--ease) 0.1s forwards;
}
@keyframes introGridIn { to { opacity: 1; } }

.intro-glow {
  position: absolute;
  width: 600px; height: 600px;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(126,255,197,0.08), transparent 60%);
  pointer-events: none;
  opacity: 0;
  animation: introGlowPulse 3s ease-in-out infinite, introGridIn 0.8s var(--ease) 0.3s forwards;
}
@keyframes introGlowPulse {
  0%, 100% { transform: translate(-50%,-50%) scale(1); }
  50% { transform: translate(-50%,-50%) scale(1.15); }
}

/* HEADER STRIP */
.intro-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px;
  font-size: 0.66rem; letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid rgba(126,255,197,0.08);
  position: relative; z-index: 2;
  opacity: 0; animation: introFadeIn 0.4s var(--ease) 0.05s forwards;
}
.intro-header .left, .intro-header .right { display: flex; gap: 16px; align-items: center; }
.intro-header .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1.4s ease-in-out infinite;
}
.intro-header .skip {
  background: transparent; border: 1px solid rgba(126,255,197,0.25);
  color: var(--accent);
  padding: 6px 12px; border-radius: 2px;
  font-family: var(--font-display); font-size: 0.66rem;
  letter-spacing: 0.06em; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.intro-header .skip:hover { background: rgba(126,255,197,0.1); border-color: var(--accent); }
.intro-header .skip kbd {
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-2);
  padding: 1px 5px; border-radius: 2px; margin-left: 6px; font-size: 0.6rem;
}

/* MAIN STAGE */
.intro-stage {
  flex: 1;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  position: relative; z-index: 2;
}
.intro-pane {
  padding: 40px 48px;
  display: flex; flex-direction: column;
  position: relative;
}
.intro-pane.left {
  border-right: 1px solid rgba(126,255,197,0.08);
}
.intro-pane-label {
  font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 24px;
}
.intro-pane-label::before { content: '// '; color: var(--accent); }

/* TERMINAL STREAM (left pane) */
.intro-terminal {
  font-size: 0.78rem; line-height: 1.85;
  flex: 1;
  overflow: hidden;
}
.intro-terminal .line {
  opacity: 0;
  animation: introLineIn 0.2s var(--ease) forwards;
  display: flex; gap: 10px; align-items: baseline;
}
.intro-terminal .line .ts { color: var(--muted-2); flex-shrink: 0; font-size: 0.7rem; }
.intro-terminal .line .body { color: var(--cream); }
.intro-terminal .line .body .ok { color: var(--accent); }
.intro-terminal .line .body .warn { color: var(--peach); }
.intro-terminal .line .body .info { color: var(--lavender); }
.intro-terminal .line .body .accent { color: var(--accent); }
.intro-terminal .line .body .dim { color: var(--muted); }
@keyframes introLineIn { to { opacity: 1; } }

/* LOCK-ON / DIAGRAM (right pane) */
.intro-target {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
}
.intro-target .crosshair {
  position: relative;
  width: 280px; height: 280px;
}
.intro-target .crosshair::before,
.intro-target .crosshair::after {
  content: ''; position: absolute;
  background: var(--accent);
}
/* corner brackets */
.intro-target .corner {
  position: absolute; width: 24px; height: 24px;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: introCornerIn 0.4s var(--ease) forwards;
}
.intro-target .corner.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; animation-delay: 0.6s; }
.intro-target .corner.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; animation-delay: 0.7s; }
.intro-target .corner.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; animation-delay: 0.8s; }
.intro-target .corner.br { bottom: 0; right: 0; border-left: 0; border-top: 0; animation-delay: 0.9s; }
@keyframes introCornerIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* logo center mark */
.intro-target .mark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; letter-spacing: -0.04em;
  color: var(--cream);
  opacity: 0;
  animation: introMarkIn 0.5s var(--ease) 1s forwards;
}
.intro-target .mark .b { color: var(--accent); font-weight: 300; margin: 0 2px; }
.intro-target .mark .cursor {
  display: inline-block; width: 8px; height: 1em;
  background: var(--accent); margin-left: 4px;
  animation: blink 0.9s step-end infinite;
}
@keyframes introMarkIn { from { opacity: 0; transform: scale(1.2); } to { opacity: 1; transform: scale(1); } }

/* horizontal scanline */
.intro-target .scan {
  position: absolute; left: -10%; right: -10%;
  height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
  top: 0;
  opacity: 0;
  animation: introScanRun 1.6s var(--ease) 0.4s forwards;
  box-shadow: 0 0 8px var(--accent);
}
@keyframes introScanRun {
  0% { top: 0; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* radar pulse */
.intro-target .pulse-ring {
  position: absolute; inset: 50% 50% 50% 50%;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: introPulseRing 2s ease-out 1.2s infinite;
}
@keyframes introPulseRing {
  0% { inset: 50% 50% 50% 50%; opacity: 0.6; }
  100% { inset: -10% -10% -10% -10%; opacity: 0; }
}

/* meta lines around the lock */
.intro-target .meta-row {
  margin-top: 28px;
  display: flex; gap: 18px;
  font-size: 0.66rem; color: var(--muted);
  opacity: 0;
  animation: introFadeIn 0.5s var(--ease) 1.4s forwards;
}
.intro-target .meta-row .v { color: var(--accent); }
@keyframes introFadeIn { to { opacity: 1; } }

/* PROGRESS RAIL — bottom */
.intro-progress {
  border-top: 1px solid rgba(126,255,197,0.08);
  padding: 18px 28px;
  display: flex; align-items: center; gap: 20px;
  font-size: 0.66rem; letter-spacing: 0.06em; color: var(--muted);
  position: relative; z-index: 2;
}
.intro-progress .bar {
  flex: 1; height: 2px; background: rgba(255,255,255,0.05); border-radius: 1px;
  overflow: hidden; position: relative;
}
.intro-progress .bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--lavender));
  width: 0;
  animation: introProgress var(--intro-duration, 4.2s) linear forwards;
  box-shadow: 0 0 8px rgba(126,255,197,0.4);
}
@keyframes introProgress { to { width: 100%; } }
.intro-progress .pct { color: var(--accent); min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.intro-progress .label { color: var(--muted); }

/* CURTAIN PULL — final reveal */
#intro-overlay.intro-curtain {
  animation: introCurtain 0.85s cubic-bezier(0.86, 0, 0.07, 1) forwards;
}
@keyframes introCurtain {
  0%   { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 100% 0); }
}

/* Hero entrance lift — runs after curtain */
html.intro-revealing .hero-headline,
html.intro-revealing .hero-meta,
html.intro-revealing .hero-bottom {
  animation-play-state: running;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .intro-stage { grid-template-columns: 1fr; }
  .intro-pane.left { border-right: 0; border-bottom: 1px solid rgba(126,255,197,0.08); padding: 24px; }
  .intro-pane.right { padding: 24px; min-height: 240px; }
  .intro-target .crosshair { width: 200px; height: 200px; }
  .intro-target .mark { font-size: 1.3rem; }
  .intro-header { padding: 14px 20px; font-size: 0.6rem; }
  .intro-header .left span:nth-child(3) { display: none; }
  .intro-progress { padding: 14px 20px; font-size: 0.6rem; }
}

/* Reduced motion → snap-cut */
@media (prefers-reduced-motion: reduce) {
  #intro-overlay { animation: none !important; }
  .intro-terminal .line { animation: none !important; opacity: 1; }
  .intro-target .corner, .intro-target .mark, .intro-target .scan,
  .intro-target .pulse-ring, .intro-target .meta-row,
  .intro-grid, .intro-glow, .intro-header, .intro-progress {
    animation: none !important; opacity: 1;
  }
  .intro-progress .bar > i { width: 100%; animation: none; }
}
