/* =========================================================================
   VARIABLES & DESIGN SYSTEM
   Basado en estilos solicitados y la paleta Porcelain/White
   ========================================================================= */
:root {
  /* Fondo general basado en la paleta solicitada */
  --porcelain: #FDFEFC;
  --porcelain-2: #FDFFFA;
  --white: #FEFFFE;
  --white-2: #FEFDFE;
  --white-3: #FFFEFE;

  /* Colores de marca y tipografía */
  --brand-primary: #004b87;
  /* Azul corporativo del logo */
  --brand-primary-hover: #00335e;
  /* Azul más oscuro para el hover */
  --text-main: #2b2b2b;
  --text-muted: #1a1a1a;
  /* Gris muy oscuro para máximo contraste con el fondo */

  /* Tipografía */
  --font-serif: 'Cormorant Garamond', serif;
  --font-button: 'Lora', serif;
  /* Serif elegante y artística, menos rígida que una tipografía editorial clásica */
  --font-slab: 'Roboto Slab', serif;
  /* Para el efecto de video text mask */
  --font-script: 'Great Vibes', cursive;
  /* Fuente elegante italic para subtítulos decorativos */

  /* Espaciado general y Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --spacing-section: 5.5rem;
  /* Espacio negativo premium */

  /* Preloader */
  --preloader-bg: #FDFEFC;
}

/* =========================================================================
   RESETS & ACCESSIBILITY
   ========================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 50px;
  /* Evita que el header tape los anclajes */
}

body {
  font-family: var(--font-serif);
  color: var(--text-main);
  background-color: var(--porcelain);
  line-height: 1.6;
  overscroll-behavior: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

body.page-ready {
  opacity: 1;
}

body.page-leaving {
  opacity: 0;
}

/* Accesibilidad: Quitar outlines por defecto solo si se reemplazan */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 4px;
}

/* =========================================================================
   TYPOGRAPHY
   ========================================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  /* Guidelines: Evitar huerfanitas */
}

p {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-button);
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 4px 6px rgba(0, 75, 135, 0.2);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 75, 135, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--text-main);
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}

/* =========================================================================
   HEADER (STICKY & GLASSMORPHISM)
   ========================================================================= */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(253, 254, 252, 0.85);
  /* Porcelain con transparencia */
  backdrop-filter: blur(12px);
  /* Glassmorphism */
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-img,
.text-logo-img {
  object-fit: contain;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  padding: 0.5rem;
  margin-left: auto;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.social-header {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.social-icon {
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
  display: flex;
}

.social-icon svg {
  width: 28px;
  height: 28px;
}

.social-icon:hover {
  color: var(--brand-primary);
  transform: translateY(-2px);
}

.main-nav .nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.main-nav a {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--brand-primary);
}

/* Compensa de forma explícita el header fijo */
#main-content {
  padding-top: 76px;
}

/* =========================================================================
   HERO SECTION
   ========================================================================= */
.hero {
  position: relative;
  min-height: calc(100vh - 110px);
  /* Premium Full-Screen feel */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  overflow: hidden;
}

