/* Speakent - Design Tokens & Variables */
:root {
  --bg-color: #060608;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-color: #6366f1; /* Indigo */
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --font-mono: 'JetBrains Mono', monospace;
  --card-bg: rgba(10, 10, 15, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --mouse-x: 50%;
  --mouse-y: 50%;

  /* Status Dot Colors */
  --status-color: #10b981; /* Green by default */

  /* Text Mask Gradient */
  --text-mask-gradient-static: linear-gradient(
    135deg,
    #a5b4fc 0%,
    #818cf8 35%,
    #e879f9 70%,
    #6366f1 100%
  );
  --text-mask-gradient-loaded: linear-gradient(
    135deg,
    rgba(165, 180, 252, 0.85) 0%,
    rgba(232, 121, 249, 0.85) 50%,
    rgba(99, 102, 241, 0.85) 100%
  );
}

/* Page-specific overrides for 404 Error Page */
body.error-page {
  --status-color: #ef4444; /* Red for errors */
  --text-mask-gradient-static: linear-gradient(
    135deg,
    #fca5a5 0%,
    #f87171 35%,
    #e879f9 70%,
    #6366f1 100%
  );
  --text-mask-gradient-loaded: linear-gradient(
    135deg,
    rgba(252, 165, 165, 0.85) 0%,
    rgba(232, 121, 249, 0.85) 50%,
    rgba(99, 102, 241, 0.85) 100%
  );
}

/* Basic Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background-color: #000000;
  color: #ffffff;
}

::-moz-selection {
  background-color: #000000;
  color: #ffffff;
}

body {
  font-family: var(--font-mono);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Image & Spotlight */
.bg-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  background-image:
    radial-gradient(
      circle at var(--mouse-x) var(--mouse-y),
      rgba(99, 102, 241, 0.15) 0%,
      rgba(0, 0, 0, 0) 50%
    ),
    linear-gradient(rgba(6, 6, 8, 0.8), rgba(6, 6, 8, 0.95));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.2s ease-out;
}

/* Once background image is preloaded, we apply it */
body.bg-loaded .bg-wrapper {
  background-image:
    radial-gradient(
      circle at var(--mouse-x) var(--mouse-y),
      rgba(99, 102, 241, 0.18) 0%,
      rgba(0, 0, 0, 0) 60%
    ),
    linear-gradient(rgba(6, 6, 8, 0.85), rgba(6, 6, 8, 0.95)),
    url('/assets/images/speakent_bg.webp');
}

/* 3D Particle Sphere Canvas */
#sphere-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

/* Tech Grid Overlay */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-size: 50px 50px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  pointer-events: none;
}

/* Header styling */
header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-color);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-color);
  animation: logo-glow 2s infinite alternate;
}

@keyframes logo-glow {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(99, 102, 241, 1);
  }
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--status-color);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--status-color);
  animation: pulse 1.6s infinite alternate;
}

@keyframes pulse {
  0% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Main Layout */
main {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.hero-container {
  max-width: 820px;
  width: 100%;
  text-align: center;
  padding: 5rem 3rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

/* Mouse glow overlay */
.hero-container::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: radial-gradient(
    circle at var(--mouse-x) var(--mouse-y),
    rgba(255, 255, 255, 0.15) 0%,
    transparent 45%
  );
  border-radius: 28px;
  z-index: -1;
  pointer-events: none;
}

/* Text Mask Effect */
.text-mask {
  font-family: var(--font-mono);
  font-size: 5.5rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  padding-left: 0.18em; /* Centering offset for letter-spacing */
  text-transform: uppercase;
  background-image: var(--text-mask-gradient-static);
  background-size: cover;
  background-position: center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  margin-bottom: 1.8rem;
  display: inline-block;
  line-height: 1.05;
  filter: drop-shadow(0 2px 15px rgba(0, 0, 0, 0.4));
  transition: background-image 0.5s ease;
}

/* When bg is loaded, mask with background image blended with a bright gradient */
body.bg-loaded .text-mask {
  background-image: var(--text-mask-gradient-loaded), url('/assets/images/speakent_bg.webp');
}

.subheading {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 3rem auto;
  line-height: 1.65;
}

/* Waitlist Form & Action Containers */
.subscription-box,
.action-box {
  max-width: 520px;
  margin: 0 auto;
}

.action-box {
  max-width: 320px;
}

.subscription-form {
  display: flex;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.subscription-form:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 20px var(--accent-glow);
  background: rgba(255, 255, 255, 0.04);
}

.subscription-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.9rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
}

.subscription-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.subscription-btn {
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.9rem 2rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.subscription-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Hover SVG transitions */
.subscription-form .subscription-btn:hover svg {
  transform: translate(2px, -2px) rotate(-45deg);
}

.action-box .subscription-btn:hover svg {
  transform: translateX(-4px);
}

.subscription-btn:active {
  transform: translateY(0);
}

.subscription-btn svg {
  transition: transform 0.25s ease;
}

/* Success Message styling */
.success-message {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: #34d399; /* Emerald */
  font-size: 1rem;
  font-weight: 500;
  padding: 1.2rem;
  border: 1px dashed rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.04);
  border-radius: 14px;
}

.success-message.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Tech Metadata Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2.5rem;
}

.stat-item {
  text-align: left;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Footer styling */
footer {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.socials {
  display: flex;
  gap: 2rem;
}

.socials a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 0.25s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.socials a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -2px;
  left: 0;
  background-color: var(--accent-color);
  transition: width 0.25s ease;
}

.socials a:hover {
  color: var(--text-primary);
}

.socials a:hover::after {
  width: 100%;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .hero-container {
    padding: 4rem 2rem;
  }
  .text-mask {
    font-size: 3.5rem;
    letter-spacing: 0.12em;
    padding-left: 0.12em;
  }
}

@media (max-width: 640px) {
  .subscription-form {
    flex-direction: column;
    background: transparent;
    border: none;
    padding: 0;
    gap: 0.8rem;
  }
  .subscription-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
  }
  .subscription-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 3.5rem;
  }
  footer {
    flex-direction: column;
    gap: 1.2rem;
    text-align: center;
    padding-bottom: 3.5rem;
  }
}

@media (min-width: 641px) {
  .stat-item:nth-child(2) {
    text-align: center;
  }
  .stat-item:nth-child(3) {
    text-align: right;
  }
}

@media (max-width: 480px) {
  .hero-container {
    padding: 3rem 1.5rem;
  }
  .text-mask {
    font-size: 2.2rem;
    letter-spacing: 0.08em;
    padding-left: 0.08em;
  }
}
