/* =========================================================
   Diócesis de Chiclayo – UI unificada (hero + header fijo)
   ========================================================= */

/* ---------- Variables y base ---------- */
:root{
  --primary:#1e73be;
  --accent:#2baf66;
  --bg:#f4fbf9;
  --paper:#fff;
  --ink:#1e2a35;
  --ink-2:#5a6b79;
  --ring:#e7eef0;
  --radius:12px;
  --shadow:0 8px 20px rgba(0,0,0,.06);

  --topbar-h:40px;
  --header-h:84px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body{
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  line-height:1.55; background:var(--bg); color:var(--ink);
  padding-top: calc(var(--topbar-h) + var(--header-h)); /* evita que el header fijo tape contenido */
}
a{ color:var(--primary); text-decoration:none; }
a:hover{ text-decoration:underline; }
h1,h2,h3,h4,h5,h6{ font-family: "Crimson Text", serif; }

/* ---------- Utilitarios ---------- */
.wrap{ max-width:1100px; margin:0 auto; padding:20px 14px 60px; }
.btn{
  display:inline-block; padding:8px 12px; border-radius:999px;
  background:var(--primary); border:1px solid var(--primary); color:#fff; font-size:13px;
}
.btn:hover{ filter:brightness(.95); }

/* ---------- Topbar ---------- */
#topbar{
  position:fixed; top:0; left:0; right:0; z-index:996;
  height:var(--topbar-h); display:flex; align-items:center;
  background:#008F4C; color:#fff; font-size:16px; font-weight:600;
}
#topbar i{ padding-right:6px; line-height:0; }

/* ---------- Header ---------- */
#header{
  position:fixed; top:var(--topbar-h); left:0; right:0; z-index:997;
  background:#fff; padding:20px 0; box-shadow:0 2px 15px rgba(0,0,0,.1);
}
#header .logo img{ max-height:60px; }
#header .menu a{ padding:.5rem .8rem; text-decoration:none; }

/* Botón Facebook en header */
.appointment-btn{
  margin-left:25px; background:#3b5998; color:#fff; border-radius:4px;
  padding:8px 25px; font-size:14px; display:inline-block;
}
.appointment-btn:hover{ color:#fff; }

/* ---------- Footer ---------- */
footer{
  border-top:1px solid var(--ring); color:var(--ink-2);
  padding:16px 12px; text-align:center;
}

/* =========================================================
   HERO / CARRUSEL – Tarjeta 16:9 con GLightbox
   ========================================================= */
.hero-card{
  max-width:1200px; margin:0 auto 28px;
  border-radius:16px; overflow:hidden; background:#000;
  box-shadow:0 16px 40px rgba(0,0,0,.12); position:relative;
}
.hero-card .carousel-item{ aspect-ratio:16/9; position:relative; background:#000; }
.hero-card .hero-img{
  width:100%; height:100%; object-fit:cover; display:block; pointer-events:none;
}
.hero-card .mini-caption{
  position:absolute; left:16px; right:16px; bottom:16px;
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:.6rem .9rem;
  background:linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
  color:#fff; z-index:5; pointer-events:none;
}
.hero-card .mini-caption h3{
  margin:0; font-weight:600; font-size:clamp(1rem,2vw,1.15rem);
  color:#fff; text-shadow:0 1px 2px rgba(0,0,0,.6); max-width:70ch;
}
.hero-card .mini-caption .btn{ pointer-events:auto; position:relative; z-index:6; white-space:nowrap; }
.hero-card .carousel-control-prev, .hero-card .carousel-control-next{ width:12%; z-index:4; }
.hero-card .carousel-control-prev-icon,.hero-card .carousel-control-next-icon{
  width:48px; height:48px; border-radius:999px; background-color:rgba(0,0,0,.35); background-size:60% 60%;
}
.hero-card .carousel-indicators{ margin:0; gap:6px; bottom:10px; z-index:4; }
.hero-card .carousel-indicators [data-bs-target]{ width:9px; height:9px; border-radius:999px; background-color:rgba(255,255,255,.55); border:0; }
.hero-card .carousel-indicators .active{ background-color:#fff; }

/* =========================================================
   GRID DE TARJETAS (con IMAGEN en el tope)
   ========================================================= */
.grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:16px; margin-top:14px;
}

/* Card base */
.card{
  background:var(--paper);
  border:1px solid var(--ring);
  border-radius:12px; overflow:hidden; box-shadow:var(--shadow);
  display:flex; flex-direction:column; height:100%;
}
.card.soft{ border:0; box-shadow:0 10px 28px rgba(0,0,0,.08); }

/* Imagen superior recortada a altura fija */
.card-hero-img{
  display:block;
  width:100%;
  height:160px;           /* alto visual de la franja superior */
  object-fit:cover;
  object-position:center;
}
@media (min-width: 992px){
  .card-hero-img{ height:180px; }
}

/* Cuerpo */
.card .body{ padding:14px; display:flex; flex-direction:column; gap:6px; }
.card h3{
  font-family:"Crimson Text", serif; font-size:20px; margin:0; color:var(--primary);
}
.card p{ margin:0 0 8px; color:var(--ink-2); font-size:14px; }
.card .btn{ align-self:flex-start; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width:900px){
  .wrap{ padding:16px 10px 40px; }
  .grid{ grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); }
  :root{ --header-h:92px; }
}
/* Variantes para páginas de detalle de portafolio */
body.portfolio-detail #topbar { top: 0; }
body.portfolio-detail header#header { 
  background:#fff; position:fixed; top:32px; left:0; right:0; z-index:1030;
  border-bottom: 1px solid #eee;
}
body.portfolio-detail header#header .menu { display: none !important; } /* Oculta menú */
body.portfolio-detail main { margin-top: 110px; }

