/* The /os layers section (WEB-143). The stage stays pinned under the header for --hm-room stage heights of scroll
   while os-how.js moves the names, leaders, heading and steps. Wide: the frame fills the stage, the steps in a column
   on the left. Phones: the heading, the stack, the names, then one step at a time. Reduced motion on phones, and phone
   windows too short to pin the stage (os-how.js): no pin and no frame, stills instead. */

.wrap.hm-sec {
  --hm-room: calc(9.3 * .42);
}

.wrap.hm-sec > .hm-track {
  grid-column: 1 / -1;
  grid-row: 1;
  width: calc(100% + 2 * var(--gutter));
  margin-inline: calc(var(--gutter) * -1);
  height: calc((100svh - var(--navH)) * (1 + var(--hm-room)));
}

.wrap.hm-sec .hm-stage {
  position: sticky;
  top: var(--navH);
  height: calc(100svh - var(--navH));
  overflow: hidden;
}

.wrap.hm-sec .hm-stage > iframe.os-story {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* side by side, once Step 1 shows, the camera walks the layers off the frame's bottom, so the frame fades out there as
   the hero console does on phones (.8, .9 and 1 of the box, components.css .os-window) under the same glass blur. The
   closed cube and the named fan before it are never cut, so they stay unfaded. The mask is on the frame, not the stage,
   so the steps, names and leaders stay crisp. :where keeps the phone block's resets below winning */
.wrap.hm-sec:where(:has(.hm-step:first-child:not(.is-hidden))) .hm-stage > iframe.os-story {
  mask-image: linear-gradient(to bottom, var(--ink) 80%, color-mix(in srgb, var(--ink) 45%, transparent) 90%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, var(--ink) 80%, color-mix(in srgb, var(--ink) 45%, transparent) 90%, transparent);
}

.wrap.hm-sec:where(:has(.hm-step:first-child:not(.is-hidden))) .hm-stage::after {
  content: "";
  position: absolute;
  inset: 80% 0 0;
  pointer-events: none;
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  mask-image: linear-gradient(to bottom, transparent, var(--ink) 45%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, var(--ink) 45%);
}

.wrap.hm-sec .hm-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}

.wrap.hm-sec .hm-line {
  fill: none;
  stroke: var(--ink);
  /* 1px leaders. --stroke is .75px, and px literals belong in tokens.css */
  stroke-width: calc(var(--stroke) * 4 / 3);
  opacity: 0;
}

.wrap.hm-sec .hm-ruler {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  visibility: hidden;
}

.wrap.hm-sec .hm-copy {
  position: absolute;
  top: 0;
  left: var(--hm-gutter);
  z-index: 1;
  box-sizing: border-box;
  width: var(--hm-copy-w);
  height: 100%;
  padding-top: calc(var(--pin-gap) + var(--hm-tl-head));
}

.wrap.hm-sec .hm-h {
  position: absolute;
  top: var(--pin-gap);
  left: 0;
  width: min(calc(100vw - 2 * var(--hm-gutter)), 13.5em);
  margin: 0;
  color: var(--ink);
  font-size: var(--hm-fs-head) !important;
  line-height: var(--hm-tl-head) !important;
  letter-spacing: var(--h-tr) !important;
  font-weight: var(--h-w) !important;
  text-wrap: balance;
  translate: 0 calc(var(--hm-y, 0) * var(--pin-unit));
}

.wrap.hm-sec .hm-steps {
  list-style: none;
  margin: calc(var(--hm-tl-b) * 1.5) 0 0;
  padding: 0;
}

/* the copy box and its list's bottom are what the story frame frames and masks by, so each step keeps main's height:
   its rule, .6 of a body line and a --hm-tl-ui title become this padding, the eyebrow and its underline */
.wrap.hm-sec .hm-step {
  padding: calc(var(--hm-tl-b) * .6 + var(--hm-tl-ui) - var(--os-tl-s-ui) - var(--os-fs-s) * .7) 0 calc(var(--hm-tl-b) * 1.2);
  cursor: pointer;
  translate: 0 calc(var(--hm-off, 0) * var(--pin-unit));
}

.wrap.hm-sec .hm-step.is-hidden {
  pointer-events: none;
}

.wrap.hm-sec .hm-t {
  margin: 0;
  padding-bottom: calc(var(--os-fs-s) * .7);
  /* the leader's colour and width, so the two read as one stroke. Safari draws a .75px border one device pixel thick */
  border-bottom: calc(var(--stroke) * 4 / 3) solid var(--ink);
}

.wrap.hm-sec .hm-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: text;
  user-select: text;
}

.wrap.hm-sec :is(.hm-btn, .hm-lab) {
  font-size: var(--hm-fs-name) !important;
  line-height: var(--hm-tl-name) !important;
  letter-spacing: var(--b-tr) !important;
  font-weight: 500;
}

.wrap.hm-sec .hm-d {
  margin: calc(var(--hm-tl-b) * .3) 0 0;
  color: var(--text);
  font-size: var(--hm-fs-b) !important;
  letter-spacing: var(--b-tr) !important;
  line-height: var(--hm-tl-b) !important;
}

.wrap.hm-sec .hm-btn:focus-visible {
  outline: var(--focus-w) solid var(--ink);
  outline-offset: var(--focus-off);
}

