/* ============================================================
   BASE.CSS — Prina Web
   Variables, @font-face, reset, utilidades globales
   ============================================================ */

/* ------------------------------------------------------------
   @font-face — Gotham (self-hosted)
   ------------------------------------------------------------ */
@font-face {
  font-family: 'Gotham';
  src: url('../fonts/GOTHAM-ULTRA.OTF') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gotham';
  src: url('../fonts/GOTHAM-MEDIUM.OTF') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gotham';
  src: url('../fonts/GOTHAM-LIGHT.OTF') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gotham';
  src: url('../fonts/GOTHAM-LIGHTITA.OTF') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------
   Design Tokens — Paleta oficial del manual de marca Prina
   ------------------------------------------------------------ */
:root {
  /* Colores */
  --color-primary:  #004C94;   /* Azul Prina — logos, fondos, titulares */
  --color-white:    #FFFFFF;
  --color-gray:     #808080;   /* Cuerpo de texto largo */
  --color-accent:   #0098F7;   /* Azul Eléctrico — ~10%, CTAs, detalles */
  --color-dark:     #000e1c;   /* Fondo oscuro derivado del azul primario */
  --color-dark-mid: #001830;   /* Intermedio para cards sobre oscuro */
  --color-text:     #1a1a1a;   /* Texto sobre fondo claro */
  --color-border:   #e0e8f0;   /* Bordes suaves */

  /* Tipografía */
  --font: 'Gotham', 'Helvetica Neue', Arial, sans-serif;
  --fw-ultra:  900;
  --fw-medium: 500;
  --fw-light:  300;

  /* Escala tipográfica (fluid) */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-md:   1.125rem;  /* 18px */
  --text-lg:   1.375rem;  /* 22px */
  --text-xl:   1.75rem;   /* 28px */
  --text-2xl:  2.25rem;   /* 36px */
  --text-3xl:  3rem;      /* 48px */
  --text-4xl:  3.75rem;   /* 60px */

  /* Espaciado */
  --space-xs:   8px;
  --space-sm:  16px;
  --space-md:  32px;
  --space-lg:  64px;
  --space-xl:  96px;
  --space-2xl: 128px;

  /* Layout */
  --container-max: 1240px;
  --container-pad:  24px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 16px;

  /* Transiciones */
  --transition: 0.22s ease;
}

/* ------------------------------------------------------------
   Reset + Base
   ------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font);
  font-weight: var(--fw-light);
  color: var(--color-text);
  background: var(--color-white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* SVGs: bloque pero sin altura auto que los expanda */
svg {
  display: block;
  overflow: hidden;
  flex-shrink: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-ultra);
  line-height: 1.15;
  color: var(--color-primary);
}

p {
  font-weight: var(--fw-light);
  color: var(--color-gray);
  line-height: 1.7;
}

/* ------------------------------------------------------------
   Container
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ------------------------------------------------------------
   Utilidades de texto
   ------------------------------------------------------------ */
.text-ultra  { font-weight: var(--fw-ultra); }
.text-medium { font-weight: var(--fw-medium); }
.text-light  { font-weight: var(--fw-light); }
.text-italic { font-style: italic; }

.text-primary { color: var(--color-primary); }
.text-white   { color: var(--color-white); }
.text-gray    { color: var(--color-gray); }
.text-accent  { color: var(--color-accent); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }
.text-4xl  { font-size: var(--text-4xl); }

.text-upper { text-transform: uppercase; letter-spacing: 0.1em; }
.text-center { text-align: center; }

/* ------------------------------------------------------------
   Utilidades de layout
   ------------------------------------------------------------ */
.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;
}

/* Elemento decorativo: filamento del manual de marca */
.filament {
  position: absolute;
  pointer-events: none;
  opacity: 0.07;
  overflow: hidden;
}

/* Bullet de sección — punto circular azul */
.section-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.section-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--fw-light);
  color: rgba(255,255,255,0.65);
  margin-bottom: var(--space-md);
}

.breadcrumb a { color: rgba(255,255,255,0.65); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--color-white); }
.breadcrumb span { color: rgba(255,255,255,0.4); }

/* ------------------------------------------------------------
   Focus states — visibles para navegación por teclado
   ------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Evitar outline en clicks (solo mostrar en teclado) */
:focus:not(:focus-visible) { outline: none; }

/* ------------------------------------------------------------
   prefers-reduced-motion — accesibilidad WCAG 2.1 AA
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------
   Stat counter — estado inicial (animado por JS vía IntersectionObserver)
   ------------------------------------------------------------ */
.stat-number[data-count] {
  transition: none;
}

/* Responsive helpers
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  :root {
    --text-3xl: 2.25rem;
    --text-4xl: 2.75rem;
    --space-xl:  64px;
    --space-2xl: 80px;
  }
}

/* ------------------------------------------------------------
   Section divider — separador circular entre secciones
   ------------------------------------------------------------ */
.section-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  height: 64px;
  position: relative;
  z-index: 2;
  overflow: visible;
  background: transparent;
  pointer-events: none;
}

.section-divider-ring {
  position: relative;
  width: 12px;
  height: 12px;
}

