/**
 * Ana Ayala - Estilos Personalizados
 * Centralización de variables, fondo de degradados tinto, cuadrícula Bento y profundidad 3D
 */

:root {
  /* Paleta cromática aprobada */
  --color-bg-base: #4a0723;
  --color-bg-dark: #360418;
  --color-bg-wine: #5b0c31;
  --color-bg-plum: #741038;
  --color-bg-raspberry: #9b1545;
  --color-bg-vibrant: #bb2d55;

  --color-crema: #fcf5e4;
  --color-crema-card: #fdf5e5;
  --color-vino: #80072d;
  --color-vino-dark: #4a071a;
  
  --color-coral: #fa6a5d;
  --color-coral-hover: #ff7c70;
  --color-coral-active: #e5594c;
  --color-coral-glow: rgba(250, 106, 93, 0.4);

  /* Tipografías */
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Radios y Geometría */
  --radius-card: 28px;
  --radius-card-sm: 20px;
  --radius-full: 9999px;

  /* Sombras y elevaciones */
  --shadow-card: 0 16px 36px -12px rgba(28, 2, 12, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-card-hover: 0 24px 48px -12px rgba(28, 2, 12, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.16);
  --shadow-btn: 0 8px 20px -4px rgba(250, 106, 93, 0.45);

  /* Transiciones */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================================
   Fondo de Degradados Modernos Tinto / Vino / Frambuesa
   ======================================================== */
.tinto-gradient-bg {
  background-color: var(--color-bg-dark);
  background-image: 
    radial-gradient(ellipse 70% 60% at 85% 8%, rgba(187, 45, 85, 0.72) 0%, transparent 60%),
    radial-gradient(ellipse 65% 55% at 15% 15%, rgba(155, 21, 69, 0.65) 0%, transparent 55%),
    radial-gradient(ellipse 80% 65% at 50% 92%, rgba(116, 16, 56, 0.68) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 5% 60%, rgba(91, 12, 49, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 95% 70%, rgba(116, 16, 56, 0.5) 0%, transparent 55%),
    linear-gradient(135deg, #430520 0%, #580a30 45%, #340417 100%);
  background-attachment: fixed;
}

/* Comportamiento fluido: En PC el primer bloque cuadra la pantalla y permite scroll hacia el footer */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  overflow-y: auto !important;
  overflow-x: hidden;
}

@media (min-width: 768px) and (min-height: 560px) {
  .site-main {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }
}

/* Feedback táctil reactivo en móvil: seguro para WebKit sin anular clicks */
.bento-wrapper,
.tilt-card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}

.card-touch-active {
  opacity: 0.93 !important;
  filter: brightness(0.97) !important;
  transition: opacity 0.08s ease, filter 0.08s ease !important;
}

/* Prevenir auto-zoom de iOS Safari / Chrome móvil al enfocar campos de texto */
input,
textarea,
select,
input[type="text"],
input[type="search"],
input[type="tel"],
input[type="email"] {
  font-size: 16px !important;
}

@media screen and (max-width: 1024px) {
  input,
  textarea,
  select,
  input:focus,
  textarea:focus,
  select:focus {
    font-size: 16px !important;
  }
}

/* ========================================================
   Cuadrícula Asimétrica Bento Grid (Desktop, Tablet, Móvil)
   ======================================================== */
.bento-container {
  width: 100%;
}

/* Disposición para Escritorio (>= 1024px) */
@media (min-width: 1024px) {
  .bento-container {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-template-rows: 1.55fr 1fr !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto;
  }

  /* Tarjeta 1: Conoce a Ana ocupa 4 columnas y 2 filas */
  .bento-container .bento-item-ana {
    grid-column: 1 / 5 !important;
    grid-row: 1 / 3 !important;
  }

  /* Fila 1 Derecha: Tarjeta 2 Identidad (4 cols) y Tarjeta 3 Comunidad (4 cols) */
  .bento-container .bento-item-identidad {
    grid-column: 5 / 9 !important;
    grid-row: 1 / 2 !important;
  }
  .bento-container .bento-item-comunidad {
    grid-column: 9 / 13 !important;
    grid-row: 1 / 2 !important;
  }

  /* Fila 2 Derecha: Tarjeta 4 Trayectoria (5 cols) y Tarjeta 5 Noticias (3 cols) */
  .bento-container .bento-item-trayectoria {
    grid-column: 5 / 10 !important;
    grid-row: 2 / 3 !important;
  }
  .bento-container .bento-item-noticias {
    grid-column: 10 / 13 !important;
    grid-row: 2 / 3 !important;
  }
}

/* Disposición para Tablet (768px a 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .bento-container {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-template-rows: 1.4fr 1fr 1fr !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto;
  }

  /* Columna izquierda: Conoce a Ana abarca 2 filas */
  .bento-container .bento-item-ana {
    grid-column: 1 / 7 !important;
    grid-row: 1 / 3 !important;
  }

  /* Columna derecha: Identidad (arriba) y Trayectoria (abajo) */
  .bento-container .bento-item-identidad {
    grid-column: 7 / 13 !important;
    grid-row: 1 / 2 !important;
  }
  .bento-container .bento-item-trayectoria {
    grid-column: 7 / 13 !important;
    grid-row: 2 / 3 !important;
  }

  /* Fila inferior: Comunidad a la izquierda y Noticias a la derecha */
  .bento-container .bento-item-comunidad {
    grid-column: 1 / 7 !important;
    grid-row: 3 / 4 !important;
  }
  .bento-container .bento-item-noticias {
    grid-column: 7 / 13 !important;
    grid-row: 3 / 4 !important;
  }
}

/* Disposición para Móvil (< 768px) */
@media (max-width: 767px) {
  .bento-container {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  }

  /* 1. Conoce a Ana (ancho completo) */
  .bento-container .bento-item-ana {
    grid-column: 1 / 13 !important;
    order: 1 !important;
  }

  /* 2. Ana Ayala Identidad (ancho completo) */
  .bento-container .bento-item-identidad {
    grid-column: 1 / 13 !important;
    order: 2 !important;
  }

  /* 3. Nuestra comunidad (mitad izquierda) */
  .bento-container .bento-item-comunidad {
    grid-column: 1 / 7 !important;
    order: 3 !important;
  }

  /* 4. Últimas noticias (mitad derecha) */
  .bento-container .bento-item-noticias {
    grid-column: 7 / 13 !important;
    order: 4 !important;
  }

  /* 5. Mi trayectoria (ancho completo) */
  .bento-container .bento-item-trayectoria {
    grid-column: 1 / 13 !important;
    order: 5 !important;
  }
}

/* ========================================================
   Animaciones de Entrada y Efecto 3D
   ======================================================== */
.site-header {
  animation: headerFadeIn 0.6s var(--ease-smooth) both;
}

@keyframes headerFadeIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bento-wrapper {
  perspective: 1200px;
  animation: bentoFadeIn 0.8s var(--ease-smooth) both;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  transition: z-index 0.32s ease;
  cursor: pointer;
}

.bento-wrapper:hover {
  z-index: 20;
}

/* Cascada escalonada perceptible "uno por uno" en Escritorio */
@media (min-width: 1024px) {
  .bento-item-ana { animation-delay: 0.15s; }
  .bento-item-identidad { animation-delay: 0.35s; }
  .bento-item-comunidad { animation-delay: 0.55s; }
  .bento-item-trayectoria { animation-delay: 0.75s; }
  .bento-item-noticias { animation-delay: 0.95s; }
}

/* Cascada escalonada en Móvil y Tablet siguiendo el orden visual */
@media (max-width: 1023px) {
  .bento-item-ana { animation-delay: 0.15s; }
  .bento-item-identidad { animation-delay: 0.35s; }
  .bento-item-comunidad { animation-delay: 0.55s; }
  .bento-item-noticias { animation-delay: 0.75s; }
  .bento-item-trayectoria { animation-delay: 0.95s; }
}

/* Delays de respaldo */
.bento-wrapper:nth-child(1) { animation-delay: 0.15s; }
.bento-wrapper:nth-child(2) { animation-delay: 0.35s; }
.bento-wrapper:nth-child(3) { animation-delay: 0.55s; }
.bento-wrapper:nth-child(4) { animation-delay: 0.75s; }
.bento-wrapper:nth-child(5) { animation-delay: 0.95s; }

@keyframes bentoFadeIn {
  0% {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tarjeta 3D Tilt */
.tilt-card {
  transform-style: preserve-3d;
  box-shadow: var(--shadow-card);
  transition: scale 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.32s ease;
  will-change: transform, scale;
  height: 100%;
  width: 100%;
  flex: 1 1 auto;
  scale: 1;
  cursor: pointer;
}

.tilt-card:hover {
  scale: 1.018;
  box-shadow: var(--shadow-card-hover);
}

/* Efecto de presión táctil al hacer clic */
.tilt-card:active,
.bento-wrapper:active .tilt-card {
  scale: 0.982;
  box-shadow: 0 8px 20px -8px rgba(28, 2, 12, 0.45);
  transition: scale 0.1s ease-out, box-shadow 0.1s ease-out;
}

/* Capas internas para efecto 3D */
.card-content-layer {
  transform-style: preserve-3d;
}

/* Paralaje suave del fondo de imágenes y elementos decorativos */
.card-parallax-img {
  will-change: transform;
  transform-origin: center center;
  transform: scale(1.06) translate3d(0, 0, 0);
}

.card-parallax-blob {
  will-change: transform;
  transform-origin: center center;
  transform: translate3d(0, 0, 0);
}

.transform-depth-text {
  transform: translateZ(28px);
  transform-style: preserve-3d;
  transition: transform 0.25s ease;
}

.transform-depth-btn {
  transform: translateZ(38px);
  transform-style: preserve-3d;
  transition: transform 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.transform-depth-btn:active {
  transform: translateZ(30px) scale(0.92);
}

.transform-depth-badge {
  transform: translateZ(32px);
  transform-style: preserve-3d;
}

/* Hover en botones */
.transform-depth-btn:hover {
  transform: translateZ(46px) scale(1.05);
}

/* Recorte de reflejo Vanilla Tilt con bordes redondeados */
.js-tilt-glare {
  border-radius: var(--radius-card) !important;
  overflow: hidden !important;
}

/* ========================================================
   Estados de accesibilidad y foco visible
   ======================================================== */
:focus-visible {
  outline: 2px solid var(--color-coral) !important;
  outline-offset: 3px !important;
}

/* ========================================================
   Respeto estricto a prefers-reduced-motion
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .site-header,
  .bento-wrapper {
    animation: none !important;
    transform: none !important;
  }

  .tilt-card {
    transform: none !important;
    scale: 1 !important;
    transition: none !important;
  }

  .transform-depth-text,
  .transform-depth-btn,
  .transform-depth-badge {
    transform: none !important;
  }
}

/* Barra de desplazamiento estética para modales */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Ocultar scrollbar horizontal en filtros manteniendo navegación táctil */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ========================================================
   Animaciones Escalonadas (Stagger) para Modales de Contenido
   ======================================================== */
@keyframes modalStaggerIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.opacity-100 .modal-stagger-item {
  animation: modalStaggerIn 0.42s var(--ease-smooth) both;
}

.opacity-100 .modal-stagger-item:nth-child(1) { animation-delay: 0.05s; }
.opacity-100 .modal-stagger-item:nth-child(2) { animation-delay: 0.12s; }
.opacity-100 .modal-stagger-item:nth-child(3) { animation-delay: 0.19s; }
.opacity-100 .modal-stagger-item:nth-child(4) { animation-delay: 0.26s; }
.opacity-100 .modal-stagger-item:nth-child(5) { animation-delay: 0.33s; }

/* Timeline Filtering Transition */
.timeline-card.is-filtered-out {
  display: none !important;
}

.timeline-card.is-animated-in {
  animation: modalStaggerIn 0.38s var(--ease-smooth) both;
}

