:root {
  --site-section-space: clamp(1.125rem, 2.4vw, 1.75rem);
  --site-feature-space: clamp(1.625rem, 3.6vw, 3.25rem);
}

/* Neighboring sections each contribute part of the transition. */
.site-main .section-block:not(.series-gateway),
.site-main .party-gallery {
  padding-block-start: var(--site-section-space);
  padding-block-end: var(--site-section-space);
}

.site-main .section-block:not(.series-gateway)::before,
.site-main .party-gallery::before {
  margin-block-end: clamp(.5rem, 1.3vw, 1rem);
}

/* A standalone parchment panel already marks the section break. */
.site-main > .book-world:has(> .chapter-end-actions:last-child) + .party-gallery::before,
.site-main > #reader-list:has(> .reader-letter:only-child)::before,
.site-main > #reader-list:has(> .reader-letter:only-child) + .section-block::before,
.site-main > .next-voyage-section:has(> .next-voyage-teaser:first-child)::before {
  display: none;
}

.site-main .section-block.series-gateway {
  margin-block-start: var(--site-feature-space);
  margin-block-end: var(--site-section-space);
}

.site-main .rusty-start-anywhere {
  margin-block: var(--site-section-space);
  margin-block-end: .75rem;
}

.site-main .rusty-scrapbook {
  margin-block-start: var(--site-section-space);
}

.series-route .has-book-miniature {
  margin-block-end: clamp(2.25rem, 5.6vw, 4.5rem);
}

.site-main .section-block.next-voyage-section { padding-block-start: .875rem; }

.site-main .next-voyage-teaser {
  margin-block-end: var(--site-section-space);
}

/* Match the chapter break to the amount of illustration beyond its edge. */
.book-world .chapter-scene {
  --chapter-art-overhang: clamp(3.5rem, 5.5vw, 5rem);
  margin-block-start: var(--site-feature-space);
  margin-block-end: var(--site-section-space);
}

.book-world .chapter-scene:has(.chapter-scene-curios) {
  margin-block-end: calc(var(--chapter-art-overhang) + var(--site-section-space));
}

.book-world .chapter-scene-curios {
  bottom: calc(-1 * var(--chapter-art-overhang));
}

.book-world .immersive-book-world {
  margin-block-start: var(--site-feature-space);
}

.book-world .chapter-audio-scroll,
.site-main .dispatch-grid,
.site-main :is(.dispatch-paper, .complaint-desk, .dispatch-declassification, .dispatch-book-bridge, .dispatch-related) {
  margin-block-end: var(--site-section-space);
}

.site-main .book-reader-invite,
.bonus-story .bonus-story-gate {
  margin-block-start: var(--site-feature-space);
}

.book-world .chapter-end-actions,
.site-main .next-world {
  margin-block: var(--site-section-space);
}

.site-main .dispatch-index-hero {
  margin-block-end: var(--site-section-space);
}

.reader-page .reader-intro { margin-block-end: var(--site-section-space); }
.reader-page .reader-next { padding-block-start: var(--site-section-space); }

@media (max-width: 760px) {
  .book-world .chapter-scene { --chapter-art-overhang: 4.75rem; }
}
