:root {
  color-scheme: dark;
  --gallery-night: #06132b;
  --gallery-panel: #101b30;
  --gallery-text: #f4e9d7;
  --gallery-muted: #dfd1ba;
  --gallery-gold: #ffe1a7;
  --gallery-rule: #bb925769;
  --gallery-display: "Palatino Linotype", Palatino, Georgia, serif;
  --gallery-label: system-ui, sans-serif;
  background: var(--gallery-night);
  color: var(--gallery-text);
  font-family: Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 15%, #77512d38, transparent 65%) 0 0 / 100% 48rem no-repeat,
    var(--gallery-night);
}

a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--gallery-gold); outline-offset: 3px; }

.lookbook {
  max-width: 100rem;
  margin-inline: auto;
  padding: var(--site-header-space) clamp(.75rem, 3.5vw, 3.5rem) clamp(2.5rem, 5vw, 5rem);
}

.lookbook-intro {
  padding: clamp(1.75rem, 4.6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.75rem);
  text-align: center;
}

.lookbook-intro h1 {
  margin: 0;
  color: var(--gallery-gold);
  font: 400 clamp(2.7rem, 6vw, 5.5rem)/1.06 var(--gallery-display);
  letter-spacing: -.045em;
}

.lookbook-intro p {
  margin: .65em 0 0;
  color: var(--gallery-muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.45;
}

.lookbook-wall {
  position: relative;
  isolation: isolate;
  height: clamp(330px, 43vw, 655px);
  overflow: hidden;
  border: 1px solid var(--gallery-rule);
  border-radius: clamp(.5rem, 1.2vw, 1.25rem);
  background: var(--gallery-panel);
  box-shadow: 0 1rem 2.5rem #03091266;
  touch-action: pan-y;
  cursor: grab;
}

.lookbook-wall::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(to bottom, var(--gallery-panel), transparent 9% 91%, var(--gallery-panel)),
    linear-gradient(to right, #101b3099, transparent 9% 91%, #101b3099);
  pointer-events: none;
  content: "";
}

.lookbook-scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.lookbook-scene:focus-visible { outline-offset: -5px; }
.lookbook-wall[data-dragging], .lookbook-wall[data-dragging] .lookbook-photo { cursor: grabbing; }
.lookbook-column { display: contents; }

.lookbook-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: var(--photo-size);
  aspect-ratio: 1 / 1.04;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--gallery-rule);
  border-radius: clamp(.4rem, 1.1vw, 1rem);
  background: var(--gallery-panel);
  transform-origin: 0 0;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.lookbook-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transition: scale 210ms ease;
  pointer-events: none;
}

.lookbook-photo:hover img, .lookbook-photo:focus-visible img { scale: 1.045; }
.lookbook-photo:focus-visible { outline: 3px solid var(--gallery-gold); outline-offset: -5px; }

.lookbook-empty { position: relative; z-index: 2; margin: 2rem; text-align: center; }

.photo-viewer {
  --viewer-max-width: min(1120px, calc(100vw - 28px));
  --viewer-max-height: calc(100dvh - 28px);
  --photo-ratio: 1.5;
  --viewer-inset: clamp(12px, 2.5vw, 28px);
  position: fixed;
  width: clamp(min(360px, var(--viewer-max-width)), calc(var(--viewer-max-height) * var(--photo-ratio)), var(--viewer-max-width));
  height: clamp(min(280px, var(--viewer-max-height)), calc(var(--viewer-max-width) / var(--photo-ratio)), var(--viewer-max-height));
  max-width: none;
  max-height: none;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--gallery-rule);
  border-radius: .375rem;
  background: var(--gallery-night);
  color: var(--gallery-text);
  box-shadow: 0 1rem 4rem #020611a6;
  overscroll-behavior: contain;
}

.photo-viewer::backdrop { background: #030912ed; }
html:has(.photo-viewer[open]) { overflow: hidden; }

.photo-viewer-background, .photo-viewer-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.photo-viewer-background { object-fit: cover; transform: scale(1.12); filter: blur(22px) brightness(.64); }
.photo-viewer-image { display: grid; place-items: center; }
.photo-viewer-image img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }

.photo-viewer-overlay {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(8px, 2vw, 20px);
  padding: clamp(32px, 8svh, 64px) var(--viewer-inset) var(--viewer-inset);
  background: linear-gradient(transparent, #081225c9 44%, #06132bf2);
}

.photo-viewer-meta { max-width: 58ch; }
.photo-viewer-meta :is(p, h2) { margin: 0; overflow-wrap: anywhere; }
#photo-year { color: var(--gallery-gold); font: 650 .875rem/1.3 var(--gallery-label); letter-spacing: .08em; }
#photo-title { margin-top: 3px; font: 400 clamp(1.18rem, 4vw, 1.8rem)/1.1 var(--gallery-display); }
#photo-description { margin-top: 6px; font-size: 1rem; line-height: 1.4; }
#photo-description:empty { display: none; }
.gallery-arrows { display: flex; gap: 4px; }

.photo-viewer button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--gallery-rule);
  border-radius: 50%;
  background: #0c1425ed;
  color: var(--gallery-gold);
  font: 1.2rem/1 var(--gallery-label);
}

.photo-viewer button:hover:not(:disabled) { background: #2b2d36; }
#close-photo { position: absolute; top: var(--viewer-inset); right: var(--viewer-inset); font-size: 1.75rem; }

@media (max-width: 600px) {
  .lookbook-wall {
    width: 100%;
    height: auto;
    aspect-ratio: 1.04;
    min-height: 330px;
    max-height: 550px;
  }
  .lookbook-wall::after {
    background: linear-gradient(to bottom, var(--gallery-panel), transparent 10% 90%, var(--gallery-panel));
  }
}

@media (prefers-reduced-motion: reduce) {
  .lookbook-photo img { transition: none; }
}
