.photo-carousel {
  --photo-line: #50618066;
  --photo-blue: #a9c3ff;
  --photo-surface: #121b2a;
  --photo-ink: #090f1a;
  --photo-muted: #b8c5dc;
  --photo-height: clamp(14rem, 46vw, 31rem);
  --photo-gap: clamp(.65rem, 1.5vw, 1.16rem);
  --photo-wide: min(88%, 56rem);
  --photo-action: min(84%, calc(var(--photo-height) * .8));
  --photo-portrait: min(76%, calc(var(--photo-height) * .72));
  --photo-square: min(82%, calc(var(--photo-height) * 1.02));
  min-width: 0;
}

.photo-carousel .photo-carousel-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--photo-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-carousel [data-photo-slide] { min-width: 0; }
.photo-carousel figure { margin: 0; }

.photo-carousel figure a {
  position: relative;
  display: block;
  overflow: hidden;
  outline-offset: -3px;
  background: var(--photo-ink);
  border: 1px solid var(--photo-line);
  transition: border-color .24s ease;
}

.photo-carousel figure a:hover { border-color: var(--photo-blue); }

.photo-carousel figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.photo-carousel figcaption {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .34rem .72rem;
  padding: .66rem .75rem;
  border: 1px solid var(--photo-line);
  border-top: 0;
  background: var(--photo-surface);
  font-size: .86rem;
}

.photo-carousel figcaption span { color: var(--photo-muted); }

.photo-carousel.is-enhanced .photo-carousel-track {
  --photo-last-width: var(--photo-wide);
  position: relative;
  display: flex;
  align-items: start;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-color: #5d77a9 var(--photo-ink);
  scrollbar-width: thin;
  padding: .24rem 0 .76rem;
}

.photo-carousel.is-enhanced .photo-carousel-track:has([data-photo-shape="portrait"]:last-child) {
  --photo-last-width: var(--photo-portrait);
}

.photo-carousel.is-enhanced .photo-carousel-track:has([data-photo-shape="square"]:last-child) {
  --photo-last-width: var(--photo-square);
}

.photo-carousel.is-enhanced .photo-carousel-track:has([data-photo-shape="action"]:last-child) {
  --photo-last-width: var(--photo-action);
}

.photo-carousel.is-enhanced .photo-carousel-track::after {
  content: "";
  flex: 0 0 max(0px, calc(100% - var(--photo-last-width) - var(--photo-gap)));
}

.photo-carousel.is-enhanced [data-photo-slide] {
  flex: 0 0 var(--photo-wide);
  scroll-snap-align: start;
}

.photo-carousel.is-enhanced [data-photo-shape="portrait"] { flex-basis: var(--photo-portrait); }
.photo-carousel.is-enhanced [data-photo-shape="square"] { flex-basis: var(--photo-square); }
.photo-carousel.is-enhanced [data-photo-shape="action"] { flex-basis: var(--photo-action); }

.photo-carousel.is-enhanced figure {
  opacity: .78;
  transform: translateY(.45rem);
  transition: opacity .32s ease, transform .42s cubic-bezier(.22, .61, .36, 1);
}

.photo-carousel.is-enhanced [data-photo-active] figure,
.photo-carousel.is-enhanced figure:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.photo-carousel.is-enhanced [data-photo-active] figure a {
  border-color: #a9c3ffae;
}

.photo-carousel.is-enhanced figure img {
  height: var(--photo-height);
  aspect-ratio: auto;
  object-fit: contain;
}

