body.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(1,116,243,.16), transparent 48%),
    rgba(1,4,10,.98);
  backdrop-filter: blur(18px);
  overscroll-behavior: contain;
}
.modal.open { display: grid; }
.modal-inner.gallery-lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  grid-template-rows: 1fr;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.gallery-lightbox > img {
  width: 100%;
  height: 100dvh;
  padding: clamp(1.5rem, 4vw, 4rem);
  object-fit: contain;
  background: transparent;
}
.gallery-lightbox .modal-bar {
  height: 100dvh;
  display: flex;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 3vw, 2.5rem);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(7,26,42,.98), rgba(2,5,12,.98));
  border-left: 1px solid rgba(143,243,232,.2);
}
.gallery-lightbox .modal-bar h3 {
  margin: .5rem 0 1rem;
  color: #ffe6ad;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 500;
}
.gallery-lightbox .modal-bar p { color: rgba(246,243,232,.78); }
.modal-close,
.modal-nav {
  position: fixed;
  z-index: 1002;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid rgba(246,243,232,.3);
  background: rgba(3,7,14,.88);
  color: #fff;
  cursor: pointer;
}
.modal-close { top: 1rem; right: 1rem; padding: .7rem 1rem; }
.modal-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.modal-next { right: 410px; top: 50%; transform: translateY(-50%); }
.modal-close:hover,
.modal-nav:hover,
.modal-close:focus-visible,
.modal-nav:focus-visible { border-color: #8ff3e8; background: #0174F3; }
.modal-details { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.25rem 0; }
.modal-details div { padding: .75rem; border: 1px solid rgba(246,243,232,.12); }
.modal-details dt { color: #8ff3e8; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.modal-details dd { margin: .25rem 0 0; color: #f6f3e8; }
@media (max-width: 800px) {
  .modal-inner.gallery-lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 68dvh) minmax(0, 32dvh); overflow: hidden; }
  .gallery-lightbox > img { height: 68dvh; padding: 3.5rem 1rem 1rem; }
  .gallery-lightbox .modal-bar { height: 32dvh; overflow-y: auto; padding: 1rem; border-left: 0; border-top: 1px solid rgba(143,243,232,.2); }
  .gallery-lightbox .modal-bar h3 { font-size: 1.7rem; }
  .modal-prev { left: .5rem; top: 34%; }
  .modal-next { right: .5rem; top: 34%; }
  .modal-details { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .modal, .modal * { transition: none !important; animation: none !important; }
}
/* True full-screen artwork presentation */
.modal-inner.gallery-lightbox {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.gallery-lightbox > img {
  width: 100vw;
  height: 100dvh;
  padding: clamp(1rem, 3vw, 2.5rem);
}
.gallery-lightbox .modal-bar {
  position: fixed;
  left: clamp(1rem, 3vw, 2.5rem);
  right: clamp(1rem, 3vw, 2.5rem);
  bottom: clamp(1rem, 3vw, 2rem);
  width: auto;
  height: auto;
  max-height: 32dvh;
  display: block;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  background: linear-gradient(90deg, rgba(2,5,12,.94), rgba(7,26,42,.82));
  border: 1px solid rgba(143,243,232,.22);
  backdrop-filter: blur(16px);
}
.gallery-lightbox .modal-bar h3 { margin: .2rem 0 .35rem; font-size: clamp(1.35rem, 2.8vw, 2.5rem); }
.gallery-lightbox .modal-bar p { margin: .25rem 0; }
.gallery-lightbox .modal-details { display: none; }
.modal-next { right: 1rem; }

/* Interactive Gallery dialog */
.lightbox[open] {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: radial-gradient(circle at 50% 40%, rgba(1,116,243,.14), transparent 48%), #01040a;
  color: #f6f3e8;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(1,4,10,.98); }
.lightbox figure { width: 100%; height: 100%; margin: 0; display: grid; place-items: center; }
.lightbox figure > img { width: 100vw; height: 100dvh; padding: clamp(1rem, 3vw, 2.5rem); object-fit: contain; }
.lightbox figcaption {
  position: fixed;
  left: clamp(1rem, 3vw, 2.5rem);
  right: clamp(1rem, 3vw, 2.5rem);
  bottom: clamp(1rem, 3vw, 2rem);
  max-height: 30dvh;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  background: linear-gradient(90deg, rgba(2,5,12,.94), rgba(7,26,42,.82));
  border: 1px solid rgba(143,243,232,.22);
  backdrop-filter: blur(16px);
}
.lightbox-close, .lightbox-nav { position: fixed; z-index: 1002; min-width: 48px; min-height: 48px; }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-nav.previous { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 1rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 800px) {
  .modal-inner.gallery-lightbox { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .gallery-lightbox > img { width: 100vw; height: 100dvh; padding: 3.5rem .75rem 8rem; }
  .gallery-lightbox .modal-bar { height: auto; max-height: 26dvh; padding: .75rem; }
  .gallery-lightbox .modal-bar p, .lightbox figcaption p { display: none; }
  .modal-prev, .modal-next { top: 50%; }
  .lightbox figure > img { padding: 3.5rem .75rem 7rem; }
  .lightbox figcaption { max-height: 23dvh; padding: .75rem; }
}

/* Second-click detail magnification */
#modalImg, #lightbox-image {
  cursor: zoom-in;
  transition: transform .28s ease;
  transform-origin: center center;
}
#modalImg.is-detail-zoomed,
#lightbox-image.is-detail-zoomed {
  transform: scale(3.25);
  cursor: zoom-out;
}
.gallery-lightbox.has-detail-zoom,
.lightbox.has-detail-zoom {
  overflow: auto;
}
.gallery-lightbox.has-detail-zoom .modal-bar,
.lightbox.has-detail-zoom figcaption {
  opacity: .12;
  pointer-events: none;
}
#modalImg:focus-visible,
#lightbox-image:focus-visible {
  outline: 3px solid #ffe6ad;
  outline-offset: -6px;
}
@media (max-width: 800px) {
  #modalImg.is-detail-zoomed,
  #lightbox-image.is-detail-zoomed { transform: scale(3.5); }
}
@media (prefers-reduced-motion: reduce) {
  #modalImg, #lightbox-image { transition: none; }
}

#modalImg.is-detail-zoomed,
#lightbox-image.is-detail-zoomed {
  max-width: none !important;
  max-height: none !important;
  z-index: 1001;
}
.gallery-lightbox.has-detail-zoom .modal-close,
.gallery-lightbox.has-detail-zoom .modal-nav,
.lightbox.has-detail-zoom .lightbox-close,
.lightbox.has-detail-zoom .lightbox-nav { opacity: .7; }

