/* ========================================
   AlphaLab9 — Terminal Theme
   ======================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #080f10;
  --bg-surface: #0c1516;
  --bg-hover: #111d1f;
  --border: #182e31;
  --border-bright: #274a4e;

  --teal: #4ee8e4;
  --teal-bright: #7ef4f0;
  --teal-dim: #36b4b1;
  --teal-faint: rgba(78, 232, 228, 0.12);

  --text: #88adb0;
  --text-bright: #c0dde0;
  --text-dim: #486d70;

  --status-live: #34d399;
  --status-internal: #60a5fa;
  --status-alpha: #4ee8e4;
  --status-invite: #a78bfa;

  --glow-sm: 0 0 10px rgba(78, 232, 228, 0.15);
  --glow-md: 0 0 20px rgba(78, 232, 228, 0.2);
  --glow-lg: 0 0 40px rgba(78, 232, 228, 0.15), 0 0 80px rgba(78, 232, 228, 0.05);

  --font: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;

  --container-max: 1000px;
  --container-padding: clamp(1.5rem, 5vw, 3rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html.lenis, html.lenis body {
  height: auto;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  /* overflow removed so body can act as scroll track properly */
}

a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection {
  background: rgba(78, 232, 228, 0.25);
  color: var(--teal-bright);
}

/* ── Cursor Blink ─────────────────────── */

.cursor-blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Audio Toggle ─────────────────────── */

.audio-toggle {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 9999;
  background: rgba(12, 21, 22, 0.7);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s, border-color 0.3s, box-shadow 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  line-height: 0;
}

.audio-toggle:hover {
  color: var(--teal);
  border-color: var(--border-bright);
  box-shadow: var(--glow-sm);
}


/* ── Background Effects ────────────────── */

#matrix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.025) 1px,
    rgba(0, 0, 0, 0.025) 2px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9996;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

/* ── 3D Wormhole Viewport ──────────────── */

/* Gate Screen — pre-boot entry */
#gate-screen {
  position: fixed;
  inset: 0;
  background: #0a0f0d;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  cursor: pointer;
  transition: opacity 0.3s var(--ease-out);
}

.gate-prompt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  transition: text-shadow 0.3s, color 0.3s;
}

.gate-cmd {
  color: var(--teal);
  font-weight: 600;
}

#gate-screen:hover .gate-cmd {
  color: var(--teal-bright);
  text-shadow: var(--glow-md);
}

.gate-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0.5;
  transition: opacity 0.3s;
}

#gate-screen:hover .gate-hint {
  opacity: 0;
}

/* Boot Sequence Overlay */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #0a0f0d;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem var(--container-padding);
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--teal-dim);
  transition: opacity 0.35s var(--ease-out);
  pointer-events: none;
}

#boot-screen.boot-hidden {
  visibility: hidden;
}

#boot-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

#boot-cursor {
  margin-top: 0.3rem;
  color: var(--teal-bright);
}

.hw-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: 2;
  pointer-events: none; /* Let scroll-track catch scroll, but wait... elements inside need pointer-events */
}

/* Restore pointer events so hover effects and clicks work */
.scene {
  pointer-events: auto;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  margin: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 var(--container-padding);
  max-width: var(--container-max);
  visibility: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

#hero {
  align-items: flex-start;
}

#wormhole-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
}


/* ── Layout ────────────────────────────── */

main {
  position: relative;
  z-index: 1;
}

/* ── Prompt Lines ──────────────────────── */

.prompt-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.prompt-arrow {
  color: var(--teal);
  font-weight: 600;
  text-shadow: var(--glow-sm);
  flex-shrink: 0;
}

.prompt-cmd {
  color: var(--text-bright);
  white-space: nowrap;
}


/* ── Scroll Progress ──────────────────── */

.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  width: 3px;
  height: 0%;
  background: var(--teal);
  opacity: 0.4;
  z-index: 9998;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* ── Terminal Output ───────────────────── */

.terminal-output {
  opacity: 1;
  transform: none;
}

.separator {
  color: var(--border-bright);
  margin: 1rem 0;
  user-select: none;
}

/* ── Hero ──────────────────────────────── */

