/**
 * Hero Cosmic Styles
 * Sistema de capas cinemáticas con performance optimizada
 * 
 * Arquitectura:
 * - Variables CSS para control dinámico desde JS
 * - Layers con z-index semántico
 * - GPU-accelerated animations
 * - Mobile-first responsive
 * 
 * @package Orvit_Cosmos
 */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Variables)
   ========================================================================= */

:root {
  /* Hero Dimensions */
  --hero-height: 100vh;
  --hero-height-mobile: 100svh; /* Safe viewport height para mobile */
  
  /* Overlay Gradient */
  --hero-overlay-start: rgba(0, 0, 0, 0.7);
  --hero-overlay-end: rgba(0, 0, 0, 0.3);
  
  /* Text Colors */
  --hero-text-primary: #ffffff;
  --hero-text-secondary: rgba(255, 255, 255, 0.8);
  
  /* Gradient Text */
  --gradient-start: #00d4ff;
  --gradient-end: #7b2ff7;
  
  /* Badge */
  --hero-badge-bg: rgba(255, 255, 255, 0.1);
  --hero-badge-border: rgba(255, 255, 255, 0.2);
  
  /* Animations */
  --hero-transition-speed: 0.8s;
  --hero-easing: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Parallax */
  --parallax-strength: 1;
  
  /* Z-index System */
  --z-hero-video: 1;
  --z-hero-overlay: 2;
  --z-hero-content: 3;
  --z-hero-floating: 4;
  --z-hero-indicator: 5;
}

/* ============================================================================
   HERO SECTION - Container Principal
   ========================================================================= */

.hero-cosmic {
  position: relative;
  width: 100%;
  height: var(--hero-height-mobile);
  min-height: 600px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate; /* Crea nuevo stacking context */
}

@supports (height: 100dvh) {
  .hero-cosmic {
    height: 100dvh; /* Dynamic viewport height - mejor que svh */
  }
}

/* ============================================================================
   MEDIA LAYER - Video Background
   ========================================================================= */

.hero-media {
  position: absolute;
  inset: 0;
  z-index: var(--z-hero-video);
  overflow: hidden;
}

.hero-video-element {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  will-change: transform; /* GPU acceleration */
  
  /* Optimización de performance */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Overlay gradiente */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-hero-overlay);
  background: linear-gradient(
    180deg,
    var(--hero-overlay-start) 0%,
    var(--hero-overlay-end) 100%
  );
  pointer-events: none;
}

/* ============================================================================
   CONTENT LAYER - Copy & CTA
   ========================================================================= */

.hero-container {
  position: relative;
  z-index: var(--z-hero-content);
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--container-padding, 2rem);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--hero-height-mobile) - 120px);
}

.hero-text-content {
  text-align: center;
  max-width: 900px;
}

/* Badge */
.hero-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: var(--hero-badge-bg);
  border: 1px solid var(--hero-badge-border);
  border-radius: 100px;
  color: var(--hero-text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  /* Animation ready */
  opacity: 0;
  transform: translateY(-20px);
}

.hero-badge.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: 
    opacity var(--hero-transition-speed) var(--hero-easing),
    transform var(--hero-transition-speed) var(--hero-easing);
}

/* Main Title */
.hero-main-title {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--hero-text-primary);
  margin: 0 0 1.5rem;
  
  /* Animation ready */
  opacity: 0;
  transform: translateY(30px);
}

.hero-main-title.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: 
    opacity var(--hero-transition-speed) var(--hero-easing) 0.1s,
    transform var(--hero-transition-speed) var(--hero-easing) 0.1s;
}

