/* Infinite Gallery: styles are scoped to .ig (the row) and .ig-lb (the lightbox),
   so nothing here touches the rest of your site. Fonts and text colour are inherited
   from the page; only the variables below are set by the gallery. */

.ig,
.ig-lb {
  --ig-surface: #e4e7ec;
  --ig-fg: inherit;
  --ig-muted: #5b6270;
  --ig-line: #cfd4dc;
  --ig-accent: #1f4fd8;
  --ig-veil: rgba(10, 12, 16, 0.92);
  --ig-plate: #ffffff;
  --ig-plate-fg: #14171c;
  --ig-plate-muted: #5b6270;
  --ig-btn-bg: rgba(255, 255, 255, 0.14);
  --ig-btn-fg: #ffffff;
  --ig-btn-hover: rgba(255, 255, 255, 0.28);
  --ig-mono:
    ui-monospace, "SFMono-Regular", "IBM Plex Mono", Menlo, Consolas, monospace;
  /* sizing: override these on your own container to change the look */
  --ig-thumb-h: 188px;
  --ig-gap: 14px;
  --ig-radius: 6px;
  /* stacking level of the whole gallery. Keep your fixed header above this
     (any z-index of 1 or more on the header is enough). */
  --ig-z: 0;
}

@media (prefers-color-scheme: dark) {
  .ig,
  .ig-lb {
    --ig-surface: #1a1e27;
    --ig-muted: #9aa3b2;
    --ig-line: #2a303c;
    --ig-accent: #7f9cff;
    --ig-veil: rgba(4, 5, 8, 0.94);
    --ig-plate: #1a1e27;
    --ig-plate-fg: #eceff4;
    --ig-plate-muted: #9aa3b2;
  }
}

.ig *,
.ig-lb * {
  box-sizing: border-box;
}

/* ---------- the row ---------- */
.ig {
  position: relative;
  z-index: var(--ig-z);
  isolation: isolate; /* keeps the moving row and fade mask inside one layer */
  width: 100%;
  font-family: inherit;
  color: var(--ig-fg);
}
.ig-viewport {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 6%,
    #000 94%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 6%,
    #000 94%,
    transparent 100%
  );
}
.ig-track {
  display: flex;
  width: max-content;
  animation: ig-drift var(--ig-drift-time, 70s) linear infinite;
  will-change: transform;
}
.ig-viewport:hover .ig-track,
.ig-viewport:focus-within .ig-track,
.ig.ig-paused .ig-track {
  animation-play-state: paused;
}

@keyframes ig-drift {
  to {
    transform: translateX(-50%);
  }
}

.ig-thumb {
  flex: none;
  margin: 0 var(--ig-gap) 0 0; /* margin (not gap) keeps both halves exactly equal */
  padding: 0;
  border: 0;
  background: var(--ig-surface);
  border-radius: var(--ig-radius);
  overflow: hidden;
  cursor: zoom-in;
  height: var(--ig-thumb-h);
  position: relative;
  outline-offset: 3px;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.ig-thumb img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
}
.ig-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}
.ig-thumb:focus-visible {
  outline: 3px solid var(--ig-accent);
}

.ig-tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ig-thumb:hover .ig-tag,
.ig-thumb:focus-visible .ig-tag {
  opacity: 1;
}

.ig-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-family: var(--ig-mono);
  font-size: 12px;
  color: var(--ig-muted);
}
.ig-pill {
  font: inherit;
  color: #942d10;
  background: transparent;
  border: 1px solid #942d10;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.ig-pill:hover {
  border-color: #942d10;
  background-color: #942d10;
  color: #fff;
}
.ig-pill:focus-visible {
  outline: 3px solid var(--ig-accent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .ig {
    --ig-thumb-h: 148px;
    --ig-gap: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ig-track {
    animation: none;
  }
  .ig-viewport {
    overflow-x: auto;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .ig-thumb,
  .ig-lb-img,
  .ig-lb-btn {
    transition: none;
  }
}

/* ---------- lightbox (appended to <body> so it always covers the whole screen) ---------- */
.ig-lb {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--ig-veil);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto; /* stage takes what is left; plate never gets covered */
  font-family: inherit;
  line-height: 1.5;
}
.ig-lb[hidden] {
  display: none;
}

.ig-lb-stage {
  position: relative;
  min-height: 0;
  min-width: 0;
  padding: 60px 76px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
/* The frame is the exact area available to the picture. The image is pinned inside it
   and scaled with object-fit, so tall or wide pictures can never spill over the caption. */
.ig-lb-frame {
  position: relative;
  min-height: 0;
  min-width: 0;
}
.ig-lb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.55));
  transition: opacity 0.18s ease;
}
.ig-lb-img.ig-swap {
  opacity: 0;
}

.ig-lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ig-btn-bg);
  color: var(--ig-btn-fg);
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.ig-lb-btn:hover {
  background: var(--ig-btn-hover);
}
.ig-lb-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.ig-lb-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ig-lb-close {
  top: 12px;
  right: 14px;
}
.ig-lb-prev {
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.ig-lb-next {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.ig-lb-prev:hover {
  transform: translateY(-50%) translateX(-2px);
}
.ig-lb-next:hover {
  transform: translateY(-50%) translateX(2px);
}

.ig-lb-count {
  position: absolute;
  top: 24px;
  left: 18px;
  font-family: var(--ig-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
}

/* legend + credits */
.ig-lb-plate {
  background: var(--ig-plate);
  color: var(--ig-plate-fg);
  padding: 18px 24px 20px;
  max-height: 40vh;
  overflow-y: auto;
}
.ig-lb-plate-inner {
  max-width: 920px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 32px;
  align-items: start;
}
.ig-lb-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  grid-column: 1;
}
.ig-lb-legend {
  margin: 0;
  color: var(--ig-plate-muted);
  max-width: 62ch;
  grid-column: 1;
}
.ig-lb-credit {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-family: var(--ig-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ig-plate-muted);
  text-align: right;
  max-width: 28ch;
}
.ig-lb-credit b {
  display: block;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

@media (max-width: 640px) {
  .ig-lb-stage {
    padding: 64px 12px 72px;
  } /* room under the picture for the arrows */
  .ig-lb-prev,
  .ig-lb-next {
    top: auto;
    bottom: 14px;
    transform: none;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.18);
  }
  .ig-lb-prev {
    left: 14px;
  }
  .ig-lb-next {
    right: 14px;
  }
  .ig-lb-prev:hover,
  .ig-lb-next:hover {
    transform: none;
  }
  .ig-lb-plate-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .ig-lb-credit {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    max-width: none;
    margin-top: 6px;
  }
}
