[data-explorer-controls] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 20px;
}

.archive-explorer-search {
  width: min(100%, 360px);
}

.archive-explorer-search label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 600;
}

.archive-explorer-search-field {
  display: flex;
  gap: 8px;
}

.archive-explorer-search-field input {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #84877a;
  border-radius: 3px;
  background: #fbfaf6;
  color: var(--ink);
  font-size: 16px;
}

.archive-explorer-search-field button,
.archive-explorer-launch {
  min-height: 44px;
  font-size: 13px;
}

.archive-explorer-search-field button {
  padding: 0 12px;
  border: 1px solid #84877a;
  border-radius: 3px;
}

.archive-explorer-search .archive-explorer-search-count {
  margin-top: 5px;
  color: #4d5146;
  font-size: 13px;
  line-height: 1.4;
}

.archive-explorer-launch {
  background: transparent;
}

.archive-explorer-launch:disabled,
.archive-explorer-search-field button:disabled {
  cursor: default;
  opacity: .5;
}

.archive-explorer-open {
  overflow: hidden;
}

.archive-explorer {
  width: min(calc(100% - 48px), 74rem);
  max-width: none;
  max-height: calc(100svh - 44px);
  scroll-padding: 6rem 0 8rem;
}

.archive-explorer-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "title actions close";
  align-items: center;
  gap: 12px 18px;
  padding: 12px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.archive-explorer-header h2 {
  grid-area: title;
  font-size: clamp(19px, 2.2vw, 27px);
  letter-spacing: -.035em;
  line-height: 1.15;
}

.archive-explorer-close {
  grid-area: close;
  padding-inline: 8px;
}

.archive-explorer-close span {
  margin-left: 5px;
  font-size: 20px;
}

.archive-explorer-actions,
.archive-explorer-compare-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-explorer-actions {
  grid-area: actions;
}

.archive-explorer-compare-views {
  grid-area: comparison;
}

.archive-explorer-actions button,
.archive-explorer-compare-views button,
.archive-explorer-navigation button {
  padding-inline: 13px;
  border: 1px solid var(--line);
}

.archive-explorer button {
  min-height: 44px;
  font-size: 13px;
}

.archive-explorer-actions button[aria-pressed="true"],
.archive-explorer-compare-views button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.archive-explorer button:disabled {
  cursor: default;
  opacity: .5;
}

.archive-explorer-content {
  padding: clamp(12px, 2.5vw, 26px) clamp(16px, 3vw, 30px);
}

.archive-explorer-help {
  margin: 0 0 10px;
  color: #4d5146;
  font-size: 13px;
  line-height: 1.5;
}

.archive-explorer-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.7vw, 30px);
}

.archive-explorer-panels.is-comparing {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.archive-explorer-panel {
  min-width: 0;
  margin: 0;
}

.archive-explorer-panel-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.archive-explorer-viewport {
  height: min(53svh, 35rem);
  min-height: 10rem;
  overflow: hidden;
  background: var(--dark);
  color: var(--paper);
}

.archive-explorer-viewport img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}

.archive-explorer-viewport.is-zoomed {
  overflow: auto;
  overscroll-behavior: contain;
}

.archive-explorer-viewport.is-zoomed img {
  width: auto;
  height: auto;
  max-width: none;
  margin-inline: auto;
}

.archive-explorer-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.archive-explorer-caption {
  padding: 12px 0 0;
  overflow-wrap: anywhere;
}

.archive-explorer-caption h3 {
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 500;
  line-height: 1.35;
}

.archive-explorer-caption p {
  max-width: 70ch;
  margin-top: 5px;
  color: #4d5146;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.archive-explorer-footer {
  position: sticky;
  z-index: 1;
  bottom: 0;
  padding: 10px clamp(16px, 3vw, 30px);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.archive-explorer-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.archive-explorer-navigation [data-previous] {
  justify-self: start;
}

.archive-explorer-navigation [data-next] {
  justify-self: end;
}

.archive-explorer-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.archive-explorer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
  margin-top: 5px;
}

.archive-explorer-links .text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding-bottom: 0;
}

