:root {
  --hdu-navy: #1a2332;
  --hdu-navy-2: #23304a;
  --hdu-gold: #c9a24b;
  --hdu-gold-light: #e4c878;
  --hdu-cream: #faf7f0;
  --hdu-text: #2a2a2a;
  --hdu-muted: #6b6b6b;
  --hdu-border: #e6e1d6;
  --hdu-white: #ffffff;
  --hdu-radius: 10px;
  --hdu-shadow: 0 4px 20px rgba(26,35,50,.08);
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 76px; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: var(--hdu-text);
  background: var(--hdu-cream);
  line-height: 1.6;
}

.hidden { display: none !important; }

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

/* Loading / login screens */
#loading-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--hdu-navy); color: var(--hdu-gold-light); font-size: 1.1rem; z-index: 9999;
  flex-direction: column; gap: 12px;
}
#login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--hdu-navy); z-index: 9998; padding: 20px;
}
.login-box {
  background: var(--hdu-white); border-radius: var(--hdu-radius); padding: 40px 36px;
  width: 100%; max-width: 380px; box-shadow: var(--hdu-shadow); text-align: center;
}
.login-box h1 { font-size: 1.3rem; margin: 0 0 4px; color: var(--hdu-navy); }
.login-box p.sub { color: var(--hdu-muted); font-size: .9rem; margin: 0 0 24px; }
.login-box input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--hdu-border);
  border-radius: 8px; font-size: .95rem;
}
.login-box button {
  width: 100%; padding: 12px; background: var(--hdu-navy); color: var(--hdu-gold-light);
  border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; font-weight: 600;
}
.login-box button:hover { background: var(--hdu-navy-2); }
#login-error { color: #c0392b; font-size: .85rem; margin-top: 10px; min-height: 1.2em; }

/* Nav */
.hdu-nav {
  background: var(--hdu-navy); color: var(--hdu-white); position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.hdu-nav-inner {
  max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; flex-wrap: wrap; gap: 12px;
}
.hdu-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.hdu-logo img { height: 40px; width: auto; }
.hdu-links { display: flex; gap: 22px; flex-wrap: wrap; }
.hdu-links a { font-size: .95rem; opacity: .88; padding: 4px 0; border-bottom: 2px solid transparent; }
.hdu-links a:hover, .hdu-links a.active { opacity: 1; border-color: var(--hdu-gold); }
.hdu-nav-toggle { display: none; background: none; border: none; color: var(--hdu-white); font-size: 1.5rem; cursor: pointer; }

/* Franja de próximo evento */
.hdu-event-banner { background: var(--hdu-gold); }
.hdu-event-banner-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 20px; flex-wrap: wrap; color: var(--hdu-navy); font-size: .9rem;
}
.hdu-event-banner-meta { display: block; font-size: .82rem; opacity: .85; font-weight: 500; }
.hdu-event-banner-link { font-weight: 700; white-space: nowrap; }

@media (max-width: 760px) {
  .hdu-nav-toggle { display: block; }
  .hdu-links {
    display: none; flex-direction: column; width: 100%; gap: 4px;
    border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px;
  }
  .hdu-links.open { display: flex; }
  #transmision-titulo { font-size: 1.05rem !important; }
  .hdu-hero { min-height: 52vh; }
}

/* Layout helpers */
.hdu-container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.hdu-section { padding: 56px 0; }
.hdu-section.alt { background: var(--hdu-white); }
.hdu-section h2 {
  font-size: 1.8rem; color: var(--hdu-navy); margin: 0 0 8px; text-align: center;
}
.hdu-section .hdu-lead { text-align: center; color: var(--hdu-muted); max-width: 640px; margin: 0 auto 36px; }