.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  color: var(--teal-bright);
  letter-spacing: -0.03em;
  line-height: 1;
  text-shadow: var(--glow-lg);
  margin-bottom: 0.5rem;
  position: relative;
}

.hero-title.glitching {
  animation: heroGlitch 0.4s steps(3, end) forwards;
}

@keyframes heroGlitch {
  0% {
    text-shadow:
      -6px 0 rgba(255, 0, 80, 0.8),
      6px 0 rgba(78, 232, 228, 0.8),
      0 0 40px rgba(78, 232, 228, 0.3);
    transform: translate(6px, 0) skewX(-3deg);
    clip-path: inset(10% 0 30% 0);
  }
  15% {
    text-shadow:
      8px 0 rgba(255, 0, 80, 0.9),
      -4px 0 rgba(78, 232, 228, 0.9),
      0 3px rgba(120, 0, 255, 0.4),
      0 0 60px rgba(78, 232, 228, 0.2);
    transform: translate(-8px, 2px) skewX(4deg);
    clip-path: inset(40% 0 5% 0);
  }
  30% {
    text-shadow:
      -5px 0 rgba(255, 0, 80, 0.7),
      10px 0 rgba(78, 232, 228, 0.7),
      0 -2px rgba(120, 0, 255, 0.3),
      0 0 50px rgba(78, 232, 228, 0.25);
    transform: translate(5px, -2px) skewX(-2deg);
    clip-path: inset(0% 0 0% 0);
  }
  50% {
    text-shadow:
      7px 0 rgba(255, 0, 80, 0.8),
      -6px 0 rgba(78, 232, 228, 0.8),
      0 0 40px rgba(78, 232, 228, 0.3);
    transform: translate(-4px, 1px) skewX(3deg);
    clip-path: inset(20% 0 40% 0);
  }
  70% {
    text-shadow:
      -3px 0 rgba(255, 0, 80, 0.5),
      4px 0 rgba(78, 232, 228, 0.5),
      0 0 30px rgba(78, 232, 228, 0.15);
    transform: translate(2px, -1px) skewX(-1deg);
    clip-path: inset(0% 0 0% 0);
  }
  85% {
    text-shadow:
      2px 0 rgba(255, 0, 80, 0.3),
      -2px 0 rgba(78, 232, 228, 0.3),
      var(--glow-lg);
    transform: translate(-1px, 0) skewX(0deg);
    clip-path: inset(0% 0 0% 0);
  }
  100% {
    text-shadow: var(--glow-lg);
    transform: translate(0, 0) skewX(0deg);
    clip-path: inset(0% 0 0% 0);
  }
}


.hero-tagline {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--teal-dim);
  font-weight: 400;
}

#hero .terminal-output > p {
  color: var(--text);
  font-size: 0.95rem;
}

.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeIn 0.8s ease 1.5s forwards;
}

.scroll-arrow {
  animation: bobDown 1.5s ease-in-out infinite;
}

@keyframes bobDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ── Product Cards ─────────────────────── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  width: 100%;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: rgba(12, 21, 22, 0.7);
  padding: 1.5rem;
  border-radius: 2px;
  transition: all 0.35s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-bright);
  background: rgba(12, 21, 22, 0.9);
  box-shadow: var(--glow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--teal);
}

.status {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

.status-live {
  color: var(--status-live);
  background: rgba(52, 211, 153, 0.1);
}

.status-internal {
  color: var(--status-internal);
  background: rgba(96, 165, 250, 0.08);
}

.status-invite {
  color: var(--status-invite);
  background: rgba(167, 139, 250, 0.1);
}

.status-alpha {
  color: var(--status-alpha);
  background: rgba(78, 232, 228, 0.08);
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card-tags span {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.card-hover-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.35s var(--ease-out);
  font-size: 0.75rem;
  color: var(--teal-dim);
  padding-top: 0;
  border-top: 1px solid transparent;
}

.card:hover .card-hover-detail {
  max-height: 50px;
  opacity: 1;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top-color: var(--border);
}

.card-action {
  display: inline-block;
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.85rem;
  color: var(--teal-dim);
  transition: all 0.3s;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 2px;
}

.card-action:hover {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
  background: rgba(78, 232, 228, 0.05);
  box-shadow: var(--glow-sm);
}

/* ── Services ──────────────────────────── */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  width: 100%;
}

.service-block {
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: rgba(12, 21, 22, 0.7);
  border-radius: 2px;
  transition: all 0.35s var(--ease-out);
}

.service-block:hover {
  border-color: var(--border-bright);
  background: rgba(12, 21, 22, 0.9);
  box-shadow: var(--glow-sm);
}

.service-block h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal);
  margin-bottom: 0.75rem;
}