.photo-carousel.is-enhanced figure a[aria-haspopup="dialog"]::after {
  content: "";
  position: absolute;
  top: .65rem;
  right: .65rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid #a9c3ff70;
  border-radius: .28rem;
  background:
    linear-gradient(var(--photo-blue) 0 0) left .47rem top .47rem / .44rem 1px,
    linear-gradient(var(--photo-blue) 0 0) left .47rem top .47rem / 1px .44rem,
    linear-gradient(var(--photo-blue) 0 0) right .47rem top .47rem / .44rem 1px,
    linear-gradient(var(--photo-blue) 0 0) right .47rem top .47rem / 1px .44rem,
    linear-gradient(var(--photo-blue) 0 0) left .47rem bottom .47rem / .44rem 1px,
    linear-gradient(var(--photo-blue) 0 0) left .47rem bottom .47rem / 1px .44rem,
    linear-gradient(var(--photo-blue) 0 0) right .47rem bottom .47rem / .44rem 1px,
    linear-gradient(var(--photo-blue) 0 0) right .47rem bottom .47rem / 1px .44rem,
    #090f1ad9;
  background-repeat: no-repeat;
  pointer-events: none;
  transition: background-color .22s ease, transform .22s ease;
}

.photo-carousel.is-enhanced figure a[aria-haspopup="dialog"]:hover::after {
  background-color: #172845;
  transform: translateY(-.16rem);
}

.photo-carousel-navigation {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .55rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--photo-line);
  margin-bottom: .73rem;
}

.photo-carousel-navigation[hidden] { display: none; }
.photo-carousel-navigation { flex-wrap: wrap; row-gap: .6rem; }
.photo-view-switch { display: flex; gap: .2rem; margin-right: auto; padding: .2rem; border: 1px solid var(--photo-line); }
.photo-carousel-navigation .photo-view-switch button { min-width: 4rem; padding: .45rem .7rem; border: 0; border-radius: 0; background: transparent; font-size: .875rem; font-weight: 700; }
.photo-carousel-navigation .photo-view-switch button[aria-pressed="true"] { background: var(--photo-blue); color: var(--photo-ink); }
.photo-carousel-navigation .photo-view-switch button:hover { transform: none; }
.photo-carousel.is-enhanced[data-photo-view="grid"] .photo-carousel-track {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.85rem, 2vw, 1.5rem);
  overflow: visible; scroll-snap-type: none; padding: 0; align-items: start;
}
.photo-carousel.is-enhanced[data-photo-view="grid"] .photo-carousel-track::after { display: none; }
.photo-carousel.is-enhanced[data-photo-view="grid"] figure { opacity: 1; transform: none; }
.photo-carousel.is-enhanced[data-photo-view="grid"] figure img { height: auto; max-height: none; aspect-ratio: auto; object-fit: contain; }
.photo-carousel.is-enhanced[data-photo-view="grid"] figure a { scroll-margin-block: 6rem; }
.photo-carousel.is-enhanced[data-photo-view="grid"] figcaption { font-size: .875rem; }
@media (max-width: 800px) {
  .photo-carousel.is-enhanced[data-photo-view="grid"] .photo-carousel-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .photo-view-switch { flex: 1 1 100%; margin-right: 0; }
  .photo-carousel-navigation .photo-view-switch button { flex: 1; }
}

.photo-carousel-navigation span {
  min-width: 3.7rem;
  text-align: center;
  color: var(--photo-muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
}

.photo-carousel-navigation button,
.photo-lightbox-controls button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .25rem .55rem;
  border: 1px solid var(--photo-line);
  border-radius: .22rem;
  color: #eef3fb;
  background: var(--photo-surface);
  font-size: 1.1rem;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease, transform .2s ease;
}

.photo-carousel-navigation button[aria-disabled="true"],
.photo-lightbox-controls button[aria-disabled="true"] {
  opacity: .52;
  cursor: default;
}

.photo-carousel-navigation button:not([aria-disabled="true"]):hover,
.photo-lightbox-controls button:not([aria-disabled="true"]):hover {
  border-color: var(--photo-blue);
  background-color: #203759;
  color: #f3f7ff;
  transform: translateY(-.1rem);
}

.photo-contact-strip {
  display: grid;
  grid-auto-columns: minmax(2.35rem, 6rem);
  grid-auto-flow: column;
  justify-content: center;
  gap: clamp(.3rem, 1vw, .55rem);
  margin-top: .64rem;
  padding: .5rem;
  border: 1px solid var(--photo-line);
  background: #0a1320;
}

