/**
 * 21C Exhibitions Showcase front-end (grid + carousel).
 * Reuses 21c-systems Frontend Styler tokens / cs-media-card + auth-records-grid patterns.
 */

.c21-exhibitions-showcase {
  --c21-exhibitions-gap: var(--auth-capture-item-spacing, 0.75rem);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-showcase *,
.c21-exhibitions-showcase *::before,
.c21-exhibitions-showcase *::after {
  box-sizing: border-box;
}

.c21-exhibitions-showcase__admin-notice {
  margin: 0 0 0.75rem;
}

/* ---- Grid ---- */

.c21-exhibitions-showcase__grid.auth-records-grid {
  display: grid;
  grid-template-columns: repeat(
    var(--c21-exhibitions-cells, 3),
    minmax(0, 1fr)
  );
  gap: var(--c21-exhibitions-gap);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: stretch;
}

.c21-exhibitions-showcase__cell {
  margin: 0;
  min-width: 0;
}

@media (max-width: 900px) {
  .c21-exhibitions-showcase__grid.auth-records-grid {
    grid-template-columns: repeat(
      min(2, var(--c21-exhibitions-cells, 3)),
      minmax(0, 1fr)
    );
  }
}

@media (max-width: 560px) {
  .c21-exhibitions-showcase__grid.auth-records-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Carousel ----
 * Track is full width of .c21-exhibitions-showcase (matches content column).
 * Prev/next overlay the track so they do not steal horizontal space from the image.
 */

.c21-exhibitions-showcase__carousel {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
}

.c21-exhibitions-showcase__track {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.c21-exhibitions-showcase__track::-webkit-scrollbar {
  display: none;
}

.c21-exhibitions-showcase__slide {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  scroll-snap-align: start;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-showcase__nav {
  position: absolute;
  top: 1.25rem;
  z-index: 4;
  appearance: none;
  border: 1px solid var(--auth-color-secondary-border, #d1d5db);
  background: var(--auth-color-secondary-bg, #f3f4f6);
  color: var(--auth-color-secondary-text, #111827);
  border-radius: var(--auth-secondary-radius, 6px);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.c21-exhibitions-showcase__nav--prev {
  left: 0.75rem;
}

.c21-exhibitions-showcase__nav--next {
  right: 0.75rem;
}

.c21-exhibitions-showcase__nav:hover {
  background: var(--auth-color-secondary-hover-bg, #e5e7eb);
  color: var(--auth-color-secondary-hover-text, #111827);
}

.c21-exhibitions-showcase__nav:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 560px) {
  .c21-exhibitions-showcase__nav {
    top: 0.75rem;
  }

  .c21-exhibitions-showcase__nav--prev {
    left: 0.5rem;
  }

  .c21-exhibitions-showcase__nav--next {
    right: 0.5rem;
  }
}

/* ---- Card (grid) ---- */

.c21-exhibitions-showcase__card.cs-media-card {
  height: 100%;
}

.c21-exhibitions-showcase__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 22rem;
  object-fit: cover;
  border-radius: calc(var(--cs-media-card-radius, 30px) * 0.35);
}

.c21-exhibitions-showcase__placeholder {
  min-height: 10rem;
}

.c21-exhibitions-showcase__owner {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--auth-color-muted, #6b7280);
}

.c21-exhibitions-showcase__description {
  margin: 0 0 0.5rem;
}

.c21-exhibitions-showcase__description p:last-child {
  margin-bottom: 0;
}

/* ---- Sub-galleries (grid cards) ---- */

.c21-exhibitions-showcase__subgallery {
  margin-top: 0.75rem;
}

.c21-exhibitions-showcase__subgallery-label {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.c21-exhibitions-showcase__subgallery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
}

.c21-exhibitions-showcase__subgallery[data-slot="video"] .c21-exhibitions-showcase__subgallery-list,
.c21-exhibitions-showcase__subgallery[data-slot="audio"] .c21-exhibitions-showcase__subgallery-list,
.c21-exhibitions-showcase__subgallery[data-slot="document"] .c21-exhibitions-showcase__subgallery-list {
  grid-template-columns: 1fr;
}

.c21-exhibitions-showcase__subgallery-item img,
.c21-exhibitions-showcase__subgallery-item video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--cs-media-card-radius, 30px) * 0.25);
}

.c21-exhibitions-showcase__subgallery-item audio {
  width: 100%;
}

.c21-exhibitions-showcase__doc-link {
  display: inline-block;
  color: var(--auth-color-primary, #2563eb);
}

/* ---- Focus carousel template ---- */

.c21-exhibitions-focus {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-focus__stage {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0; /* no side gap when panel is collapsed — gap only when open */
  width: 100%;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-focus.is-open .c21-exhibitions-focus__stage {
  gap: var(--c21-exhibitions-gap);
}

.c21-exhibitions-focus__primary {
  flex: 1 1 100%;
  min-width: 0;
  transition: flex-basis 0.35s ease, max-width 0.35s ease;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-focus.is-open .c21-exhibitions-focus__primary {
  flex: 1 1 70%;
  max-width: 70%;
}

.c21-exhibitions-focus__media {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0; /* kill inline-img baseline gap under the image */
}

.c21-exhibitions-focus__image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.c21-exhibitions-focus__placeholder {
  min-height: 12rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

.c21-exhibitions-focus__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.4rem;
  padding: 0 0.15rem;
}

.c21-exhibitions-focus__learn-more {
  margin: 0;
}

.c21-exhibitions-focus.is-open .c21-exhibitions-focus__actions {
  display: none;
}

.c21-exhibitions-focus__meta {
  margin-top: var(--auth-short-description-gap-above, 0.4rem);
  padding: 0 0.15rem;
}

.c21-exhibitions-focus__owner {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--auth-color-muted, #6b7280);
}

.c21-exhibitions-focus__description {
  margin: 0;
  color: var(--auth-color-text, #111827);
}

.c21-exhibitions-focus__description p:last-child {
  margin-bottom: 0;
}

.c21-exhibitions-focus__panel {
  flex: 0 0 0;
  max-width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    flex-basis 0.35s ease,
    max-width 0.35s ease,
    opacity 0.25s ease,
    visibility 0.25s ease;
  background: var(--cs-media-card-bg, #f8f9fb);
  border: 1px solid var(--auth-color-border, #d1d5db);
  border-radius: calc(var(--cs-media-card-radius, 30px) * 0.35);
  box-sizing: border-box;
}

.c21-exhibitions-focus.is-open .c21-exhibitions-focus__panel {
  flex: 0 0 30%;
  max-width: 30%;
  opacity: 1;
  visibility: visible;
  overflow: auto;
  padding: var(--cs-media-card-padding, 1rem);
}

.c21-exhibitions-focus:not(.is-open) .c21-exhibitions-focus__panel {
  pointer-events: none;
  border-width: 0;
  padding: 0;
  margin: 0;
}

.c21-exhibitions-focus__panel-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0.75rem;
}

.c21-exhibitions-focus__close {
  min-width: 2.25rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
  font-size: 1.35rem;
  line-height: 1;
}

.c21-exhibitions-focus__section {
  margin: 0 0 1rem;
}

.c21-exhibitions-focus__section:last-child {
  margin-bottom: 0;
}

.c21-exhibitions-focus__section-title {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--auth-color-text, #111827);
}

.c21-exhibitions-focus__section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.c21-exhibitions-focus__section[data-slot="gallery_images"] .c21-exhibitions-focus__section-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.4rem;
}

.c21-exhibitions-focus__section-item img,
.c21-exhibitions-focus__section-item video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--cs-media-card-radius, 30px) * 0.2);
}

.c21-exhibitions-focus__section-item audio {
  width: 100%;
}

.c21-exhibitions-focus__doc-link {
  color: var(--auth-color-primary, #2563eb);
}

@media (max-width: 700px) {
  .c21-exhibitions-focus__stage {
    flex-direction: column;
  }

  .c21-exhibitions-focus__primary,
  .c21-exhibitions-focus.is-open .c21-exhibitions-focus__primary {
    flex: 1 1 auto;
    max-width: 100%;
  }

  .c21-exhibitions-focus__panel,
  .c21-exhibitions-focus.is-open .c21-exhibitions-focus__panel {
    flex: 0 0 auto;
    max-width: 100%;
    width: 100%;
  }

  .c21-exhibitions-focus:not(.is-open) .c21-exhibitions-focus__panel {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    margin: 0;
  }

  .c21-exhibitions-focus.is-open .c21-exhibitions-focus__panel {
    max-height: none;
    margin-top: var(--c21-exhibitions-gap);
  }
}

/* ---- Intro screen (normal page layout) ---- */

.c21-exhibitions-showcase__intro {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.c21-exhibitions-showcase__welcome {
  color: var(--auth-color-text, #111827);
  margin: 0 0 1.25rem;
}

.c21-exhibitions-showcase__welcome p {
  margin: 0 0 0.75rem;
}

.c21-exhibitions-showcase__welcome p:last-child {
  margin-bottom: 0;
}

.c21-exhibitions-showcase__enter-wrap {
  margin: 0;
}

/* ---- Fullscreen dark overlay ----
 * Fit image + owner/description into the viewport (no vertical scroll).
 * Breathing-room margins apply here only — in-page carousel stays edge-to-edge.
 */

.c21-exhibitions-showcase__overlay[hidden] {
  display: none !important;
}

.c21-exhibitions-showcase__overlay {
  --c21-exhibitions-overlay-gap: clamp(0.75rem, 2.5vw, 1.75rem);
  --c21-exhibitions-overlay-meta-max: min(7.5rem, 22vh);
  --c21-exhibitions-overlay-accent: #e11d48;
  --c21-exhibitions-overlay-accent-hover: #fb7185;
  --c21-exhibitions-overlay-control-bg: #000000;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  color: #f5f5f5;
  overflow: hidden;
  height: 100%;
  max-height: 100dvh;
}

html.c21-exhibitions-exhibition-open,
body.c21-exhibitions-exhibition-open {
  overflow: hidden;
}

.c21-exhibitions-showcase__overlay-chrome {
  flex: 0 0 auto;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.5rem var(--c21-exhibitions-overlay-gap) 0.25rem;
}

.c21-exhibitions-showcase__overlay-close {
  min-width: 2.5rem;
  font-size: 1.5rem;
  line-height: 1;
}

.c21-exhibitions-showcase__overlay-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--c21-exhibitions-overlay-gap) var(--c21-exhibitions-overlay-gap);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.c21-exhibitions-showcase__overlay-loading,
.c21-exhibitions-showcase__empty {
  margin: 2rem 1rem;
  text-align: center;
  color: #d4d4d4;
}

/* Grid inside overlay may still scroll; fit-to-viewport rules are carousel-only */
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__gallery[data-display="grid"] {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Viewport-fit carousel layout (overlay only) */

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__gallery[data-display="carousel"],
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__carousel {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__track {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__slide {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__stage {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__primary {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__media {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: auto;
  object-fit: contain;
  object-position: center;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__placeholder {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100%, 28rem);
  height: min(100%, 20rem);
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__actions {
  /* Float in the right-hand margin beside the image (out of document flow) */
  position: absolute;
  right: 0.15rem;
  top: 50%;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 0;
  margin-top: calc(var(--c21-exhibitions-overlay-meta-max) * -0.35);
  padding: 0;
  transform: translateY(-50%);
  /* Sit clear of the circular next control */
  margin-right: 2.85rem;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__learn-more {
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--c21-exhibitions-overlay-accent);
  background: var(--c21-exhibitions-overlay-control-bg);
  color: var(--c21-exhibitions-overlay-accent);
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: none;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__learn-more:hover,
.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__learn-more:focus {
  background: var(--c21-exhibitions-overlay-control-bg);
  border-color: var(--c21-exhibitions-overlay-accent-hover);
  color: var(--c21-exhibitions-overlay-accent-hover);
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__meta {
  flex: 0 1 auto;
  max-height: var(--c21-exhibitions-overlay-meta-max);
  margin-top: 0.5rem;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__owner,
.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__description {
  text-align: center;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav {
  top: 50%;
  transform: translateY(-50%);
  /* Sit in the side breathing room, not over the image centre */
  margin-top: calc(var(--c21-exhibitions-overlay-meta-max) * -0.35);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--c21-exhibitions-overlay-accent);
  background: var(--c21-exhibitions-overlay-control-bg);
  color: var(--c21-exhibitions-overlay-accent);
  box-shadow: none;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav:hover,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav:focus {
  background: var(--c21-exhibitions-overlay-control-bg);
  border-color: var(--c21-exhibitions-overlay-accent-hover);
  color: var(--c21-exhibitions-overlay-accent-hover);
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav:disabled {
  opacity: 0.35;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav--prev {
  left: 0.15rem;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__nav--next {
  right: 0.15rem;
}

/* Learn More panel: keep primary column height-bounded; panel scrolls internally */
.c21-exhibitions-showcase__overlay .c21-exhibitions-focus.is-open .c21-exhibitions-focus__panel {
  max-height: 100%;
  overflow: auto;
}

@media (max-width: 700px) {
  .c21-exhibitions-showcase__overlay .c21-exhibitions-focus__actions {
    /* Keep clear of next chevron; slightly tighter on small screens */
    margin-right: 2.5rem;
  }

  .c21-exhibitions-showcase__overlay .c21-exhibitions-focus__learn-more {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
  }

  .c21-exhibitions-showcase__overlay .c21-exhibitions-focus.is-open .c21-exhibitions-focus__stage {
    flex-direction: column;
    overflow: hidden;
  }

  .c21-exhibitions-showcase__overlay .c21-exhibitions-focus.is-open .c21-exhibitions-focus__primary {
    flex: 1 1 55%;
    max-height: 55%;
  }

  .c21-exhibitions-showcase__overlay .c21-exhibitions-focus.is-open .c21-exhibitions-focus__panel {
    flex: 1 1 45%;
    max-height: 45%;
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* Dark-theme overrides scoped to the overlay */

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__owner,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__owner {
  color: #a3a3a3;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__description,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__description,
.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__section-title,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__title {
  color: #f5f5f5;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__panel {
  background: #171717;
  border-color: #404040;
  color: #f5f5f5;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__doc-link,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__doc-link {
  color: #93c5fd;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__close,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__overlay-close {
  background: #262626;
  border-color: #525252;
  color: #f5f5f5;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-focus__close:hover,
.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__overlay-close:hover {
  background: #404040;
  color: #ffffff;
}

.c21-exhibitions-showcase__overlay .c21-exhibitions-showcase__card.cs-media-card {
  background: #171717;
  border-color: #404040;
  color: #f5f5f5;
}

.c21-exhibitions-showcase__overlay .auth-records-grid__placeholder {
  background: #262626;
}
