/* Gallery page - Beautiful Tight Collage with Bigger Images */
:root {
  --gallery-header-clearance: clamp(92px, 10vh, 140px);
  --mobile-padding: clamp(1rem, 4vw, 1.5rem);
}

/* Top Section */
.gallery-top {
  padding: calc(var(--gallery-header-clearance) + 1.25rem)
    var(--mobile-padding) 2rem;
  background: linear-gradient(180deg, #fff 0%, #faf8f5 100%);
  border-bottom: 1px solid var(--soft-beige);
}

.gallery-top__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-top .eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sage-dark);
  font-weight: 700;
  font-size: clamp(0.7rem, 2.5vw, 0.875rem);
}

.gallery-top h1 {
  margin: 0.5rem 0 0.75rem;
  color: var(--charcoal);
  font-size: clamp(1.85rem, 5.5vw, 3rem);
  line-height: 1.2;
}

.gallery-top .lead {
  max-width: 50ch;
  color: var(--warm-gray);
  font-size: clamp(1rem, 2.8vw, 1.05rem);
  line-height: 1.7;
  margin: 0;
}

.gallery-meta {
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--soft-beige);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 30px -20px rgba(0, 0, 0, 0.15);
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  margin-top: 0.5rem;
}

.gallery-meta i {
  font-size: 1.1em;
  color: var(--sage-dark);
}

/* Gallery Section - SUPER SPECIFIC to override main styles */
.gallery-section {
  background: var(--warm-white);
  padding: clamp(2rem, 5vw, 3rem) 0;
}

.gallery-section .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 24px);
}

/* Gallery Grid - MAX 4 COLUMNS with bigger images */
.gallery-section .gallery-grid,
section.gallery-section .gallery-grid,
main .gallery-section .gallery-grid,
body .gallery-section .gallery-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(1, 1fr);
  margin-top: 0;
  grid-auto-rows: auto;
  list-style: none;
  padding: 0;
}