.c4-gallery-entry {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto 0;
  padding: clamp(1.25rem, 3vw, 2.2rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  border: 1px solid rgba(73,217,255,.34);
  background: radial-gradient(circle at 85% 15%, rgba(255,107,157,.13), transparent 34%), linear-gradient(135deg, rgba(8,119,242,.22), rgba(2,5,12,.94));
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
}
.c4-gallery-entry h2 { margin: .25rem 0 .6rem; color: #ffe6ad; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 4vw, 3.5rem); font-weight: 500; }
.c4-gallery-entry p { max-width: 760px; color: rgba(246,243,232,.76); }
.c4-button { border-color: rgba(255,107,157,.55) !important; }
@media (max-width: 720px) {
  .c4-gallery-entry { grid-template-columns: 1fr; }
}

.detail-zoom-control {
  position: fixed;
  z-index: 1003;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  min-height: 48px;
  padding: .7rem 1rem;
  border: 1px solid #8ff3e8;
  background: rgba(2,5,12,.92);
  color: #fff;
  cursor: pointer;
  font: 800 .68rem/1 Inter, Arial, sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.detail-zoom-control:hover,
.detail-zoom-control:focus-visible,
.detail-zoom-control[aria-pressed="true"] { background: #0174F3; border-color: #ffe6ad; }