@media (max-width: 700px) {
  [data-explorer-controls] {
    align-items: flex-start;
  }

  .archive-explorer {
    width: calc(100% - 22px);
    max-height: calc(100svh - 22px);
    scroll-padding-top: 9rem;
  }

  .archive-explorer-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title close"
      "actions actions";
    gap: 5px 12px;
  }

  .archive-explorer-header:has(.archive-explorer-compare-views:not([hidden])) {
    grid-template-areas:
      "title close"
      "actions actions"
      "comparison comparison";
  }

  .archive-explorer-panels.is-comparing {
    grid-template-columns: minmax(0, 1fr);
  }

  .archive-explorer-viewport {
    height: min(43svh, 25rem);
  }
}
.study-comparison {
  --study-split: 50%;
  max-width: 860px;
  margin: 28px auto 0;
  border-block: 1px solid var(--line);
}

.study-comparison summary {
  min-height: 44px;
  padding: 12px 0;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.study-comparison-frame {
  position: relative;
  display: grid;
  overflow: hidden;
  background: #161714;
}

.study-comparison-frame img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
}

.study-comparison-frame img:nth-of-type(2) {
  clip-path: inset(0 calc(100% - var(--study-split)) 0 0);
}

.study-comparison-frame > span {
  position: absolute;
  inset: 0 auto 0 var(--study-split);
  border-left: 2px solid #fff9ec;
  box-shadow: 0 0 4px #0009;
  pointer-events: none;
}

.study-comparison[data-endpoint] .study-comparison-frame > span {
  display: none;
}

.study-comparison-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  color: var(--ink);
  font-size: clamp(11px, 2.8vw, 14px);
}

.study-comparison-control input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  accent-color: var(--accent);
  cursor: ew-resize;
}

.lighting-crossfade {
  --study-split: 100%;
}

.lighting-crossfade .study-comparison-control,
.lighting-crossfade .study-comparison-frame {
  max-width: 960px;
}

.lighting-crossfade .study-comparison-control {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  margin-top: 14px;
  font-weight: 600;
}

.lighting-crossfade-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 108px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #762b40;
  border-radius: 24px;
  color: #762b40;
  font-size: 14px;
  white-space: nowrap;
}

.lighting-crossfade-play:not(:disabled):hover {
  color: #762b40;
  background: #e9dcd9;
}

.lighting-crossfade-play:disabled {
  opacity: .6;
  cursor: default;
}

.lighting-crossfade-play [data-crossfade-icon] {
  width: 1em;
  text-align: center;
}

@media (max-width: 540px) {
  .lighting-crossfade .study-comparison-control { grid-template-columns: auto minmax(0, 1fr) auto; }
  .lighting-crossfade-play { grid-column: 1 / -1; justify-self: start; }
}

.lighting-crossfade .study-comparison-frame {
  margin-top: 8px;
  aspect-ratio: 8 / 5;
}

.lighting-crossfade .study-comparison-frame img:nth-of-type(2) {
  clip-path: none;
  opacity: var(--study-split);
}

.projection-tour-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 20px;
}

.projection-tour-buttons button {
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid #848177;
  border-radius: 24px;
  color: var(--ink);
  font: inherit;
}

.projection-tour-buttons button[aria-pressed="true"] {
  border-color: var(--dark);
  background: var(--dark);
  color: var(--paper);
}

.projection-tour-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(225px, 1fr);
  gap: clamp(18px, 3vw, 40px);
}

.projection-tour-image {
  position: relative;
  background: var(--dark);
}

.projection-tour-image img {
  display: block;
  width: 100%;
  height: auto;
}

.projection-tour-image [data-tour-marker] {
  position: absolute;
  width: clamp(25px, 4vw, 46px);
  aspect-ratio: 1;
  border: 2px solid #fff9ec;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #161714, inset 0 0 0 2px #161714;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.projection-tour-grid figcaption {
  margin-top: 8px;
  color: #56584d;
  font-size: 13px;
}

.projection-tour-copy h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.projection-tour-copy a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.projection-tour-copy > a {
  margin-top: 6px;
}

.projection-tour-copy div[data-tour-detail] + div[data-tour-detail]:not([hidden]) {
  margin-top: 8px;
}

@media (max-width: 700px) {
  .projection-tour-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