/* Mobile: 2 columns */
@media (min-width: 480px) {
  .gallery-section .gallery-grid,
  section.gallery-section .gallery-grid,
  main .gallery-section .gallery-grid,
  body .gallery-section .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* Tablet: 3 columns */
@media (min-width: 768px) {
  .gallery-section .gallery-grid,
  section.gallery-section .gallery-grid,
  main .gallery-section .gallery-grid,
  body .gallery-section .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

/* Desktop: MAX 4 columns */
@media (min-width: 1024px) {
  .gallery-section .gallery-grid,
  section.gallery-section .gallery-grid,
  main .gallery-section .gallery-grid,
  body .gallery-section .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

/* Large screens: still MAX 4 columns (bigger images) */
@media (min-width: 1400px) {
  .gallery-section .gallery-grid,
  section.gallery-section .gallery-grid,
  main .gallery-section .gallery-grid,
  body .gallery-section .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

/* Gallery Item - More specific selectors */
.gallery-section .gallery-item,
.gallery-section .gallery-grid .gallery-item,
section.gallery-section .gallery-grid .gallery-item {
  position: relative;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s 0s;
  border-radius: 6px;
  aspect-ratio: 1;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gallery-section .gallery-item img,
.gallery-section .gallery-grid .gallery-item img,
section.gallery-section .gallery-grid .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.4s ease, filter 0.4s ease;
  border-radius: 0;
  aspect-ratio: 1;
}

/* Hover overlay gradient */
.gallery-section .gallery-item::after,
.gallery-section .gallery-grid .gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Caption */
.gallery-section .gallery-item figcaption,
.gallery-section .gallery-grid .gallery-item figcaption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  font-weight: 500;
  line-height: 1.3;
  max-width: calc(100% - 28px);
}

/* Hover Effects (Desktop) */
@media (hover: hover) {
  .gallery-section .gallery-item:hover,
  .gallery-section .gallery-grid .gallery-item:hover {
    transform: scale(1.04);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s 0s;
  }

  .gallery-section .gallery-item:hover img,
  .gallery-section .gallery-grid .gallery-item:hover img {
    transform: scale(1.06);
    filter: brightness(1.05) contrast(1.05);
  }

  .gallery-section .gallery-item:hover::after,
  .gallery-section .gallery-grid .gallery-item:hover::after {
    opacity: 1;
  }

  .gallery-section .gallery-item:hover figcaption,
  .gallery-section .gallery-grid .gallery-item:hover figcaption {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile tap feedback */
@media (hover: none) {
  .gallery-section .gallery-item:active,
  .gallery-section .gallery-grid .gallery-item:active {
    transform: scale(0.97);
    opacity: 0.9;
  }
}

/* Lightbox Dialog */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(10px);
  border: 0;
  z-index: 2000;
  overscroll-behavior: contain;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
}

.lightbox[open] {
  display: flex;
  animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.lightbox[open] .lb-stage {
  transform: scale(1);
  opacity: 1;
}

#lb-img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
  transition: opacity 0.3s ease;
  opacity: 0;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pinch-zoom;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#lb-img.is-loaded {
  opacity: 1;
}

/* Loading Spinner */
.lb-spinner {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 1;
}

.lb-spinner::after {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Counter */
.lb-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
  border-radius: 24px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Control Buttons */
.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: none;
  color: var(--charcoal);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-size: 1.3rem;
}

.lb-close:active,
.lb-prev:active,
.lb-next:active {
  transform: scale(0.92);
}

.lb-close {
  top: 20px;
  right: 20px;
}

.lb-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* UI hide on idle */
.lightbox.lb-ui-hidden .lb-prev,
.lightbox.lb-ui-hidden .lb-next,
.lightbox.lb-ui-hidden .lb-close,
.lightbox.lb-ui-hidden .lb-counter {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Zoom state */
.lb-stage.zoomed #lb-img {
  cursor: grab;
}

.lb-stage.dragging #lb-img {
  cursor: grabbing;
}

/* Desktop hover enhancements */
@media (hover: hover) and (min-width: 1024px) {
  .gallery-top__inner {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    text-align: left;
  }

  .gallery-meta {
    margin-top: 0;
  }

  #lb-img {
    max-width: 88vw;
    max-height: 90vh;
  }

  .lb-counter {
    top: 24px;
    right: 90px;
    bottom: auto;
    left: auto;
    transform: none;
  }

  .lb-close {
    top: 24px;
    right: 24px;
  }

  .lb-prev {
    left: 24px;
  }

  .lb-next {
    right: 24px;
  }

  .lb-close:hover,
  .lb-prev:hover,
  .lb-next:hover {
    background: #fff;
    transform: scale(1.08);
  }

  .lb-prev:hover {
    transform: translate(-4px, -50%) scale(1.08);
  }

  .lb-next:hover {
    transform: translate(4px, -50%) scale(1.08);
  }

  .lb-close:hover {
    transform: scale(1.08);
  }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
  .gallery-top__inner {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    text-align: left;
  }

  .gallery-meta {
    margin-top: 0;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .gallery-section .gallery-item,
  .gallery-section .gallery-item img,
  .gallery-section .gallery-item::after,
  .gallery-section .gallery-item figcaption,
  .lb-stage,
  #lb-img,
  .lb-close,
  .lb-prev,
  .lb-next {
    transition: none !important;
    animation: none !important;
  }

  .lb-spinner::after {
    animation: none;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .gallery-top {
    padding-top: calc(var(--gallery-header-clearance) + 0.5rem);
    padding-bottom: 1rem;
  }

  .lb-counter {
    bottom: 12px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  #lb-img {
    max-height: 72vh;
  }
}

/* Print */
@media print {
  .gallery-meta,
  .lightbox {
    display: none;
  }

  .gallery-section .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

/* ========================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES
   GALLERY PAGE OPTIMIZATIONS
   ======================================== */

/* Extra Small Mobile (320px - 374px) */
@media (max-width: 374px) {
  :root {
    --gallery-header-clearance: 85px;
    --mobile-padding: 0.875rem;
  }

  .gallery-top {
    padding: calc(85px + 1rem) 0.875rem 1.5rem;
  }

  .gallery-top__inner {
    gap: 0.875rem;
  }

  .gallery-top .eyebrow {
    font-size: 0.65rem;
  }

  .gallery-top h1 {
    font-size: 1.65rem;
    margin: 0.4rem 0 0.65rem;
  }

  .gallery-top .lead {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .gallery-meta {
    padding: 0.65rem 0.875rem;
    font-size: 0.85rem;
    border-radius: 12px;
  }

  .gallery-meta i {
    font-size: 1rem;
  }

  .gallery-section {
    padding: 1.75rem 0;
  }

  .gallery-section .container {
    padding: 0 10px;
  }

  .gallery-section .gallery-grid {
    gap: 6px;
  }

  .gallery-section .gallery-item {
    border-radius: 4px;
  }

  .gallery-section .gallery-item figcaption {
    left: 10px;
    bottom: 10px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 8px;
    max-width: calc(100% - 20px);
  }

  /* Lightbox adjustments */
  #lb-img {
    max-width: 94vw;
    max-height: 85vh;
    border-radius: 6px;
  }

  .lb-counter {
    bottom: 16px;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 20px;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
  }

  .lb-close {
    top: 12px;
    right: 12px;
  }

  .lb-prev {
    left: 12px;
  }

  .lb-next {
    right: 12px;
  }

  .lb-spinner::after {
    width: 40px;
    height: 40px;
    border-width: 2.5px;
  }
}

/* Small Mobile Portrait (375px - 479px) */
@media (min-width: 375px) and (max-width: 479px) {
  :root {
    --gallery-header-clearance: 88px;
    --mobile-padding: 1rem;
  }

  .gallery-top {
    padding: calc(88px + 1.15rem) 1rem 1.65rem;
  }

  .gallery-top h1 {
    font-size: 1.75rem;
  }

  .gallery-top .lead {
    font-size: 0.95rem;
  }

  .gallery-meta {
    padding: 0.7rem 0.95rem;
    font-size: 0.9rem;
  }

  .gallery-section {
    padding: 1.85rem 0;
  }

  .gallery-section .container {
    padding: 0 11px;
  }

  .gallery-section .gallery-grid {
    gap: 7px;
  }

  .gallery-section .gallery-item figcaption {
    left: 11px;
    bottom: 11px;
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
  }

  #lb-img {
    max-width: 93vw;
    max-height: 86vh;
  }

  .lb-counter {
    bottom: 18px;
    padding: 0.55rem 0.95rem;
    font-size: 0.875rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    top: 14px;
  }

  .lb-prev {
    left: 14px;
    top: 50%;
  }

  .lb-next {
    right: 14px;
    top: 50%;
  }
}

/* Mobile Landscape */
@media (max-width: 767px) and (orientation: landscape) {
  :root {
    --gallery-header-clearance: 75px;
  }

  .gallery-top {
    padding: calc(75px + 0.75rem) 1.25rem 1.25rem;
  }

  .gallery-top h1 {
    font-size: 1.85rem;
    margin: 0.35rem 0 0.5rem;
  }

  .gallery-top .lead {
    font-size: 0.95rem;
  }

  .gallery-section {
    padding: 1.75rem 0;
  }

  .gallery-section .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  #lb-img {
    max-height: 75vh;
    max-width: 90vw;
  }

  .lb-counter {
    bottom: 10px;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 42px;
    height: 42px;
  }

  .lb-close {
    top: 10px;
    right: 10px;
  }

  .lb-prev {
    left: 10px;
    top: 50%;
  }

  .lb-next {
    right: 10px;
    top: 50%;
  }
}

/* Medium Mobile (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
  :root {
    --gallery-header-clearance: 90px;
    --mobile-padding: 1.125rem;
  }

  .gallery-top {
    padding: calc(90px + 1.2rem) 1.125rem 1.75rem;
  }

  .gallery-top__inner {
    gap: 0.95rem;
  }

  .gallery-top .eyebrow {
    font-size: 0.7rem;
  }

  .gallery-top h1 {
    font-size: 1.95rem;
  }

  .gallery-top .lead {
    font-size: 1rem;
  }

  .gallery-meta {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  .gallery-section {
    padding: 2rem 0;
  }

  .gallery-section .container {
    padding: 0 12px;
  }

  .gallery-section .gallery-grid {
    gap: 9px;
  }

  .gallery-section .gallery-item {
    border-radius: 5px;
  }

  .gallery-section .gallery-item figcaption {
    left: 12px;
    bottom: 12px;
    padding: 0.575rem 0.9rem;
    font-size: 0.825rem;
  }

  #lb-img {
    max-width: 91vw;
    max-height: 87vh;
  }

  .lb-counter {
    bottom: 20px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .lb-close {
    top: 16px;
    right: 16px;
  }

  .lb-prev {
    left: 16px;
  }

  .lb-next {
    right: 16px;
  }
}

/* Large Mobile / Phablet (640px - 767px) */
@media (min-width: 640px) and (max-width: 767px) {
  :root {
    --gallery-header-clearance: 95px;
    --mobile-padding: 1.25rem;
  }

  .gallery-top {
    padding: calc(95px + 1.25rem) 1.25rem 1.85rem;
  }

  .gallery-top h1 {
    font-size: 2.15rem;
  }

  .gallery-top .lead {
    font-size: 1.02rem;
  }

  .gallery-meta {
    font-size: 0.975rem;
  }

  .gallery-section {
    padding: 2.15rem 0;
  }

  .gallery-section .container {
    padding: 0 13px;
  }

  .gallery-section .gallery-grid {
    gap: 10px;
  }

  .gallery-section .gallery-item figcaption {
    left: 13px;
    bottom: 13px;
    padding: 0.6rem 0.95rem;
    font-size: 0.85rem;
  }

  #lb-img {
    max-width: 90vw;
    max-height: 87vh;
  }

  .lb-counter {
    bottom: 22px;
    padding: 0.625rem 1.05rem;
    font-size: 0.925rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 50px;
    height: 50px;
    font-size: 1.275rem;
  }

  .lb-close {
    top: 18px;
    right: 18px;
  }

  .lb-prev {
    left: 18px;
  }

  .lb-next {
    right: 18px;
  }
}

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --gallery-header-clearance: 100px;
    --mobile-padding: 1.5rem;
  }

  .gallery-top {
    padding: calc(100px + 1.3rem) 1.5rem 2rem;
  }

  .gallery-top__inner {
    gap: 1.05rem;
  }

  .gallery-top .eyebrow {
    font-size: 0.775rem;
  }

  .gallery-top h1 {
    font-size: 2.35rem;
  }

  .gallery-top .lead {
    font-size: 1.05rem;
  }

  .gallery-meta {
    padding: 0.8rem 1.05rem;
    font-size: 1rem;
  }

  .gallery-section {
    padding: 2.5rem 0;
  }

  .gallery-section .container {
    padding: 0 15px;
  }

  .gallery-section .gallery-grid {
    gap: 11px;
  }

  .gallery-section .gallery-item {
    border-radius: 6px;
  }

  .gallery-section .gallery-item figcaption {
    left: 14px;
    bottom: 14px;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  #lb-img {
    max-width: 89vw;
    max-height: 88vh;
    border-radius: 8px;
  }

  .lb-counter {
    bottom: 24px;
    padding: 0.65rem 1.1rem;
    font-size: 0.95rem;
    border-radius: 24px;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
  }

  .lb-close {
    top: 20px;
    right: 20px;
  }

  .lb-prev {
    left: 20px;
  }

  .lb-next {
    right: 20px;
  }

  .lb-spinner::after {
    width: 50px;
    height: 50px;
  }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {
  .gallery-top {
    padding: calc(95px + 1.25rem) 1.75rem 1.85rem;
  }

  .gallery-top h1 {
    font-size: 2.25rem;
  }

  .gallery-section {
    padding: 2.25rem 0;
  }

  .gallery-section .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  #lb-img {
    max-height: 82vh;
  }

  .lb-counter {
    top: 20px;
    right: 80px;
    bottom: auto;
    left: auto;
    transform: none;
  }
}