/* Botón volver */
.header--detail .btn { padding: .45rem .8rem; }
.header--detail .logo img { height: 56px; width: auto; } /* más compacto en detalle */
@media (min-width: 992px){
  .header--detail .logo img { height: 64px; }
}
/* Asegura stacking correcto del carrusel */
.carousel,
.carousel-inner,
.carousel-item { position: relative; }

/* La leyenda siempre por encima de controles/indicadores */
.carousel .carousel-caption { 
  position: absolute;       /* Bootstrap ya lo trae, reforzamos */
  z-index: 30;              /* mayor que controles/indicadores */
}

/* Tu botón "Leer más" por encima de todo */
.carousel .btn-leer-mas {
  position: relative; 
  z-index: 50;              /* > caption/controles/indicadores */
  pointer-events: auto;     /* por si hay overlays con eventos */
}

/* (Opcional) si quieres fijarlo abajo a la derecha */
.carousel .caption-cta {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
}
/* Asegura contexto de stacking */
.carousel, .carousel-inner, .carousel-item { position: relative; }

/* Caja de la leyenda */
.carousel .carousel-caption.caption-cta{
  position: absolute;            /* ya la usabas */
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  max-width: min(92%, 980px);
  padding: .75rem 1rem;
  background: rgba(0,0,0,.45);   /* fondo translúcido */
  color: #fff;
  border-radius: .5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  backdrop-filter: blur(2px);    /* sutil desenfoque */
  z-index: 40;
}

/* Título más legible */
.carousel .carousel-caption h5,
.carousel .carousel-caption h3{
  margin: 0 0 .5rem 0;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}

/* Botón por encima y contrastado */
.carousel .btn-leer-mas{
  position: relative;
  z-index: 50;
  pointer-events: auto;
  font-weight: 600;
  border: 0;
}

/* Mejora contraste del btn primary sobre fondos claros */
.btn-leer-mas.btn-primary{
  background: #0d6efd;
}
.btn-leer-mas.btn-primary:hover{
  background: #0b5ed7;
}

/* Responsivo: más aire en móvil */
@media (max-width: 576px){
  .carousel .carousel-caption.caption-cta{
    padding: .6rem .8rem;
    bottom: .75rem;
  }
}
/* Layout con miniatura (thumb) a la izquierda */
#noticiaModal .noticia-partial.noticia--thumb .contenido-wrap{
  display: grid;
  grid-template-columns: 260px 1fr;  /* ancho miniatura + texto */
  gap: 1rem;
  align-items: start;
}
#noticiaModal .noticia-partial.noticia--thumb figure{
  margin: 0;
}
#noticiaModal .noticia-partial.noticia--thumb figure img{
  width: 100%;
  height: 180px;          /* tamaño fijo de la miniatura */
  object-fit: cover;
  border-radius: .5rem;
}
@media (max-width: 576px){
  #noticiaModal .noticia-partial.noticia--thumb .contenido-wrap{
    grid-template-columns: 1fr;      /* stack en móvil */
  }
  #noticiaModal .noticia-partial.noticia--thumb figure img{
    height: 200px;
  }
}
/* Modal ancho cómodo */
#noticiaModal .modal-dialog.modal-xl { max-width: 980px; }

/* Espaciado y tipografía */
#noticiaModal .noticia-content { max-width: 900px; }