/* Hero */
.hdu-hero {
  background: linear-gradient(135deg, var(--hdu-navy), var(--hdu-navy-2));
  color: var(--hdu-white); text-align: center; padding: 60px 20px;
  min-height: 65vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hdu-hero .verse { font-style: italic; color: var(--hdu-gold-light); max-width: 620px; margin: 0 auto 18px; font-size: 1.05rem; }
.hdu-hero h1 { font-size: 2.2rem; margin: 0 0 10px; }
.hdu-hero .cta { display: inline-flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-block; padding: 12px 24px; border-radius: 30px; font-weight: 600; cursor: pointer;
  border: 2px solid var(--hdu-gold); transition: .15s;
}
.btn-solid { background: var(--hdu-gold); color: var(--hdu-navy); }
.btn-solid:hover { background: var(--hdu-gold-light); }
.btn-outline { background: transparent; color: var(--hdu-white); }
.btn-outline:hover { background: rgba(255,255,255,.1); }

/* Cards grid */
.hdu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.hdu-card {
  background: var(--hdu-white); border-radius: var(--hdu-radius); overflow: hidden;
  box-shadow: var(--hdu-shadow); display: flex; flex-direction: column;
}
.hdu-card img { width: 100%; height: 170px; object-fit: cover; background: var(--hdu-border); }
.hdu-card-body { padding: 18px 20px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.hdu-card-body h3 {
  margin: 0 0 4px; font-size: 1.1rem; line-height: 1.3; color: var(--hdu-navy); font-weight: 700;
  display: inline-block; padding-bottom: 8px; border-bottom: 3px solid var(--hdu-gold); align-self: flex-start;
}
.hdu-card-body .meta { font-size: .8rem; color: var(--hdu-muted); }
.hdu-card-body p { margin: 0; color: var(--hdu-text); font-size: .92rem; }
.hdu-card-body .leer-mas {
  margin-top: auto; color: var(--hdu-navy); font-weight: 700; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em;
}

/* Ministerios (tarjeta con miniatura/ícono, no foto grande) */
.hdu-ministerio-card {
  background: var(--hdu-white); border-radius: var(--hdu-radius); box-shadow: var(--hdu-shadow);
  padding: 24px 20px; text-align: center;
}
.hdu-ministerio-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; overflow: hidden;
  background: var(--hdu-cream); border: 2px solid var(--hdu-gold);
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
}
.hdu-ministerio-icon img { width: 100%; height: 100%; object-fit: cover; }
.hdu-ministerio-card h3 { margin: 0 0 8px; color: var(--hdu-navy); font-size: 1.05rem; }
.hdu-ministerio-card p { margin: 0; color: var(--hdu-muted); font-size: .92rem; }

/* Mensaje del Pastor / Apóstol */
.hdu-pastor-card {
  display: flex; gap: 28px; align-items: center; background: var(--hdu-white);
  border-radius: var(--hdu-radius); box-shadow: var(--hdu-shadow); padding: 28px; flex-wrap: wrap;
}
.hdu-pastor-foto {
  width: 140px; height: 140px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 3px solid var(--hdu-gold); background: var(--hdu-cream);
}
.hdu-pastor-card blockquote { margin: 0 0 10px; font-style: italic; color: var(--hdu-text); white-space: pre-wrap; }
.hdu-pastor-card .nombre { color: var(--hdu-navy); font-weight: 700; }
.hdu-pastor-card .titulo { color: var(--hdu-muted); font-size: .85rem; }
.hdu-pastor-card .texto { flex: 1; min-width: 220px; }

/* Video embed */
.hdu-video-wrap { position: relative; padding-top: 56.25%; border-radius: var(--hdu-radius); overflow: hidden; box-shadow: var(--hdu-shadow); background: #000; }
.hdu-video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Video thumbnail (miniatura + botón de reproducir, para transmisiones pasadas) */
.hdu-video-thumb {
  position: relative; width: 100%; height: 170px; background: #000; cursor: pointer;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.hdu-video-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: .15s; }
.hdu-video-thumb:hover img { opacity: 1; }
.hdu-video-thumb .hdu-play-btn {
  position: absolute; width: 54px; height: 54px; border-radius: 50%; background: rgba(26,35,50,.75);
  color: var(--hdu-gold-light); display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; padding-left: 4px; transition: .15s;
}
.hdu-video-thumb:hover .hdu-play-btn { background: var(--hdu-navy); transform: scale(1.08); }
.hdu-video-thumb .hdu-video-wrap { padding-top: 0; height: 100%; }

/* Shorts (formato vertical, máx. 5) — crecen proporcional al ancho disponible
   (hasta un tope) para llenar la fila con hasta 5 shorts */
.hdu-shorts-grid { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.hdu-short-card { flex: 1 1 150px; max-width: 210px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hdu-short-title {
  font-size: .9rem; color: var(--hdu-navy); font-weight: 600; text-align: center; line-height: 1.3;
}
.hdu-short-thumb {
  position: relative; width: 100%; aspect-ratio: 9/16; background: #000; cursor: pointer;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: var(--hdu-radius); box-shadow: var(--hdu-shadow);
}
.hdu-short-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: .15s; }
.hdu-short-thumb:hover img { opacity: 1; }
.hdu-short-thumb .hdu-play-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(26,35,50,.75);
  color: var(--hdu-gold-light); display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; padding-left: 3px; transition: .15s;
}
.hdu-short-thumb:hover .hdu-play-btn { background: var(--hdu-navy); transform: scale(1.08); }

/* Gallery */
.hdu-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.hdu-gallery-grid img { width: 100%; height: 220px; object-fit: cover; border-radius: 8px; box-shadow: var(--hdu-shadow); cursor: pointer; }

/* Info blocks (horarios/contacto) */
.hdu-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.hdu-info-card { background: var(--hdu-white); border-radius: var(--hdu-radius); padding: 24px; box-shadow: var(--hdu-shadow); text-align: center; }
.hdu-info-card .icon { font-size: 1.8rem; margin-bottom: 10px; }
.hdu-info-card h4 { margin: 0 0 8px; color: var(--hdu-navy); }
.hdu-info-card p { margin: 4px 0; color: var(--hdu-muted); font-size: .92rem; }

/* Social */
.hdu-social-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hdu-social-links a {
  display: flex; align-items: center; gap: 10px; background: var(--hdu-white); padding: 14px 24px;
  border-radius: 30px; box-shadow: var(--hdu-shadow); font-weight: 600; color: var(--hdu-navy);
}
.hdu-social-links a:hover { background: var(--hdu-navy); color: var(--hdu-white); }

/* Footer */
.hdu-footer { background: var(--hdu-navy); color: rgba(255,255,255,.75); padding: 40px 20px 24px; margin-top: 40px; }
.hdu-footer .hdu-container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.hdu-footer h5 { color: var(--hdu-white); margin: 0 0 10px; font-size: .95rem; }
.hdu-footer a { opacity: .85; }
.hdu-footer a:hover { opacity: 1; color: var(--hdu-gold-light); }
.hdu-footer .copy { text-align: center; margin-top: 24px; font-size: .8rem; opacity: .6; }

/* Buttons for admin (reused) */
.hdu-btn { padding: 9px 16px; border-radius: 6px; border: 1px solid var(--hdu-navy); background: var(--hdu-navy); color: #fff; cursor: pointer; font-size: .88rem; }
.hdu-btn:hover { background: var(--hdu-navy-2); }
.hdu-btn.secondary { background: transparent; color: var(--hdu-navy); }
.hdu-btn.danger { background: #c0392b; border-color: #c0392b; }

/* Toast */
#hdu-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--hdu-navy); color: #fff; padding: 12px 22px; border-radius: 8px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 10000; box-shadow: var(--hdu-shadow);
}
#hdu-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#hdu-toast.err { background: #c0392b; }

/* Modal de noticia */
.hdu-modal-overlay {
  position: fixed; inset: 0; background: rgba(26,35,50,.8); z-index: 5000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.hdu-modal-box {
  background: var(--hdu-white); border-radius: var(--hdu-radius); max-width: 700px; width: 100%;
  max-height: 88vh; overflow-y: auto; position: relative; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.hdu-modal-close {
  position: absolute; top: 10px; right: 14px; font-size: 1.8rem; line-height: 1; cursor: pointer;
  color: #fff; background: rgba(26,35,50,.6); width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.hdu-modal-close:hover { background: var(--hdu-navy); }

/* Lightbox de fotos */
.hdu-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 5000;
  display: flex; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out;
}
.hdu-lightbox-content {
  display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; max-height: 100%;
}
.hdu-lightbox img { max-width: 100%; max-height: 80vh; border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.hdu-lightbox-caption { color: #fff; font-size: .95rem; text-align: center; max-width: 600px; }
.hdu-lightbox-caption:empty { display: none; }
.hdu-lightbox-close {
  position: absolute; top: 20px; right: 24px; font-size: 2rem; line-height: 1; color: #fff; cursor: pointer;
}