/* Fondo transparente parallax para TODA la página con logo gris oscuro */
.site-bg-logo {
  position: fixed;
  /* Se mantiene estático al hacer scroll - efecto parallax sutil */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95vw;
  /* Más grande en base al ancho */
  height: 95vh;
  max-width: 1200px;
  max-height: 1200px;
  background-image: url('referencias/main_logo.jpeg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.045;
  /* 30% de opacidad - más sutil para mejor contraste con el texto */
  filter: grayscale(100%);
  z-index: -9999;
  /* Asegurando que esté detrás de todo permanentemente */
  pointer-events: none;
  /* Que no interrumpa ningún click o arrastre */
  transition: opacity 0.5s ease-in-out;
  /* Fade suave al activar/desactivar */
}

/* Solo en index.html: el logo comienza invisible y se activa con scroll */
body.index-page .site-bg-logo {
  opacity: 0;
  /* Inicialmente invisible */
  transition: opacity 0.5s ease-in-out;
  /* Fade suave */
}

.hero-content {
  max-width: 800px;
  position: relative;
  z-index: 1;
  /* Aire extra entre header y bloque principal */
  margin-top: 0.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.hero-subtitle {
  font-size: clamp(1.35rem, 2.2vw, 1.55rem);
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* =========================================================================
   ABOUT US SECTION
   ========================================================================= */
.about-section {
  padding: var(--spacing-section) 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.about-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  align-items: center;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.about-text p {
  font-size: 1.35rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.about-more-link {
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.about-more-link:hover {
  color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

/* Asimetría inicial en las fotos de "Nosotros" */
.about-images {
  position: relative;
  height: 500px;
}

.img-placeholder {
  position: absolute;
  background-color: #E6E8E6;
  /* Gris muy clarito para placeholders */
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s ease;
}

.img-placeholder:hover {
  transform: scale(1.02);
}

/* Posición asimétrica */
.placeholder-1 {
  width: 60%;
  height: 300px;
  top: 0;
  left: 0;
}

.placeholder-2 {
  width: 55%;
  height: 350px;
  bottom: 0;
  right: 0;
  z-index: 2;
}

/* =========================================================================
   GALLERY SECTION (MASONRY ASIMÉTRICO)
   ========================================================================= */
.gallery-section {
  padding: var(--spacing-section) 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 5rem;
}

.gallery-header .section-title {
  font-family: var(--font-serif);
  font-weight: 600;
}

.gallery-header p {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
}

/* CSS Grid approach para masonry asimétrico */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 2rem;
  /* Espaciado negativo / aire */
}

.masonry-item {
  background-color: #E6E8E6;
  border-radius: var(--radius-md);
  cursor: pointer;
  /* El transform ahora lo maneja el JS para el efecto Z-axis, 
     así que eliminamos el translateY estático de aquí */
}

.masonry-item:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  /* El transform sobre el hover ahora entraría en conflicto con el motor 
     de animación de scroll, así que mantenemos el efecto visual vía sombras */
}

/* Distintos tamaños para romper el mosaico */
.item-large {
  grid-column: span 2;
  grid-row: span 2;
}

.item-wide {
  grid-column: span 2;
  grid-row: span 1;
}

/* Elementos de la columna derecha con desfase asimétrico elegante */
/* Usamos margin-top para no entrar en conflicto con el 'transform' de la animación JS */
.item-tall {
  grid-column: span 1;
  grid-row: span 2;
  margin-top: 80px;
}

.item-short {
  grid-column: span 1;
  grid-row: span 1;
  margin-top: 80px;
}

.item-medium {
  grid-column: span 1;
  grid-row: span 1;
  margin-top: 80px;
}

.item-short-2 {
  grid-column: span 2;
  grid-row: span 1;
  margin-top: 80px;
}

/* =========================================================================
   BOTTOM CTA SECTION
   ========================================================================= */
.bottom-cta {
  padding: var(--spacing-section) 2rem;
  background-color: var(--porcelain-2);
}

.cta-box {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  background: white;
  padding: 4rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}

.cta-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.cta-subtitle {
  color: var(--text-muted);
  font-size: 1.35rem;
  margin-bottom: 3rem;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer {
  background-color: #1A1A1A;
  /* Oscuro serio, como en la referencia */
  color: #FDFEFC;
  padding: 4rem 2rem 2rem;
}

.footer-container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 4rem;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 3rem;
}

.footer-logos-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.footer-logo {
  border-radius: 0;
  max-height: 70px;
  width: auto;
  object-fit: contain;
  /* Técnica avanzada para eliminar fondos blancos de JPEGs en paneles oscuros
     convirtiendo la forma a silueta luminosa y mezclando los oscuros al fondo */
  filter: grayscale(100%) invert(100%) brightness(200%);
  mix-blend-mode: screen;
}

.footer-logo-uach {
  border-radius: 0;
  max-height: 70px;
  width: auto;
  object-fit: contain;
}

.footer-logo-cioff {
  border-radius: 0;
  max-height: 75px;
  /* Ligeramente más alto para compensar su forma ovalada */
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.7);
  max-width: 300px;
  margin-bottom: 1.5rem;
}

.footer-socials {
  display: flex;
  gap: 1rem;
}

.footer-socials a {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s, transform 0.2s;
  display: inline-flex;
}

.footer-socials a:hover {
  color: #fff;
  transform: translateY(-2px);
}

.footer-heading {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.footer-links ul,
.footer-events ul {
  list-style: none;
}

.footer-links li,
.footer-events li {
  margin-bottom: 0.8rem;
}

.footer-links a,
.footer-events a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover,
.footer-events a:hover {
  color: #fff;
}

.highlight-link {
  color: var(--brand-primary) !important;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

/* =========================================================================
   RESPONSIVE (MOBILE FIRST / ADAPTIVE LAYOUTS)
   ========================================================================= */

/* Tablets and Mobile landscape */
@media (max-width: 900px) {

  /* Navegación colapsable */
  .mobile-menu-toggle {
    display: block;
    order: 2;
    /* Mueve el toggle al lado derecho */
  }

  .header-tools {
    display: none;
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
    order: 4;
  }

  .header-tools.mobile-active {
    display: flex;
  }

  .main-nav {
    display: none;
    width: 100%;
    order: 3;
    margin-top: 1rem;
  }

  .main-nav.mobile-active {
    display: flex;
    flex-direction: column;
    background: rgba(253, 254, 252, 0.98);
    border-top: 1px solid rgba(0, 75, 135, 0.1);
    border-bottom: 1px solid rgba(0, 75, 135, 0.1);
    padding: 0.5rem 0;
    margin-top: 0.75rem;
  }

  .main-nav .nav-links {
    flex-direction: column;
    gap: 0;
    align-items: center;
    padding: 0;
    width: 100%;
  }

  .main-nav .nav-links li {
    width: 100%;
    text-align: center;
  }

  .main-nav .nav-links a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .main-nav .nav-links li:last-child a {
    border-bottom: none;
  }

  .hero-actions {
    flex-direction: column;
  }

  .about-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  /* Resetear asimetría en pantallas menores */
  .about-images {
    height: 320px;
    position: relative;
  }

  .placeholder-1 {
    width: 65%;
    height: 180px;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
  }

  .placeholder-2 {
    width: 60%;
    height: 200px;
    position: absolute;
    bottom: 0;
    right: 0;
    margin: 0;
    margin-top: 0;
    margin-left: auto;
    z-index: 2;
  }

  /* Masonry a 2 columnas */
  .masonry-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-large,
  .item-wide,
  .item-short-2 {
    grid-column: span 2;
  }

  /* Footer a 1 columna */
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-brand p {
    margin: 0 auto 1.5rem auto;
  }

  .footer-socials {
    justify-content: center;
  }
}

/* Mobile Portrait */
@media (max-width: 500px) {
  .logo-img {
    height: 50px;
  }

  .text-logo-img {
    height: 40px;
  }

  .masonry-grid {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  .masonry-item {
    height: 250px;
  }
}

/* =========================================================================
   SCROLL TO TOP BUTTON
   ========================================================================= */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--brand-primary);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top-btn:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.scroll-top-btn svg {
  transition: transform 0.3s ease;
}

.scroll-top-btn:active {
  transform: scale(0.9);
}

/* =========================================================================
   PRELOADER (PANTALLA DE CARGA)
   ========================================================================= */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--preloader-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 0.8s ease, visibility 0.8s;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-content {
  text-align: center;
  position: relative;
}

.preloader-logo {
  width: 120px;
  height: auto;
  margin-bottom: 2rem;
  animation: pulse-elegant 2s infinite ease-in-out;
}

.preloader-bar {
  width: 200px;
  height: 2px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 1px;
  overflow: hidden;
  margin: 0 auto;
}

.preloader-progress {
  width: 100%;
  height: 100%;
  background-color: var(--brand-primary);
  transform: translateX(-100%);
  animation: preloader-loading 3s infinite linear;
}

.preloader-text {
  margin-top: 1rem;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: var(--brand-primary);
  opacity: 0.8;
}

@keyframes pulse-elegant {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes preloader-loading {
  0% {
    transform: translateX(-100%);
  }

  50% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Suavizar la carga de imágenes reales */
img {
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Base para el efecto de revelado dinámico y fluido (Scroll-Linked) */
.reveal-on-scroll {
  opacity: 0;
  transform: scale(0.9) translateZ(0);
  will-change: transform, opacity;
  /* Eliminamos la transición de CSS para que el JS controle el movimiento en tiempo real sin lag */
  transition: none;
}

/* Ocultar contenido mientras carga para evitar el flash de contenido sin estilo */
body.loading {
  overflow: hidden;
}

/* =========================================================================
   TIMELINE HORIZONTAL INMERSIVO (v3) - SECCION COMENTADA
   ========================================================================= */

/* 
.tl-intro-section { ... }
.tl-wrapper { ... }
... (Styles hidden) ...
*/

/* =========================================================================
   ZIGZAG BAFUACH — Video Text Mask
   ========================================================================= */
.zigzag-section {
  position: relative;
  width: 100%;
  height: 520px;
  padding-top: 200px;
  padding-bottom: 20px;
  overflow: hidden;
  background: transparent;
  margin-top: 0;
  z-index: 1;
}

.zigzag-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.zigzag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zigzag-svg {
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.zigzag-mobile {
  display: none;
}

.zigzag-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(to bottom, transparent 0%, #FDFEFC 100%);
  z-index: 3;
  pointer-events: none;
}

/* Ajuste responsive */
@media (max-width: 900px) {
  .zigzag-desktop {
    display: none;
  }

  .zigzag-mobile {
    display: block;
  }

  .zigzag-section {
    height: 420px;
    padding-top: 160px;
    padding-bottom: 15px;
  }
}

@media (max-width: 600px) {
  .zigzag-section {
    height: 340px;
    padding-top: 130px;
    padding-bottom: 12px;
  }
}