/* ==========================================================================
   DegenX Landing Page Styles
   ========================================================================== */

/* CSS Variables
   ========================================================================== */
:root {
  --brand-red: #ef4444;
  --brand-red-dark: #dc2626;
  --brand-red-light: #f87171;
  --bg-black: #000000;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(17, 7, 7, 0.4);
  --glass-bg-hover: rgba(17, 7, 7, 0.6);
  --glass-border: rgba(239, 68, 68, 0.2);
  --glass-border-hover: rgba(239, 68, 68, 0.4);
}

/* Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* Account for fixed navbar height */
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-black);
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0),
    url('../../static/images/degenx_bg.png');
  background-size: 40px 40px, cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}

/* Mobile-specific overflow constraints - Fixed */
@media (max-width: 768px) {
  html {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  /* Fix scroll context issues */
  main {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  /* Ensure sections don't create separate scroll contexts */
  section {
    overflow: visible;
    width: 100%;
    position: relative;
  }
  
  /* Fix container overflow issues */
  .container,
  div[class*="max-w"] {
    width: 100%;
    max-width: 100vw;
    overflow-x: visible;
    box-sizing: border-box;
  }
}

/* Animations
   ========================================================================== */
@keyframes scroll {
  0% { 
    transform: translateX(0); 
  }
  100% { 
    transform: translateX(-50%); 
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
  }
}


.animate-scroll {
  animation: scroll 40s linear infinite;
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.8s ease-out forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
  animation: glow 3s ease-in-out infinite;
}


/* Responsive animation speed */
@media (min-width: 768px) {
  .animate-scroll {
    animation-duration: 90s;
  }
}

/* Glass Morphism Components
   ========================================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  margin: 20px 10px; /* Add margin for shadow space on desktop */
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.1), transparent);
  transition: left 0.6s;
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  border: 1px solid var(--glass-border-hover);
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.2);
}

.glass-card:hover::before {
  left: 100%;
}

/* Mobile adjustments for cards - More subtle effects */
@media (max-width: 768px) {
  .glass-card {
    margin: 10px 0; /* Reduced margin on mobile */
    transition: all 0.2s ease-out; /* Faster, more subtle transition */
  }
  
  .glass-card:hover {
    transform: translateY(-2px) scale(1.005); /* Much more subtle movement */
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.15); /* Softer shadow */
  }
}

/* Utility Classes
   ========================================================================== */
.brand-shadow {
  box-shadow: 0 0 40px -10px var(--brand-red);
}

.brand-glow {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.brand-glow-strong {
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
}

/* Email Capture Form Styles
   ========================================================================== */
.email-capture-form {
  width: 100%;
}

.email-capture-form input[type="email"] {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease-in-out;
}

.email-capture-form input[type="email"]:focus {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.02);
}

.email-capture-form input[type="email"]::placeholder {
  transition: opacity 0.3s ease;
}

.email-capture-form input[type="email"]:focus::placeholder {
  opacity: 0.7;
}

/* Form feedback styles */
#formFeedback.success {
  color: #10b981;
  animation: fadeInUp 0.3s ease-out;
}

#formFeedback.error {
  color: #ef4444;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Loading spinner animation */
.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Mobile form adjustments */
@media (max-width: 640px) {
  .email-capture-form .flex-col {
    gap: 0.75rem;
  }
  
  .email-capture-form input[type="email"] {
    text-align: center;
  }
  
  .email-capture-form button {
    width: 100%;
    justify-content: center;
  }
}

/* Custom Button Styles
   ========================================================================== */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark));
  color: white;
  font-weight: bold;
  transition: all 0.3s ease-in-out;
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
  margin: 10px; /* Add margin for shadow space */
  min-height: 44px; /* Ensure minimum touch target size */
  min-width: 44px;
  display: inline-flex; /* Ensure proper alignment */
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none; /* Remove link underline */
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-red-dark), #b91c1c);
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* Mobile touch adjustments - More subtle */
@media (max-width: 768px) {
  .btn-primary:hover {
    transform: scale(1.01) translateY(-1px); /* Very subtle transform */
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2); /* Softer shadow */
  }
  
  .btn-primary:active {
    transform: scale(0.99) translateY(0);
    transition: all 0.1s ease-out; /* Quick feedback */
  }
  
  /* Disable glow animation on mobile - can be distracting */
  .btn-primary.animate-glow {
    animation: none;
  }
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: scale(1.02) translateY(0);
}

/* Button container spacing */
.btn-primary-container {
  padding: 15px; /* Extra space for button shadows */
}

