.designing-rotation-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
/* Native scroll gets real travel in the document, with the rotation stage
   pinned by CSS rather than canceling touch input or correcting scrollY. */
html[data-native-project-scroll] .adopting-liquid-glass-phone-section {
  display: block;
  height: 185svh;
  overflow: visible;
}
html[data-native-project-scroll] .designing-rotation-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}
/* Fill the visible browser viewport as its toolbar retracts. The controller
   still measures story progress against the stable rotation-stage height. */
html[data-native-project-scroll] .designing-hands-stage {
  height: 100dvh;
}
/* Keep Safari's fixed dock above the sticky scene's composited white circle.
   display:contents gives the custom element no layer of its own. */
html[data-native-project-scroll] yoz-menu {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
html[data-native-project-scroll] .yoz-menu-dock {
  pointer-events: auto;
}

/* Let the browser perform vertical panning, pinch zoom and inertial release. */
html[data-native-project-scroll],
html[data-native-project-scroll] .adopting-liquid-glass-page {
  touch-action: pan-y pinch-zoom;
  scroll-behavior: auto;
  scroll-snap-type: none;
}
html[data-native-project-scroll] .adopting-liquid-glass-page {
  -webkit-overflow-scrolling: touch;
}

.designing-title-mobile-break,
.designing-title-mobile-space,
.designing-title-mobile-caret {
  display: none;
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .designing-hands-stage { --mobile-story-layout: 1; }

  /* Fade only the hands below the phone screens into the black lower scene.
     Screen bounds follow the transparent hand artwork's intrinsic geometry. */
  .designing-hand::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent 0%, #000 100%);
  }
  .designing-hand-left::after { top: 83.1%; }
  .designing-hand-right::after { top: 84.7%; }

  .designing-code-intro-stage { padding-inline: 1rem; }
  .adopting-liquid-glass-title {
    font-size: clamp(2.75rem, min(17vw, 16svh), 6rem);
    line-height: 1.05;
    white-space: nowrap;
  }
  .designing-title-mobile-break { display: inline; }
  .designing-title-mobile-space { display: inline; }
  .designing-title-desktop-break,
  .designing-title-desktop-space { display: none; }
  .adopting-liquid-glass-title::after { display: none; }
  .designing-title-mobile-caret {
    display: inline-block;
    margin-left: 0.115em;
    vertical-align: -0.08em;
    width: 0.085em;
    height: 0.88em;
    background: #fff;
    animation: designing-code-cursor-blink 1.15s steps(1, end) infinite;
  }

  /* Encoded edge pixels differ slightly from the scene's #FCFEFB. Feather
     only the empty outer margin, including the poster, to avoid a hard seam. */
  .adopting-liquid-glass-phone {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 4px, #000 calc(100% - 4px), transparent), linear-gradient(to bottom, transparent, #000 4px, #000 calc(100% - 4px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 4px, #000 calc(100% - 4px), transparent), linear-gradient(to bottom, transparent, #000 4px, #000 calc(100% - 4px), transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }
  .adopting-liquid-glass-phone-video,
  .adopting-liquid-glass-phone-poster {
    display: block;
    border: 0;
    outline: 0;
    box-shadow: none;
  }
  .designing-details-title,
  .designing-delight-title {
    font-size: clamp(2rem, min(9vw, 10svh), 3.25rem);
  }
  .designing-details-phone {
    /* Leave enough caption space above the fixed dock on short phones. */
    --details-phone-width: min(92vw, calc((100svh - max(26svh, calc(220px + env(safe-area-inset-bottom)))) * 874 / 1350), 760px);
  }
}

@media (max-width: 760px) and (orientation: portrait), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .designing-hands-stage { --portrait-comparison-layout: 1; }
  .designing-hand {
    --comparison-hand-width: min(70vw, 60svh);
    width: var(--comparison-hand-width);
    bottom: auto;
  }
  /* Center the visible screens, whose centers sit above the hand-image center. */
  .designing-hand-left {
    left: calc(25vw - var(--comparison-hand-width) * 0.541);
    top: calc(50% - var(--comparison-hand-width) * 0.49456);
  }
  .designing-hand-right {
    right: calc(25vw - var(--comparison-hand-width) * 0.56699);
    top: calc(50% - var(--comparison-hand-width) * 0.50385);
  }
  .designing-hands-title { font-size: clamp(1.5rem, 6vw, 2.25rem); }
}

@media (max-width: 760px) and (orientation: landscape), (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .designing-code-title-camera { margin-bottom: 110px; }
  .adopting-liquid-glass-title { font-size: clamp(2.25rem, 14svh, 4rem); }
  .designing-intro-context { margin-top: 10px; font-size: 14px; line-height: 1.3; }
}

@media (prefers-reduced-motion: reduce) {
  .designing-title-mobile-caret { animation: none; }
}
