/* Read the words, then turn the page. Without motion (no script, reduced motion, motion
   that never started) page 1's two sides sit side by side, a still before and after.
   With motion page 1 lies on the right-hand page of an open book; motion.js turns it
   (scenes.turn) once the visitor scrolls it into view or taps "Turn the page", then page 2
   on request; the !important undoes a turn if motion stops. data-step (0, 1, 2) names the
   picture lying on the left; data-turning is set while a leaf moves. The labels keep
   their space and the button shows from the start, so nothing moves when a turn ends. */
.turn-section { display: grid; gap: 14px; }
.turn-copy .section-lede { margin-bottom: .6em; }
.turn-option { color: var(--muted); margin: 0; }
.turn { margin: 0; max-width: 560px; min-width: 0; }
/* Clip the turning leaf at the book, not the figure, so the button's focus ring stays whole. */
.spread { overflow-x: clip; }
.turn .sheet, .turn .leaf-2, .next-veil, .turn-label, .turn-again { display: none; }
.leaf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
:root:not(.motion) .leaf { transform: none !important; }
.face, .sheet {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 17 / 22;
  background: var(--page); border-radius: 10px; box-shadow: var(--lift); padding: 12px 12px 32px;
}
.face-step { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 1rem/1.2 var(--sans); }
.page-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2.5px var(--honey); font: 800 .95rem/1 var(--display); }
.turn-text { font: 700 clamp(1.1rem, 4.4vw, 1.5rem)/1.3 var(--book); margin: auto 0; }
.leaf-1 .face-front .turn-text { margin-bottom: 4px; }
.name-note { margin: 0 0 auto; font: 700 .95rem/1.25 var(--sans); color: var(--sage-ink); }
.face-back img { margin: auto 0; border: 2px solid var(--ink); border-radius: 4px; padding: 3px; }
.turn-no { position: absolute; right: 12px; bottom: 8px; font: 600 1rem/1 var(--book); color: var(--muted); }
.sheet-label { margin: 0; font: 700 1rem/1.2 var(--book); color: var(--muted); }
/* The warm-up words sit in one row under their label, never level with the story line. */
.sheet-words { display: flex; flex-wrap: wrap; gap: 0 .7em; margin: 10px 0 auto; font: 700 1.2rem/1.35 var(--book); color: var(--muted); }
/* A deep perspective keeps the lifted leaf inside the book's edge as it turns. */
.motion .spread {
  position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); perspective: 5200px;
  padding: 8px; border-radius: 16px; background: #ead9b6; box-shadow: var(--lift);
}
.motion .sheet { display: flex; grid-row: 1; box-shadow: none; }
.motion .sheet-left { grid-column: 1; border-radius: 8px 0 0 8px; box-shadow: inset -14px 0 14px -14px #5a4a3240; }
.motion .sheet-right { grid-column: 2; border-radius: 0 8px 8px 0; box-shadow: inset 14px 0 14px -14px #5a4a3240; }
.motion .leaf { display: block; grid-column: 2; grid-row: 1; position: relative; z-index: 2; transform-origin: 0 50%; transform-style: preserve-3d; }
.motion .leaf-2 { z-index: 1; }
.motion .turn[data-step="2"] .leaf-2, .motion .turn[data-step="1"][data-turning] .leaf-2 { z-index: 3; }
.motion .face {
  position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0 8px 8px 0;
  box-shadow: inset 14px 0 14px -14px #5a4a3240; -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.motion .face-back { transform: rotateY(180deg); border-radius: 8px 0 0 8px; box-shadow: inset -14px 0 14px -14px #5a4a3240; }
.motion .face-step { display: none; }
/* After a turn the next page's words wait, pale, under a quiet tag. */
.motion .next-veil {
  display: grid; place-items: start center; grid-column: 2; grid-row: 1; z-index: 4; margin: 0;
  padding: 12px 8px 0; border-radius: 0 8px 8px 0; background: #ffffff9e;
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.next-veil span {
  padding: 3px 10px; border-radius: 999px; background: var(--sage-wash); color: var(--sage-ink);
  font: 700 .9rem/1.25 var(--sans); text-align: center;
}
.motion .turn-label {
  display: grid; grid-template-columns: 1fr 1fr; margin: 8px 0 0; padding: 0 8px;
  font: 700 1rem/1.3 var(--sans); color: var(--sage-ink);
}
.turn-label span { grid-column: 1; grid-row: 1; visibility: hidden; }
.turn-label .label-0 { grid-column: 2; }
.motion .turn-again { display: inline-flex; }
.motion .turn:is([data-step="1"], [data-step="2"]):not([data-turning]) .next-veil { opacity: 1; visibility: visible; }
.motion .turn[data-step="0"]:not([data-turning]) .label-0,
.motion .turn[data-step="1"]:not([data-turning]) .label-1,
.motion .turn[data-step="2"]:not([data-turning]) .label-2 { visibility: visible; }
.turn-again { margin-top: 2px; border: 0; background: none; font: 700 1rem/1.2 var(--sans); color: var(--sage-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

@media (min-width: 760px) {
  .turn-section { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; gap: 44px; }
  .turn { justify-self: end; width: 100%; }
}
