/* Each chapter lets one photograph set the pace. */
.photo-essay {
  --essay-accent: #ffd2ed;
  --essay-line: #e0b5dc78;
}

.essay-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .35rem 1.15rem;
  flex-wrap: wrap;
  padding-block: .38rem;
  border-block: 1px solid var(--essay-line);
}

.essay-chapters,
.essay-pages {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.essay-toolbar button {
  min-width: 3rem;
  min-height: 3rem;
  border: 0;
  color: var(--scene-text);
  background: transparent;
  font-weight: 700;
}

.essay-chapters button {
  position: relative;
  padding: .48rem clamp(.42rem, 2vw, .9rem);
  border-radius: .2rem;
}

.essay-chapters button::after {
  position: absolute;
  content: "";
  inset: auto .43rem 0;
  height: 2px;
  background: var(--essay-accent);
  opacity: 0;
}

.essay-chapters button[aria-pressed="true"] { color: var(--essay-accent); }
.essay-chapters button[aria-pressed="true"]::after { opacity: 1; }
.essay-toolbar button:not([aria-disabled="true"]):hover { background: #a9629e20; }
.essay-toolbar button[aria-disabled="true"] { color: var(--scene-muted); cursor: default; }
.essay-toolbar button[aria-disabled="true"] svg { opacity: .58; }

.essay-pages { gap: .16rem; }
.essay-pages button {
  display: grid;
  place-items: center;
  padding: .3rem;
  border-radius: 50%;
}

.essay-pages svg { width: 1.25rem; height: 1.25rem; }
.essay-count {
  min-width: 4.15rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.essay-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.essay-photo {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(0, .72fr);
  align-items: center;
  gap: clamp(1.65rem, 5.6vw, 6rem);
  margin: 0;
  padding-block: clamp(1.45rem, 4vw, 3.5rem);
  border-block-end: 1px solid var(--essay-line);
}

.essay-image {
  display: grid;
  justify-items: center;
  min-width: 0;
}

.photo-essay[data-essay-ready] .essay-image { touch-action: pan-y pinch-zoom; }

.essay-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(22rem, 70svh, 37rem);
  object-fit: contain;
  border-radius: .15rem;
  box-shadow: 0 12px 32px #4f285226;
}

.essay-photo figcaption {
  max-width: 14ch;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4vw, 4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.031em;
  color: var(--essay-accent);
  text-shadow: 0 2px 9px #1f1429ce;
  text-wrap: balance;
}

.essay-photo figcaption::before {
  display: block;
  width: clamp(2.4rem, 8vw, 6rem);
  height: 1px;
  margin-bottom: clamp(.7rem, 2.3vw, 1.35rem);
  content: "";
  background: var(--essay-line);
}

.gallery .gallery-note {
  margin-top: 1rem;
  color: var(--scene-muted);
}

@media (max-width: 46rem) {
  .essay-photo {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(.72rem, 2.8vw, 1.15rem);
    padding-block: .9rem 1.18rem;
  }

  .essay-image img { max-height: clamp(16.5rem, 60svh, 31rem); }
  .essay-photo figcaption { max-width: 24ch; font-size: clamp(1.58rem, 6.1vw, 2.6rem); }
  .essay-photo figcaption::before { display: none; }
}

@media (max-width: 25rem) {
  .essay-toolbar { gap: .25rem .24rem; }
  .essay-chapters { gap: .06rem; }
  .essay-pages { gap: 0; }
  .essay-count { min-width: 3.2rem; font-size: .88rem; }
  .essay-chapters button { padding-inline: .33rem; font-size: .89rem; }
}

@media (max-width: 22rem) {
  .essay-toolbar { display: grid; grid-template-columns: 1fr; justify-items: center; }
  .essay-chapters { width: 100%; justify-content: space-evenly; }
}
