.collection-gallery-main {
  min-height: 70vh;
}

.gallery-back {
  width: fit-content;
  margin: 38px 0 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8ea3af;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .13em;
  text-decoration: none;
  transition: color .2s ease;
}

.gallery-back:hover { color: var(--cyan); }
.gallery-back span { color: var(--cyan); font-size: 15px; }

.gallery-hero {
  position: relative;
  padding: clamp(34px, 5vw, 66px) clamp(24px, 5vw, 64px) clamp(28px, 4vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(82, 221, 255, .23);
  background:
    radial-gradient(ellipse at 78% 42%, rgba(0, 108, 151, .2), transparent 38%),
    linear-gradient(140deg, rgba(8, 17, 25, .96), rgba(5, 10, 16, .96));
}

.gallery-hero::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(105, 164, 190, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 164, 190, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(90deg, #000, transparent 88%);
}

.gallery-hero > * { position: relative; z-index: 1; }

.gallery-crumb {
  margin: 0 0 17px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .15em;
}

.gallery-hero h1 {
  max-width: 950px;
  margin: 0;
  color: var(--text);
  font-size: clamp(43px, 7vw, 84px);
  font-weight: 620;
  letter-spacing: -.075em;
  line-height: .98;
}

.gallery-hero-description {
  max-width: 680px;
  margin: 18px 0 0;
  color: #9baeb9;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.75;
}

.gallery-hero-meta {
  margin-top: 27px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-hero-meta span {
  padding: 8px 10px;
  border: 1px solid rgba(145, 184, 209, .18);
  color: #a5bac6;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
}

.gallery-actions {
  margin-top: 26px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.gallery-actions .collection-link { margin-top: 0; }

.gallery-section {
  padding: clamp(52px, 7vw, 82px) 0 clamp(78px, 9vw, 112px);
}

.gallery-section-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.gallery-section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(23px, 3vw, 33px);
  font-weight: 530;
  letter-spacing: -.055em;
}

.gallery-section-heading p {
  margin: 0 0 4px;
  color: #8499a6;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
  text-align: right;
}

.collection-gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.gallery-piece {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(145, 184, 209, .2);
  background:
    linear-gradient(rgba(82, 221, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 221, 255, .04) 1px, transparent 1px),
    #080e15;
  background-size: 22px 22px;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.gallery-piece:hover {
  z-index: 1;
  transform: translateY(-3px);
  border-color: rgba(82, 221, 255, .65);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .35);
}

.gallery-piece:focus-visible {
  z-index: 2;
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.gallery-piece img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: transform .25s ease;
}

.gallery-piece:hover img { transform: scale(1.025); }

.collection-gallery-grid[data-style="pipe"] .gallery-piece img {
  image-rendering: pixelated;
}

.gallery-piece-number {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 5px 7px;
  border: 1px solid rgba(145, 184, 209, .24);
  color: #e2edf2;
  background: rgba(5, 9, 14, .84);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
}

.gallery-lightbox {
  width: min(920px, calc(100% - 28px));
  max-width: 920px;
  max-height: calc(100svh - 28px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(82, 221, 255, .36);
  color: var(--text);
  background: #070c12;
  box-shadow: 0 25px 100px rgba(0, 0, 0, .75);
}

.gallery-lightbox::backdrop { background: rgba(1, 4, 8, .88); backdrop-filter: blur(5px); }

.lightbox-topline,
.lightbox-bottomline {
  min-height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(8, 16, 24, .96);
}

.lightbox-topline { border-bottom: 1px solid var(--line); }
.lightbox-bottomline { border-top: 1px solid var(--line); }

.lightbox-number,
.lightbox-count {
  color: #a7bdc8;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
}

.lightbox-close,
.lightbox-step {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(145, 184, 209, .24);
  color: var(--cyan);
  background: transparent;
  font: inherit;
  font-size: 19px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.lightbox-close:hover,
.lightbox-step:hover { border-color: var(--cyan); background: rgba(82, 221, 255, .08); }
.lightbox-close:focus-visible,
.lightbox-step:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.lightbox-image-wrap {
  min-height: 280px;
  max-height: calc(100svh - 160px);
  padding: clamp(12px, 3vw, 26px);
  display: grid;
  place-items: center;
  background: #05080d;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: calc(100svh - 220px);
  display: block;
  object-fit: contain;
}

.lightbox-hint {
  color: #718691;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
}

@media (max-width: 980px) {
  .collection-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .gallery-back { margin-top: 25px; }
  .gallery-hero { padding-inline: 22px; }
  .collection-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
}

@media (max-width: 520px) {
  .collection-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery-section-heading { align-items: start; flex-direction: column; }
  .gallery-section-heading p { text-align: left; }
  .lightbox-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-piece,
  .gallery-piece img,
  .gallery-back,
  .lightbox-close,
  .lightbox-step { transition: none !important; }
  .gallery-piece:hover,
  .gallery-piece:hover img { transform: none; }
}

/* Gallery labels and artwork indices stay legible at every breakpoint. */
.gallery-back,
.gallery-crumb,
.gallery-hero-meta span,
.gallery-section-heading p,
.gallery-piece-number,
.lightbox-number,
.lightbox-count,
.lightbox-hint {
  font-size: 10px;
}
