/* ============================================================
   Studio7south — matted print carousel
   Signature element: each photograph sits inside a warm mat
   board, like a print mounted for a gallery wall, with the
   title and edition number set below it the way a caption is
   penciled beneath a fine-art print. Slow crossfades, no chrome.
   ============================================================ */

.s7-carousel {
  --stage-h: clamp(300px, 62vh, 680px);
  position: relative;
}

@media (max-height: 480px) {
  .s7-carousel {
    --stage-h: clamp(220px, 74vh, 380px);
  }
}

/* ---------- stage ---------- */

.s7-stage {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.5rem);
}

.s7-frame {
  position: relative;
  height: var(--stage-h);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  row-gap: clamp(8px, 1.6vw, 14px);
  background: var(--c-mat);
  padding: clamp(20px, 4vw, 48px) clamp(20px, 4vw, 48px)
    clamp(14px, 2.2vw, 22px);
  border-radius: var(--radius);
  box-shadow:
    0 50px 90px -40px rgba(0, 0, 0, 0.65),
    0 1px 0 rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: width 0.35s ease;
}

.s7-frame-track {
  grid-row: 1;
  grid-column: 1 / -1;
  position: relative;
  min-height: 0;
  min-width: 0;
  cursor: zoom-in;
}

.s7-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.s7-frame img.is-active {
  opacity: 1;
  position: relative;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.25);
}

/* caption + edition number, set on the mat like a penciled print label */

.s7-frame-caption,
.s7-frame-counter {
  position: static;
  background: none;
  border: none;
  padding: 0;
  backdrop-filter: none;
  pointer-events: none;
}

.s7-frame-caption {
  grid-row: 2;
  grid-column: 1;
  align-self: end;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 200;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  line-height: 1.25;
  color: var(--c-mat-ink);
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.s7-frame-caption:empty {
  display: none;
}

.s7-frame-counter {
  grid-row: 2;
  grid-column: 2;
  justify-self: end;
  align-self: end;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(38, 36, 31, 0.55);
}

/* ---------- prev / next ---------- */

.s7-carousel-nav {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--c-text-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.25s ease,
    transform 0.25s ease;
}

.s7-carousel-nav:hover {
  color: var(--c-accent);
}

.s7-prev:hover {
  transform: translateX(-2px);
}
.s7-next:hover {
  transform: translateX(2px);
}

@media (max-width: 900px) {
  .s7-carousel-nav {
    width: 30px;
    font-size: 1.35rem;
  }
}

@media (max-width: 640px) {
  .s7-stage {
    grid-template-columns: minmax(0, 1fr);
  }
  .s7-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 34px;
    height: 34px;
    background: rgba(18, 19, 22, 0.55);
    border-radius: 50%;
    color: var(--c-text);
  }
  .s7-prev {
    left: 0.5rem;
  }
  .s7-next {
    right: 0.5rem;
  }
  .s7-prev:hover,
  .s7-next:hover {
    transform: translateY(-50%);
    color: var(--c-accent-2);
  }
}

@media (max-width: 400px) {
  .s7-frame-counter,
  .s7-frame-caption {
    font-size: 0.8rem;
  }
}

/* ---------- index row (formerly filmstrip) ---------- */

.s7-filmstrip {
  margin-top: clamp(1rem, 2.5vw, 1.6rem);
  border-top: 1px solid var(--c-hairline);
  padding-top: clamp(0.9rem, 2vw, 1.3rem);
}

.s7-filmstrip-track {
  display: flex;
  gap: clamp(0.6rem, 1.5vw, 1rem);
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--c-accent) transparent;
  padding-bottom: 0.4rem;
}

.s7-filmstrip-track::-webkit-scrollbar {
  height: 4px;
}
.s7-filmstrip-track::-webkit-scrollbar-thumb {
  background: rgba(183, 165, 118, 0.4);
  border-radius: 2px;
}

.s7-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 58px;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: var(--c-bg-raised);
  opacity: 0.45;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease;
  padding: 3px 3px 5px;
}

.s7-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.s7-thumb:hover {
  opacity: 0.75;
}

.s7-thumb.is-active {
  opacity: 1;
  border-bottom-color: var(--c-accent);
}

.s7-thumb:focus-visible {
  outline: 1px solid var(--c-accent-2);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .s7-thumb {
    width: 72px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .s7-thumb {
    width: 60px;
    height: 42px;
  }
  .s7-filmstrip-track {
    gap: 0.5rem;
  }
}

/* ---------- loading skeleton ---------- */

.s7-carousel[data-loading="true"] .s7-frame-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(38, 36, 31, 0.06) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: s7-shimmer 1.4s ease infinite;
}

@keyframes s7-shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

/* ---------- lightbox ---------- */

body.s7-lightbox-lock {
  overflow: hidden;
}

.s7-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(74, 74, 76, 0.97);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  outline: none;
}

.s7-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.s7-lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1400px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.s7-lightbox-img {
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.55),
    0 8px 20px rgba(0, 0, 0, 0.45);
}

.s7-lightbox-figure figcaption {
  margin-top: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  color: var(--c-text);
  max-width: 92vw;
}

.s7-lightbox-caption {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
}

.s7-lightbox-counter {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
}

.s7-lightbox-close {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-hairline);
  background: none;
  color: var(--c-text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}

.s7-lightbox-close:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
}

.s7-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  background: none;
  color: var(--c-text-dim);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.s7-lightbox-nav:hover {
  color: var(--c-accent);
}

.s7-lightbox-prev {
  left: clamp(0.5rem, 3vw, 2rem);
}
.s7-lightbox-next {
  right: clamp(0.5rem, 3vw, 2rem);
}

@media (max-width: 640px) {
  .s7-lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }
  .s7-lightbox-close {
    width: 34px;
    height: 34px;
    font-size: 1.3rem;
  }
  .s7-lightbox-img {
    max-height: 70vh;
  }
}
