/* ==========================================================================
   Instagram feed — four interchangeable layouts.

   Switch between them with 'layout' in config.instagram.php. The markup is
   identical for all four; only the wrapper class changes, so swapping layouts
   never touches the template.

   .ig-feed                 shared behaviour (hover, video badge, media box)
   .ig-feed--grid5          five equal squares in a row
   .ig-feed--mosaic         one large tile with four smaller ones beside it
   .ig-feed--carousel       horizontal scrolling strip with snap points
   .ig-feed--polaroid       tilted photo cards with captions
   ========================================================================== */

:root {
  --ig-pink: #fd7792;
  --ig-pink-soft: rgba(253, 119, 146, 0.72);
  --ig-radius: 3px;
  --ig-gap: 4px;
}

/* ---------- shared ---------- */

.ig-feed {
  margin: 0 auto;
  max-width: 1100px;
}

.ig-item {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--ig-radius);
  background: #f4f4f4;
}

.ig-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .45s ease;
}

.ig-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  background: rgba(253, 119, 146, 0);
  opacity: 0;
  transition: opacity .3s ease, background .3s ease;
}

.ig-item:hover img { transform: scale(1.05); }
.ig-item:hover .ig-overlay { background: var(--ig-pink-soft); opacity: 1; }

.ig-item:focus-visible {
  outline: 3px solid var(--ig-pink);
  outline-offset: 3px;
}

/* Video posts get a persistent badge so they read as playable, not static. */
.ig-badge {
  position: absolute;
  top: 8px;
  right: 9px;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .55);
  pointer-events: none;
}

/* A quiet marker shown only when the section is running on curated tiles. */
.ig-status {
  font-size: 12px;
  letter-spacing: .04em;
  color: #b9b0b3;
  margin-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .ig-item img,
  .ig-overlay { transition: none; }
  .ig-item:hover img { transform: none; }
}

/* ---------- 1. grid5 ---------- */

.ig-feed--grid5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--ig-gap);
}

.ig-feed--grid5 .ig-item { aspect-ratio: 1 / 1; }

@media (max-width: 991.98px) {
  .ig-feed--grid5 { grid-template-columns: repeat(3, 1fr); }
  .ig-feed--grid5 .ig-item:nth-child(n + 4) { display: none; }
}

@media (max-width: 575.98px) {
  .ig-feed--grid5 { grid-template-columns: repeat(2, 1fr); }
  .ig-feed--grid5 .ig-item:nth-child(n + 4) { display: block; }
  .ig-feed--grid5 .ig-item:nth-child(n + 5) { display: none; }
}

/* ---------- 2. mosaic ---------- */

.ig-feed--mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--ig-gap);
  aspect-ratio: 2 / 1;
}

.ig-feed--mosaic .ig-item { aspect-ratio: auto; height: 100%; }

/* First post gets a 2x2 block; the rest fill the remaining cells. */
.ig-feed--mosaic .ig-item:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

@media (max-width: 767.98px) {
  .ig-feed--mosaic {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    aspect-ratio: auto;
  }
  .ig-feed--mosaic .ig-item { aspect-ratio: 1 / 1; }
  .ig-feed--mosaic .ig-item:first-child { grid-column: span 2; grid-row: auto; aspect-ratio: 2 / 1; }
}

/* ---------- 3. carousel ---------- */

.ig-feed--carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--ig-pink) transparent;
}

.ig-feed--carousel .ig-item {
  flex: 0 0 260px;
  aspect-ratio: 4 / 5;
  scroll-snap-align: start;
}

.ig-feed--carousel::-webkit-scrollbar { height: 6px; }
.ig-feed--carousel::-webkit-scrollbar-track { background: rgba(0, 0, 0, .05); border-radius: 3px; }
.ig-feed--carousel::-webkit-scrollbar-thumb { background: var(--ig-pink); border-radius: 3px; }

@media (max-width: 575.98px) {
  .ig-feed--carousel .ig-item { flex-basis: 74vw; }
}

/* ---------- 4. polaroid ---------- */

.ig-feed--polaroid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}

.ig-feed--polaroid .ig-item {
  flex: 0 0 200px;
  background: #fff;
  padding: 10px 10px 0;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .10);
  overflow: visible;
  transition: transform .3s ease, box-shadow .3s ease;
}

/* Alternating tilt, so a row of cards looks scattered rather than stacked. */
.ig-feed--polaroid .ig-item:nth-child(odd)  { transform: rotate(-2deg); }
.ig-feed--polaroid .ig-item:nth-child(even) { transform: rotate(1.6deg); }

.ig-feed--polaroid .ig-item:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .16);
}

.ig-feed--polaroid .ig-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 1px;
}

.ig-feed--polaroid .ig-caption {
  display: block;
  padding: 11px 4px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #7d7378;
  text-align: center;
  min-height: 54px;
}

@media (max-width: 575.98px) {
  .ig-feed--polaroid { gap: 16px; }
  .ig-feed--polaroid .ig-item { flex-basis: 150px; }
  .ig-feed--polaroid .ig-caption { min-height: 0; }
}

/* In polaroid mode the media box owns the hover, not the whole card. */
.ig-feed--polaroid .ig-item:hover img { transform: scale(1.04); }
