@property --glass-tone {
  syntax: "<color>";
  inherits: true;
  initial-value: #d4dfe7;
}

.flight-sequence {
  --intro-width: clamp(350px, 41vw, 560px);
  --intro-font-size: calc(var(--intro-width) * .09);
}

.showcase {
  --glass-tone: #d4dfe7;
  --showcase-sheen: 255 255 255;
  --content-top: calc(var(--header-top) + var(--header-height) + 16px);
  --content-bottom: max(clamp(20px, 4svh, 56px), env(safe-area-inset-bottom));
  position: relative;
  box-sizing: border-box;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(176px, 28%) minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: center;
  gap: 12px clamp(16px, 2vw, 40px);
  padding: var(--content-top) var(--content-left) var(--content-bottom);
  overflow: clip;
  background: var(--flight-page);
  color: var(--showcase-ink, #1d1d1f);
}

.showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 78% 90% at 88% 70%, color-mix(in srgb, var(--glass-tone) 62%, transparent), transparent 74%),
    radial-gradient(ellipse 52% 70% at 19% 45%, color-mix(in srgb, var(--glass-tone) 36%, transparent), transparent 72%),
    linear-gradient(120deg, rgb(var(--showcase-sheen) / .55),
      rgb(var(--showcase-sheen) / .2) 55%, rgb(var(--showcase-sheen) / .45));
}

