.series-detail {
  --series-gutter: clamp(2.5rem, 7vw, 7rem);
  padding-block: clamp(1.5rem, 4vw, 3.5rem) var(--series-gutter);
}

.series-detail a.underlined {
  gap: .6rem;
}

.series-detail-return {
  margin-bottom: clamp(1.75rem, 4vw, 3.5rem);
}

.series-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr);
  gap: clamp(1.5rem, 4vw, 4.5rem);
  align-items: center;
}

.series-detail-hero--text {
  grid-template-columns: minmax(0, 42rem);
}

.series-detail-opening {
  min-width: 0;
  overflow-wrap: anywhere;
}

.series-detail-opening h1 {
  font-size: clamp(3.2rem, 6.4vw, 6.4rem);
  letter-spacing: -.055em;
  line-height: .98;
  text-wrap: balance;
}

.theme-introduction-hero--art-photographics .series-detail-opening {
  container-type: inline-size;
}

.theme-introduction-hero--art-photographics .series-detail-opening h1 {
  font-size: min(clamp(3.2rem, 6.4vw, 6.4rem), 16cqi);
}

@media (min-width: 761px) {
  .theme-introduction-hero--art-photographics:not(.series-detail-hero--text) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }
}

.series-detail-lead {
  max-width: 36ch;
  margin-top: 1.35rem;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.65;
  color: var(--muted);
}

.series-detail-jump {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin-top: 1.5rem;
}

.series-detail-figure {
  margin: 0;
  min-width: 0;
}

.series-detail-frame {
  display: grid;
  place-items: center;
  position: relative;
  padding: clamp(.4rem, 1.5vw, 1.25rem);
  background: var(--room);
}

.series-detail-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.series-detail-frame[data-context-work] {
  cursor: zoom-in;
}

.series-detail-expand {
  position: absolute;
  bottom: .75rem;
  right: .75rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}

.series-detail-expand .icon {
  width: 14px;
  height: 14px;
}

.series-detail-artwork-arrow {
  display: inline-flex;
  transition: color .22s ease, transform .22s ease;
}

.series-detail-artwork-arrow .icon {
  width: .9rem;
  height: .9rem;
}

.series-detail-artwork:is(:hover, :focus-visible) + figcaption .series-detail-artwork-arrow {
  color: var(--ink);
  transform: translateX(.2rem);
}

.series-detail-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem 1rem;
  margin-top: .75rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}

.series-detail-figure figcaption em {
  font-style: normal;
}

