.spv-dialog {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: #18251f;
  color: #fffaf0;
  font: inherit;
  overflow: hidden;
}
.spv-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.spv-dialog::backdrop { background: #18251f; }
.spv-dialog .spv-bar,
.spv-dialog .spv-foot {
  box-sizing: border-box;
  align-items: center;
  gap: clamp(5px, 2vw, 14px);
  padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
}
.spv-dialog .spv-bar {
  display: flex;
  justify-content: flex-end;
  padding-top: max(5px, env(safe-area-inset-top));
  padding-bottom: 5px;
}
.spv-dialog .spv-count {
  margin-right: auto;
  padding-inline: 4px;
  font-size: 0.95rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.spv-dialog button {
  flex: none;
  box-sizing: border-box;
  min-width: 46px;
  min-height: 46px;
  padding: 5px 11px;
  border: 1px solid #84958b;
  border-radius: 4px;
  background: transparent;
  color: #fffaf0;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.35;
  cursor: pointer;
}
.spv-dialog button:focus-visible { outline: 3px solid #f5cc95; outline-offset: -4px; }
.spv-dialog .spv-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #101a15;
  touch-action: pan-x pan-y pinch-zoom;
  overscroll-behavior: contain;
}
.spv-dialog .spv-frame {
  position: absolute;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.spv-dialog .spv-frame.spv-zoomed {
  position: relative;
  inset: auto;
  display: grid;
  place-items: center;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 100%;
}
.spv-dialog .spv-photo,
.spv-dialog .spv-preview {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  max-height: none;
  max-width: none;
  margin: 0;
  border: none;
  border-radius: 0;
  object-fit: contain;
  user-select: none;
}
.spv-dialog .spv-preview {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.spv-dialog .spv-photo[hidden],
.spv-dialog .spv-preview[hidden] { visibility: hidden; }
.spv-dialog .spv-foot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding-top: 5px;
  padding-bottom: max(5px, env(safe-area-inset-bottom));
}
.spv-dialog .spv-foot button { font-family: system-ui, sans-serif; font-size: 1.8rem; }
.spv-dialog .spv-foot button[hidden] { display: none; }
.spv-dialog .spv-caption {
  grid-column: 2;
  margin: 0;
  padding: 5px 0;
  color: #fffaf0;
  text-align: center;
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  overflow-y: auto;
  max-height: 26vh;
}

/* A browsable album sits under the existing full-screen viewer. */
.album-dialog,
.spv-dialog {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.album-dialog:not([open]),
.spv-dialog:not([open]),
.spv-dialog .spv-floor-photos[hidden] {
  display: none;
}
.spv-dialog { z-index: 1001; }
.spv-dialog .spv-bar { flex-wrap: wrap; }
.spv-dialog .spv-floor-photos {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}
.album-dialog {
  --album-pad: clamp(.85rem, 3.8vw, 2.8rem);
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--paper, #f7f4ec);
  color: var(--ink, #20382d);
  font: inherit;
  overflow: hidden;
}
.album-dialog[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.album-dialog::backdrop { background: rgba(16, 30, 22, .62); }
.album-dialog .album-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin: 0;
  padding: .8rem var(--album-pad) .3rem;
  padding-top: max(.8rem, env(safe-area-inset-top));
}
.album-dialog .album-title {
  min-width: 0;
  color: var(--ink);
  font: 500 clamp(1.55rem, 3.1vw, 2.45rem)/1.28 var(--serif);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.album-close,
.album-item,
.album-controls select { font: inherit; }
.album-dialog .album-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: .45rem .82rem;
  border: 1px solid #a4aea0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: .91rem;
  line-height: 1.35;
  cursor: pointer;
}
.album-dialog .album-close:hover { background: #eaede3; }
.album-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  align-items: end;
  gap: .38rem .75rem;
  box-sizing: border-box;
  padding: .25rem var(--album-pad) .65rem;
  border-bottom: 1px solid #bec6b7;
  color: var(--soft);
}
.album-controls label {
  display: block;
  min-width: 0;
  font-size: .86rem;
  line-height: 1.45;
}
.album-controls select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: .15rem;
  padding: .32rem .45rem;
  border: 1px solid #93a18f;
  border-radius: 3px;
  background-color: var(--white, #fffdf7);
  color: var(--ink);
  font-size: 1rem;
}
.album-controls .album-count {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .86rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.album-stage {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: .8rem;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  align-items: start;
  gap: clamp(1.2rem, 3.2vw, 2.5rem) clamp(.65rem, 2.1vw, 1.8rem);
  margin: 0;
  padding: 1rem var(--album-pad) 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}
.album-grid .album-item {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
  text-align: left;
  cursor: zoom-in;
}
.album-item img {
  display: block;
  width: 100%;
  height: auto;
  background: #e4e5da;
}
.album-item .album-caption {
  display: block;
  margin-top: .42rem;
  font-size: clamp(.84rem, 1.1vw, 1rem);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.album-item:hover .album-caption {
  text-decoration: underline;
  text-underline-offset: .2em;
}
.album-item[aria-current="true"] img {
  outline: 2px solid #4e6853;
  outline-offset: -2px;
}
.album-dialog button:focus,
.album-controls select:focus {
  outline: 3px solid #92672f;
  outline-offset: 2px;
}
.album-dialog button:focus:not(:focus-visible),
.album-controls select:focus:not(:focus-visible) { outline: none; }
.album-dialog .album-item:focus-visible { outline-offset: 4px; }
@media (min-width: 44rem) {
  .album-dialog {
    width: calc(100% - 3rem);
    max-width: 1280px;
    height: calc(100% - 2.5rem);
    height: calc(100dvh - 2.5rem);
    margin: auto;
    border-radius: 4px;
  }
  .album-dialog .album-head { padding-top: 1.3rem; }
  .album-controls {
    grid-template-columns: minmax(8rem, 15rem) minmax(8rem, 15rem) 1fr;
    gap: 1rem;
    padding-top: .5rem;
    padding-bottom: 1rem;
  }
  .album-controls .album-count {
    grid-column: auto;
    align-self: end;
    justify-self: end;
    padding-bottom: .65rem;
  }
  .album-grid { padding-top: 1.5rem; }
}
@media (min-width: 68rem) {
  .album-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 19rem) {
  .album-grid { grid-template-columns: minmax(0,1fr); }
  .album-controls { gap: .35rem; }
}
@media (max-height: 28rem) {
  .album-dialog { height: 100%; height: 100dvh; }
  .album-dialog .album-head { padding-top: .22rem; padding-bottom: 0; }
  .album-controls { padding-top: 0; padding-bottom: .3rem; }
}
/* The hero and plan shortcuts use the same visual language as the filters. */
.choice-opening .pair-frontages > .hero-album-link,
.choice-unit .hero-album-link {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
  padding: .18rem 0;
  color: var(--ink);
  font: 600 .94rem/1.45 var(--sans);
  text-decoration: underline;
  text-underline-offset: .22em;
  cursor: pointer;
}
.choice-opening .pair-frontages > .hero-album-link { grid-column: 1 / -1; }
.choice-unit figcaption .hero-album-link { width: fit-content; }
a[data-album] { cursor: pointer; }
@media (max-width: 43.99rem) {
  .album-dialog { --album-pad: clamp(12px, 4vw, 24px); }
  .album-dialog .album-title { font-size: clamp(1.05rem, 6.4vw, 1.55rem); }
  .album-dialog .album-head { gap: 8px; }
  .album-dialog .album-close { padding: .25rem 9px; }
  .album-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(8rem, 35%)), 1fr));
  }
}