.showcase:has([data-device="iphone-duo"][aria-pressed="true"]) { --glass-tone: #d9e2dd; }
.showcase:has([data-device="ipad"][aria-pressed="true"]) { --glass-tone: #dfe4d8; }
.showcase:has([data-device="macbook"][aria-pressed="true"]) { --glass-tone: #dcdce8; }

@media (prefers-color-scheme: dark) {
  :root { --showcase-ink: #f0f2f6; }
  .showcase {
    color-scheme: dark;
    --glass-tone: #222e3b;
    --showcase-sheen: 26 29 38;
    --device-blur-strength: .26;
    --showcase-focus: #aac4ed;
    --playback-fill: #4f6076;
    --playback-divider: rgb(198 211 228 / .12);
    --selection-background: #c6d3e4;
    --selection-text: #161a21;
  }
  .showcase:has([data-device="iphone-duo"][aria-pressed="true"]) { --glass-tone: #23312e; }
  .showcase:has([data-device="ipad"][aria-pressed="true"]) { --glass-tone: #2d3028; }
  .showcase:has([data-device="macbook"][aria-pressed="true"]) { --glass-tone: #292637; }
}

.showcase-intro {
  position: relative;
  z-index: 1;
  width: var(--intro-width);
  container-type: inline-size;
  transform: translateY(-2svh);
}

.flight-playback {
  --playback-size: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(28px, 4svh, 48px);
}

.flight-segments {
  --track-inset: 2px;
  --track-cap: calc(var(--playback-size) / 2 - var(--track-inset) - var(--contact-edge-width));
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  flex: 1;
  min-width: 0;
  height: var(--playback-size);
  box-sizing: border-box;
  padding: var(--track-inset);
  gap: 1px;
  border-radius: 999px;
}

.flight-segment {
  --roundness: 0;
  --remaining: 100%;
  --cap: calc(var(--track-cap) * var(--roundness));
  --cap-start: var(--cap);
  --cap-end: var(--cap);
  --fill-shape: inset(0 var(--remaining) 0 0 round var(--cap-start) var(--cap-end) var(--cap-end) var(--cap-start));
  position: relative;
  overflow: hidden;
  color: inherit;
}
.flight-segment + .flight-segment { border-inline-start: 1px solid var(--playback-divider, rgb(103 90 81 / .09)); }
.flight-scrubber {
  position: absolute;
  z-index: 2;
  inset: var(--track-inset);
  width: calc(100% - 2 * var(--track-inset));
  height: calc(100% - 2 * var(--track-inset));
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  opacity: 0;
  cursor: grab;
  touch-action: none;
}
.flight-scrubber::-webkit-slider-thumb { -webkit-appearance: none; width: 0; height: calc(2 * var(--track-cap)); }
.flight-scrubber::-moz-range-thumb { width: 0; height: calc(2 * var(--track-cap)); border: 0; }
.flight-segments[data-scrubbing] .flight-scrubber { cursor: grabbing; }
.flight-segments:has(.flight-scrubber:focus-visible) { outline: 2px solid currentColor; outline-offset: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .flight-segments {
    scale: 1;
    transition: scale 900ms linear(0, .029 1%, .124 2.2%, .901 9%, 1.042 11.3%, 1.086 12.6%, 1.108 13.9%, 1.114 15.1%, 1.108 16.4%, 1.014 23.8%, .996 26.2%, .988 28.9%, 1.001 43.8%, 1);
  }
  .flight-segments[data-scrubbing] { scale: .96; }
}
.flight-segment:first-of-type { border-radius: var(--track-cap) 0 0 var(--track-cap); --cap-start: var(--track-cap); }
.flight-segment:last-of-type { border-radius: 0 var(--track-cap) var(--track-cap) 0; --cap-end: var(--track-cap); }
.flight-segment::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--playback-fill, #000);
  clip-path: var(--fill-shape);
}
.flight-segment-label {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: clamp(11px, .92vw, 14px);
  font-weight: 650;
  line-height: 1;
}
.flight-segment-label svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: currentColor;
}
.flight-plane-icon { scale: 1.2; }
.flight-segment-label[data-filled] { color: #fff; clip-path: var(--fill-shape); }
.flight-playback-action {
  position: relative;
  flex: none;
  width: var(--playback-size);
  height: var(--playback-size);
}
.flight-playback-toggle {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: none;
  width: var(--playback-size);
  height: var(--playback-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.flight-playback-toggle svg { position: relative; grid-area: 1 / 1; width: 21px; height: 21px; fill: currentColor; }
.flight-playback-toggle .playback-pause,
.flight-playback-toggle[data-playing] .playback-play { display: none; }
.flight-playback-toggle[data-playing] .playback-pause { display: block; }
.flight-playback-toggle:disabled { cursor: default; }
.flight-playback-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

@keyframes playback-shell-reveal {
  from { opacity: 0; filter: blur(4px); translate: 0 6px; }
  to { opacity: 1; filter: none; translate: 0 0; }
}

@keyframes playback-segment-reveal {
  from { opacity: 0; filter: blur(3px); translate: 0 5px; }
  to { opacity: 1; filter: none; translate: 0 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .showcase-copy[data-type-ready]:not([data-visible]) + .flight-playback { visibility: hidden; }
  .showcase-copy[data-visible] + .flight-playback .flight-segments {
    animation: playback-shell-reveal 1100ms var(--button-press) 80ms backwards;
  }
  .showcase-copy[data-visible] + .flight-playback .flight-segment {
    animation: playback-segment-reveal 1100ms var(--button-press) 170ms backwards;
  }
  .showcase-copy[data-visible] + .flight-playback .flight-segment:nth-of-type(2) { animation-delay: 260ms; }
  .showcase-copy[data-visible] + .flight-playback .flight-segment:nth-of-type(3) { animation-delay: 350ms; }
  .showcase-copy[data-visible] + .flight-playback .flight-segment:nth-of-type(4) { animation-delay: 440ms; }
  .showcase-copy[data-visible] + .flight-playback .flight-segment:nth-of-type(5) { animation-delay: 530ms; }
  .showcase-copy[data-visible] + .flight-playback .flight-segment:nth-of-type(6) { animation-delay: 620ms; }
  .showcase-copy[data-visible] + .flight-playback .flight-playback-action {
    animation: playback-shell-reveal 1100ms var(--button-press) 530ms backwards;
  }
}

.showcase-copy {
  width: 100%;
  margin: 0;
  font-size: var(--intro-font-size);
  font-weight: 450;
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.showcase-copy strong {
  font-weight: 700;
  white-space: nowrap;
}

.showcase-stage {
  --orbit-ease: linear(0, .013 1%, .051 2.2%, .404 9.8%, .51 12.6%, .602 15.5%, .683 18.7%, .754 22.2%, .813 26%, .861 30.2%, .9 34.8%, .931 40%, .972 52.7%, .992 70.2%, 1);
  position: absolute;
  inset: var(--content-top) var(--content-left) var(--content-bottom);
  container-type: size;
  isolation: isolate;
}

.showcase-copy {
  position: relative;
  z-index: 1;
}

.device-wave, .device-orbit { position: absolute; inset: 0; }

.device-orbit-item {
  position: absolute;
  inset: 0 auto auto 0;
  width: min(var(--device-width), calc(var(--device-height) * var(--device-ratio)));
  aspect-ratio: var(--device-ratio);
  transform-origin: center;
  cursor: pointer;
  touch-action: manipulation;
}

.device-orbit-item[data-device="iphone"] { --device-width: 48cqw; --device-height: 92cqh; }
.device-orbit-item[data-device="iphone-duo"] { --device-width: 57cqw; --device-height: 90cqh; }
.device-orbit-item[data-device="ipad"] { --device-width: 62cqw; --device-height: 86cqh; }
.device-orbit-item[data-device="macbook"] { --device-width: 64cqw; --device-height: 84cqh; }

@media (min-width: 701px) {
  .device-orbit-item { max-width: var(--front-width, 100%); }
}

.device-orbit-item::before,
.device-orbit-item::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  translate: -50% 0;
  pointer-events: none;
  opacity: var(--device-sharp, 1);
}

.device-orbit-item::before {
  bottom: -12%;
  width: 174%;
  height: 42%;
  background: radial-gradient(ellipse at 50% 62%,
    rgb(var(--showcase-sheen) / .76),
    color-mix(in srgb, var(--glass-tone) 42%, transparent) 34%,
    color-mix(in srgb, var(--glass-tone) 16%, transparent) 52%,
    transparent 72%);
}

.device-orbit-item::after {
  bottom: -7%;
  width: 142%;
  height: 15%;
  background:
    radial-gradient(ellipse 33% 13% at 50% 49%, rgb(103 122 142 / .09), transparent 100%),
    radial-gradient(ellipse 48% 35% at 50% 55%, rgb(var(--showcase-sheen) / .92),
      rgb(var(--showcase-sheen) / .38) 45%, transparent 100%);
}

.device-orbit-media {
  position: absolute;
  inset: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .device-orbit-media {
    animation: device-float 5.5s var(--orbit-ease) infinite alternate;
    animation-play-state: paused;
  }
  .showcase-stage[data-playing] .device-orbit-item[data-front] .device-orbit-media { animation-play-state: running; }
}

@keyframes device-float {
  from { transform: translateY(4px) rotate(-.18deg); }
  to { transform: translateY(-5px) rotate(.18deg); }
}

.device-orbit-item img,
.device-orbit-item video {
  position: absolute;
  display: block;
  width: var(--canvas-width);
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  left: var(--canvas-left);
  top: var(--canvas-top);
  pointer-events: none;
}

.device-orbit-sharp {
  position: absolute;
  inset: 0;
  isolation: isolate;
  opacity: var(--device-sharp, 1);
}
/* Blend inside a single sharp layer so the device stays opaque during handoff. */
.device-orbit-poster,
.device-orbit-sharp > video { mix-blend-mode: plus-lighter; }
.device-orbit-poster,
.device-orbit-item video { opacity: 1; }
.device-orbit-blur {
  opacity: calc((1 - var(--device-sharp, 1)) * var(--device-blur-strength, 1));
  /* The blurred poster still has visible alpha along the export's top and bottom. */
  mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent);
}
.device-orbit-sharp:has(video:not([data-buffering])) .device-orbit-poster { opacity: 0; }
.showcase-stage video[data-buffering] { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .device-orbit-poster,
  .device-orbit-sharp > video { transition: opacity 650ms var(--orbit-ease); }
}

.showcase-devices {
  position: absolute;
  z-index: 2;
  inset-inline-end: max(12px, calc(var(--content-left) - 38px));
  inset-block: 5% 0;
  height: max-content;
  margin-block: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}


.showcase-devices button {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.flight-playback-action:not([data-liquid]) button::before {
  content: "";
  position: absolute;
  inset: 0;
  border: var(--contact-border);
  border-radius: inherit;
  background: var(--contact-background);
}

.showcase-devices button svg:not(.aqua-button-surface) {
  position: relative;
  width: 22px;
  height: 22px;
  transform-box: border-box;
  transform-origin: center;
  scale: var(--device-scale, 1);
}

.showcase-devices button svg:not(.aqua-button-surface) {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.showcase-devices button[aria-pressed="true"] { --device-selection: 1; color: #fff; }
.showcase-devices :is(.aqua-button-surface, .device-liquid) {
  filter: drop-shadow(0 1.25px 0 var(--aqua-shadow, rgb(104 119 139 / .16)));
}
.showcase-devices[data-liquid] .aqua-button-surface { display: none; }
/* The liquid shape supplies the hover and press motion. */
.showcase-devices[data-liquid] .aqua-button { scale: 1; }

.showcase-devices[data-liquid] button { touch-action: none; -webkit-user-select: none; user-select: none; }
.showcase-devices[data-liquid] button svg:not(.aqua-button-surface) { scale: none; transition: none; }

.showcase-devices[data-liquid] button {
  color: color-mix(in srgb, #fff var(--device-icon-fill, 0%), var(--showcase-ink, #1d1d1f));
}
.showcase-devices button:focus-visible { outline: 2px solid var(--showcase-focus, #376598); outline-offset: 3px; }

.device-liquid {
  display: none;
  position: absolute;
  z-index: 0;
  inset: -64px;
  width: calc(100% + 128px);
  height: calc(100% + 128px);
  overflow: visible;
  pointer-events: none;
}

.showcase-devices .device-liquid, .flight-playback-action[data-liquid] .device-liquid { display: block; }
.flight-playback-action[data-liquid] button { touch-action: none; -webkit-user-select: none; user-select: none; }

@media (prefers-reduced-motion: no-preference) {
  .showcase { transition: --glass-tone 1100ms var(--button-release); }
}

@media (max-width: 700px) {
  .flight-sequence {
    --showcase-gutter: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
    --intro-width: min(520px, calc(100vw - 2 * var(--showcase-gutter)));
    --intro-font-size: calc(var(--intro-width) * .0892);
  }
  .showcase {
    height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    padding-inline: var(--showcase-gutter);
  }

  .showcase-intro {
    max-width: 100%;
    transform: none;
    display: grid;
    justify-items: center;
  }
  .flight-playback { width: 100%; gap: 8px; margin-top: 22px; }
  .flight-segment-label { font-size: 11px; gap: 3px; }
  .flight-segment-label svg { width: 13px; height: 13px; }

  .showcase-copy { text-align: left; }

  .showcase-stage {
    position: relative;
    inset: auto;
    width: 100%;
    height: min(100%, 650px);
  }
  .device-orbit-item[data-device="iphone"] { --device-width: 82cqw; --device-height: 94cqh; }
  .device-orbit-item[data-device="iphone-duo"] { --device-width: 88cqw; --device-height: 90cqh; }
  .device-orbit-item[data-device="ipad"] { --device-width: 94cqw; --device-height: 86cqh; }
  .device-orbit-item[data-device="macbook"] { --device-width: 96cqw; --device-height: 82cqh; }
  .showcase-devices {
    position: relative;
    inset: auto;
    margin-block: 0;
    flex-direction: row;
  }
}

@media (prefers-reduced-motion: reduce) {
}

@media (max-width: 700px) and (max-height: 500px) and (orientation: landscape) {
  .flight-sequence { --intro-font-size: min(calc(var(--intro-width) * .0892), 8dvh); }
}

@container (max-width: 600px) {
  .flight-segment-label { flex-direction: column; gap: 2px; font-size: 10px; }
  .flight-segment-label svg { width: 14px; height: 14px; }
}

@media (max-width: 360px) {
  .flight-playback { display: grid; justify-items: center; gap: 6px; }
  .flight-segments { width: 100%; }
}