/* Small Desktop (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
  :root {
    --gallery-header-clearance: 110px;
  }

  .gallery-top {
    padding: calc(110px + 1.35rem) 2rem 2.15rem;
  }

  .gallery-top__inner {
    gap: 1.15rem;
  }

  .gallery-top .eyebrow {
    font-size: 0.8rem;
  }

  .gallery-top h1 {
    font-size: 2.6rem;
  }

  .gallery-top .lead {
    font-size: 1.05rem;
  }

  .gallery-meta {
    padding: 0.8rem 1.1rem;
    font-size: 1rem;
  }

  .gallery-meta i {
    font-size: 1.15em;
  }

  .gallery-section {
    padding: 2.75rem 0;
  }

  .gallery-section .container {
    padding: 0 18px;
  }

  .gallery-section .gallery-grid {
    gap: 13px;
  }

  .gallery-section .gallery-item {
    border-radius: 6px;
  }

  .gallery-section .gallery-item figcaption {
    left: 14px;
    bottom: 14px;
    padding: 0.625rem 1.05rem;
    font-size: 0.875rem;
    border-radius: 10px;
  }

  #lb-img {
    max-width: 87vw;
    max-height: 89vh;
  }

  .lb-counter {
    top: 24px;
    right: 85px;
    bottom: auto;
    left: auto;
    transform: none;
    padding: 0.65rem 1.15rem;
    font-size: 0.95rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 54px;
    height: 54px;
    font-size: 1.35rem;
  }

  .lb-close {
    top: 24px;
    right: 24px;
  }

  .lb-prev {
    left: 24px;
  }

  .lb-next {
    right: 24px;
  }
}

/* Medium Desktop (1280px - 1439px) */
@media (min-width: 1280px) and (max-width: 1439px) {
  :root {
    --gallery-header-clearance: 115px;
  }

  .gallery-top {
    padding: calc(115px + 1.4rem) 2.25rem 2.25rem;
  }

  .gallery-top__inner {
    gap: 1.2rem;
    max-width: 1300px;
  }

  .gallery-top .eyebrow {
    font-size: 0.825rem;
  }

  .gallery-top h1 {
    font-size: 2.75rem;
  }

  .gallery-top .lead {
    font-size: 1.05rem;
    max-width: 52ch;
  }

  .gallery-meta {
    padding: 0.825rem 1.15rem;
    font-size: 1.02rem;
    border-radius: 15px;
  }

  .gallery-section {
    padding: 2.85rem 0;
  }

  .gallery-section .container {
    padding: 0 20px;
    max-width: 1450px;
  }

  .gallery-section .gallery-grid {
    gap: 14px;
  }

  .gallery-section .gallery-item figcaption {
    padding: 0.65rem 1.1rem;
    font-size: 0.88rem;
  }

  #lb-img {
    max-width: 86vw;
    max-height: 89vh;
  }

  .lb-counter {
    top: 24px;
    right: 88px;
    padding: 0.675rem 1.2rem;
    font-size: 0.975rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 55px;
    height: 55px;
    font-size: 1.375rem;
  }
}

