/**
 * === SECTION TRANSITIONS & COHESION ===
 * Crea transiciones suaves entre secciones
 * Integra visualmente todas las partes del sitio
 */

/* ─────────────────────────────────────────────── */
/* 0. ADMIN BAR FIX — Espacio negro arriba del nav */
/* ─────────────────────────────────────────────── */

/* WordPress inyecta "margin-top: 32px" en <html> cuando el admin bar está activo.
   Esto empuja todo el contenido (incluyendo nuestro <nav fixed top-0>) hacia abajo,
   creando una franja negra visible. Resetamos eso aquí. */
html.admin-bar {
  margin-top: 0 !important;
}

/* El admin bar en sí mismo se posiciona fixed en top:0. Hacemos que el
   nav custom quede por encima usando z-index superior. */
html.admin-bar .wp-block-template-part nav,
html.admin-bar nav.fixed {
  top: 0 !important; /* ignorar el desplazamiento del admin bar */
  z-index: 100001 !important; /* 1 más que el admin bar (z-index: 99999) */
}

/* Ocultar el admin bar completamente en el frontend para una experiencia limpia.
   Los administradores pueden acceder al panel desde el dashboard directamente. */
#wpadminbar {
  display: none !important;
}

/* ─────────────────────────────────────────────── */
/* 1. GLOBAL THEME UNITY */
/* ─────────────────────────────────────────────── */

html, body {
  background-color: var(--og-surface-950);
  color: var(--og-text-100);
}

/* Línea de transición entre secciones */
section:not(:last-child)::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--og-emerald-500) 20%,
    var(--og-emerald-500) 80%,
    transparent 100%
  );
  opacity: 0;
  animation: slideIn 0.8s ease-out forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 0.3;
    transform: scaleX(1);
  }
}

/* ─────────────────────────────────────────────── */
/* 2. SECTION SPACING SYSTEM */
/* ─────────────────────────────────────────────── */

section {
  position: relative;
  transition: background-color 0.4s ease;
  scroll-margin-top: 80px; /* offset para sticky header */
}

/* Espaciado consistente: usa CSS variables */
.section-light-spacing {
  padding-block: clamp(24px, 6vw, 48px);
}

.section-normal-spacing {
  padding-block: clamp(32px, 8vw, 64px);
}

.section-heavy-spacing {
  padding-block: clamp(48px, 12vw, 96px);
}

/* ─────────────────────────────────────────────── */
/* 3. CONSISTENT BACKGROUNDS */
/* ─────────────────────────────────────────────── */

/* Todas las secciones usan la paleta del tema */
.bg-primary-dark {
  background-color: var(--og-surface-950);
}

.bg-primary-light {
  background-color: var(--og-surface-800);
}

.bg-emerald-dark {
  background: linear-gradient(135deg, 
    var(--og-surface-950) 0%,
    var(--og-emerald-900)/5 50%,
    var(--og-surface-950) 100%);
}

/* ─────────────────────────────────────────────── */
/* 4. HEADER & NAVIGATION INTEGRATION */
/* ─────────────────────────────────────────────── */

/* El <nav> custom ya tiene fixed/z-index en su HTML.
   Solo reseteamos el bloque wrapper de WordPress para
   que NO genere espacio negro adicional encima del nav. */
header,
.wp-block-template-part {
  background: transparent !important;
  border-bottom: none !important;
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  display: contents; /* colapsa el bloque wrapper sin afectar layout */
}

/* Reset de padding/flex en <nav> genérico — el nav custom
   usa grid-cols internamente y no debe ser sobreescrito */
nav {
  /* sin padding-block ni display:flex globales — el nav
     custom de navigation.html ya los define inline/Tailwind */
}

