/* ================================================================ INSTAGRAM REELS BAND
   Horizontal band of IG reels + carousels on the homepage.

   Baseline (no-JS / touch / prefers-reduced-motion) = a swipeable
   scroll-snap row. reels.js upgrades it to a seamless, GPU-composited
   auto-scroll marquee ONLY on capable desktops (fine pointer + hover +
   motion OK), pausing on hover, keyboard focus, and when off-screen.

   Spacing uses per-card margin-inline-end (NOT flex gap) so the duplicated
   track translates by exactly -50% with a perfectly seamless loop. */
.ig .section-head { margin-bottom: var(--sp-3); }
.ig .section-sub {
  color: var(--muted);
  max-width: 52ch;
  margin-top: var(--sp-2);
  font-size: var(--fs-lede);
}

/* viewport: baseline = swipeable row */
.ig__viewport {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-block: var(--sp-3);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.ig__track {
  display: flex;
  width: max-content;
  list-style: none;
  margin: 0;
  /* align the first card with the centered container edge */
  padding-inline: max(var(--sp-4), calc((100vw - var(--container)) / 2));
}

/* card */
.ig__card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: clamp(196px, 22vw, 248px);
  aspect-ratio: 4 / 5;
  list-style: none;
  margin-inline-end: var(--sp-3); /* per-card spacing -> seamless -50% loop */
}
.ig__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--r);
  overflow: hidden;
  border: var(--bw) solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px oklch(from var(--fg) l c h / 0.05);
  transition:
    transform var(--dur-fast) var(--ease-soft),
    box-shadow var(--dur-fast) var(--ease-soft),
    border-color var(--dur-fast) var(--ease-soft);
}
.ig__link:hover,
.ig__link:focus-visible {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--border-strong);
  box-shadow: 0 14px 30px oklch(from var(--fg) l c h / 0.14);
  outline: none;
}
.ig__media { position: absolute; inset: 0; }
/* object-position top keeps the TOP of tall (9:16) reel covers — where the
   headline text sits — instead of cropping it away when fit into the 4:5
   frame. 4:5 carousels are an exact fit, so this is a no-op for them. */
.ig__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; display: block; }

.ig__shade {
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    oklch(from var(--fg) l c h / 0) 36%,
    oklch(from var(--fg) l c h / 0.82) 100%
  );
}
.ig__kind {
  position: absolute; top: var(--sp-1); left: var(--sp-1);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  background: oklch(from var(--bg) l c h / 0.82);
  border: var(--bw) solid var(--border);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.ig__tag {
  position: absolute; top: var(--sp-1); right: var(--sp-1);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--accent-strong);
  background: oklch(from var(--bg) l c h / 0.9);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: var(--bw) solid var(--border-soft);
  max-width: 62%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ig__title {
  position: absolute;
  left: var(--sp-2); right: var(--sp-2); bottom: var(--sp-2);
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.18;
  font-weight: 500;
  color: #FFFDF9;
  text-shadow: 0 1px 10px oklch(from var(--fg) l c h / 0.55);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ig__cta {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #FFFDF9;
  background: oklch(from var(--accent) l c h / 0);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-soft);
}
.ig__cta .arrow { width: 1em; height: 1em; }
.ig__link:hover .ig__cta,
.ig__link:focus-visible .ig__cta {
  opacity: 1;
  background: oklch(from var(--accent) l c h / 0.92);
}

/* ---- enhanced marquee mode (reels.js adds .is-marquee on capable desktops).
   The viewport is already overflow-x:auto from the baseline row, so manual
   scroll (drag / trackpad horizontal / touch) works natively. In marquee mode
   we: drop scroll-snap (it fights continuous auto-scroll), hide the scrollbar,
   add the edge fade + a grab cursor. reels.js drives the auto-scroll by
   advancing the native scrollLeft, pausing on hover/drag/off-screen/hidden. */
.ig__viewport.is-marquee {
  scroll-snap-type: none;
  scrollbar-width: none;
  cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.ig__viewport.is-marquee::-webkit-scrollbar { display: none; }
.ig__viewport.is-marquee.is-dragging { cursor: grabbing; user-select: none; }
.ig__viewport.is-marquee.is-dragging .ig__link { cursor: grabbing; }
.ig__track.is-marquee {
  padding-inline: 0;            /* edge-to-edge: one set == half scrollWidth */
  width: max-content;
}