.series-detail-figure figcaption a {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.series-detail-story,
.series-detail-works,
.series-detail-closing,
.series-detail-end {
  margin-top: var(--series-gutter);
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
}

.series-detail-story {
  display: grid;
  grid-template-columns: minmax(9rem, .52fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 5vw, 4.5rem);
}

.series-detail h2 {
  font-size: clamp(2.2rem, 4.2vw, 4.4rem);
  letter-spacing: -.04em;
  line-height: 1;
}

.series-detail-prose {
  max-width: 43rem;
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.7;
}

.series-detail-prose > * + * {
  margin-top: 1.1rem;
}

.series-detail-prose > .series-detail-figure {
  margin-block: 1.75rem;
}

.series-detail-copy a,
.series-detail-lead a {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.series-detail .has-drop-cap:not(:focus)::first-letter {
  float: none;
  margin: 0;
  font: inherit;
}

.series-detail-story,
.series-detail-works {
  scroll-margin-top: 1.5rem;
}

.series-detail-works:focus {
  outline: none;
}

.series-detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.75rem, 4vw, 4rem) clamp(1.25rem, 3vw, 3rem);
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.series-detail-gallery .series-detail-frame {
  aspect-ratio: 4 / 3;
}

.series-detail-gallery .series-detail-frame img {
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.series-detail-gallery--portfolio {
  grid-template-columns: minmax(0, 1fr);
  max-width: 55rem;
  margin-inline: auto;
  margin-top: clamp(2rem, 4vw, 4rem);
  row-gap: var(--portfolio-gallery-gap);
}

.series-detail-gallery--portfolio :is(.series-detail-figure, .series-detail-frame) {
  grid-template-columns: minmax(0, 1fr);
}

.series-detail-gallery--portfolio > .series-detail-figure {
  display: grid;
  align-content: center;
  min-height: 60svh;
}

.series-detail-gallery--portfolio .series-detail-frame {
  aspect-ratio: auto;
  padding: 0;
  background: transparent;
}

.series-detail-gallery--portfolio .series-detail-frame img {
  width: auto;
  height: auto;
  max-height: var(--portfolio-image-height);
}

.series-detail-gallery--portfolio figcaption {
  justify-content: center;
  margin-top: 1.125rem;
  text-align: center;
}

.series-detail-gallery > .series-detail-copy {
  grid-column: 1 / -1;
  justify-self: center;
  text-align: center;
}

.series-detail-closing {
  margin-inline: auto;
}

.series-detail-end {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.viewer-series-controls:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin-top: .65rem;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}

.viewer-series-controls .icon-button {
  width: 44px;
  height: 44px;
}

.viewer-series-controls [aria-disabled="true"] {
  opacity: .35;
  cursor: default;
}

.viewer:has(.viewer-series-controls:not([hidden])) .viewer-layout {
  padding-block: 3.75rem 1rem;
}

.viewer:has(.viewer-series-controls:not([hidden])) {
  --viewer-image-limit: calc(100svh - 13.5rem);
}

.viewer:has(.viewer-series-controls:not([hidden])) .viewer-frame:not([data-zoom-locked]) {
  touch-action: none;
}

@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-layout {
    display: grid;
    grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
    gap: 12px;
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-stage {
    container-type: size;
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-canvas {
    --viewer-image-limit: 100cqh;
    height: 100%;
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-bottom {
    width: 100%;
    min-width: 0;
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-bottom h2 {
    max-height: 30svh;
    overflow: auto;
    overflow-wrap: anywhere;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-layout {
    grid-template: minmax(0, 1fr) / minmax(0, 1.2fr) minmax(0, 1fr);
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-bottom {
    align-self: center;
  }

  .viewer:has(.viewer-series-controls:not([hidden])) .viewer-stage {
    padding-inline: 18px 0;
  }
}

@media (max-width: 760px) {
  .series-detail-hero,
  .series-detail-story,
  .series-detail-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  .series-detail-opening h1 {
    text-wrap: wrap;
  }

  .series-detail-gallery:not(.series-detail-gallery--portfolio) .series-detail-frame {
    aspect-ratio: auto;
  }

  .series-detail-gallery:not(.series-detail-gallery--portfolio) .series-detail-frame img {
    width: 100%;
    height: auto;
    max-height: 75svh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .series-detail-artwork-arrow {
    transition: none;
  }
}

.theme-introduction-story {
  margin-top: var(--series-gutter);
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
  scroll-margin-top: 2rem;
}

.theme-introduction-story > header,
.theme-introduction-reading > :not(.series-detail-figure, .theme-introduction-gallery) {
  max-width: 42rem;
  margin-inline: auto;
}

.theme-introduction-story > header p {
  margin-top: .55rem;
}

.theme-introduction .theme-introduction-reading {
  display: block;
  max-width: 55rem;
  margin-inline: auto;
}

.theme-introduction-reading .series-detail-frame {
  aspect-ratio: auto;
  background: transparent;
}

.theme-introduction-reading .series-detail-frame img {
  width: auto;
  height: auto;
  max-height: var(--portfolio-image-height);
  margin-inline: auto;
}

.theme-introduction-reading :is(figcaption, .theme-introduction-caption) {
  display: block;
  text-align: center;
}

.theme-introduction-reading > .theme-introduction-gallery--editor-group {
  margin-block: clamp(1.5rem, 4vw, 3rem);
}

.theme-introduction-reading > .theme-introduction-gallery--editor-group + .theme-introduction-caption {
  margin-block-start: 0;
}

/* Match the larger editable image-to-image Spacers on China 2018. */
.theme-introduction--china-2018 .theme-introduction-gallery {
  row-gap: 200px;
}

.theme-introduction--abstract-real .theme-introduction-gallery {
  row-gap: 100px;
}

:is(.theme-introduction--china-2018, .theme-introduction--abstract-real) .theme-introduction-gallery > .series-detail-figure {
  min-height: 0;
}

/* A saved Spacer must not gain an additional gallery bottom margin. */
.theme-introduction-reading > .theme-introduction-gallery:has(+ .wp-block-spacer) {
  margin-block-end: 0;
}

/* Native Spacer heights own the gap instead of adding the gallery's default margin. */
.theme-introduction-reading > .wp-block-spacer + * {
  margin-block-start: 0;
}

.theme-introduction-reading > .wp-block-spacer + .theme-introduction-gallery > .series-detail-figure:first-child {
  min-height: 0;
}

.theme-introduction .oberg-comments {
  margin-inline: auto;
}

.theme-introduction-reading .legacy-exhibition-video iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* Themes uses native paragraph and Spacer blocks, including Jan's chosen gap. */
.themes-page .themes-introduction {
  margin-top: 0;
  overflow-wrap: anywhere;
}

.themes-introduction .wp-block-spacer {
  margin-block: 0;
}

.themes-introduction :is(p, ul, ol) + :is(p, ul, ol) {
  margin-top: 1em;
}

.theme-index.theme-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
  max-width: none;
}

.theme-directory li a {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  justify-content: stretch;
  height: 100%;
}

.theme-directory-image {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--room);
}

.theme-directory-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.theme-directory-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font: 400 clamp(1.3rem, 2.2vw, 1.7rem)/1.2 var(--serif);
}

@media (max-width: 639px) {
  .theme-index.theme-directory {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .theme-directory li a {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .75rem 0;
  }

  .theme-directory-image {
    flex: 0 0 clamp(4.5rem, 20vw, 6.25rem);
    width: clamp(4.5rem, 20vw, 6.25rem);
  }

  .theme-directory-title {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* Uniques needs room for the material/process explanations. */
.portfolio-catalogue--uniques .series-detail-gallery--portfolio { row-gap: calc(var(--portfolio-gallery-gap) * 1.28); }
.portfolio-catalogue--uniques .series-detail-gallery--portfolio figcaption,
.theme-introduction--uniques .series-detail-gallery--portfolio figcaption { margin-top: 1.44rem; }
.portfolio-catalogue--uniques .portfolio-work-description {
  flex-basis: 100%;
  max-width: 65ch;
  margin: .5rem auto 0;
  line-height: 1.6;
}
.portfolio-catalogue--uniques .series-detail-gallery--portfolio figcaption {
  display: block;
  text-align: center;
}