/* Punto central */
.section-divider-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 8px rgba(0,152,247,0.8);
}

/* Anillo pulsante */
.section-divider-ring::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,152,247,0.4);
  animation: ring-pulse 2.4s ease-out infinite;
}

/* Segundo anillo desfasado */
.section-divider-ring span {
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  border: 1px solid rgba(0,152,247,0.18);
  animation: ring-pulse 2.4s ease-out 0.8s infinite;
  display: block;
}

@keyframes ring-pulse {
  0%   { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(2);   opacity: 0; }
}

/* Líneas a los lados del punto */
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(0,152,247,0.25));
  margin-inline: 20px;
}

.section-divider::after {
  background: linear-gradient(to left, transparent, rgba(0,152,247,0.25));
}

/* ------------------------------------------------------------
   SCROLL REVEAL
   ------------------------------------------------------------ */
.reveal-el {
  opacity: 0;
  transform: translateY(32px);
  /* Entrada: suave y lenta */
  transition:
    opacity  0.65s cubic-bezier(0.23, 1, 0.32, 1),
    transform 0.65s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-el.reveal-up    { transform: translateY(32px); }
.reveal-el.reveal-left  { transform: translateX(-32px); }
.reveal-el.reveal-right { transform: translateX( 32px); }
.reveal-el.reveal-scale { transform: scale(0.92) translateY(16px); }

/* Tilt springy — cards entran inclinadas y se enderezan */
.reveal-el.reveal-tilt-left {
  transform: rotate(-4deg) translateX(-24px) translateY(20px) scale(0.96);
  transition: opacity  0.72s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.72s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reveal-el.reveal-tilt-right {
  transform: rotate(4deg) translateX(24px) translateY(20px) scale(0.96);
  transition: opacity  0.72s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.72s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Clip-path wipe — imágenes se revelan como cortina horizontal */
.reveal-el.reveal-clip {
  opacity: 1;
  transform: none;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.1s cubic-bezier(0.77, 0, 0.175, 1);
}
.reveal-el.reveal-clip-right {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 100%);
  transition: clip-path 1.1s cubic-bezier(0.77, 0, 0.175, 1);
}
/* Mayor especificidad para sobrescribir .is-revealed en clips */
.reveal-el.reveal-clip.is-revealed,
.reveal-el.reveal-clip-right.is-revealed {
  clip-path: inset(0 0% 0 0);
  transition: clip-path 0.55s cubic-bezier(0.77, 0, 0.175, 1);
}

.reveal-el.is-revealed {
  opacity: 1;
  transform: none;
  /* Salida (cuando se remueve is-revealed): más rápida */
  transition:
    opacity  0.35s ease,
    transform 0.35s ease;
}

/* Sin animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  .reveal-el {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------
   HERO ENTRANCE ANIMATION (page load)
   ------------------------------------------------------------ */
@keyframes hero-enter {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

@keyframes hero-enter-scale {
  from { opacity: 0; transform: translateY(20px) scale(0.93); }
  to   { opacity: 1; transform: none; }
}

.hero-anim {
  animation: hero-enter 0.8s cubic-bezier(0.23, 1, 0.32, 1) both;
}
.hero-anim-1 { animation-delay: 0.05s; }
.hero-anim-2 { animation-delay: 0.18s; }
.hero-anim-3 { animation-delay: 0.32s; }
.hero-anim-4 { animation: hero-enter-scale 0.7s cubic-bezier(0.23, 1, 0.32, 1) 0.46s both; }
.hero-anim-5 { animation-delay: 0.62s; }

@media (prefers-reduced-motion: reduce) {
  .hero-anim, .hero-anim-1, .hero-anim-2,
  .hero-anim-3, .hero-anim-4, .hero-anim-5 {
    animation: none !important;
  }
}

/* ------------------------------------------------------------
   CLIP-PATH WIPE EN IMÁGENES HERO (páginas internas)
   ------------------------------------------------------------ */
@keyframes img-wipe {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

.hero-img-wipe {
  animation: img-wipe 1.3s cubic-bezier(0.77, 0, 0.175, 1) 0.05s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-img-wipe { animation: none !important; }
}

/* ------------------------------------------------------------
   SCROLL PROGRESS BAR
   ------------------------------------------------------------ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(to right, var(--color-accent), #00c4ff);
  z-index: 9999;
  pointer-events: none;
  transition: width 0.05s linear;
  box-shadow: 0 0 8px rgba(0, 152, 247, 0.6);
}

/* ------------------------------------------------------------
   PAGE LOADER — transición entre páginas
   ------------------------------------------------------------ */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-dark);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#page-loader.loader-visible {
  opacity: 1;
  pointer-events: auto;
}

#page-loader img {
  height: 48px;
  width: auto;
  animation: loader-pulse 1.2s ease-in-out infinite;
}

.loader-bar-track {
  width: 160px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--color-accent), #00c4ff);
  border-radius: 2px;
  animation: loader-bar 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loader-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.04); }
}

@keyframes loader-bar {
  from { width: 0%; }
  to   { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #page-loader img { animation: none; }
  .loader-bar-fill { animation: none; width: 100%; }
}