.wrap.hm-sec .hm-labs {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.wrap.hm-sec .hm-lab {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  translate: calc(var(--hm-x, 0) * var(--pin-unit)) calc(var(--hm-y, 0) * var(--pin-unit));
}

/* each name has a grey line under it. Wide, the leader runs between the two, as a step's rule runs between its title
   and body */
.wrap.hm-sec :is(.hm-ln, .hm-ld) {
  display: block;
}

.wrap.hm-sec .hm-ln {
  padding-bottom: calc(var(--os-fs-s) * .7);
}

.wrap.hm-sec .hm-ld {
  padding-top: calc(var(--hm-tl-b) * .3);
  color: var(--text);
  font-size: var(--hm-fs-b);
  line-height: var(--hm-tl-b);
  letter-spacing: var(--b-tr);
  font-weight: var(--b-w);
}

.wrap.hm-sec .hm-ld .tie {
  white-space: nowrap;
}

.wrap.hm-sec .hm-i {
  margin-right: .35em;
  color: var(--grey);
  font-variant-numeric: tabular-nums;
}

@media (max-width:699px),(max-width:1023px) and (orientation:portrait) {
  /* the fan keeps its size and slides right until its middle, Governance's corner, clears Compute's row (tokens.css) */
  .wrap.hm-sec .hm-stage > iframe.os-story {
    --hm-fit: 1;
    top: calc(var(--hm-fy, 0) * var(--pin-unit));
    left: max(0%, calc(var(--hm-gutter) + var(--hm-fan-mid) - 50%));
    height: calc(var(--hm-pic-h) - var(--hm-pic-cut, 0) * var(--pin-unit));
    mask-image: none;
    -webkit-mask-image: none;
  }

  .wrap.hm-sec .hm-stage::after {
    content: none;
  }

  .wrap.hm-sec .hm-copy {
    display: contents;
  }

  /* the stage is empty under the step slot (--hm-tail), so the next section follows the last step at the usual gap */
  .wrap.hm-sec > .hm-track {
    margin-bottom: calc(var(--hm-tail, 0) * var(--pin-unit) * -1);
  }

  .wrap.hm-sec:not([data-still]) .hm-stage {
    pointer-events: none;
  }

  .wrap.hm-sec :is(.hm-h, .hm-steps) {
    pointer-events: auto;
  }

  .wrap.hm-sec .hm-h {
    left: var(--hm-gutter);
    width: calc(100% - 2 * var(--hm-gutter));
  }

  .wrap.hm-sec .hm-steps {
    position: absolute;
    top: calc(var(--hm-slot, 0) * var(--pin-unit));
    left: var(--hm-gutter);
    right: var(--hm-gutter);
    z-index: 1;
    margin: 0;
  }

  .wrap.hm-sec .hm-step {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(var(--hm-tl-b) * .6) 0 0;
    border-top: calc(var(--stroke) * 4 / 3) solid var(--ink);
    translate: 0 calc(var(--hm-y, 0) * var(--pin-unit));
  }

  .wrap.hm-sec .hm-t {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .wrap.hm-sec :is(.hm-btn, .hm-lab) {
    font-size: var(--hm-fs-name-ph) !important;
    line-height: var(--hm-tl-name-ph) !important;
  }

  .wrap.hm-sec[data-tight] .hm-lab {
    font-size: calc((var(--hm-fs-b) + var(--hm-fs-name-ph)) / 2) !important;
    line-height: var(--hm-tl-ui) !important;
  }

  /* one flush-left column; os-how.js stops each row short of the drops passing it */
  .wrap.hm-sec .hm-lab {
    padding: calc(var(--hm-tl-b) * .6) 0 0;
    white-space: normal;
    width: max-content;
    max-width: calc(var(--hm-lab-w) * var(--pin-unit));
  }

  .wrap.hm-sec .hm-ln {
    padding-bottom: 0;
    white-space: nowrap;
  }

  .wrap.hm-sec .hm-ld {
    padding-top: calc(var(--hm-tl-b) * .1);
    text-wrap: balance;
  }
}

.wrap.hm-sec[data-still] > .hm-track {
  height: auto;
}

.wrap.hm-sec[data-still] .hm-stage {
  position: relative;
  top: auto;
  height: auto;
  padding-inline: var(--hm-gutter);
  overflow: visible;
}

.wrap.hm-sec[data-still] .hm-stage > iframe.os-story {
  display: none;
}

.wrap.hm-sec[data-still] .hm-copy {
  display: block;
  position: static;
  width: auto;
  height: auto;
  padding: 0;
}

.wrap.hm-sec[data-still] .hm-h {
  position: static;
  width: auto;
  margin-bottom: calc(var(--hm-tl-b) * 1.2);
  translate: none;
}

.wrap.hm-sec[data-still] .hm-still {
  position: relative;
  height: calc(var(--hm-h, 0) * var(--pin-unit));
  margin: 0 0 calc(var(--hm-tl-b) * 2);
}

.wrap.hm-sec[data-still] :is(.hm-still > img, .hm-shot) {
  display: block;
  width: 100%;
  height: auto;
}

/* the named still runs into the right gutter, where its fan slides as the live one does */
.wrap.hm-sec[data-still] .hm-still > img {
  width: calc(100% + var(--hm-gutter));
}

.wrap.hm-sec[data-still] .hm-steps {
  position: static;
}

.wrap.hm-sec[data-still] .hm-step {
  position: static;
  margin-bottom: calc(var(--hm-tl-b) * 1.5);
  padding: 0;
  border-top: 0;
  opacity: 1;
  translate: none;
}

.wrap.hm-sec[data-still] .hm-shot {
  margin-bottom: calc(var(--hm-tl-b) * .5);
}

.wrap.hm-sec[data-still] .hm-t {
  padding-top: calc(var(--hm-tl-b) * .6);
  border-top: var(--stroke) solid var(--ink);
}
