/* ===========================
   VARIABLES
   =========================== */
:root {
  --color-primary: #C4A76D;
  --color-secondary: #AA8B56;
  --color-bg: #FDFBF5;
  --color-card: #F5EBDD;
  --color-footer: #EBDDC5;
  --color-text: #3E3E3E;
  --color-accent: #e67e22;
  --font-main: 'Montserrat', sans-serif;
  --font-title: 'Cinzel Decorative', cursive;
}

/* ===========================
   BASE & TYPOGRAPHY
   =========================== */
body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}
h1, h2, h3 {
  font-family: var(--font-title);
  color: var(--color-primary);
}

/* ===========================
   HEADER & NAVIGATION
   =========================== */
.header {
  background: rgba(253,251,245,0.95);
  backdrop-filter: blur(10px);
  position: fixed;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.container {
  width: 90%;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}
/* Desktop Navigation */
nav a {
  margin: 0 1rem;
  text-decoration: none;
  color: var(--color-secondary);
  font-weight: 600;
  transition: color .3s;
}
nav a:hover, .nav-mobile a:hover {
  background: rgba(0,0,0,0.07);
  color: var(--color-primary);
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
/* Mobile Navigation */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--color-secondary);
  cursor: pointer;
}
.nav-mobile {
  flex-direction: column;
  background: var(--color-bg);
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1001;
  display: flex;
  height: 0;
  overflow: hidden;
}
.nav-mobile.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  height: auto;
  overflow: visible;
}
.nav-mobile a {
  padding: 1rem;
  border-bottom: 1px solid #F5EBDD;
  color: var(--color-secondary);
}

/* ===========================
   HERO SECTION
   =========================== */
.hero {
  position: relative;
  height: 120vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background-image: url('portada.jpg');
  background-size: cover;
  background-position: top; /* <-- Esto ajusta la imagen hacia arriba */
  background-repeat: no-repeat;
}
.img-portada {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
}
.hero::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: -1;
}
.hero-content h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}
.hero-content p {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: #fff;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin-top: 2rem;
  transition: .4s;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.btn:hover {
  background: #F5EBDD;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  transform: translateY(-3px);
}
/* WhatsApp Button */
.btn-whatsapp {
  background: #25D366;
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.2rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: 0.3s;
}
.btn-whatsapp:hover {
  transform: scale(1.05);
}

/* ===========================
   SECTIONS & CARDS
   =========================== */
.section {
  padding: 4rem 2rem 3rem;
}
.card {
  background: var(--color-card);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  transition: .3s;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.25);
}

/* ===========================
   GRIDS (Noticias, Videos, Horarios)
   =========================== */
.noticias-grid, .video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
  gap: 3rem;
}
.noticia-img, .video-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1rem;
}
/* Horarios de Misa y Confesiones */
.horarios-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}
.horario-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(191,164,109,0.10);
  padding: 1.2rem 1.5rem;
  min-width: 250px;
  max-width: 350px;
  flex: 1 1 250px;
  text-align: left;
  transition: transform 0.2s, box-shadow 0.2s;
}
.horario-card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 6px 16px rgba(191,164,109,0.16);
}
.horario-card h3 {
  color: #bfa46d;
  margin-bottom: .7rem;
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
}
.horario-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.horario-card li {
  margin-bottom: .5rem;
  font-size: 1.05rem;
}
.horario-card i {
  margin-right: .5rem;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), color 0.3s;
}
.horario-card:hover i {
  transform: scale(1.2) rotate(-8deg);
  color: #e0c98d;
}

/* ===========================
   GALERÍA Y CARRUSEL
   =========================== */
.galeria-carrusel {
  position: relative;
  max-width: 900px;
  margin: 3rem auto 0 auto;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.carrusel {
  display: flex;
  transition: transform 0.5s ease-in-out;
}
.slide {
  min-width: 100%;
}
.carrusel img {
  width: 100%;
  height: 450px;
  object-fit: cover;
  border-radius: 10px;
}
.carrusel-controles {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  z-index: 5;
  transform: translateY(-50%);
  pointer-events: none;
}
.carrusel-controles button {
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  opacity: 0.8;
  transition: 0.3s;
  pointer-events: all;
}
.carrusel-controles button:hover {
  background: #8c713a;
  opacity: 1;
  filter: brightness(0.8);
}
.galeria-carrusel img, .noticia-img, .video-thumb {
  cursor: pointer;
  object-fit: cover;
  object-position: center;
}

/* ===========================
   CONTACTO & MAPA
   =========================== */
.contacto-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}
.map-responsive {
  overflow: hidden;
  padding-bottom: 56.25%;
  position: relative;
  height: 0;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 900px;
  margin: auto;
}
.map-responsive iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ===========================
   FOOTER & SOCIAL
   =========================== */
.footer {
  background: var(--color-footer);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--color-text);
}
.social-icons a {
  color: var(--color-primary);
  font-size: 2rem;
  margin: 0 1.5rem;
  transition: .3s;
}
.social-icons a:hover {
  color: var(--color-secondary);
}

