/* ================================================================
   NICKDECKER.NET / ARTIFACTS
   Shares tokens, palette, reset, base and .pill with styles.css
   (loaded first). This file adds only the gallery + lightbox.
   ================================================================ */

.shell {
  max-width: 66rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* --- Top utility bar: back to the site -------------------------- */
.art-top {
  position: relative;
  z-index: 30;
  border-bottom: var(--hair);
  padding-block: var(--space-sm);
}
.art-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-size: var(--type-caption);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1.5px solid transparent;
  transition: gap 0.25s var(--ease), border-color 0.2s ease;
}
.art-back:hover { gap: 1ch; border-color: var(--red); }

/* ================================================================
   GALLERY — tall scroll section + sticky arc stage
   ================================================================ */
.gallery {
  position: relative;
  /* height is set inline per artifact count; fallback here */
  height: 540vh;
  background: var(--cream);
}
.gallery__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* Changing caption — sits above the arch apex */
.gallery__caption {
  position: absolute;
  top: clamp(2.5rem, 7vh, 6rem);
  left: 0;
  right: 0;
  z-index: 1500;          /* above all cards */
  text-align: center;
  padding-inline: var(--gutter);
  pointer-events: none;
}
.gallery__index {
  font-size: var(--type-caption);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red);
}
.gallery__title {
  margin-top: var(--space-xs);
  font-size: var(--type-title);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  /* cross-fade when the active artifact changes */
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.gallery__title.is-swapping { opacity: 0; transform: translateY(6px); }

/* --- Arc cards -------------------------------------------------- */
.artifact {
  position: absolute;
  top: 0;
  left: 0;
  /* JS writes translate3d(x,y)…; this is the size of a card */
  width: clamp(9rem, 24vw, 19rem);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  will-change: transform, opacity;
  /* fade-in once the image decodes */
  filter: saturate(1);
  transition: filter 0.3s var(--ease);
}
.artifact img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  box-shadow: 4px 5px 0 rgba(31, 31, 29, 0.45);
  background: var(--ink);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.artifact.is-loaded img { opacity: 1; }
.artifact:hover { filter: saturate(1.05) brightness(1.03); }

/* Hint at the bottom */
.gallery__hint {
  position: absolute;
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  font-size: var(--type-caption);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  pointer-events: none;
}

/* ================================================================
   REDUCED-MOTION / FALLBACK RAIL
   Hidden by default; shown when motion is reduced.
   ================================================================ */
.rail { display: none; }

@media (prefers-reduced-motion: reduce) {
  .gallery { height: auto; }
  .gallery__stage { position: static; height: auto; overflow: visible; }
  .gallery__caption, .gallery__hint, .artifact { display: none; }

  .rail {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: var(--space-lg) var(--gutter);
    -webkit-overflow-scrolling: touch;
  }
  .rail__item {
    flex: 0 0 auto;
    width: min(78vw, 22rem);
    scroll-snap-align: center;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    display: grid;
    gap: var(--space-xs);
  }
  .rail__item img {
    width: 100%;
    height: auto;
    border: 2px solid var(--ink);
    box-shadow: 4px 5px 0 rgba(31, 31, 29, 0.45);
  }
  .rail__cap {
    font-size: var(--type-fine);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
}

/* ================================================================
   LIGHTBOX
   ================================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  gap: var(--space-sm);
  padding: clamp(1.5rem, 5vw, 4rem);
  background: rgba(31, 31, 29, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s var(--ease);
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__img {
  max-width: min(92vw, 1100px);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 2px solid var(--cream);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}
.lightbox__title {
  color: var(--cream);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}
.lightbox__close {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--cream);
  background: none;
  color: var(--cream);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s ease, color 0.2s ease;
}
.lightbox__close:hover { transform: rotate(90deg); background: var(--cream); color: var(--ink); }

/* ================================================================
   FOOTER (reuses .pill from styles.css)
   ================================================================ */
.art-foot {
  border-top: var(--hair);
  padding-block: var(--space-lg);
  text-align: center;
}
.art-foot__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}