/* Large Desktop (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
  :root {
    --gallery-header-clearance: 120px;
  }

  .gallery-top {
    padding: calc(120px + 1.45rem) 2.5rem 2.35rem;
  }

  .gallery-top__inner {
    gap: 1.25rem;
    max-width: 1350px;
  }

  .gallery-top .eyebrow {
    font-size: 0.85rem;
  }

  .gallery-top h1 {
    font-size: 2.9rem;
  }

  .gallery-top .lead {
    font-size: 1.08rem;
    max-width: 54ch;
  }

  .gallery-meta {
    padding: 0.85rem 1.2rem;
    font-size: 1.05rem;
    border-radius: 15px;
  }

  .gallery-meta i {
    font-size: 1.2em;
  }

  .gallery-section {
    padding: 3rem 0;
  }

  .gallery-section .container {
    padding: 0 22px;
    max-width: 1500px;
  }

  .gallery-section .gallery-grid {
    gap: 15px;
  }

  .gallery-section .gallery-item {
    border-radius: 7px;
  }

  .gallery-section .gallery-item figcaption {
    padding: 0.675rem 1.125rem;
    font-size: 0.9rem;
    border-radius: 11px;
  }

  #lb-img {
    max-width: 85vw;
    max-height: 89vh;
    border-radius: 9px;
  }

  .lb-counter {
    top: 24px;
    right: 90px;
    padding: 0.7rem 1.25rem;
    font-size: 1rem;
    border-radius: 26px;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }

  .lb-spinner::after {
    width: 52px;
    height: 52px;
    border-width: 3.5px;
  }
}

/* Extra Large Desktop / 1080p (1920px - 2559px) */
@media (min-width: 1920px) and (max-width: 2559px) {
  :root {
    --gallery-header-clearance: 130px;
  }

  .gallery-top {
    padding: calc(130px + 1.65rem) 3rem 2.75rem;
  }

  .gallery-top__inner {
    gap: 1.5rem;
    max-width: 1500px;
  }

  .gallery-top .eyebrow {
    font-size: 0.9rem;
    letter-spacing: 0.2em;
  }

  .gallery-top h1 {
    font-size: 3.25rem;
    margin: 0.6rem 0 0.85rem;
  }

  .gallery-top .lead {
    font-size: 1.15rem;
    max-width: 58ch;
    line-height: 1.75;
  }

  .gallery-meta {
    padding: 0.95rem 1.35rem;
    font-size: 1.12rem;
    border-radius: 16px;
    box-shadow: 0 12px 36px -22px rgba(0, 0, 0, 0.2);
  }

  .gallery-meta i {
    font-size: 1.25em;
  }

  .gallery-section {
    padding: 3.5rem 0;
  }

  .gallery-section .container {
    padding: 0 26px;
    max-width: 1600px;
  }

  .gallery-section .gallery-grid {
    gap: 17px;
  }

  .gallery-section .gallery-item {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  }

  .gallery-section .gallery-item figcaption {
    left: 16px;
    bottom: 16px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border-radius: 12px;
    max-width: calc(100% - 32px);
  }

  #lb-img {
    max-width: 84vw;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
  }

  .lb-counter {
    top: 28px;
    right: 100px;
    padding: 0.8rem 1.4rem;
    font-size: 1.1rem;
    border-radius: 28px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 62px;
    height: 62px;
    font-size: 1.55rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  }

  .lb-close {
    top: 28px;
    right: 28px;
  }

  .lb-prev {
    left: 28px;
  }

  .lb-next {
    right: 28px;
  }

  .lb-spinner::after {
    width: 56px;
    height: 56px;
    border-width: 4px;
  }
}

