/* A half-beat separates the two faces; opening a detail keeps the selected object in focus. */
@media (prefers-reduced-motion: no-preference) {
  #duo.entering article .cutout { --approach: -7px; animation: plaque-settles 680ms cubic-bezier(.2,.75,.25,1) backwards; }
  #duo.entering article + article .cutout { --approach: 7px; animation-delay: 100ms; }
  #photo-dialog[open].single-view .viewer-frame { animation: detail-arrives 220ms ease-out; }
  #photo-dialog[open]::backdrop { animation: veil-arrives 180ms ease-out; }
  #closing .to-top span { transition: transform 160ms ease-out; }
  #closing .to-top:focus-visible span { transform: translateY(-3px); }
}
@keyframes detail-arrives { from { opacity: .6; transform: scale(.985); } to { opacity: 1; transform: none; } }
@keyframes veil-arrives { from { opacity: 0; } to { opacity: 1; } }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  #closing .to-top:hover span { transform: translateY(-3px); }
  #geometry .angle-detail figcaption { transition: color 140ms ease-out; }
}

/* Anchor arrows to the image row, outside the gesture capture surface. */
#photo-dialog .viewer-frame { grid-area: 2 / 1; }
#photo-dialog .view-step { display: none; }
#photo-dialog.single-view .view-step {
  grid-area: 2 / 1;
  z-index: 1;
  align-self: center;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-inline: clamp(8px, 2.4vw, 36px);
  padding: 0;
  border: 1px solid var(--pair-brass);
  border-radius: 50%;
  color: var(--dark-ink);
  background: var(--pine);
  cursor: pointer;
}
.view-step.previous { justify-self: start; --direction: -1; }
.view-step.next { justify-self: end; --direction: 1; }
.view-step span {
  width: 11px; height: 11px;
  border: solid currentColor; border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
}
.view-step.previous span { transform: rotate(-135deg); }
#photo-dialog .view-step:focus-visible { outline: 2px solid var(--dark-ink); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .view-step span { transition: translate 160ms ease-out; }
  #photo-dialog .view-step:active span { translate: calc(3px * var(--direction)) 0; }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  #photo-dialog .view-step:hover span { translate: calc(3px * var(--direction)) 0; }
}

@keyframes plaque-settles {
  from { opacity: .35; transform: translate(var(--approach), 4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  #relief .guardian-side.entering { --approach: 5px; animation: plaque-settles 620ms ease-out backwards; }
}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  #duo .cutout img, #relief .guardian-side {
    transform-origin: center bottom;
    transition: transform 240ms ease-out;
  }
  #duo .cutout:hover img { transform: translateY(-3px) scale(1.012); }
  #relief .relief-object:hover .guardian-side { transform: translateY(-2px) scale(1.018); }
}

/* The photo frame follows the carved silhouette. Reserve room for the widest face and both arrows. */
#detail-object { display: contents; }
#photo-dialog.single-view .viewer-frame { container-type: size; min-width: 0; }
#photo-dialog.single-view #detail-object {
  display: block; flex: none;
  height: min(88cqh, calc(130cqw - 140px)); width: auto;
}
#photo-dialog.single-view #detail-object img {
  width: calc(100% * 1086 / var(--frame-w)); height: auto;
  max-width: none; max-height: none;
}
