/* ===================== DESIGN TOKENS ===================== */
:root {
  --bg-base:     #070b12;
  --bg-surface:  rgba(13, 17, 23, 0.45);
  --bg-raised:   rgba(22, 27, 34, 0.65);
  --bg-overlay:  rgba(28, 35, 51, 0.7);
  --accent:      #39d353;
  --accent-dim:  #1a6b2a;
  --accent-glow: rgba(57, 211, 83, 0.15);
  --accent-glow-strong: rgba(57, 211, 83, 0.35);
  --cyan:        #58a6ff;
  --purple:      #bc8cff;
  --text-1:      #e6edf3;
  --text-2:      #8b949e;
  --text-3:      #484f58;
  --border:      rgba(33, 38, 45, 0.45);
  --border-glow: rgba(57, 211, 83, 0.25);
  --mono:        'JetBrains Mono', 'Fira Code', monospace;
  --sans:        'Inter', sans-serif;
  --radius:      8px;
  --radius-lg:   14px;
}

/* ===================== RESET & SYSTEM ===================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--sans);
  background: var(--bg-base);
  color: var(--text-1);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Background grid overlay */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(57, 211, 83, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 211, 83, 0.015) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: 1;
  pointer-events: none;
}

/* Full-bleed Canvas */
#intro-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: crosshair;
}

/* Centered content layer */
.intro-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 2rem;
  pointer-events: none; /* Let clicks pass through to canvas when clicking outside terminal */
}

/* ===================== INTRO TERMINAL ===================== */
.intro-terminal {
  width: 100%;
  max-width: 580px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 80px rgba(7, 11, 18, 0.8), 0 0 40px rgba(57, 211, 83, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s ease, border-color 0.6s ease;
}

.intro-terminal.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Highlighted state when denoised */
.intro-terminal.denoised {
  border-color: var(--accent-glow-strong);
  box-shadow: 
    0 20px 80px rgba(7, 11, 18, 0.8), 
    0 0 50px var(--accent-glow),
    inset 0 0 15px rgba(57, 211, 83, 0.05);
}

/* Terminal Titlebar */
.terminal-header {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  background: rgba(13, 17, 23, 0.8);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.terminal-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
  margin: 0 auto;
  letter-spacing: 0.5px;
}

/* Terminal Body and Logs */
.terminal-body {
  padding: 2.2rem 2.5rem;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.log-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.log-line {
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--text-2);
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(4px);
  animation: logReveal 0.25s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes logReveal {
  to {
    opacity: 1;
    transform: none;
  }
}

.log-prefix {
  font-weight: 700;
  margin-right: 8px;
  min-width: 90px;
  display: inline-block;
}

.log-prefix.sys { color: var(--cyan); }
.log-prefix.probe { color: var(--purple); }
.log-prefix.model { color: var(--yellow); }
.log-prefix.signal { color: var(--accent); }

.log-content {
  color: var(--text-1);
}

.log-value {
  color: var(--accent);
  font-weight: 500;
}

/* Dynamic Interactive Prompts */
.terminal-action {
  margin-top: 2rem;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.action-prompt-sym {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  margin-right: 8px;
  font-size: 0.9rem;
}

.action-cmd {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text-1);
}

.cursor-blink {
  color: var(--accent);
  font-family: var(--mono);
  animation: cursorBlink 1.1s step-end infinite;
  display: inline-block;
  margin-left: 2px;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

/* Clickable Transition Button */
.btn-enter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 20px var(--accent-glow);
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: btnReveal 0.6s 0.2s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes btnReveal {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.btn-enter:hover {
  background: var(--accent);
  color: var(--bg-base);
  box-shadow: 0 0 35px var(--accent-glow-strong);
  transform: translateY(-2px);
}

/* ===================== PAGE FADE TRANSITION ===================== */
#page-fade-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#page-fade-overlay.fade-out {
  opacity: 0;
}

#page-fade-overlay.fade-in {
  opacity: 1;
}

/* Responsive adjustment */
@media (max-width: 580px) {
  .intro-terminal {
    max-width: 100%;
  }
  .terminal-body {
    padding: 1.5rem 1.8rem;
  }
  .log-prefix {
    min-width: 80px;
    font-size: 0.78rem;
  }
  .log-content {
    font-size: 0.78rem;
  }
}
