/*
  Terminal hero — replaces the original Framer hero content on the homepage.
  The original hero markup is hidden via CSS (so Framer hydration can't
  un-hide it), and hero-terminal.js injects the terminal into #hero.
*/

/* Hide the original Framer hero content, keep the terminal and its backdrop. */
#hero > *:not(#terminal-hero-root):not(#terminal-hero-bg) {
  display: none !important;
}

/* ---- Ambient hero backdrop: drifting grid + dot matrix + data series ---- */

#terminal-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Grid/dots wrapper — no bob/tilt. Oscillating ease-in-out motion is what
   made the hero feel like it was pulsing/flickering. */
#terminal-hero-bg .th-bg-float {
  position: absolute;
  inset: 0;
}

/* Slow linear tile drift only — constant velocity, no opacity change. */
#terminal-hero-bg .th-bg-grid {
  position: absolute;
  inset: -120px;
  background-image:
    repeating-linear-gradient(to right, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 48px);
  animation: th-bg-grid-drift 80s linear infinite;
}

#terminal-hero-bg .th-bg-dots {
  position: absolute;
  inset: -140px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1.2px, transparent 1.4px);
  background-size: 96px 96px;
  animation: th-bg-dots-drift 110s linear infinite;
}

/* Static ambient glow — never animate opacity; that reads as flicker. */
#terminal-hero-bg .th-bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 50% 45%, rgba(126, 231, 135, 0.045), transparent 70%);
}

/* One soft light wash, not stacked competing bands. The track is 200% wide with
   two identical soft peaks so a -50% translate loops with no seam or jump. */
#terminal-hero-bg .th-bg-wash {
  position: absolute;
  inset: -20%;
  overflow: hidden;
  transform: rotate(-6deg);
}

#terminal-hero-bg .th-bg-wash__track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 200%;
  /* Two identical soft peaks on a 200% track — translate -50% loops cleanly.
     Contrast is high enough to read as motion against the grid; still no
     opacity animation, so it drifts instead of flickering. */
  background:
    radial-gradient(ellipse 22% 65% at 25% 48%, rgba(255, 255, 255, 0.12), transparent 68%),
    radial-gradient(ellipse 22% 65% at 75% 48%, rgba(255, 255, 255, 0.12), transparent 68%);
  filter: blur(40px);
  will-change: transform;
  animation: th-bg-wash-drift 18s linear infinite;
}

@keyframes th-bg-grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(48px, 48px, 0); }
}

@keyframes th-bg-dots-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-96px, 96px, 0); }
}

/* Constant left -> right travel. Linear only — ease-in-out would slow at the
   ends and feel like a pulse. */
@keyframes th-bg-wash-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #terminal-hero-bg * {
    animation: none !important;
  }
}

/* Use a normal cursor in the hero (disable Framer's custom-cursor effect). */
#hero {
  cursor: auto !important;
}
#terminal-hero-root .th-body,
#terminal-hero-root .th-body *,
#terminal-hero-root .th-input {
  cursor: text !important;
}

/* Fill the full-height dark hero and center the terminal both axes. */
#terminal-hero-root {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

#terminal-hero-root .th-window {
  background: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 740px;
  /* Cap the height so a long command history scrolls inside the terminal
     instead of growing past the bottom of the hero section. */
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-align: left;
}

#terminal-hero-root .th-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 14px;
  background: #2d2d2d;
  border-bottom: 1px solid #3a3a3a;
}

#terminal-hero-root .th-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

#terminal-hero-root .th-titlebar span {
  margin-left: 10px;
  font-size: 12px;
  color: #9a9a9a;
}

#terminal-hero-root .th-body {
  padding: 22px 24px;
  font-size: 15px;
  line-height: 1.9;
  cursor: text;
  color: #e6edf3;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#terminal-hero-root .th-body::-webkit-scrollbar {
  width: 8px;
}
#terminal-hero-root .th-body::-webkit-scrollbar-track {
  background: transparent;
}
#terminal-hero-root .th-body::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 4px;
}
#terminal-hero-root .th-body::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

/* Blinking block caret shown while the terminal "types" on load. */
#terminal-hero-root .th-caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  background: #e6edf3;
  vertical-align: text-bottom;
  animation: th-blink 1s steps(1) infinite;
}

@keyframes th-blink {
  50% { opacity: 0; }
}

#terminal-hero-root .th-body .th-indent {
  padding-left: 100px;
}

#terminal-hero-root .th-match {
  background: rgba(126, 231, 135, 0.15);
  color: #ffffff;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

#terminal-hero-root .th-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6edf3;
  font-family: inherit;
  font-size: 14px;
  padding: 0 0 0 6px;
  caret-color: #e6edf3;
}

#terminal-hero-root .th-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  #terminal-hero-root {
    padding: 16px;
  }
  #terminal-hero-root .th-window {
    max-height: 72vh;
  }
  #terminal-hero-root .th-body .th-indent {
    padding-left: 24px;
  }
}
