/* instagram-gallery.css — galeria dinâmica do Instagram + lightbox + hero video.
   Estilo consistente com o design system Maple Bear (Caxias e BG):
   variáveis --red, --paper, --ink, --font-display, --font-ui já vêm do styles.css base. */

/* ===================== HERO VIDEO ===================== */
.ig-hero-video {
  position: relative;
  margin: clamp(2rem, 5vw, 4rem) auto;
  max-width: min(1100px, 92vw);
}
.ig-hero-video.ig-empty { display: none !important; }

.ig-hero-video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: var(--ink, #000);
  box-shadow:
    0 30px 80px -30px rgba(204, 18, 22, 0.35),
    0 12px 28px -10px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(204, 18, 22, 0.18);
}
@media (max-width: 720px) {
  .ig-hero-video__frame { aspect-ratio: 9 / 16; max-height: 80vh; max-width: 460px; margin-inline: auto; }
}

.ig-hero-video__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ig-hero-video__sound,
.ig-hero-video__link {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: background 200ms ease, transform 200ms ease;
}
.ig-hero-video__sound { bottom: 1rem; left: 1rem; padding: 0.55rem; }
.ig-hero-video__link  { bottom: 1rem; right: 1rem; }
.ig-hero-video__sound:hover, .ig-hero-video__link:hover {
  background: rgba(204, 18, 22, 0.9);
  transform: translateY(-1px);
}

/* ===================== SEÇÃO INSTAGRAM ===================== */
.ig-section {
  padding-block: clamp(3rem, 7vw, 5rem);
  background: var(--paper-warm, #F0DDD0);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}
.ig-section.ig-empty { display: none !important; }

.ig-section__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.ig-section__head {
  text-align: center;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.ig-section__eyebrow {
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red, #CC1216);
  font-weight: 600;
  margin: 0 0 0.6rem;
}
.ig-section__handwritten {
  font-family: var(--font-script, 'Caveat', cursive);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  color: var(--red-deep, #AA0413);
  display: block;
  margin: 0 0 0.3rem;
}
.ig-section__title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 350;
  line-height: 1.05;
  color: var(--ink, #000);
  margin: 0 auto 0.8rem;
  max-width: 18ch;
}
.ig-section__title em {
  font-style: italic;
  font-weight: 280;
  color: var(--red, #CC1216);
}
.ig-section__lede {
  font-family: var(--font-body, 'Spectral', serif);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  line-height: 1.6;
  color: var(--ink-soft, #2a2a2a);
  max-width: 52ch;
  margin: 0 auto;
}
.ig-stats {
  display: block;
  margin-top: 0.8rem;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.85rem;
  color: var(--ink-faint, #6a6a6a);
}
.ig-stats.ig-empty { display: none; }
.ig-stats strong { color: var(--red-deep, #AA0413); font-weight: 700; }

/* ===================== FILTROS ===================== */
.ig-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.ig-filter {
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.55rem 1.05rem;
  background: transparent;
  color: var(--ink-soft, #2a2a2a);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: all 200ms ease;
}
.ig-filter:hover {
  background: rgba(204, 18, 22, 0.08);
  border-color: rgba(204, 18, 22, 0.3);
}
.ig-filter--active {
  background: var(--red, #CC1216);
  color: var(--paper, #F6E9E1);
  border-color: var(--red, #CC1216);
}

/* ===================== GRID ===================== */
.ig-gallery.ig-empty { display: none; }

.ig-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: clamp(0.5rem, 1.2vw, 0.9rem);
}

.ig-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  transition: transform 400ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 400ms ease;
}
/* Itens em destaque ocasional — todo 7º item ocupa 2 colunas */
.ig-item:nth-child(7n + 1) { grid-column: span 2; aspect-ratio: 2 / 1; }
@media (max-width: 720px) {
  .ig-item:nth-child(7n + 1) { grid-column: span 1; aspect-ratio: 1 / 1; }
}

.ig-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -20px rgba(204, 18, 22, 0.35);
}

.ig-item__link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.ig-item__link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ig-item:hover .ig-item__link img { transform: scale(1.05); }

.ig-item__badge {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.ig-item__cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.6rem 0.7rem;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.75rem;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0) 100%);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}
.ig-item:hover .ig-item__cap,
.ig-item:focus-within .ig-item__cap { opacity: 1; }

.ig-foot {
  text-align: center;
  margin-top: 1.8rem;
  font-family: var(--font-ui, 'Inter', sans-serif);
}
.ig-foot a {
  color: var(--red, #CC1216);
  font-weight: 600;
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--red, #CC1216);
  border-radius: 999px;
  display: inline-block;
  transition: all 200ms ease;
}
.ig-foot a:hover {
  background: var(--red, #CC1216);
  color: var(--paper, #F6E9E1);
}

/* ===================== LIGHTBOX ===================== */
.ig-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
.ig-lightbox:empty { display: none; }
.ig-lightbox:not(:empty) { pointer-events: auto; }

.ig-lb__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: ig-lb-fade 200ms ease both;
}
@keyframes ig-lb-fade { from { opacity: 0; } to { opacity: 1; } }

.ig-lb__shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
  animation: ig-lb-pop 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes ig-lb-pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ig-lb__close,
.ig-lb__nav {
  position: absolute;
  z-index: 2;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
  backdrop-filter: blur(8px);
}
.ig-lb__close:hover,
.ig-lb__nav:hover { background: rgba(204, 18, 22, 0.9); transform: scale(1.05); }
.ig-lb__close { top: 1rem; right: 1rem; }
.ig-lb__nav--prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.ig-lb__nav--next { right: 1rem; top: 50%; transform: translateY(-50%); }
.ig-lb__nav--prev:hover { transform: translateY(-50%) scale(1.05); }
.ig-lb__nav--next:hover { transform: translateY(-50%) scale(1.05); }
@media (max-width: 720px) {
  .ig-lb__nav--prev { left: 0.5rem; }
  .ig-lb__nav--next { right: 0.5rem; }
}

.ig-lb__figure {
  margin: 0;
  max-width: min(900px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}
.ig-lb__media {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  border-radius: 10px;
  background: #000;
  margin: 0 auto;
}
.ig-lb__cap {
  color: #f0e5da;
  font-family: var(--font-body, 'Spectral', serif);
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  max-width: 64ch;
  margin: 0 auto;
}
.ig-lb__extras {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.4rem;
}
.ig-lb__extra img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  opacity: 0.8;
  transition: opacity 200ms;
}
.ig-lb__extra img:hover { opacity: 1; }

.ig-lb__permalink {
  align-self: center;
  color: #fff;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  transition: all 200ms;
}
.ig-lb__permalink:hover {
  background: var(--red, #CC1216);
  border-color: var(--red, #CC1216);
}

/* ===================== ACESSIBILIDADE ===================== */
@media (prefers-reduced-motion: reduce) {
  .ig-item, .ig-item__link img, .ig-hero-video__sound, .ig-hero-video__link,
  .ig-filter, .ig-foot a, .ig-lb__close, .ig-lb__nav, .ig-lb__permalink {
    transition: none !important;
  }
  .ig-lb__backdrop, .ig-lb__shell { animation: none !important; }
  .ig-hero-video__media { animation-play-state: paused; }
}