nav a {
  color: var(--og-text-100);
  text-decoration: none;
  position: relative;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

/* ─────────────────────────────────────────────── */
/* 5. HERO SECTION REFINEMENT */
/* ─────────────────────────────────────────────── */

.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    var(--og-surface-950) 0%,
    var(--og-surface-950)/0 50%);
  z-index: 2;
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom,
    transparent 0%,
    var(--og-surface-950) 100%);
  z-index: 3;
}

/* Parpadeo sutil del scroll indicator */
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(8px); opacity: 0.3; }
}

.scroll-indicator {
  animation: scrollBounce 2s ease-in-out infinite;
}

/* ─────────────────────────────────────────────── */
/* 6. CONTENT SECTION TRANSITIONS */
/* ─────────────────────────────────────────────── */

.content-section {
  position: relative;
  z-index: 1;
}

.content-section h2 {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--og-text-100);
  line-height: 1.2;
}

.content-section h3 {
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 500;
  color: var(--og-text-100);
  margin-bottom: 12px;
}

.content-section p {
  color: var(--og-text-400);
  line-height: 1.6;
  margin-bottom: 16px;
  font-size: 16px;
}

/* ─────────────────────────────────────────────── */
/* 7. DECORATIVE ELEMENTS */
/* ─────────────────────────────────────────────── */

/* Línea decorativa */
.decorative-line {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg,
    var(--og-emerald-400),
    var(--og-emerald-400),
    transparent);
  margin-bottom: 16px;
  animation: expandWidth 0.8s ease-out;
}

@keyframes expandWidth {
  from { width: 0; }
  to { width: 48px; }
}

/* Punto focal */
.focal-point {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--og-emerald-400);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.focal-point::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--og-emerald-400);
  animation: pulse 2s ease-in-out infinite;
}

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

/* ─────────────────────────────────────────────── */
/* 8. FOOTER INTEGRATION */
/* ─────────────────────────────────────────────── */

footer {
  background: var(--og-surface-900);
  border-top: 1px solid var(--og-emerald-500)/10;
  padding-block: 48px;
  margin-top: 80px;
}

footer .footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

footer .footer-links h4 {
  color: var(--og-text-100);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

footer .footer-links a {
  color: var(--og-text-400);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
  display: block;
  margin-bottom: 8px;
}

footer .footer-links a:hover {
  color: var(--og-emerald-400);
}

footer .footer-bottom {
  border-top: 1px solid var(--og-emerald-500)/10;
  padding-top: 24px;
  text-align: center;
  color: var(--og-text-600);
  font-size: 13px;
}

/* ─────────────────────────────────────────────── */
/* 9. LOADING & TRANSITIONS */
/* ─────────────────────────────────────────────── */

body.page-transition {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0.8;
  }
}

/* Scroll progress bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg,
    var(--og-emerald-400),
    var(--og-emerald-500));
  z-index: 99999;
  pointer-events: none;
  transition: width 0.1s linear;
}

/* ─────────────────────────────────────────────── */
/* 10. RESPONSIVE ADJUSTMENTS */
/* ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  section {
    padding-inline: 16px;
  }

  .section-normal-spacing {
    padding-block: clamp(24px, 5vw, 48px);
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }

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

/* ─────────────────────────────────────────────── */
/* 11. DARK MODE REFINEMENT */
/* ─────────────────────────────────────────────── */

/* Asegurar que el tema oscuro está siempre activo */
:root,
html.dark,
[data-scheme="dark"] {
  color-scheme: dark;
}

/* Evitar problemas con inputs en modo oscuro */
input,
select,
textarea {
  color-scheme: dark;
  background-color: var(--og-surface-800);
  border-color: var(--og-emerald-500)/20;
}

/* ─────────────────────────────────────────────── */
/* 12. ANIMATIONS & ENTRANCE EFFECTS */
/* ─────────────────────────────────────────────── */

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.animate-in {
  animation: slideInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-in.delay-1 { animation-delay: 100ms; }
.animate-in.delay-2 { animation-delay: 200ms; }
.animate-in.delay-3 { animation-delay: 300ms; }
