/* blocks.css - blog, promociones, botones flotantes, lightbox y animaciones de llegada */
:root {
  --wa: #25d366;
  --wa-dark: #128c7e;
}

#blog, #promociones { scroll-margin-top: 90px; }

/* ---------- botón WhatsApp reutilizable ---------- */
.btn-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--wa); color: #fff; font-weight: 700; font-size: .95rem;
  padding: .7rem 1.2rem; border-radius: 999px; text-decoration: none;
  transition: background .25s, transform .25s, box-shadow .25s;
}
.btn-wa:hover { background: var(--wa-dark); transform: translateY(-2px); box-shadow: 0 8px 18px -6px rgba(18, 140, 126, .6); }
.btn-wa i { font-size: 1.2rem; }

/* ---------- blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.8rem; }
.blog-card {
  display: flex; flex-direction: column; background: var(--white, #fff); border-radius: 20px;
  overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
  transition: transform .3s, box-shadow .3s;
}
.blog-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
/* La imagen se muestra completa (sin recortar ni deformar) sobre su propio fondo difuminado */
.blog-media, .promo-media {
  position: relative; display: block; overflow: hidden; background: #dfe8f3;
}
.blog-media { aspect-ratio: 4 / 5; }
.blog-media::before, .promo-media::before {
  content: ""; position: absolute; inset: -20px; background: var(--bg) center / cover; filter: blur(18px) saturate(1.1); opacity: .55;
}
.blog-media img, .promo-media img {
  position: relative; display: block; width: 100%; height: 100%; object-fit: contain;
}
.blog-card:hover .blog-media img { transform: scale(1.03); }
.blog-media img { transition: transform .5s; }
.blog-body { display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem 1.3rem 1.4rem; flex: 1; }
.blog-body time { font-size: .8rem; font-weight: 600; color: var(--accent); }
.blog-body h3 { font-size: 1.15rem; line-height: 1.3; color: var(--text-dark); margin: 0; }
.blog-body p { font-size: .92rem; color: var(--text-soft); line-height: 1.5; margin: 0; }
.blog-more { margin-top: auto; padding-top: .4rem; font-weight: 700; color: var(--primary); font-size: .9rem; }
.blog-more i { transition: transform .25s; }
.blog-card:hover .blog-more i { transform: translateX(4px); }

/* artículo */
.post-detail { max-width: 820px; }
.post-back a { color: var(--primary); font-weight: 600; text-decoration: none; }
.post-title { font-size: 2.2rem; line-height: 1.2; color: var(--primary-dark); margin: 1rem 0 .4rem; }
.post-date { display: block; color: var(--accent); font-weight: 600; margin-bottom: 1.5rem; }
.post-figure { margin: 0 0 2rem; text-align: center; background: var(--gray-light); border-radius: 20px; padding: 1rem; }
.post-figure img { max-width: 100%; max-height: 80vh; width: auto; height: auto; border-radius: 12px; }
.post-content p { font-size: 1.1rem; line-height: 1.75; color: var(--text-soft); margin-bottom: 1.1rem; }
.post-cta { text-align: center; margin-top: 2rem; }

