/* ============================================
   CSS Variables - Twilio Color Palette
   ============================================ */
:root {
  --twilio-red: #F22F46;
  --dark-bg: #1E1E1E;
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0B0;
  --accent-blue: #4A90E2;
  --section-bg: #252525;
  --border-color: #333333;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--dark-bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   Hero Section - Full Screen Animation
   ============================================ */
.hero-section {
  position: relative;
  width: 100%;
  background-color: var(--dark-bg);
  /* Height will be set dynamically by JavaScript to include spacer */
}

.hero-container {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-section.pinned .hero-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  z-index: 100;
}

#animationCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  will-change: contents;
  image-rendering: high-quality;
}

.hero-overlay {
  position: relative;
  z-index: 10;
  text-align: center;
  pointer-events: none;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.hero-title,
.summary-heading-overlay,
.summary-text-overlay {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  /* Strong text shadow for better contrast against video */
  text-shadow: 
    0 2px 12px rgba(0, 0, 0, 0.9),
    0 4px 24px rgba(0, 0, 0, 0.7),
    0 6px 32px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 0, 0, 0.3);
  /* Subtle backdrop blur effect */
  padding: 12px 24px;
  display: inline-block;
  border-radius: 12px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background-color: rgba(0, 0, 0, 0.25);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  /* Faster transitions to reduce overlap */
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}

.hero-title {
  font-size: clamp(36px, 8vw, 72px);
  opacity: 1;
  white-space: nowrap;
}

.summary-heading-overlay {
  font-size: clamp(32px, 6vw, 56px);
  max-width: 90%;
  white-space: normal;
  opacity: 0;
  transform: translateX(-50%) translateY(calc(-50% + 20px));
}

.summary-text-overlay {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 400;
  max-width: 1400px;
  width: 95%;
  min-width: 700px;
  white-space: normal;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%) translateY(calc(-50% + 20px));
  /* Override parent inline-block to allow proper text flow */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  /* Ensure text flows horizontally, not character by character */
  word-break: normal;
  word-wrap: normal;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Ensure box-sizing includes padding */
  box-sizing: border-box;
  /* Increase padding for better text spacing */
  padding: 16px 32px;
}

.hero-subtitle {
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--text-secondary);
  font-weight: 400;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: bounce 2s infinite;
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* ============================================
   Scroll Spacer - Controls Animation Duration
   ============================================ */
.scroll-spacer {
  width: 100%;
  height: 0;
  /* Height will be set dynamically by JavaScript */
  background: transparent;
  pointer-events: none;
  visibility: hidden;
}

/* ============================================
   Product Summary Section
   ============================================ */
.summary-heading {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  /* Initial hidden state for scroll-based fade-in */
  opacity: 0;
  transform: translateY(20px);
  /* Smooth transform transition, opacity controlled by JavaScript */
  transition: transform 0.4s ease-out;
}

.summary-heading.visible {
  transform: translateY(0);
}

.summary-text {
  font-size: clamp(18px, 2vw, 22px);
  text-align: center;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
  /* Initial hidden state for scroll-based fade-in */
  opacity: 0;
  transform: translateY(20px);
  /* Smooth transform transition, opacity controlled by JavaScript */
  transition: transform 0.4s ease-out 0.1s;
}

.summary-text.visible {
  transform: translateY(0);
}

/* ============================================
   Features Section
   ============================================ */
.features-section {
  padding: 20px 0 80px 0;
  background-color: var(--dark-bg);
  margin-top: 0;
}

.features-heading {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 64px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 48px;
}

.feature-card {
  background-color: var(--section-bg);
  padding: 40px 32px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--twilio-red);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 24px;
  display: block;
}

.feature-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.feature-description {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   CTA Section
   ============================================ */
.cta-section {
  padding: 80px 0;
  background: linear-gradient(135deg, var(--section-bg) 0%, var(--dark-bg) 100%);
  text-align: center;
}

.cta-heading {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.cta-text {
  font-size: clamp(18px, 2vw, 20px);
  color: var(--text-secondary);
  margin-bottom: 48px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cta-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--twilio-red);
  color: var(--text-primary);
}

.btn-primary:hover {
  background-color: #D91E35;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(242, 47, 70, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--text-primary);
  color: var(--dark-bg);
  transform: translateY(-2px);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: 48px 0;
  background-color: var(--dark-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.footer-text {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */
@media (max-width: 968px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .features-section,
  .cta-section {
    padding: 20px 0 80px 0;
  }
}

/* ============================================
   Responsive Design - Mobile
   ============================================ */
@media (max-width: 640px) {
  .hero-section {
    min-height: 500px;
  }

  .hero-overlay {
    padding: 0 16px;
  }

  .container {
    padding: 0 16px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .feature-card {
    padding: 32px 24px;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .features-section,
  .cta-section {
    padding: 20px 0 60px 0;
  }

  .summary-heading,
  .features-heading,
  .cta-heading {
    margin-bottom: 20px;
  }
}

/* ============================================
   Loading State
   ============================================ */
.loading {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.loaded {
  opacity: 1;
}