.service-block p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text);
}

/* ── About ─────────────────────────────── */

.about-content {
  max-width: 700px;
}

.about-lead {
  font-size: 1rem;
  color: var(--text-bright);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.about-content > p:not(.about-lead) {
  margin-bottom: 2rem;
}

.cap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cap-tag {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.3rem 0.1rem;
  transition: all 0.3s var(--ease-out);
}

.cap-tag:hover {
  color: var(--teal);
  text-shadow: var(--glow-sm);
}

/* ── Contact ───────────────────────────── */

.contact-content {
  max-width: 800px;
}

.contact-heading {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--teal-bright);
  text-shadow: var(--glow-md);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.contact-desc {
  margin-bottom: 2rem;
  color: var(--text);
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 1rem;
  row-gap: 0.5rem;
}

.contact-cta {
  max-width: 28rem;
  font-size: 0.85rem;
  color: var(--teal-dim);
  font-style: italic;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
  font-size: 1rem;
  color: var(--teal);
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.35s var(--ease-out);
  position: relative;
}

.email-tail {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.rabbit-emoji {
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.contact-email:hover {
  border-color: var(--teal-dim);
  box-shadow: var(--glow-md);
  background: var(--teal-faint);
}

.contact-email.is-confirmed {
  border-color: var(--teal);
  box-shadow: var(--glow-md);
  background: var(--teal-faint);
}

.contact-email[data-status]::after {
  content: attr(data-status);
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--teal-dim);
  white-space: nowrap;
}

/* ── Footer ────────────────────────────── */

.scene-footer {
  margin-top: 4rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.footer-home-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s, text-shadow 0.3s;
}

.footer-home-link:hover {
  color: var(--teal-bright);
  text-shadow: var(--glow-sm);
}

.footer-meta {
  letter-spacing: 0.05em;
}

.footer-privacy {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s, text-shadow 0.3s;
}

.footer-privacy:hover {
  color: var(--teal-bright);
  text-shadow: var(--glow-sm);
}

/* ── Responsive ────────────────────────── */

@media (max-width: 800px) {
  .product-grid,
  .services-grid {
    grid-template-columns: 1fr;
  }

  .contact-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .contact-email {
    justify-self: start;
  }

  .contact-email[data-status]::after {
    font-size: 0.62rem;
  }
}

@media (max-width: 640px) {
  :root {
    --container-padding: 1rem;
  }

  .hero-title {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
  }

  #products {
    justify-content: flex-start;
    padding-top: max(1.5rem, calc(env(safe-area-inset-top) + 0.75rem));
    padding-bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 0.75rem));
  }

  #products .prompt-line {
    margin-bottom: 0.85rem;
  }

  #products .terminal-output {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 0.4rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #products .terminal-output::-webkit-scrollbar {
    display: none;
  }

  #products .product-grid {
    gap: 0.7rem;
  }

  #products .card {
    padding: 0.85rem;
  }

  #products .card-header {
    margin-bottom: 0.6rem;
  }

  #products .card-name {
    font-size: 0.95rem;
  }

  #products .status {
    font-size: 0.58rem;
    padding: 0.12rem 0.42rem;
  }

  #products .card-desc {
    font-size: 0.72rem;
    line-height: 1.5;
    margin-bottom: 0.65rem;
  }

  #products .card-action {
    font-size: 0.78rem;
    padding: 0.32rem 0.68rem;
  }

  .scene-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .scene { opacity: 1; transform: none; visibility: visible; }
  .prompt-cmd { width: auto; border: none; }
  #matrix-bg, .scanlines { display: none; }
}
