/* Decorative menu bars stay separate from the footage and demo controls. */
.desktop-screen {
  --desktop-bar-height: 34px;
  --desktop-bar-inset: 16px;
  --desktop-icon-size: 14px;
  --desktop-icon-gap: 13px;
  --recording-zoom: 1;
  position: relative;
  isolation: isolate;
}
.desktop-menu {
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--desktop-bar-height);
  padding-inline: var(--desktop-bar-inset);
  color: #fffffff2;
  pointer-events: none;
  user-select: none;
}
.desktop-menu__apple, .desktop-menu__icon {
  display: block;
  flex: none;
  width: auto;
  height: var(--desktop-icon-size);
  object-fit: contain;
}
.desktop-menu__status {
  display: flex;
  align-items: center;
  gap: var(--desktop-icon-gap);
}
.desktop-menu__app {
  display: grid;
  place-items: center;
}
.desktop-menu__apple { height: calc(var(--desktop-icon-size) * 1.1); }
.desktop-menu__icon--battery { height: calc(var(--desktop-icon-size) * .8); }
.desktop-screen--video {
  --desktop-bar-height: clamp(28px, 3.3vw, 38px);
  --desktop-bar-inset: clamp(12px, 1.8vw, 24px);
  --desktop-icon-size: clamp(12px, 1.2vw, 16px);
  --desktop-icon-gap: clamp(9px, 1.4vw, 18px);
  --recording-zoom: 1.035;
}
.desktop-screen--compact {
  --desktop-bar-height: 26px;
  --desktop-bar-inset: 12px;
  --desktop-icon-size: 11px;
  --desktop-icon-gap: 10px;
}
.desktop-screen--mini {
  --desktop-bar-height: 17px;
  --desktop-bar-inset: 7px;
  --desktop-icon-size: 8px;
  --desktop-icon-gap: 6px;
}
.desktop-screen--mini .desktop-menu__icon--battery,
.desktop-screen--mini .desktop-menu__icon--volume { display: none; }

/* The source recordings include a menu bar. Crop it out beneath our own. */
.desktop-screen__recording {
  transform: scale(var(--recording-zoom));
  transform-origin: center bottom;
}

/* Expensa's scroll-linked tilt, applied to the video, menu bar and pause control together. */
.video-preview.has-perspective .preview-media {
  transform-origin: center bottom;
  transform: translateY(calc(-24% * (1 - var(--preview-progress, 0))))
    perspective(clamp(900px, 150vw, 1800px))
    rotateX(calc(42deg * (1 - var(--preview-progress, 0))));
  backface-visibility: hidden;
}
.video-preview.is-perspective-active .preview-media { will-change: transform; }

@media (max-width: 440px) {
  .desktop-screen:not(.desktop-screen--mini) {
    --desktop-bar-inset: 12px;
    --desktop-icon-size: 12px;
    --desktop-icon-gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-preview.has-perspective .preview-media { transform: none; will-change: auto; }
}

/* The closing MacBook display rises from behind the footer as the page scrolls. */
.closing-screen {
  --closing-rise: translateY(calc((1 - var(--closing-progress, 1)) * 34%));
  overflow: hidden;
  margin-top: clamp(24px, 4vw, 50px);
  padding-top: 60px;
}
.closing-screen__stage {
  position: relative;
  width: min(1160px, calc(100% - 48px));
  margin-inline: auto;
  transform: var(--closing-rise);
}
.closing-screen.is-rising .closing-screen__stage { will-change: transform; }
.closing-screen__device {
  position: relative;
  padding: 16px 16px 0;
  border: 1px solid #5a6072;
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  background: linear-gradient(#20232e, #0b0d14 60%);
  box-shadow: inset 0 1px 0 #ffffff2e, 0 -8px 36px #0d236940;
}
/* The camera sits in the top bezel. */
.closing-screen__device::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2a3042;
  transform: translateX(-50%);
}
.closing-screen__display {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 16px 16px 0 0;
  background: #30305f;
}
.closing-screen__video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
/* A soft shade keeps the centred text legible over any part of the footage. */
.closing-screen__content {
  position: absolute;
  inset: 17px 17px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 24px;
  background: radial-gradient(ellipse 62% 58% at 50% 52%, #12153f8c, #12153f00 100%);
  text-align: center;
}
.closing-screen__content h2 { margin-bottom: 18px; color: #fff; font-size: clamp(2.4rem, 4.4vw, 3.5rem); }
.closing-screen__content > p:not(.compat) { max-width: 34em; margin: 0 0 26px; color: #fffffff2; }
.closing-screen__content .compat { color: #ffffffd9; }
/* A narrow screen can't hold the text without turning the laptop into a tablet,
   so the words sit on the page and a landscape display rises beneath them. */
@media (max-width: 720px) {
  .closing-screen { padding-top: 0; }
  .closing-screen__stage { display: flex; flex-direction: column-reverse; width: calc(100% - 32px); transform: none; }
  .closing-screen.is-rising .closing-screen__stage { will-change: auto; }
  .closing-screen__device { padding: 8px 8px 0; border-radius: 18px 18px 0 0; transform: translateY(calc((1 - var(--closing-progress, 1)) * 40%)); }
  .closing-screen.is-rising .closing-screen__device { will-change: transform; }
  .closing-screen__device::before { top: 2px; width: 4px; height: 4px; }
  .closing-screen__display {
    --desktop-bar-height: 22px;
    --desktop-bar-inset: 10px;
    --desktop-icon-size: 9px;
    --desktop-icon-gap: 7px;
    aspect-ratio: 16 / 10;
    border-radius: 10px 10px 0 0;
  }
  .closing-screen__content { position: static; padding: 0 0 36px; background: none; }
  .closing-screen__content h2 { color: var(--ink); }
  .closing-screen__content > p:not(.compat), .closing-screen__content .compat { color: var(--muted); }
  .closing-screen__content .compat { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .closing-screen__stage, .closing-screen__device { transform: none; }
}