/* ===========================
   ANIMACIONES GENERALES
   =========================== */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease, transform 1s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Fade-in y slide-up para tarjetas y secciones */
.animated-fadein {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(.4,0,.2,1), transform 0.7s cubic-bezier(.4,0,.2,1);
}
.animated-fadein.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   MENÚ ICONO ANIMADO
   =========================== */
#menu-icon {
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), color 0.3s;
}
#menu-icon.animated {
  transform: rotate(90deg) scale(1.9);
  color: var(--color-accent);
}

/* ===========================
   LIGHTBOX IMAGEN
   =========================== */
#lightbox-img {
  background: transparent;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s cubic-bezier(0.4,0,0.2,1);
  opacity: 1;
  cursor: zoom-in;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  display: block;
  margin: auto;
}
#lightbox-img.zoomed {
  cursor: zoom-out;
  transform: scale(2);
  z-index: 10001;
}
#lightbox-img.animating {
  opacity: 0;
  transform: scale(0.96);
}
#lightbox-img.slide-left {
  animation: slideLeft 0.4s;
}
#lightbox-img.slide-right {
  animation: slideRight 0.4s;
}
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(60px);}
  to { opacity: 1; transform: translateX(0);}
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-60px);}
  to { opacity: 1; transform: translateX(0);}
}

/* ===========================
   ACCESIBILIDAD
   =========================== */
a:focus, button:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .mobile-menu-btn { display: block; }
  .hero-content h1 { font-size: 2rem; }
  .hero-content p { font-size: 1rem; }
  .carrusel img { height: 300px; }
  .video-thumb { height: 180px; }
}
@media (max-width: 700px) {
  .horarios-grid {
    flex-direction: column;
    gap: 1rem;
  }
  .horario-card {
    max-width: 100%;
    min-width: 0;
  }
}

/* ===========================
   CALENDARIO DINÁMICO
   =========================== */
#calendar-container {
  max-width: 400px;
  width: 100%;
  margin: 0 auto 2rem auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 1rem;
  overflow-x: auto;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.calendar-header button {
  background: #bfa46d;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.2rem;
  cursor: pointer;
}
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}
.calendar-table th, .calendar-table td {
  padding: .5rem;
  width: 14.2%;
  min-width: 36px;
  box-sizing: border-box;
}
.calendar-day {
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}
.calendar-day:hover {
  background: #f5e9c6;
}
.has-event {
  background: #f7f3e7;
  position: relative;
}
.event-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #bfa46d;
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
}
/* Modal de eventos */
#event-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.7);
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: 99999;
}
#event-content {
  background: #fff;
  padding: 1rem;
  border-radius: 10px;
  min-width: 250px;
  max-width: 95vw;
  text-align: center;
  font-size: 1rem;
}
#event-modal button {
  margin-top: 1rem;
  background: #bfa46d;
  color: #fff;
  border: none;
  padding: .5rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
}
/* Responsive para móvil */
@media (max-width: 500px) {
  #calendar-container {
    padding: .5rem;
    font-size: 0.95rem;
  }
  .calendar-header span {
    font-size: 1rem;
  }
  .calendar-table th, .calendar-table td {
    padding: .3rem;
    min-width: 28px;
    font-size: 0.85rem;
  }
  #event-content {
    padding: .5rem;
    font-size: 0.95rem;
  }
}

/* ===========================
   TARJETAS DE EVANGELIO DEL DÍA
   =========================== */
.evangelio-card {
  background: #fffbe9;
  border-left: 5px solid #bfa46d;
  border-radius: 8px;
  padding: 1.2rem 1rem;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(191,164,109,0.08);
  font-family: 'Montserrat', serif;
}
.evangelio-cita {
  font-weight: bold;
  color: #bfa46d;
  margin-bottom: .5rem;
}
.evangelio-texto {
  font-size: 1.1rem;
  color: #333;
}
.evangelio-cargando, .evangelio-error {
  color: #bfa46d;
  font-style: italic;
}

/* ===========================
   MODAL HISTORIA
   =========================== */
/* Modal fondo */
.modal-historia {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
  padding: 1rem;
  animation: fadeInBg 0.4s;
}
@keyframes fadeInBg {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.7); }
}

/* Modal contenido */
.modal-historia-content {
  background: #fff;
  padding: 2rem 1.5rem;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-sizing: border-box;
  animation: modalZoomIn 0.4s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  transition: box-shadow 0.3s;
}
@keyframes modalZoomIn {
  from { transform: scale(0.85) translateY(40px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* Botón cerrar */
.cerrar-modal {
  position: absolute;
  top: 1rem; right: 1rem;
  font-size: 2.2rem;
  color: #333;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}
.cerrar-modal:hover {
  color: #b71c1c;
  transform: scale(1.15);
}

/* Responsive para móviles */
@media (max-width: 600px) {
  .modal-historia-content {
    padding: 1rem 0.5rem;
    max-width: 98vw;
    border-radius: 8px;
  }
  .cerrar-modal {
    top: 0.5rem; right: 0.5rem;
    font-size: 2rem;
  }
}
