/* ========================================
   Tu Mejor Defensa - Custom Styles
   Premium Apple-Inspired Design
   ======================================== */

/* --- CSS Variables --- */
:root {
  --primary: #4D0085;
  --primary-dark: #2A004A;
  --accent: #C5A059;
  --accent-light: #D4B06F;
  --surface: #F7F5F8;
  --dark-purple: #2A004A;
}

/* --- Global Styles --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* scroll-behavior removed to avoid conflict with Lenis */
}

body {
  font-family: 'Public Sans', sans-serif;
  overflow-x: hidden;
}

/* ========================================
   SPLASH SCREEN - Premium Entry Experience
   ======================================== */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #0a001a; /* Deeper background */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.8s ease, visibility 0.8s, pointer-events 0.8s;
  pointer-events: auto;
}

#splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#splash-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(77, 0, 133, 0.4) 0%, transparent 70%);
  z-index: -1;
  animation: glowPulse 5s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

#splash-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

#splash-logo-container {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  filter: blur(10px);
  will-change: transform, opacity, filter;
}

#splash-logo-container img {
  width: 140px; /* Slightly larger */
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
  will-change: filter, transform;
}

/* Clean Apple-style Intro */

#splash-text {
  opacity: 0;
  transform: translateY(20px);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.8em;
  text-transform: uppercase;
  color: white; /* Pure white */
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
  margin-right: -0.8em;
  will-change: opacity, transform, letter-spacing;
  text-align: center;
}

@media (max-width: 768px) {
  #splash-text {
    font-size: 0.9rem; /* Smaller to fit one line */
    letter-spacing: 0.25em; /* Tighter spacing */
    margin-right: -0.25em;
  }
  
  #splash-logo-container img {
    width: 80px; /* Smaller logo */
  }

  #splash-progress-container {
    width: 160px;
    bottom: 60px;
  }
}

#splash-progress-container {
  position: absolute;
  bottom: 80px;
  width: 280px;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-light));
  border-radius: 10px;
  box-shadow: 0 0 30px var(--accent);
}

/* --- Glass Navigation --- */
.glass-nav {
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  backdrop-filter: blur(30px) saturate(200%);
  background-color: rgba(255, 255, 255, 0.75);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.glass-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(197, 160, 89, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.glass-nav.scrolled::before {
  opacity: 1;
}

.glass-nav.scrolled {
  background: linear-gradient(180deg, rgba(77, 0, 133, 0.95) 0%, rgba(42, 0, 74, 0.95) 100%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Logo and text color handling */
.nav-logo-img {
  transition: filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-logo-text {
  color: var(--primary);
  transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-nav.scrolled .nav-logo-img {
  filter: brightness(0) saturate(100%) invert(100%);
}

.glass-nav.scrolled .nav-logo-text {
  color: white;
}

.glass-nav.scrolled a,
.glass-nav.scrolled .nav-logo {
  color: white !important;
}

.glass-nav.scrolled #mobile-menu-btn {
  color: white !important;
}

.glass-nav.scrolled #mobile-menu-btn span {
  color: white !important;
}

/* Contact button: purple on white bg, gold on purple bg */
.nav-contact-btn {
  background-color: #4D0085 !important;
  color: white !important;
  transition: background-color 0.4s ease, color 0.4s ease !important;
}

.glass-nav.scrolled .nav-contact-btn {
  background-color: #C5A059 !important;
  color: white !important;
}

/* --- Hero Image Styling --- */
.hero-image-wrapper {
  position: relative;
  overflow: hidden;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-image-wrapper:hover .hero-image {
  transform: scale(1.05);
}

/* Hero 3D Parallax Container */
.hero-image-wrapper {
  will-change: transform;
  transform-style: preserve-3d;
}

/* --- Leadership Cards --- */
.leadership-card {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.leadership-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(77, 0, 133, 0.3);
}

/* --- Team Images --- */
.team-image {
  width: 100%;
  height: 500px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

.team-image:hover {
  transform: scale(1.05);
}

/* --- Tab Buttons --- */
.tab-btn {
  position: relative;
  transition: all 0.3s ease;
}

.tab-btn::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

.tab-btn.tab-active::before {
  width: 100%;
}

.tab-btn.tab-active {
  background-color: white;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(77, 0, 133, 0.1);
}

/* --- Tab Panels Animation --- */
.tab-panel {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Fade In Up Animation --- */
.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- WhatsApp Float --- */
.whatsapp-float {
  transition: all 0.3s ease;
}

.whatsapp-float:hover .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-10px);
}

.whatsapp-float .tooltip {
  transition: all 0.3s ease;
}

/* --- Mobile Menu --- */
/* --- Mobile Menu & Hamburger --- */
.mobile-menu-toggle {
  width: 30px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 100;
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 2px;
}

.glass-nav.scrolled .hamburger-line {
  background-color: white;
}

#mobile-menu-btn.active .line-1 {
  transform: translateY(9px) rotate(45deg);
}

#mobile-menu-btn.active .line-2 {
  opacity: 0;
  transform: translateX(-10px);
}

#mobile-menu-btn.active .line-3 {
  transform: translateY(-9px) rotate(-45deg);
}

.mobile-menu {
  -webkit-backdrop-filter: blur(25px) saturate(200%);
  backdrop-filter: blur(25px) saturate(200%);
  background-color: rgba(255, 255, 255, 0.9) !important; /* More opaque for readability */
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none; /* Prevent interaction when hidden */
}

.mobile-menu.active {
  transform: translateY(0) scale(1) !important;
  opacity: 1 !important;
  pointer-events: auto; /* Enable interaction when active */
}

.mobile-link {
  position: relative;
  transition: all 0.3s ease;
}

.mobile-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

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

/* --- Chart Container --- */
#successChart {
  max-height: 300px;
}

/* --- Form Styles --- */
#contact-form input,
#contact-form select,
#contact-form textarea {
  transition: all 0.3s ease;
}