/* Ultra-Wide / 4K (2560px+) */
@media (min-width: 2560px) {
  :root {
    --gallery-header-clearance: 140px;
  }

  .gallery-top {
    padding: calc(140px + 2rem) 4rem 3.5rem;
  }

  .gallery-top__inner {
    gap: 1.75rem;
    max-width: 1800px;
  }

  .gallery-top .eyebrow {
    font-size: 1rem;
    letter-spacing: 0.22em;
  }

  .gallery-top h1 {
    font-size: 3.75rem;
    margin: 0.75rem 0 1rem;
    letter-spacing: -0.01em;
  }

  .gallery-top .lead {
    font-size: 1.35rem;
    max-width: 65ch;
    line-height: 1.8;
  }

  .gallery-meta {
    padding: 1.15rem 1.65rem;
    font-size: 1.3rem;
    border-radius: 18px;
    box-shadow: 0 14px 42px -24px rgba(0, 0, 0, 0.25);
    border-width: 1.5px;
  }

  .gallery-meta i {
    font-size: 1.35em;
  }

  .gallery-section {
    padding: 4.5rem 0;
  }

  .gallery-section .container {
    padding: 0 32px;
    max-width: 1900px;
  }

  .gallery-section .gallery-grid {
    gap: 20px;
  }

  .gallery-section .gallery-item {
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  }

  .gallery-section .gallery-item figcaption {
    left: 18px;
    bottom: 18px;
    padding: 0.9rem 1.5rem;
    font-size: 1.15rem;
    border-radius: 14px;
    max-width: calc(100% - 36px);
  }

  #lb-img {
    max-width: 82vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  }

  .lb-counter {
    top: 32px;
    right: 115px;
    padding: 1rem 1.75rem;
    font-size: 1.3rem;
    border-radius: 32px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    border-width: 1.5px;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 72px;
    height: 72px;
    font-size: 1.85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  .lb-close {
    top: 32px;
    right: 32px;
  }

  .lb-prev {
    left: 32px;
  }

  .lb-next {
    right: 32px;
  }

  .lb-spinner::after {
    width: 64px;
    height: 64px;
    border-width: 5px;
  }
}

