/* ==========================================================================
   Primible — Instagram: grilla + modal (section-instagram-feed.php)
   ========================================================================== */

html.dark-mode .igf,
.igf { padding: clamp(56px, 8vw, 110px) 0; background: transparent !important; }

.igf__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 32px;
  margin-bottom: clamp(22px, 3vw, 36px);
}
.igf__head .sec-title { margin-bottom: 0 !important; }

.igf__follow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 8px 0 18px;
  border: 1.5px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}
.igf__follow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.igf__follow svg .instagram-icon-dot { fill: currentColor; stroke: none; }
.igf__follow-cta { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; background: #b114ff; }
.igf__follow:hover { border-color: #fff; }

/* Grilla: 7 columnas en escritorio, a todo el ancho con márgenes laterales */
.igf__grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(6px, .8vw, 12px);
  margin: 0 !important;
  padding: 0 clamp(16px, 4vw, 64px) !important;
  list-style: none !important;
}
.igf__grid li { margin: 0 !important; }

.igf__item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #303032;
  cursor: pointer;
}
.igf__item img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none !important; margin: 0 !important; object-fit: cover; transition: transform .5s ease, filter .3s ease; }
.igf__item::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(24, 24, 24, .55));
  opacity: 0;
  content: "";
  transition: opacity .3s ease;
}
.igf__item:hover img { transform: scale(1.05); }
.igf__item:hover::after { opacity: 1; }
.igf__item:focus-visible { outline: 3px solid #d66bff; outline-offset: 3px; }

.igf__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(24, 24, 24, .55);
  color: #fff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Me gusta, reproducciones y comentarios bajo cada publicación */
.igf__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  padding: 0 2px;
  color: rgba(255, 255, 255, .6);
  font-size: 11.5px;
  letter-spacing: .02em;
}
.igf__stats > span { display: inline-flex; align-items: center; gap: 4px; }
.igf__stats svg { flex: none; opacity: .85; }

/* ---------- Modal ---------- */
.igf-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px) clamp(56px, 6vw, 96px);
}
.igf-modal[hidden] { display: none; }

.igf-modal__backdrop { position: absolute; inset: 0; background: rgba(10, 10, 12, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.igf-modal__card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(300px, 420px);
  width: auto;
  max-width: 100%;
  height: min(88vh, 820px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 24px;
  background: #232325;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
  animation: igfIn .25s ease both;
}
@keyframes igfIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.igf-modal__media {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  aspect-ratio: 9 / 16;
  min-height: 0;
  overflow: hidden;
  background: #000;
}
.igf-modal__media img,
.igf-modal__media video { width: 100%; height: 100%; object-fit: contain; }
.igf-modal__media iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* Carrusel dentro del modal */
.igf-slide { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .25s ease; }
.igf-slide.is-active { opacity: 1; z-index: 1; }
.igf-car__btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  color: #18181b;
  cursor: pointer;
  transform: translateY(-50%);
}
.igf-car__btn--prev { left: 10px; }
.igf-car__btn--next { right: 10px; }
.igf-car__dots { position: absolute; bottom: 12px; left: 0; right: 0; z-index: 2; display: flex; justify-content: center; gap: 5px; }
.igf-car__dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.igf-car__dots span.is-active { background: #fff; }

.igf-modal__meta { display: grid; gap: 6px; }
.igf-modal__meta .igf__stats { margin: 0; padding: 0; font-size: 12.5px; color: rgba(255, 255, 255, .8); }
.igf-modal__fallback {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #b114ff;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
}

.igf-modal__mute {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(24, 24, 24, .6);
  color: #fff;
  cursor: pointer;
}

.igf-modal__side { display: flex; flex-direction: column; min-height: 0; }

.igf-modal__account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.igf-modal__account img { width: 40px; height: 40px; border-radius: 50%; background: #181818; object-fit: contain; box-shadow: 0 0 0 2px #b114ff; }
.igf-modal__account a { margin-right: auto; color: #fff !important; font-weight: 600; text-align: left; text-decoration: none !important; }
.igf-modal__close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.igf-modal__caption {
  flex: 1;
  overflow: auto;
  padding: 20px;
  color: rgba(255, 255, 255, .85);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.igf-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.igf-modal__date { color: rgba(255, 255, 255, .5); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.igf-modal__link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #b114ff;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}

.igf-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(35, 35, 37, .8);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}
.igf-modal__nav--prev { left: clamp(6px, 1.5vw, 24px); }
.igf-modal__nav--next { right: clamp(6px, 1.5vw, 24px); }
.igf-modal__nav:hover { border-color: #b114ff; background: #b114ff; }

/* ---------- Tablet y móvil ---------- */
@media (max-width: 1100px) {
  .igf__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .igf__grid li:nth-child(n + 9) { display: none; }
}

@media (max-width: 760px) {
  .igf__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 16px !important; }
  .igf__grid li:nth-child(n + 9) { display: list-item; }
  .igf__grid li:nth-child(n + 10) { display: none; }
  .igf__item { border-radius: 10px; }

  .igf-modal { padding: 0; }
  .igf-modal__card { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; width: 100%; height: 100%; border-radius: 0; }
  .igf-modal__media { width: 100%; height: 100%; aspect-ratio: auto; }
  .igf-modal__side { max-height: 42vh; }
  .igf-modal__account { order: -1; }
  .igf-modal__nav { top: auto; bottom: calc(42vh + 12px); transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .igf-modal__card { animation: none; }
  .igf__item img { transition: none; }
}

/* Reels con música con derechos: portada + acceso directo a Instagram */
.igf-modal__media > img { position: absolute; inset: 0; }
.igf-modal__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55));
  color: #fff !important;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none !important;
}
.igf-modal__play small { max-width: 26ch; color: rgba(255, 255, 255, .75); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.igf-modal__play-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding-left: 4px;
  border-radius: 50%;
  background: #b114ff;
  box-shadow: 0 14px 34px -10px rgba(177, 20, 255, .9);
}
.igf-modal__play:hover .igf-modal__play-icon { background: #c547ff; }
