/* Platform: the 3D model standing on the beige page. The section is tall
   (780svh) so scrolling through it opens the
   model layer by layer; a sticky stage holds the model in view meanwhile,
   below the floating header. The canvas is transparent, so the page shows
   through. */
.scroll-story {
  position: relative;
  height: 780svh;               /* opening (82%), then reassembly */
  /* The stage is held just below the floating header (where a nav link
     lands every section), so the title sits the same distance from the
     section's top edge as the other section titles, held or not. */
  --pin: calc(var(--top) + var(--h) + 8px);
  scroll-margin-top: var(--pin);
}
.platform-sticky {
  position: sticky;
  top: var(--pin);
  height: calc(100vh - var(--pin));
  height: calc(100svh - var(--pin));
  display: flex;
}
/* The stage fills the screen below the header; its edges fade into the page,
   so layers lifting away dissolve rather than being cut off. */
.platform-stage {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 56px), transparent),
                      linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 56px), transparent),
              linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent);
  mask-composite: intersect;
}
.platform-stage { position: relative; flex: 1; min-width: 0; min-height: 0; }
.platform-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;          /* touch scrolls the page (and so the model) */
  cursor: grab;
}
.platform-stage canvas:active { cursor: grabbing; }
.platform-loading {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* The section's title, top left, matching "Neural tissue": same gutter and
   width as the gallery heading, just below the header. The model turns
   behind it; the title never takes the pointer. */
.platform-head {
  position: absolute;
  z-index: 1;
  /* The same space above it as the other section titles (their top padding). */
  top: clamp(26px, 2.7vw, 40px);
  left: max(env(safe-area-inset-left), var(--side));
  right: max(env(safe-area-inset-right), var(--side));
  max-width: var(--column);
  margin-inline: auto;
  pointer-events: none;
}

/* The text under the title: one plain paragraph. */
.platform-lines {
  margin: 0 0 clamp(20px, 2.4vw, 36px);   /* the title's own space below */
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--size-large);
  line-height: 1.3;
  color: #4a4b4f;
}
/* Landscape screens: the title and text sit over the stage. Behind them is
   a faint frosted shape traced from the words themselves (platform.js draws
   it into --shape), following each line's length with a short feathered
   edge: over the plain page it is invisible, and where the model turns
   beneath, the model softens there, so the words stay clear. */
@media (orientation: landscape) {
  /* The text wraps within the left side, clear of the model. */
  .platform-lines { max-width: min(24em, 30vw); }
  .platform-head .section-title,
  .platform-lines { position: relative; --shape: linear-gradient(transparent, transparent); }
  .platform-head .section-title::before,
  .platform-lines::before {
    --f: 12px;                         /* feather; matches FEATHER in platform.js */
    content: "";
    position: absolute;
    z-index: -1;
    inset: calc(var(--f) * -1);
    background: rgb(223 219 208 / 0.15);
    -webkit-backdrop-filter: blur(3px);
            backdrop-filter: blur(3px);
    -webkit-mask: var(--shape) 0 0 / 100% 100% no-repeat;
            mask: var(--shape) 0 0 / 100% 100% no-repeat;
  }
}
/* Portrait screens (phones): the opened model needs the full height, so the
   title and lines sit above the stage instead of over it, and the model
   has the space below them. */
@media (orientation: portrait) {
  .platform-sticky { flex-direction: column; }
  .platform-head {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    box-sizing: border-box;
    flex: none;
    padding: clamp(26px, 2.7vw, 40px) max(env(safe-area-inset-right), var(--side)) 0 max(env(safe-area-inset-left), var(--side));
  }
  .platform-lines { margin-bottom: 0; }
}

/* Section change from Neural tissue, in the manner of Team to Contact but
   softer: a very faint shade fading out within 90px, and a fainter hairline
   that fades out at both ends. */
.scroll-story.platform {
  background: linear-gradient(180deg, rgb(17 18 20 / 0.018), rgb(17 18 20 / 0.006) 40px, transparent 90px);
}
.scroll-story.platform::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(var(--column), calc(100% - 2 * var(--side)));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgb(17 18 20 / 0.07) 30%, rgb(17 18 20 / 0.07) 70%, transparent);
}