/* Gradient Text */
.text-gradient {
  background: linear-gradient(
    135deg,
    var(--gradient-start) 0%,
    var(--gradient-end) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  
  /* Efecto shimmer sutil (opcional) */
  background-size: 200% 200%;
  animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Description */
.hero-description {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
  color: var(--hero-text-secondary);
  max-width: 700px;
  margin: 0 auto 2.5rem;
  
  /* Animation ready */
  opacity: 0;
  transform: translateY(30px);
}

.hero-description.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: 
    opacity var(--hero-transition-speed) var(--hero-easing) 0.2s,
    transform var(--hero-transition-speed) var(--hero-easing) 0.2s;
}

/* ============================================================================
   CTA ACTIONS - Buttons
   ========================================================================= */

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  
  /* Animation ready */
  opacity: 0;
  transform: translateY(30px);
}

.hero-actions.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: 
    opacity var(--hero-transition-speed) var(--hero-easing) 0.3s,
    transform var(--hero-transition-speed) var(--hero-easing) 0.3s;
}

/* Button Base (debe estar en base.css, aquí por coherencia) */
.orvit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s var(--hero-easing);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  /* GPU acceleration */
  transform: translateZ(0);
  will-change: transform;
}

.orvit-btn-primary {
  background: linear-gradient(
    135deg,
    var(--gradient-start) 0%,
    var(--gradient-end) 100%
  );
  color: #ffffff;
  box-shadow: 
    0 10px 30px -10px rgba(123, 47, 247, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.orvit-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 20px 40px -10px rgba(123, 47, 247, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

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

.orvit-btn-icon {
  display: flex;
  transition: transform 0.3s var(--hero-easing);
}

.orvit-btn:hover .orvit-btn-icon {
  transform: translateX(4px);
}

/* ============================================================================
   FLOATING OBJECT - Parallax Element
   ========================================================================= */

.hero-floating-object {
  position: absolute;
  z-index: var(--z-hero-floating);
  top: 50%;
  right: 10%;
  width: clamp(200px, 30vw, 400px);
  pointer-events: none;
  
  /* Parallax y animación controlada por JS */
  transform: translate3d(0, -50%, 0);
  will-change: transform;
  
  /* Entrada suave */
  opacity: 0;
  animation: float-in 1.5s var(--hero-easing) 0.5s forwards;
}

.hero-floating-object img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 20px 60px rgba(0, 212, 255, 0.3));
}

@keyframes float-in {
  to {
    opacity: 1;
  }
}

/* ============================================================================
   SCROLL INDICATOR - Mouse Icon
   ========================================================================= */

.hero-scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-hero-indicator);
  
  /* Animation ready */
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.hero-scroll-indicator.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition: 
    opacity var(--hero-transition-speed) var(--hero-easing) 0.5s,
    transform var(--hero-transition-speed) var(--hero-easing) 0.5s;
}

.mouse-icon {
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.wheel {
  width: 3px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  animation: scroll-wheel 2s ease-in-out infinite;
}

@keyframes scroll-wheel {
  0%, 100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ============================================================================
   RESPONSIVE - Mobile & Tablet
   ========================================================================= */

@media (max-width: 1024px) {
  .hero-floating-object {
    right: 5%;
    width: clamp(150px, 25vw, 300px);
  }
}

@media (max-width: 768px) {
  .hero-cosmic {
    min-height: 500px;
  }
  
  .hero-badge {
    font-size: 0.75rem;
    padding: 0.375rem 1rem;
    margin-bottom: 1.5rem;
  }
  
  .hero-main-title {
    margin-bottom: 1rem;
  }
  
  .hero-description {
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .orvit-btn {
    width: 100%;
    justify-content: center;
    max-width: 320px;
  }
  
  .hero-floating-object {
    display: none; /* Oculto en mobile para mejor performance */
  }
  
  .hero-scroll-indicator {
    bottom: 2rem;
  }
}

/* ============================================================================
   ACCESSIBILITY - Screen Reader Only
   ========================================================================= */

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

/* ============================================================================
   PERFORMANCE - Reduce Motion
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .hero-cosmic * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-floating-object {
    animation: none;
  }
  
  .wheel {
    animation: none;
  }
  
  .text-gradient {
    animation: none;
  }
}