/* Mobile adjustments for buttons - Enhanced */
@media (max-width: 768px) {
  .btn-primary {
    margin: 8px; /* Adequate margin to prevent clipping */
    padding: 12px 24px; /* Ensure proper touch target */
    min-height: 48px; /* iOS recommended minimum */
  }
  
  .btn-primary-container {
    padding: 15px; /* Extra padding to prevent shadow clipping */
    overflow: visible; /* Ensure shadows aren't clipped */
  }
  
  /* Fix any parent containers that might clip buttons */
  .flex,
  .flex-col,
  .flex-row {
    overflow: visible;
  }
}

/* Logo Carousel Styles
   ========================================================================== */
.logo-carousel {
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  white-space: nowrap;
}

.logo-carousel img {
  filter: grayscale(100%) opacity(0.7);
  transition: all 0.3s ease-in-out;
}

.logo-carousel img:hover {
  filter: grayscale(0%) opacity(1);
  transform: scale(1.1);
}

/* Header Styles
   ========================================================================== */
.header-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  transition: all 0.3s ease-in-out;
}

.header-backdrop.scrolled {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Navigation Link Hover Effects */
.nav-link {
  position: relative;
  transition: all 0.3s ease-in-out;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand-red);
  transition: width 0.3s ease-in-out;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link:hover {
  transform: translateY(-1px);
}

/* Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.1;
  }
  
  .glass-card {
    margin-bottom: 1rem;
  }
  
  /* Fix mobile layout issues */
  section {
    overflow-x: hidden;
    width: 100%;
  }
  
  /* Ensure containers don't overflow */
  .max-w-7xl {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Fix logo carousel on mobile */
  .logo-carousel {
    width: 100%;
    overflow-x: hidden;
  }
  
  /* Fix hero section grid on mobile */
  .grid {
    width: 100%;
    overflow-x: hidden;
  }
  
  /* Disable background attachment on mobile for better performance */
  body {
    background-attachment: scroll;
  }
  
  /* Fix transform and positioning issues */
  section {
    transform: none !important;
    overflow: visible;
  }
  
  /* Fix container widths and prevent clipping */
  .container, .max-w-7xl {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
  }
  
  /* Ensure interactive elements have proper space */
  .glass-card {
    margin: 1rem 0.5rem;
    overflow: visible;
  }
  
  /* Fix any clipping issues with animated elements */
  .glass-card:hover {
    transform: translateY(-4px) scale(1.01); /* Reduced to prevent clipping */
  }
  
  /* Fix spacing issues */
  .space-x-10 {
    gap: 1rem;
  }
  
  .space-x-16 {
    gap: 1.5rem;
  }
  
  .space-x-20 {
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 4rem;
    line-height: 1;
  }
}

/* Desktop spacing for animated elements */
@media (min-width: 769px) {
  /* Add padding to sections with animated elements */
  .section-with-animations {
    padding: 20px;
  }
  
  /* Ensure grid containers have space for shadows */
  .grid {
    padding: 20px 0;
  }
  
  /* Problem/solution sections spacing */
  section[id="problem"],
  section[id="flywheel"],
  section[id="edge"],
  section[id="strategy"] {
    padding: 40px 20px;
    margin: 20px 0;
  }
}

/* Performance Optimizations
   ========================================================================== */
.video-container {
  will-change: transform;
  transition: transform 0.3s ease-out;
}

.animate-scroll {
  will-change: transform;
}

/* Hero Section Enhancements */
.hero-title {
  animation: fadeInUp 1s ease-out 0.2s both;
}

/* Stagger Animation Classes */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* Interactive Elements */
.interactive-element {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.interactive-element:hover {
  transform: scale(1.05) translateY(-5px);
}

/* Mobile Touch and Accessibility Enhancements
   ========================================================================== */
@media (max-width: 768px) {
  /* Ensure all touch targets meet accessibility guidelines */
  button, input, textarea, select {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Navigation links need proper touch targets */
  a:not(.btn-primary) {
    min-height: 44px;
    padding: 8px 12px;
  }
  
  /* Fix any overflow issues with transformed elements */
  section, main, .container {
    overflow-x: hidden;
    overflow-y: visible;
  }
  
  /* Prevent elements from being clipped by container edges */
  .flex, .grid {
    overflow: visible;
  }
  
  /* Fix logo carousel potential overflow */
  .logo-carousel .flex {
    overflow: visible;
  }
  
  /* Ensure navigation links have proper touch targets */
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 12px;
  }
  
  /* Fix mobile menu touch targets */
  #mobile-menu a {
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  
  /* Ensure form elements have proper spacing */
  .email-capture-form {
    padding: 10px;
    overflow: visible;
  }
  
  /* Fix video container on mobile */
  .video-container {
    overflow: hidden; /* This one should be hidden to prevent video overflow */
  }
}

/* Print Styles
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .glass-card {
    background: white !important;
    border: 1px solid #ccc !important;
  }
}