/* Ultra-Ultra-Wide (3440px+) */
@media (min-width: 3440px) {
  :root {
    --gallery-header-clearance: 160px;
  }

  .gallery-top {
    padding: calc(160px + 2.5rem) 5rem 4.5rem;
  }

  .gallery-top__inner {
    gap: 2rem;
    max-width: 2200px;
  }

  .gallery-top .eyebrow {
    font-size: 1.15rem;
  }

  .gallery-top h1 {
    font-size: 4.25rem;
    margin: 0.85rem 0 1.15rem;
  }

  .gallery-top .lead {
    font-size: 1.55rem;
    max-width: 70ch;
  }

  .gallery-meta {
    padding: 1.35rem 2rem;
    font-size: 1.5rem;
    border-radius: 20px;
  }

  .gallery-section {
    padding: 5.5rem 0;
  }

  .gallery-section .container {
    padding: 0 40px;
    max-width: 2300px;
  }

  .gallery-section .gallery-grid {
    gap: 24px;
  }

  .gallery-section .gallery-item {
    border-radius: 12px;
  }

  .gallery-section .gallery-item figcaption {
    left: 20px;
    bottom: 20px;
    padding: 1.1rem 1.75rem;
    font-size: 1.35rem;
    border-radius: 16px;
  }

  #lb-img {
    max-width: 80vw;
    border-radius: 14px;
  }

  .lb-counter {
    top: 40px;
    right: 135px;
    padding: 1.2rem 2rem;
    font-size: 1.5rem;
    border-radius: 36px;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 84px;
    height: 84px;
    font-size: 2.2rem;
  }

  .lb-close {
    top: 40px;
    right: 40px;
  }

  .lb-prev {
    left: 40px;
  }

  .lb-next {
    right: 40px;
  }
}