/* Imagen principal más pequeña y siempre contenida */
#noticiaModal .noticia-partial figure {
  margin: 0 0 1rem 0;
}
#noticiaModal .noticia-partial figure img{
  display: block;
  width: 100%;
  height: auto;           /* responsive */
  max-height: 340px;      /* <-- AJUSTA EL TAMAÑO AQUÍ */
  object-fit: cover;      /* recorte elegante si la foto es muy alta */
  object-position: center;
  border-radius: .5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

/* ===== Modal de noticia: marco general ===== */
#noticiaModal .modal-dialog.modal-xl{ max-width: 980px; }
#noticiaModal .modal-content{ border:0; border-radius:14px; overflow:hidden; }
#noticiaModal .modal-body{ padding:0; background:#f7f9fb; }

/* ===== Article ===== */
.noticia-article{
  margin:0 auto;
  padding: 20px 22px 28px;
  max-width: 860px;
  background:#fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.08);
}

/* Cabecera */
.noticia-article .categoria{
  display:inline-block; font-size:.75rem; font-weight:600;
  text-transform:uppercase; letter-spacing:.04em;
  background:#e9f2ff; color:#0d6efd; padding:.25rem .5rem; border-radius:999px;
  margin-bottom:.5rem;
}
.noticia-article h1{
  font-family: "Crimson Text", serif;
  font-weight:700; line-height:1.2;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  margin:0 0 .25rem 0;
}
.noticia-article .meta{
  display:flex; flex-wrap:wrap; gap:.75rem; color:#6c757d; font-size:.93rem;
  margin-bottom: .75rem;
}
.noticia-article .meta i{ margin-right:.35rem; }

/* Portada pequeña (opcional) */
.noticia-article .cover{
  margin: .25rem 0 1rem 0;
}
.noticia-article .cover img{
  width:100%; height:auto; max-height:280px; object-fit:cover;
  border-radius:10px; box-shadow:0 6px 16px rgba(0,0,0,.12);
}

/* Texto */
.noticia-article .lead{
  font-size:1.05rem; color:#3d4a5a; margin-bottom:.75rem; font-weight:500;
}
.noticia-article .dropcap:first-letter{
  float:left; font-size:2.6rem; line-height:1; padding-right:.22rem; font-weight:700; color:#0d6efd;
}
.noticia-article .contenido{ max-width: 70ch; }
.noticia-article .contenido p{ margin:0 0 .9rem 0; text-align:justify; }
.noticia-article .contenido h2, 
.noticia-article .contenido h3{ margin:1.2rem 0 .4rem; font-weight:600; }
.noticia-article .contenido img{ max-width:100%; height:auto; border-radius:8px; margin:.5rem 0; }
.noticia-article .contenido blockquote{
  margin: .8rem 0; padding:.6rem .9rem; border-left:4px solid #0d6efd1f; background:#f5f9ff;
  color:#334155; border-radius:6px;
}

/* Pie */
.noticia-article .divider{ height:1px; background:#eef2f6; margin:1rem 0; }
.noticia-article .tags{ display:flex; gap:.5rem; flex-wrap:wrap; }
.noticia-article .tag{
  font-size:.8rem; background:#f1f5f9; color:#475569; border-radius:999px; padding:.25rem .6rem;
}
/* === Modal Noticias: límites firmes === */
#noticiaModal .modal-dialog.modal-xl{ max-width: 980px; }
#noticiaModal .modal-body{ overflow-x: hidden; }   /* sin scroll horizontal */

/* Contenedor del artículo */
#noticiaModal .noticia-article{ max-width: 860px; margin: 0 auto; }

/* Imagen de portada: más pequeña SIEMPRE */
#noticiaModal .noticia-article .cover img{
  display:block;
  width:100%;
  height:auto;
  max-height: 220px;        /* <-- AJUSTA aquí: 180–260px según gusto */
  object-fit: cover;        /* recorte elegante */
  object-position: center;
  border-radius: 10px;
}

/* Por si alguna noticia trae <img> sueltas gigantes */
#noticiaModal .noticia-article img{
  max-width:100% !important;
  height:auto !important;
}

/* Evita que algo cree ancho extra */
#noticiaModal .noticia-article,
#noticiaModal .noticia-article *{
  box-sizing: border-box;
  max-width: 100%;
}
/* ===========================
   RESPONSIVE CELULAR
   =========================== */

/* HOME GRID */
#home {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  padding: 16px;
}

/* AREAS */
.area {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
}