/* ---------- promociones (carrusel infinito) ---------- */
.promo-section { background: var(--gray-light); padding-bottom: 3rem; overflow: hidden; }
.promo-head { padding-bottom: 0; }
.promo-slider { overflow: hidden; padding: .5rem 0 1rem; }
.promo-track { display: flex; width: max-content; }
.promo-track.is-animated { animation: promoScroll var(--promo-duration, 40s) linear infinite; }
.promo-slider:hover .promo-track, .promo-slider:focus-within .promo-track, .promo-slider.is-paused .promo-track { animation-play-state: paused; }
@keyframes promoScroll { to { transform: translateX(-50%); } }
.promo-card {
  flex: 0 0 auto; width: 300px; margin-right: 1.5rem; background: #fff; border-radius: 22px;
  box-shadow: var(--shadow-sm); padding: .8rem; display: flex; flex-direction: column; gap: .7rem;
}
.promo-media {
  width: 100%; aspect-ratio: 1 / 1; border: 0; padding: 0; border-radius: 16px; cursor: zoom-in;
}
.promo-zoom {
  position: absolute; right: .6rem; bottom: .6rem; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(11, 43, 92, .85); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .25s;
}
.promo-media:hover .promo-zoom, .promo-media:focus-visible .promo-zoom { opacity: 1; }
.promo-card h3 { font-size: .98rem; line-height: 1.3; margin: 0; color: var(--text-dark); min-height: 2.6em; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.promo-card .btn-wa { width: 100%; }
.promo-slider:not(.is-ready) { overflow-x: auto; }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 3000; background: rgba(5, 15, 35, .92); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1rem; }
.lb.open { display: flex; animation: lbIn .25s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb img { max-width: min(92vw, 900px); max-height: calc(100vh - 150px); width: auto; height: auto; object-fit: contain; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lb-title { color: #fff; font-weight: 600; text-align: center; max-width: 92vw; }
.lb-btn { position: absolute; background: rgba(255, 255, 255, .15); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; transition: background .2s; }
.lb-btn:hover { background: rgba(255, 255, 255, .3); }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }

/* ---------- botones flotantes ---------- */
.float-btn {
  width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center;
  color: #fff; font-size: 1.5rem; text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .4); transition: transform .25s, box-shadow .25s;
}
.float-btn:hover { transform: scale(1.1); }
.float-social { position: fixed; left: 16px; bottom: 20px; z-index: 1500; display: flex; flex-direction: column; gap: .7rem; }
.float-facebook { background: #1877f2; }
.float-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.float-tiktok { background: #111; }
.float-wa { position: fixed; right: 16px; bottom: 20px; z-index: 1500; display: flex; flex-direction: column; align-items: flex-end; gap: .8rem; }
.float-whatsapp { background: var(--wa); width: 62px; height: 62px; font-size: 1.9rem; animation: waPulse 2.4s infinite; }
@keyframes waPulse { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .6); } 70% { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }
.wa-panel { width: min(340px, calc(100vw - 32px)); max-height: min(70vh, 520px); background: #fff; border-radius: 18px; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .35); display: flex; flex-direction: column; overflow: hidden; }
.wa-panel[hidden] { display: none; }
.wa-panel.open { animation: waPanelIn .25s ease; }
@keyframes waPanelIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.wa-panel-head { display: flex; align-items: center; gap: .8rem; background: var(--wa-dark); color: #fff; padding: .9rem 1rem; }
.wa-panel-head > i { font-size: 1.8rem; }
.wa-panel-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.wa-panel-head small { opacity: .85; font-size: .78rem; }
.wa-close { background: transparent; border: 0; color: #fff; font-size: 1.1rem; cursor: pointer; padding: .3rem; }
.wa-panel-body { padding: .6rem .8rem; overflow-y: auto; flex: 1; background: #f4f7f6; }
.wa-faq { background: #fff; border-radius: 12px; margin: .45rem 0; padding: .7rem .9rem; font-size: .92rem; }
.wa-faq summary { cursor: pointer; font-weight: 600; color: var(--text-dark); }
.wa-faq p { margin: .5rem 0 0; color: var(--text-soft); line-height: 1.5; }
.wa-panel-cta { margin: .8rem; }

/* ---------- animaciones de llegada ---------- */
html.js[data-anim="1"] .reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
html.js[data-anim="1"] .reveal[data-reveal="left"] { transform: translateX(-40px); }
html.js[data-anim="1"] .reveal[data-reveal="right"] { transform: translateX(40px); }
html.js[data-anim="1"] .reveal[data-reveal="zoom"] { transform: scale(.92); }
html.js[data-anim="1"] .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js[data-anim="1"] .reveal { opacity: 1; transform: none; transition: none; }
  .promo-track.is-animated, .float-whatsapp { animation: none; }
}

@media (max-width: 640px) {
  #blog, #promociones { scroll-margin-top: 150px; }
  .promo-card { width: 250px; margin-right: 1rem; }
  .post-title { font-size: 1.7rem; }
  .float-btn { width: 46px; height: 46px; font-size: 1.25rem; }
  .float-whatsapp { width: 54px; height: 54px; font-size: 1.6rem; }
  .float-social { left: 10px; bottom: 14px; gap: .5rem; }
  .float-wa { right: 10px; bottom: 14px; }
}
