/* A persistent paper scene carries its current pose between chapter and content. */
html body.living-fold #site-stage > .horizontal-strip { z-index: 1; }
html body.living-fold .origami-flow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 650ms ease;
  --paper-x: 55vw;
  --paper-y: 25vh;
  --paper-scale: 1;
  --paper-roll: -4deg;
}
html body.living-fold:not(.is-hero-scene) .origami-flow { opacity: 1; }
html body.living-fold .origami-flow__carrier {
  position: absolute;
  top: 0;
  left: 0;
  width: min(800px, 44vw);
  height: min(700px, 64vh);
  transform-origin: 50% 50%;
  transform: translate3d(var(--paper-x), var(--paper-y), 0) scale(var(--paper-scale)) rotate(var(--paper-roll));
  transition: transform 1200ms cubic-bezier(.22, .7, .2, 1), opacity 650ms ease;
}
html body.living-fold .origami-flow__piece {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 550ms ease;
  perspective: 1100px;
}
html body.living-fold .origami-flow__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 70%;
}
/* Neighbouring scenes can fetch their lazy artwork before it becomes current. */
html body.living-fold:has([data-panel][data-near][data-section="Projects"]) [data-origami-section="Projects"],
html body.living-fold:has([data-panel][data-near][data-section="Places"]) [data-origami-section="Places"],
html body.living-fold:has([data-panel][data-near][data-section="Archive"]) [data-origami-section="Archive"],
html body.living-fold:has([data-panel][data-near][data-section="About"]) [data-origami-section="About"],
html body.living-fold:has([data-panel][data-near][data-section="Reviews"]) [data-origami-section="Reviews"] { display: block; }
html body.living-fold[data-scene-section="Projects"] [data-origami-section="Projects"],
html body.living-fold[data-scene-section="Places"] [data-origami-section="Places"],
html body.living-fold[data-scene-section="Archive"] [data-origami-section="Archive"],
html body.living-fold[data-scene-section="About"] [data-origami-section="About"],
html body.living-fold[data-scene-section="Reviews"] [data-origami-section="Reviews"],
html body.living-fold[data-scene-section="Contact"] [data-origami-section="Reviews"] { display: block; opacity: 1; }
html body.living-fold[data-scene-section="Places"] .origami-flow { --paper-x: 28vw; --paper-y: 44vh; --paper-scale: 1.2; --paper-roll: -3deg; }
html body.living-fold[data-scene-section="Archive"] .origami-flow { --paper-x: 5vw; --paper-y: 23vh; --paper-scale: 1.04; --paper-roll: 5deg; }
html body.living-fold[data-scene-section="About"] .origami-flow { --paper-x: 56vw; --paper-y: 24vh; --paper-scale: 1; --paper-roll: -7deg; }
html body.living-fold[data-scene-section="Reviews"] .origami-flow { --paper-x: 35vw; --paper-y: 43vh; --paper-scale: 1.08; --paper-roll: 3deg; }
html body.living-fold[data-scene="content"] .origami-flow {
  --paper-x: 70vw;
  --paper-y: 60vh;
  --paper-scale: .48;
  --paper-roll: 12deg;
  opacity: .2;
}
html body.living-fold[data-scene="content"][data-scene-section="Places"] .origami-flow,
html body.living-fold[data-scene="content"][data-scene-section="About"] .origami-flow { --paper-x: -15vw; --paper-roll: -10deg; }

/* The title layouts make room for the same travelling artwork in different poses. */
html body.visual-refresh.editorial-v1.living-fold.horizontal-snap .title-panel .chapter-shell {
  height: min(640px, calc(100dvh - 168px)) !important;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 24px !important;
}
html body.visual-refresh.editorial-v1.living-fold.horizontal-snap .title-panel .chapter-index { grid-area: 1 / 1 !important; width: min(220px, 100%) !important; margin: 0 !important; }
html body.visual-refresh.editorial-v1.living-fold.horizontal-snap .title-panel .chapter-copy { grid-area: 2 / 1 !important; text-align: left !important; justify-items: start !important; align-self: center !important; }
html body.visual-refresh.editorial-v1.living-fold.horizontal-snap .title-panel .chapter-copy h2 { font-size: clamp(40px, 4.4vw, 76px) !important; }
html body.living-fold.horizontal-snap .chapter-label,
html body.living-fold.horizontal-snap .chapter-keywords { justify-content: flex-start; }
html body.visual-refresh.editorial-v1.living-fold.horizontal-snap .title-panel .living-fold-chapter-art { display: none !important; }

/* The inner title lines own the single entrance in chapter-motion.css. */
html body.visual-refresh.editorial-v1.living-fold .title-panel .chapter-copy { animation: none !important; opacity: 1; translate: none; }

/* Native vertical layouts keep a reserved artwork space within each chapter. */
html body.visual-refresh.editorial-v1.living-fold.mobile-continuous .living-fold-chapter-art { display: block !important; width: min(440px, 100%) !important; }
html body.visual-refresh.editorial-v1.living-fold .title-panel .living-fold-art__image { aspect-ratio: var(--chapter-ratio, 4 / 3); max-height: min(330px, 40vh); object-fit: contain; }
html body.living-fold [data-chapter-stage="02"] { --chapter-ratio: 1605 / 980; }
html body.living-fold [data-chapter-stage="03"] { --chapter-ratio: 1341 / 1173; }
html body.living-fold [data-chapter-stage="04"] { --chapter-ratio: 1 / 1; }
html body.living-fold [data-chapter-stage="05"] { --chapter-ratio: 1478 / 1064; }
html body.living-fold.mobile-continuous .origami-flow { --paper-x: calc(100vw - 170px); --paper-y: calc(100dvh - 290px); --paper-scale: 1; --paper-roll: 8deg; opacity: .12; }
html body.living-fold.mobile-continuous .origami-flow__carrier { width: 230px; height: 210px; }
html body.living-fold.mobile-continuous:is(.is-title-scene, .is-hero-scene) .origami-flow { opacity: 0; }
html body.living-fold.mobile-continuous:is(.is-title-scene, .is-hero-scene) .origami-flow__image { animation-play-state: paused; }

html body.visual-refresh.editorial-v1.living-fold:is(.is-page-hidden, .project-open, .cv-open) #site-stage :is(.origami-flow__image, .living-fold-art__image, .chapter-copy) { animation-play-state: paused !important; }
html body.living-fold:is(.project-open, .cv-open) .origami-flow { visibility: hidden; }
html.performance-lite body.visual-refresh.editorial-v1.living-fold #site-stage :is(.origami-flow__image, .living-fold-art__image, .chapter-copy, .origami-flow, .origami-flow__piece, .origami-flow__carrier),
html body.visual-refresh.editorial-v1.living-fold.a11y-reduce-motion #site-stage :is(.origami-flow__image, .living-fold-art__image, .chapter-copy, .origami-flow, .origami-flow__piece, .origami-flow__carrier) { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  html body.visual-refresh.editorial-v1.living-fold #site-stage :is(.origami-flow__image, .living-fold-art__image, .chapter-copy, .origami-flow, .origami-flow__piece, .origami-flow__carrier) { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) { html body.visual-refresh.editorial-v1.living-fold #site-stage :is(.origami-flow, .living-fold-chapter-art) { display: none !important; } }
@media print { html body.visual-refresh.editorial-v1.living-fold #site-stage :is(.origami-flow, .living-fold-chapter-art) { display: none !important; } }
