.intro-demo{padding-block:clamp(28px,3.6vw,58px)}
.intro-demo h1 {
  margin-bottom: clamp(20px, 2.1vw, 32px);
  font-size: var(--page-title);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.35;
  text-wrap: balance;
}
.purchase-guide .button {
  flex: none;
  min-height: 34px;
  padding: 0 13px;
  gap: 8px;
  border-radius: 18px;
  font-size: 13px;
  letter-spacing: 0;
}
.purchase-guide .button .icon { width: 12px; height: 12px; }
.frame-shell{overflow:hidden;border:1px solid #dedfd9;border-radius:6px}
.frame-shell iframe{width:100%;display:block;border:0}
.frame-shell iframe{height:clamp(520px, min(52vw,69vh), 780px)}
@media(max-width:760px){
  .frame-shell iframe{height:clamp(500px,74svh,700px)}
}

.hero-stage { background: #92977a url("../river-pump-station.webp") center / cover; }
.stage-selection { background: #c6b69c url("../terraced-hills.webp") center bottom / cover; }
.stage-selection-workspace { background: #cbd8da; }
.stage-mail { background: #e3d5c1; }
.demo-stage {
  padding: clamp(28px, 4vw, 68px) clamp(18px, 5.5vw, 96px);
  border-radius: 7px;
}
.hero-stage .frame-shell {
  background: white;
  box-shadow: 0 12px 38px #1d302c38;
}
.demo-stage iframe { aspect-ratio: 16 / 9; height: auto; min-height: 410px; }
@media (max-width: 600px) {
  .demo-stage { padding: 22px 8px; }
  .demo-stage iframe { aspect-ratio: auto; height: clamp(380px, 54svh, 480px); min-height: 0; }
}

/* Scale the demo's viewport and its contents together on larger screens. */
@media (min-width: 901px) {
  .intro-demo, .chapters {
    --demo-scale: .88;
    width: calc(100% * var(--demo-scale));
    max-width: calc(1440px * var(--demo-scale));
    padding-inline: calc(var(--pad) * var(--demo-scale));
  }
  .demo-stage {
    padding: calc(clamp(28px, 4vw, 68px) * var(--demo-scale))
             calc(clamp(18px, 5.5vw, 96px) * var(--demo-scale));
  }
  .frame-shell { position: relative; }
  .demo-stage .frame-shell { aspect-ratio: 16 / 9; min-height: calc(410px * var(--demo-scale)); }
  .scene-demo .frame-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
  .hero-stage .frame-shell iframe {
    position: absolute;
    inset: 0 auto auto 0;
    width: calc(100% / var(--demo-scale));
    height: calc(100% / var(--demo-scale));
    min-height: 0;
    transform: scale(var(--demo-scale));
    transform-origin: top left;
  }
}

.scene-feature {
  border-top: 1px solid var(--line);
  padding-block: clamp(28px, 4vw, 60px);
}
/* Scene descriptions sit outside the live workbench. */
.scene-copy h2 { font-size: var(--section-title); font-weight: 500; line-height: 1.35; letter-spacing: -.025em; }
.scene-copy p { margin-top: 10px; max-width: 25em; line-height: 1.65; }
.scene-demo { min-width: 0; }
.scene-demo .frame-shell { background: white; }
.scene-feature { display: grid; gap: 16px; }
@media (min-width: 1200px) {
  .chapters {
    width: 100%;
    max-width: none;
    padding-inline: 0;
    container-type: inline-size;
  }
  .scene-feature {
    /* Match the hero's window after its page gutters and background inset. */
    --window-width: calc((min(100cqw, 1440px) - 2 * var(--pad) - 2 * clamp(18px, 5.5vw, 96px)) * var(--demo-scale));
    --scene-inset: clamp(16px, 1.6vw, 28px);
    --stage-width: calc(var(--window-width) + 2 * var(--scene-inset));
    max-width: 1520px;
    margin-inline: auto;
    padding-inline: clamp(20px, 3vw, 48px);
    grid-template-columns: minmax(0, 1fr) var(--stage-width);
    grid-template-areas: "copy demo";
    align-items: center;
    gap: clamp(24px, 3vw, 48px);
  }
  .scene-feature .scene-copy { grid-area: copy; }
  .scene-feature .scene-demo { grid-area: demo; padding: var(--scene-inset); }
  .scene-feature:nth-of-type(even) {
    grid-template-columns: var(--stage-width) minmax(0, 1fr);
    grid-template-areas: "demo copy";
  }
}