.photo-contact-strip button {
  display: grid;
  min-width: 0;
  min-height: 2.75rem;
  padding: .16rem;
  border: 1px solid #7188ae55;
  border-radius: .18rem;
  background: var(--photo-ink);
  transition: background-color .2s ease, border-color .23s ease, transform .24s ease;
}

.photo-contact-strip img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 5 / 3;
  object-fit: cover;
}

.photo-contact-strip button:hover { border-color: var(--photo-blue); }
.photo-contact-strip button[aria-current="true"] {
  border-color: var(--photo-blue);
  background: #365888;
  transform: translateY(-.13rem);
}

.photo-carousel :is(.photo-contact-strip button, .photo-carousel-navigation button, .photo-lightbox button):focus-visible {
  outline: 2px solid #d5e3ff;
  outline-offset: 2px;
}

body.photo-viewer-open { overflow: hidden; }
.photo-lightbox {
  width: min(72rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100% - 2rem);
  gap: .6rem;
  margin: auto;
  padding: clamp(.58rem, 2vw, 1.25rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #a9c3ff80;
  background: #0b1423;
  color: #f2f5ff;
  box-shadow: 0 1.4rem 4.5rem #000a;
}

.photo-lightbox[open] {
  display: grid;
  animation: photo-lightbox-in .25s cubic-bezier(.22, .61, .36, 1) both;
}

.photo-lightbox::backdrop {
  background: #03070be8;
  backdrop-filter: blur(6px);
}

@keyframes photo-lightbox-in {
  from { opacity: 0; transform: translateY(.52rem); }
  to { opacity: 1; transform: translateY(0); }
}

.photo-lightbox-header,
.photo-lightbox-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .58rem;
}

.photo-lightbox-title {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
}

.photo-lightbox-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(65svh, 47rem, calc(100dvh - 15rem));
  object-fit: contain;
  background: #060a12;
}