.num {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2f8f83;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

  /* Oculta sidebar */
  #side {
    display: none;
  }

  /* Layout vertical */
  #layout {
    display: block;
    padding: 12px;
  }

  /* Hero */
  .hero-icon h2 {
    font-size: 1.3rem;
    text-align: center;
  }

  .hero-icon i {
    font-size: 40px;
  }

  /* Áreas en columna */
  .area {
    flex-direction: column;
    align-items: flex-start;
  }

  .num {
    margin-bottom: 6px;
  }

  /* Botones */
  .btn {
    width: 100%;
    text-align: center;
  }

}
/* ===========================
   HEADER / MENU RESPONSIVE
   =========================== */

.menu-toggle{
  display:none;
  border:0;
  background:#0b5ed7;
  color:#fff;
  width:40px;
  height:40px;
  border-radius:10px;
  font-size:22px;
  line-height:40px;
}

/* Ajusta el header en general (si tienes .header-inner o similar) */
header .container,
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

/* MOBILE */
@media (max-width: 768px){

  /* muestra botón */
  .menu-toggle{ display:inline-flex; align-items:center; justify-content:center; }

  /* el nav se vuelve desplegable */
  #mainNav{
    display:none;           /* cerrado por defecto */
    position:absolute;
    left:12px;
    right:12px;
    top:70px;               /* ajusta si tu header es más alto */
    background:#fff;
    border:1px solid rgba(0,0,0,.08);
    border-radius:12px;
    padding:10px;
    box-shadow:0 10px 30px rgba(0,0,0,.12);
    z-index:9999;
  }

  /* cuando esté abierto */
  #mainNav.open{ display:block; }

  /* links en columna */
  #mainNav a{
    display:block;
    padding:10px 12px;
    border-radius:10px;
  }

  #mainNav a:hover{
    background:rgba(11,94,215,.08);
  }
}
/* =========================
   MENU RESPONSIVE FIX
   ========================= */

.menu-toggle{
  display:none;
  border:0;
  background:#2f6fb3;
  color:#fff;
  width:42px;
  height:42px;
  border-radius:10px;
  font-size:22px;
  line-height:42px;
  align-items:center;
  justify-content:center;
}

/* MOBILE */
@media (max-width: 768px){

  .menu-toggle{
    display:flex;
  }

  #mainNav{
    display:none;
    position:absolute;
    left:12px;
    right:12px;
    top:85px; /* ajusta si tu header es más alto */
    background:#fff;
    border-radius:12px;
    padding:12px;
    box-shadow:0 10px 25px rgba(0,0,0,.15);
    z-index:9999;
  }

  /* ESTA LINEA ES LA CLAVE */
  #mainNav.open{
    display:block;
  }

  #mainNav a{
    display:block;
    padding:10px;
    border-radius:8px;
  }

  #mainNav a:hover{
    background:#f2f2f2;
  }
}
/* ===========================
   HEADER / MENU RESPONSIVE
   =========================== */

.menu-toggle{
  display:none;
  border:0;
  background:#2f6fb3;
  color:#fff;
  width:42px;
  height:42px;
  border-radius:10px;
  font-size:22px;
  line-height:42px;
  align-items:center;
  justify-content:center;
}

/* MOBILE */
@media (max-width: 768px){
  #header .container{ position: relative; }

  .menu-toggle{
    display:flex;
  }

  /* NAV como dropdown */
  #mainNav{
    display:none;
    position:absolute;
    left:12px;
    right:12px;
    top:85px; /* ajusta si tu header cambia */
    background:#fff;
    border-radius:12px;
    padding:12px;
    box-shadow:0 10px 25px rgba(0,0,0,.15);
    z-index:9999;
  }

  /* ESTO HACE QUE ABRA */
  #mainNav.open{
    display:block;
  }

  #mainNav a{
    display:block;
    padding:10px 12px;
    border-radius:10px;
  }

  #mainNav a:hover{
    background:#f2f2f2;
  }
}
@media (max-width: 768px){
  #mainNav{ display:none; }
  #mainNav.open{ display:block; }
}
/* ================================
   FIX DEFINITIVO MENU HEADER
   ================================ */

/* contenedor del menú */
#mainNav,
.nav {
  display: flex;
  align-items: center;
  gap: 18px;              /* 👈 AQUÍ se arregla lo “pegado” */
}

/* links del menú */
#mainNav a,
.nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  font-weight: 500;
  white-space: nowrap;
}

/* botón facebook */
#mainNav .appointment-btn {
  padding: 8px 12px;
  border-radius: 6px;
  margin-left: 6px;
}

/* responsive: móvil */
@media (max-width: 991px) {
  #mainNav,
  .nav {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 16px;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    display: none; /* controlado por menu.js */
  }

  #mainNav.show {
    display: flex;
  }
}