/* Height-based adjustments for short screens */
@media (max-height: 600px) {
  :root {
    --gallery-header-clearance: 75px;
  }

  .gallery-top {
    padding: calc(75px + 0.5rem) 1.25rem 1rem;
  }

  .gallery-top h1 {
    margin: 0.3rem 0 0.5rem;
  }

  .gallery-section {
    padding: 1.5rem 0;
  }

  #lb-img {
    max-height: 70vh;
  }

  .lb-counter {
    bottom: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .lb-close {
    top: 8px;
    right: 8px;
  }

  .lb-prev {
    left: 8px;
  }

  .lb-next {
    right: 8px;
  }
}

@media (min-height: 900px) {
  .gallery-top {
    padding-bottom: 3rem;
  }

  .gallery-section {
    padding: 3.5rem 0;
  }

  #lb-img {
    max-height: 91vh;
  }
}

@media (min-height: 1080px) {
  .gallery-top {
    padding-bottom: 3.5rem;
  }

  .gallery-section {
    padding: 4.5rem 0;
  }

  #lb-img {
    max-height: 92vh;
  }
}

/* Specific device optimizations */

/* iPhone SE / Small phones */
@media (max-width: 375px) and (max-height: 667px) {
  .gallery-top h1 {
    font-size: 1.6rem;
  }

  .gallery-section .gallery-grid {
    gap: 6px;
  }
}

