/* Personal photographs: a worn reddish-wood board beneath three moveable prints. */
.photo-gallery-overlay {
  --photo-gallery-padding: clamp(14px, 3vw, 42px);
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--photo-gallery-padding);
  color: #f6eee3;
  background: #452923;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  isolation: isolate;
}

.photo-gallery-overlay[hidden] { display: none; }

.photo-gallery-scrim {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 50% 36%, rgba(171, 112, 87, .28), transparent 58%),
    linear-gradient(90deg, rgba(37, 15, 13, .62), rgba(101, 56, 45, .22) 52%, rgba(37, 15, 13, .65)),
    rgba(39, 17, 14, .90);
  backdrop-filter: blur(8px);
}

.photo-gallery-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  height: min(820px, calc(100dvh - var(--photo-gallery-padding) - var(--photo-gallery-padding)));
  max-height: calc(100dvh - var(--photo-gallery-padding) - var(--photo-gallery-padding));
  min-height: min(460px, calc(100dvh - var(--photo-gallery-padding) - var(--photo-gallery-padding)));
  overflow: visible;
}

.photo-gallery-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 16px;
}

.photo-gallery-heading h2 {
  margin: 0;
  color: var(--ink, #f8efe3);
  font: 400 26px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.photo-gallery-heading { min-width: 0; }

.photo-gallery-heading .eyebrow {
  display: block;
  margin: 0 0 8px;
  color: var(--accent, #d7bb87);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2.6px;
  line-height: 1.2;
  text-transform: uppercase;
}

.photo-gallery-heading p {
  margin: 8px 0 0;
  color: var(--muted, #b8c4bd);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .03em;
}

.photo-gallery-close {
  position: static;
  top: auto;
  right: auto;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 5px 8px;
  border: 0;
  border-radius: 0;
  color: var(--muted, #b8c4bd);
  background: transparent;
  font: inherit;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
}

.photo-gallery-close:hover,
.photo-gallery-close:focus-visible {
  border-color: transparent;
  color: var(--ink, #f3f1e8);
  background: transparent;
}

.photo-gallery-close:focus-visible,
.photo-gallery-control:focus-visible,
.photo-gallery-rotate-handle:focus-visible,
.photo-gallery-print:focus-visible {
  outline: 2px solid var(--accent, #e8c58d);
  outline-offset: 3px;
}

.photo-gallery-workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 1px solid rgba(235, 201, 178, .28);
  border-radius: 4px;
  background:
    repeating-linear-gradient(0deg, rgba(235, 192, 158, .045) 0 1px, transparent 1px 7px),
    linear-gradient(96deg, transparent 0 22%, rgba(219, 165, 132, .055) 22.2% 22.35%, transparent 22.6% 100%),
    linear-gradient(173deg, transparent 0 42%, rgba(50, 22, 18, .10) 42.2% 42.55%, transparent 42.8% 100%),
    radial-gradient(ellipse at 48% 30%, rgba(171, 112, 87, .24), transparent 63%),
    #6b3e33;
  box-shadow:
    inset 0 1px 0 rgba(249, 230, 211, .11),
    inset 0 -40px 70px rgba(35, 13, 11, .27),
    0 18px 70px rgba(27, 10, 8, .38);
  touch-action: none;
}

.photo-gallery-workspace::before,
.photo-gallery-workspace::after {
  position: absolute;
  left: 4%;
  right: 4%;
  height: 1px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(235, 192, 158, .15), transparent);
}

.photo-gallery-workspace::before { top: 10%; }
.photo-gallery-workspace::after { bottom: 12%; opacity: .55; }

.photo-gallery-print {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  width: var(--photo-intrinsic-width, 280px);
  transform: translate(-50%, -50%) rotate(var(--photo-rotation, 0deg)) scale(var(--photo-scale, 1));
  transform-origin: center center;
  transition: left .24s ease, top .24s ease, transform .24s ease, filter .24s ease;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.photo-gallery-print:active { cursor: grabbing; }

.photo-gallery-print.is-selected {
  filter: drop-shadow(0 18px 20px rgba(30, 11, 9, .48));
}

.photo-gallery-paper {
  position: relative;
  box-sizing: border-box;
  padding: 8px 8px 11px;
  border: 1px solid rgba(235, 229, 216, .90);
  background: #e9e5d8;
  box-shadow:
    0 7px 15px rgba(35, 13, 10, .36),
    0 1px 0 rgba(255, 252, 240, .6) inset;
}

.photo-gallery-print:not(.is-selected) .photo-gallery-paper {
  box-shadow: 0 5px 11px rgba(32, 12, 9, .30), 0 1px 0 rgba(255, 252, 240, .55) inset;
}

.photo-gallery-figure {
  display: block;
  width: 100%;
  margin: 0;
}

.photo-gallery-image {
  display: block;
  width: 100%;
  aspect-ratio: var(--photo-ratio, .72);
  height: auto;
  object-fit: contain;
  background: #b5b3a5;
  pointer-events: none;
}

.photo-gallery-caption {
  display: block;
  padding: 9px 2px 0;
  color: #3b2722;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: 11px;
  line-height: 1.28;
  text-align: left;
}

.photo-gallery-caption-label,
.photo-gallery-caption-text { display: block; }

.photo-gallery-caption-label {
  margin-bottom: 3px;
  color: #8a6859;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.photo-gallery-caption-text {
  overflow-wrap: normal;
  white-space: pre-wrap;
}

.photo-gallery-rotate-handle {
  position: absolute;
  right: -13px;
  bottom: -13px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid rgba(55, 24, 19, .90);
  border-radius: 50%;
  color: #f7e5c2;
  background: #784b3d;
  box-shadow: 0 3px 7px rgba(28, 10, 8, .44);
  font-size: 17px;
  line-height: 1;
  cursor: alias;
  touch-action: none;
}

.photo-gallery-rotate-handle:hover { background: #8c5a48; }

.photo-gallery-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px 0;
}

.photo-gallery-selection {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted, #b8c4bd);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-control-buttons {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  gap: 6px;
}

.photo-gallery-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border, rgba(241, 239, 226, .2));
  border-radius: 6px;
  color: var(--ink, #f3f1e8);
  background: rgba(15, 34, 34, .64);
  backdrop-filter: blur(10px);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.photo-gallery-control-wide { min-width: 86px; font-size: 11px; letter-spacing: .02em; }

.photo-gallery-control:hover,
.photo-gallery-control:focus-visible {
  border-color: rgba(215, 187, 135, .65);
  color: var(--ink, #f3f1e8);
  background: rgba(36, 61, 56, .9);
}

@media (max-width: 700px) {
  .photo-gallery-overlay {
    --photo-gallery-padding: 12px;
    padding: var(--photo-gallery-padding);
  }
  .photo-gallery-shell {
    height: min(780px, calc(100dvh - var(--photo-gallery-padding) - var(--photo-gallery-padding)));
    min-height: 420px;
  }
  .photo-gallery-header { padding-bottom: 10px; }
  .photo-gallery-heading h2 { font-size: 26px; }
  .photo-gallery-heading p { max-width: 260px; font-size: 12px; }
  .photo-gallery-workspace { min-height: 260px; }
  .photo-gallery-controls { align-items: flex-end; flex-direction: column; gap: 9px; }
  .photo-gallery-selection { align-self: flex-start; max-width: 100%; }
  .photo-gallery-control-buttons { width: 100%; justify-content: flex-end; }
  .photo-gallery-control { min-height: 38px; height: 38px; }
}

@media (max-width: 430px) {
  .photo-gallery-shell { grid-template-rows: auto minmax(0, 1fr) auto; }
  .photo-gallery-print { transition-duration: .15s; }
  .photo-gallery-rotate-handle { right: -11px; bottom: -11px; width: 26px; height: 26px; }
  .photo-gallery-control-wide { min-width: 72px; padding-right: 7px; padding-left: 7px; }
}

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

.photo-gallery-overlay.reduced-motion .photo-gallery-print { transition: none; }