.photo-lightbox-controls span {
  color: var(--photo-muted);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.photo-lightbox-comparison {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem;
}
.photo-lightbox-edit-label { margin: 0; color: var(--photo-muted); font: 600 .875rem/1.5 var(--body); }
.photo-lightbox-compare { margin-left: auto; min-height: 2.75rem; font-size: .875rem; }
.photo-lightbox-compare[aria-pressed="true"] { color: var(--photo-ink); background: var(--photo-blue); border-color: var(--photo-blue); }

.photo-lightbox-stage {
  --photo-reveal: 50%; position: relative; isolation: isolate; overflow: hidden;
  width: 100%; height: min(56svh, 42rem); min-height: 14rem;
  background: #05080e; border: 1px solid var(--photo-line);
}
.photo-lightbox-stage :is(.photo-lightbox-image, .photo-lightbox-original) {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
  margin: 0; object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.photo-lightbox-original { z-index: 1; background: #05080e; clip-path: inset(0 calc(100% - var(--photo-reveal)) 0 0); }
.photo-lightbox-stage.is-comparing { cursor: ew-resize; touch-action: pan-y; }
.photo-view-label, .photo-reveal-labels span {
  position: absolute; z-index: 3; top: .8rem; padding: .35rem .65rem;
  background: #05080ee6; color: #eef4ff; border: 1px solid #c1d5ff4d;
  font: 600 .8125rem/1.4 var(--body); pointer-events: none;
}
.photo-view-label, .photo-reveal-labels span:first-child { left: .8rem; }
.photo-reveal-labels span:last-child { right: .8rem; }
.photo-reveal-divider { position: absolute; z-index: 2; inset: 0 auto 0 var(--photo-reveal); width: 2px; background: #edf4ff; translate: -50%; pointer-events: none; }
.photo-reveal-divider > span {
  position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  width: 2.8rem; height: 2.8rem; border: 1px solid #e8f1ff; border-radius: 50%;
  background: #080f1de8; box-shadow: 0 .25rem 1.5rem #0008;
}
.photo-reveal-divider > span::before, .photo-reveal-divider > span::after {
  content: ""; position: absolute; top: .8rem; bottom: .8rem; width: 2px; background: #e8f1ff;
}
.photo-reveal-divider > span::before { left: 1.05rem; }
.photo-reveal-divider > span::after { right: 1.05rem; }
.photo-lightbox-stage.is-revealing .photo-reveal-divider > span { background: #294577; }
.photo-reveal-controls { padding: .7rem .2rem .2rem; }
.photo-reveal-label { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font: 600 .875rem/1.4 var(--body); color: #e4edfc; }
.photo-reveal-amount { color: var(--photo-blue); font-variant-numeric: tabular-nums; }
.photo-reveal-range { display: block; width: 100%; min-height: 2.75rem; margin: .15rem 0 0; padding: 0; accent-color: var(--photo-blue); cursor: ew-resize; }
.photo-reveal-controls p { max-width: none; margin: 0; font-size: .8125rem; line-height: 1.5; color: var(--photo-muted); }
.photo-comparison-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.photo-comparison-actions .button { min-height: 2.75rem; font-size: .875rem; padding: .55rem .85rem; }
.photo-lightbox-reveal[aria-pressed="true"] { color: var(--photo-ink); background: var(--photo-blue); border-color: var(--photo-blue); }
.photo-comparison-status { margin: 0; color: #ffc9d2; font-size: .875rem; line-height: 1.5; }
.photo-comparison-status:empty { display: none; }
@media (max-width: 640px) {
  .photo-lightbox-stage { height: min(49svh, 32rem); min-height: 12rem; }
  .photo-lightbox-comparison { align-items: flex-start; }
  .photo-comparison-actions { width: 100%; margin-left: 0; }
  .photo-comparison-actions .button { flex: 1 1 8rem; margin-left: 0; }
  .photo-view-label, .photo-reveal-labels span { top: .5rem; padding: .3rem .5rem; font-size: .75rem; }
  .photo-view-label, .photo-reveal-labels span:first-child { left: .5rem; }
  .photo-reveal-labels span:last-child { right: .5rem; }
}

@media (max-width: 640px) {
  .photo-carousel {
    --photo-wide: 90%;
    --photo-portrait: min(76%, calc(var(--photo-height) * .79));
    --photo-square: min(83%, calc(var(--photo-height) * 1.02));
  }

  .photo-carousel .photo-carousel-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-carousel figcaption { font-size: .875rem; }
  .photo-contact-strip { grid-auto-columns: minmax(0, 1fr); }
  .photo-lightbox { width: calc(100% - 1.2rem); }
  .photo-lightbox-image { max-height: min(60svh, 32rem); }
}

@media (prefers-reduced-motion: reduce) {
  .photo-carousel *, .photo-carousel *::after { transition: none !important; }
  .photo-lightbox[open] { animation: none; }
}

.photo-carousel-navigation .photo-detail-toggle {
  width: auto; margin-right: auto; padding: .5rem .85rem;
  border-radius: 0; font-size: .875rem; font-weight: 700;
}
.photo-carousel-navigation .photo-detail-toggle[aria-pressed="true"] {
  color: #07090c; background: #b1ccff; border-color: #b1ccff;
}
.photo-detail-lens {
  position: absolute; z-index: 2; pointer-events: none; opacity: 0;
  border: 1px solid #d5e5ff; border-radius: 50%; background-color: #07090c;
  background-repeat: no-repeat; box-shadow: 0 0 0 5px #07090c66, 0 8px 35px #0009;
}
.photo-detail-lens::after {
  content: "2.5×"; position: absolute; bottom: .45rem; left: 50%; translate: -50%;
  padding: .15rem .5rem; background: #07090cdd; color: white; font: 600 .75rem/1.5 var(--body);
}
.has-detail-lens [data-detail-active] .photo-detail-lens { opacity: 1; }
.has-detail-lens figure a { cursor: zoom-in; }