/* iPad Mini Portrait */
@media (min-width: 768px) and (max-width: 768px) and (orientation: portrait) {
  .gallery-section .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
  }
}

/* iPad Pro 11" Portrait */
@media (min-width: 834px) and (max-width: 834px) and (orientation: portrait) {
  .gallery-section .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .lb-counter {
    top: 22px;
    right: 82px;
    bottom: auto;
  }
}

/* iPad Pro 12.9" Portrait */
@media (min-width: 1024px) and (max-width: 1024px) and (orientation: portrait) {
  .gallery-section .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Surface Pro / 2-in-1 devices */
@media (min-width: 1280px) and (min-height: 900px) {
  .gallery-top {
    padding-bottom: 3rem;
  }

  .gallery-section {
    padding: 3.5rem 0;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .gallery-section .gallery-item:active {
    transform: scale(0.96);
  }

  .lb-close:active,
  .lb-prev:active,
  .lb-next:active {
    transform: scale(0.88);
  }

  .lb-prev:active {
    transform: translate(0, -50%) scale(0.88);
  }

  .lb-next:active {
    transform: translate(0, -50%) scale(0.88);
  }
}

/* High resolution displays */
@media (min-resolution: 192dpi) and (min-width: 1024px) {
  .gallery-section .gallery-item {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  }

  #lb-img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .gallery-section .gallery-item,
  .gallery-section .gallery-item img,
  .gallery-section .gallery-item::after,
  .gallery-section .gallery-item figcaption,
  .lightbox,
  .lb-stage,
  #lb-img,
  .lb-close,
  .lb-prev,
  .lb-next {
    transition: none !important;
    animation: none !important;
  }

  @keyframes lightboxFadeIn {
    from,
    to {
      opacity: 1;
    }
  }

  @keyframes spin {
    from,
    to {
      transform: rotate(0deg);
    }
  }

  .gallery-section .gallery-item:hover {
    transform: none;
  }

  .gallery-section .gallery-item:hover img {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gallery-meta {
    border-width: 2px;
  }

  .gallery-section .gallery-item {
    border: 2px solid rgba(0, 0, 0, 0.2);
  }

  .lb-close,
  .lb-prev,
  .lb-next {
    border: 2px solid rgba(0, 0, 0, 0.3);
  }

  .lb-counter {
    border-width: 2px;
  }
}

/* Print styles */
@media print {
  :root {
    --gallery-header-clearance: 0;
  }

  .gallery-top {
    background: #fff !important;
    padding: 1.5rem 1rem !important;
    border: none;
    page-break-after: avoid;
  }

  .gallery-top h1 {
    color: #000 !important;
  }

  .gallery-top .lead {
    color: #333 !important;
  }

  .gallery-meta {
    display: none;
  }

  .gallery-section {
    padding: 1rem 0;
  }

  .gallery-section .container {
    padding: 0;
    max-width: 100%;
  }

  .gallery-section .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    page-break-inside: avoid;
  }

  .gallery-section .gallery-item {
    border-radius: 4px;
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .gallery-section .gallery-item::after,
  .gallery-section .gallery-item figcaption {
    display: none;
  }

  .gallery-section .gallery-item:hover {
    transform: none;
  }

  .lightbox {
    display: none !important;
  }
}