#contact-form input:focus,
#contact-form select:focus,
#contact-form textarea:focus {
  outline: none;
  transform: translateY(-2px);
}

#contact-form button {
  transition: all 0.3s ease;
}

#contact-form button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(77, 0, 133, 0.3);
}

/* --- Section Hover Effects --- */
section {
  scroll-margin-top: 100px;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--dark-purple));
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

/* --- Button Hover Effects --- */
.bg-primary {
  transition: all 0.3s ease;
}

.bg-primary:hover {
  box-shadow: 0 8px 25px rgba(77, 0, 133, 0.3);
}

/* --- Card Hover Effects --- */
.bg-surface {
  transition: all 0.4s ease;
}

/* --- Gradient Background Animation --- */
.gradient-bg {
  background: linear-gradient(40deg, #ffffff, #ffffff);
  overflow: hidden;
}

.gradients-container {
  position: relative;
  width: 100%;
  height: 100%;
  filter: blur(60px); /* Hardware accelerated CSS blur */
  will-change: filter;
}

.gradient-blob {
  position: absolute;
  top: calc(50% - 25%);
  left: calc(50% - 25%);
  width: 50%;
  height: 50%;
  mix-blend-mode: hard-light;
  opacity: 1;
}

.blob-1 {
  background: radial-gradient(circle at center, rgba(197, 160, 89, 0.2) 0%, rgba(77, 0, 133, 0.15) 35%, transparent 70%);
  transform-origin: center center;
  width: 45%; /* Smaller */
  height: 45%; /* Smaller */
  animation: moveBlob1 20s ease-in-out infinite;
  --mx: 0px;
  --my: 0px;
  will-change: transform;
  opacity: 0.8; /* More subtle */
}

@keyframes moveBlob1 {
  0%, 100% { transform: translate3d(var(--mx), var(--my), 0) scale(1); }
  33% { transform: translate3d(calc(var(--mx) + 100px), calc(var(--my) - 50px), 0) scale(1.1); }
  66% { transform: translate3d(calc(var(--mx) - 50px), calc(var(--my) + 80px), 0) scale(0.9); }
}

@keyframes moveBlob2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-100px, 100px, 0) scale(1.2); }
}

@keyframes moveBlob3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(100px, -100px, 0) scale(1.2); }
}

/* --- Metrics Bar Animation --- */
[data-purpose="metrics-bar"] {
  position: relative;
}

[data-purpose="metrics-bar"] {
  position: relative;
  /* Shimmer removed for better scroll performance */
}

/* --- TikTok Grid Hover --- */
[data-purpose="tiktok-community"] img {
  transition: transform 0.5s ease;
}

[data-purpose="tiktok-community"] .group:hover img {
  transform: scale(1.1);
}

/* --- Footer Links --- */
footer a {
  position: relative;
  transition: all 0.3s ease;
}

footer a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .hero-image {
    object-position: center 15%;
  }

  .team-image {
    height: 350px;
  }

  .glass-nav {
    padding: 1rem;
  }

  h1 {
    font-size: 2.5rem !important;
  }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Focus States --- */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Print Styles --- */
@media print {

  .glass-nav,
  .whatsapp-float,
  .mobile-menu {
    display: none !important;
  }

  body {
    background: white !important;
  }

  section {
    page-break-inside: avoid;
  }
}