/* The phone story: a pinned device whose screens open and close with the scroll. */

.sprite { position: absolute; width: 0; height: 0; }

.stage { position: relative; height: 2300svh; }
.mark { position: absolute; left: 0; width: 1px; height: 1px; }

.stage__pin {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: clip;
}

/* iPhone 17 Pro Max in Deep Blue, drawn to scale: 163.4 x 78 x 8.75 mm. */
.device {
  --fit: 1;
  --shift: 0px;
  --enter: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  box-sizing: border-box;
  width: 390px;
  height: 817px;
  margin: -408.5px 0 0 -195px;
  padding: 7px;
  border-radius: 66px;
  transform: translateY(var(--shift)) scale(calc(var(--fit) * var(--enter)));
  will-change: transform, opacity;
}

/* Black glass with a hairline of polished edge around the display. */
.device::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 66px;
  background: #01030B;
  box-shadow: inset 0 0 0 1.5px #4B689E, inset 0 0 0 3px #0E1A36, 0 0 0 2px #1A2C52, 0 0 0 3px #3D5A8E;
}
.device::after {
  content: "";
  position: absolute;
  inset: 34px 22px -30px;
  z-index: -1;
  border-radius: 80px;
  background: rgba(16, 70, 210, .5);
  filter: blur(46px);
}

.key {
  position: absolute;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4A679C, #1B2D54);
}
.key--action { left: -3px; top: 166px; height: 32px; }
.key--up { left: -3px; top: 226px; height: 62px; }
.key--down { left: -3px; top: 300px; height: 62px; }
.key--power { right: -3px; top: 254px; height: 96px; }
.key--capture { right: -3px; top: 468px; height: 66px; border-radius: 3px; background: linear-gradient(90deg, #15264C, #5B79B0); }

/* A band of light that slides over the glass as the phone tilts. */
.sheen {
  position: absolute;
  z-index: 7;
  inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .09) 49%, rgba(255, 255, 255, .02) 55%, transparent 60%);
  pointer-events: none;
}
.device__key {
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: rgba(190, 212, 255, .8);
}
.device__key--a { left: -8px; top: 150px; height: 34px; }
.device__key--b { left: -8px; top: 204px; height: 62px; }
.device__key--c { right: -8px; top: 214px; height: 92px; }

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 59px;
  background: var(--navy);
  isolation: isolate;
}
.wall, .wall-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.wall-shade {
  background: linear-gradient(rgba(3, 10, 44, .34), transparent 22%, rgba(3, 10, 44, .35) 42%, rgba(3, 10, 44, .78) 68%, rgba(3, 10, 44, .12) 80%, rgba(3, 10, 44, .55));
}

.apps { position: absolute; inset: 0; z-index: 5; pointer-events: none; }

.app {
  --content: 0;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  overflow: hidden;
  border-radius: 59px;
  transform-origin: 0 0;
  color: var(--ink-soft);
  background: linear-gradient(170deg, rgba(10, 47, 150, .9), rgba(4, 26, 94, .94) 38%, rgba(2, 10, 48, .97));
  will-change: transform;
}

.app__bar, .app__body { opacity: var(--content); }

.app__bar {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  flex: none;
  padding: 50px 22px 14px;
  font: 500 11px/1 Unbounded, sans-serif;
  color: var(--cyan);
}
.app__bar b { color: var(--ink); font: 600 18px/1 Inter, sans-serif; text-align: center; }
.app__bar i { color: var(--cyan); font-style: normal; }
.app__bar svg { justify-self: end; width: 20px; height: 20px; }

.app__body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.app__scroll { padding: 8px 24px 44px; font-size: 15.5px; line-height: 1.55; }
.app__scroll p + p { margin-top: .8em; }
.app__chapter {
  margin-bottom: 16px;
  font: 500 8.5px/1.5 Unbounded, sans-serif;
  letter-spacing: .08em;
  color: var(--cyan);
}
.app h3 {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -.012em;
}

.stat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-bottom: 12px; }
.stat b {
  font: 500 44px/1.05 Unbounded, sans-serif;
  letter-spacing: -.03em;
  background: linear-gradient(100deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span { color: var(--cyan); font-weight: 500; }

.channels { display: grid; gap: 6px; margin: 12px 0 14px; }
.channels li {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(47, 123, 255, .14);
  font-size: 14.5px;
  line-height: 1.35;
}

.finger {
  position: absolute;
  left: -26px;
  top: -26px;
  z-index: 8;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 50%;
  opacity: 0;
  background: rgba(255, 255, 255, .28);
  box-shadow: 0 0 26px rgba(120, 200, 255, .9);
  pointer-events: none;
}

/* On wide screens the current function is named in the open space beside the phone. */
.side {
  position: absolute;
  left: var(--gutter);
  top: 50%;
  width: min(34vw, 560px);
  opacity: 0;
  transform: translateY(-50%);
  text-shadow: 0 2px 26px rgba(3, 10, 44, .95);
}
.side__chapter { font: 500 clamp(10px, .8vw, 13px)/1.6 Unbounded, sans-serif; letter-spacing: .12em; color: var(--cyan); }
.side__number {
  margin: 14px 0 8px;
  font: 500 clamp(64px, 9vw, 150px)/1 Unbounded, sans-serif;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--cyan);
  filter: drop-shadow(0 0 22px rgba(69, 200, 255, .55));
}
.side__title { font-weight: 600; font-size: clamp(26px, 3vw, 50px); line-height: 1.1; letter-spacing: -.02em; }

@media (orientation: portrait), (max-width: 980px) {
  .side { display: none; }
}

/* Without motion the apps simply stack as readable sections. */
.is-still .stage { height: auto; }
.is-still .stage__pin { position: static; height: auto; overflow: visible; }
.is-still .device { position: static; width: min(100%, 560px); height: auto; margin: auto; padding: 0; transform: none; }
.is-still .device::before, .is-still .device::after { display: none; }
.is-still .key, .is-still .wall, .is-still .wall-shade, .is-still .status, .is-still .home,
.is-still .dash, .is-still .tabbar, .is-still .indicator, .is-still .menu, .is-still .side, .is-still .finger { display: none; }
.is-still .screen { height: auto; overflow: visible; background: none; }
.is-still .apps { position: static; }
.is-still .app { --content: 1; position: static; margin-bottom: 24px; visibility: visible; opacity: 1; }
