#galeri {
  background: var(--black);
  color: #f8f8f5;
  border-block-start: 2px solid var(--yellow);
  padding-block: var(--section-space);
}

#galeri .eyebrow { color: var(--yellow); }
#galeri :focus-visible { outline-color: var(--yellow); }

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px 40px;
  margin-bottom: 32px;
}

.gallery-heading h2 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.06;
  letter-spacing: -.055em;
  margin: 10px 0 0;
}

.gallery-heading p,
.gallery-feature-heading p,
.work-gallery-heading p {
  color: #bdbdb8;
  margin: 0;
}

.gallery-heading p {
  max-width: 44ch;
}

.gallery-jump {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 7px;
  color: var(--yellow);
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: .25em;
}

.gallery-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
  padding: clamp(12px, 2vw, 24px);
  margin-bottom: 20px;
  border: 1px solid #414037;
  border-radius: 18px;
  background: #20201b;
}

.gallery-feature-heading {
  padding-inline: clamp(0px, 1vw, 12px);
}

.gallery-feature-heading h3 {
  font-size: clamp(25px, 3.35vw, 40px);
  line-height: 1.1;
  letter-spacing: -.035em;
  margin: 8px 0 10px;
}

.gallery-feature-pair,
.gallery-comparison-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.8vw, 18px);
}

.gallery-comparisons {
  display: grid;
  gap: clamp(14px, 2.4vw, 28px);
  max-width: 56rem;
  margin: clamp(32px, 5vw, 60px) auto 0;
  scroll-margin-top: calc(var(--header-offset) + 12px);
}

.gallery-comparisons h3 {
  margin: 0;
  padding-inline-start: 12px;
  border-inline-start: 3px solid var(--yellow);
  font-size: clamp(21px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: -.035em;
}

.gallery-comparison {
  padding: clamp(10px, 2vw, 20px);
  border: 1px solid #414037;
  border-radius: 14px;
  background: #20201b;
}

.gallery-comparison h4 {
  margin: 0 0 10px;
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1.3;
  letter-spacing: -.02em;
}

.gallery-comparison figure {
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  border: 1px solid #48473e;
  border-radius: 8px;
  background: #141414;
}

.gallery-comparison figcaption {
  padding: 6px 8px;
  background: #30302a;
  color: #f8f8f5;
  font-size: clamp(14px, 1.7vw, 16px);
  font-weight: 800;
  text-align: center;
}

.gallery-comparison figure:last-child figcaption {
  background: var(--yellow);
  color: var(--black);
}

.gallery-comparison img {
  display: block;
  width: 100%;
  height: auto;
  margin-block: auto;
}

.work-gallery {
  margin-top: clamp(40px, 7vw, 84px);
  padding: clamp(26px, 4vw, 48px) 0 0;
  border-top: 1px solid #514624;
}

.work-gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px 30px;
  margin-bottom: 22px;
}

.work-gallery-heading h3 {
  margin: 8px 0 0;
  font-size: clamp(26px, 4.1vw, 47px);
  line-height: 1.1;
  letter-spacing: -.04em;
}

.work-gallery-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.work-gallery-tools p { font-size: 13px; }
.work-gallery-tools .scroll-controls button { color: var(--yellow); background: #22221b; border-color: #5a5135; }
.work-gallery-tools .scroll-controls button:not(:disabled):hover { color: var(--black); background: var(--yellow); }
.work-grid .gallery-link { height: 100%; }
.work-grid .gallery-frame { aspect-ratio: 4 / 3; }

.gallery-link {
  display: block;
  min-width: 0;
  border: 1px solid #383838;
  border-radius: 8px;
  background: #191919;
  transition: border-color .18s ease;
}

.gallery-link:hover,
.gallery-link:focus-visible {
  border-color: var(--yellow);
}

.gallery-link:focus-visible,
.gallery-jump:focus-visible,
#gallery-viewer button:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

.gallery-card {
  margin: 0;
}

.gallery-frame {
  aspect-ratio: 3 / 4;
  padding: 4px;
  background: #090909;
  overflow: hidden;
  border-radius: 7px 7px 0 0;
}

.gallery-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-caption {
  position: relative;
  padding: 12px 43px 13px 14px;
}

.gallery-caption::after {
  content: "↗" / "";
  display: grid;
  place-items: center;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 1px solid #48473e;
  border-radius: 4px;
  color: var(--yellow);
  line-height: 1;
}

.gallery-caption-title,
.gallery-caption-detail {
  display: block;
}

.gallery-caption-title {
  font-weight: 800;
  line-height: 1.3;
}

.gallery-caption-detail {
  color: #bdbdb8;
  font-size: 13px;
  margin-top: 3px;
}

.gallery-feature-pair .gallery-link:last-child .gallery-caption-title {
  color: var(--yellow);
}

.shared-gallery {
  border-block-start: 1px solid var(--rule);
  background: var(--paper);
}

.shared-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(12px, 2vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.shared-gallery-link {
  display: block;
  padding: 5px;
  border: 1px solid var(--rule);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 3px 12px #2c26100a;
}

.shared-gallery-link:hover { border-color: var(--warm); }
.shared-gallery-link img { display: block; width: 100%; height: auto; border-radius: 9px; }

@media (max-width: 620px) {
  .shared-gallery-grid { grid-template-columns: minmax(0, 1fr); }
}

html:has(#gallery-viewer[open]) {
  overflow: hidden;
}

#gallery-viewer {
  box-sizing: border-box;
  width: min(680px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 12px;
  border: 1px solid #666152;
  border-radius: 10px;
  background: #151515;
  color: #fff;
}

#gallery-viewer::backdrop {
  background: #000d;
}

.gallery-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}

.gallery-viewer-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

#gallery-viewer button {
  min-height: 44px;
  padding-inline: 12px;
  border: 0;
  border-radius: 4px;
  background: var(--yellow);
  color: var(--black);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

#gallery-viewer img:not([hidden]) {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(75vh, 46rem);
  max-height: min(75dvh, 46rem);
  object-fit: contain;
  background: #080808;
}

#gallery-viewer p {
  padding: 12px;
}

@media (max-width: 800px) {
  .gallery-feature { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .gallery-heading { flex-direction: column; align-items: flex-start; margin-bottom: 24px; }
  .work-gallery-heading { flex-direction: column; align-items: stretch; }
  .gallery-feature { margin-bottom: 14px; }
  .gallery-feature-pair .gallery-caption { padding-inline: 8px 27px; }
  .gallery-feature-pair .gallery-caption::after { right: 6px; width: 17px; height: 17px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-link { transition: none; }
}
