/* Match the homepage's one-shot device rotation without replacing layout transforms. */
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .device-tilt-parent { perspective: 1600px; }
  .device-tilt {
    rotate: 2 5 0 -44deg;
    transition: rotate 5.2s cubic-bezier(0.16, 1, 0.3, 1) 0.5s,
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    filter: none !important;
    isolation: auto !important;
  }
  .device-tilt.feature-phone { rotate: 0 1 0 34deg; }
  .device-tilt.feature-ipad { rotate: 2 5 0 -40deg; }
  .device-tilt.is-device-revealed { rotate: 0deg; }
  .device-tilt__slice {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    transform: translateZ(calc(var(--slice) / 24 * -12px));
    background: color-mix(in srgb, #4b5468, #090c12 calc(var(--slice) / 24 * 100%));
  }
  .feature-ipad > .device-tilt__slice {
    background: color-mix(in srgb, #9aa2b6, #171b24 calc(var(--slice) / 24 * 100%));
  }
}

/* Landing-page devices retain a visible edge after the entrance finishes. */
.campaign-main .device-tilt-parent { perspective: 1600px; }
.campaign-main .device-tilt {
  --device-rest-angle: -24deg;
  --device-depth: 22px;
  rotate: 1 4 0 var(--device-rest-angle);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  filter: none !important;
  isolation: auto !important;
}
.campaign-main .device-tilt.feature-phone {
  --device-rest-angle: 24deg;
  --device-depth: 14px;
}
.campaign-main .device-tilt.feature-ipad {
  --device-rest-angle: -20deg;
  --device-depth: 12px;
}
.campaign-main .device-tilt.is-device-revealed {
  rotate: 1 4 0 var(--device-rest-angle);
}
.campaign-main .device-tilt__slice {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  transform: translateZ(calc(var(--slice) / 24 * var(--device-depth) * -1));
  background: color-mix(in srgb, #7d879c, #10141e calc(var(--slice) / 24 * 100%));
  border: 1px solid rgba(170, 187, 215, 0.12);
}
.campaign-main .feature-ipad > .device-tilt__slice {
  background: color-mix(in srgb, #adb7ca, #303744 calc(var(--slice) / 24 * 100%));
}
.campaign-main .device-tilt::after {
  /* A faint glass highlight follows the existing rounded front bezel. */
  background: linear-gradient(115deg, rgba(222, 235, 255, 0.07), transparent 30%, transparent 75%, rgba(166, 189, 230, 0.03));
}
@media (max-width: 900px) {
  .campaign-main .device-tilt { --device-rest-angle: -16deg; --device-depth: 16px; }
  .campaign-main .device-tilt.feature-phone { --device-rest-angle: 18deg; }
  .campaign-main .device-tilt.feature-ipad { --device-rest-angle: -14deg; }
}
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .campaign-main .device-tilt:not(.is-device-revealed) { rotate: 2 5 0 -44deg; }
  .campaign-main .device-tilt.feature-phone:not(.is-device-revealed) { rotate: 0 1 0 34deg; }
}
@media (prefers-reduced-motion: reduce) {
  .campaign-main .device-tilt { transition: none; }
}

/* Quick Missions uses the hero phone shell, scaled to fit its section. */
.campaign-main .feature-quick__phone {
  --workflow-phone-height: 430px;
  --device-depth: calc(var(--workflow-phone-height) * 0.032353);
  transform: rotate(2.5deg);
}
.feature-quick__phone .phone-mock__screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 900px) {
  .campaign-main .feature-quick__phone {
    --workflow-phone-height: min(680px, calc(100vw * 0.72 * 19.5 / 9));
  }
}

/* Hardware keys use rounded capsule shells with front and rear faces.
   Keep every wrapper in the same 3D context as its chassis. */
.phone-shell-buttons,
.phone-shell-buttons__rail,
.feature-phone__buttons,
.feature-phone__rail {
  transform-style: preserve-3d;
  overflow: visible;
}
.device-key.device-key {
  --key-depth: 7px;
  --key-radius: calc(var(--key-depth) / 2);
  transform-style: preserve-3d;
  translate: 0 0 -2px;
  overflow: visible;
  background: none;
  border: 0;
  box-shadow: none;
  filter: none;
  pointer-events: none;
}
.device-key.device-key::before,
.device-key.device-key::after { content: none; }
.device-key__face {
  position: absolute;
  display: block;
  box-sizing: border-box;
  pointer-events: none;
  backface-visibility: visible;
  background: linear-gradient(110deg, #cbd3de, #8390a3 38%, #49566b);
}
.device-key__face--front,
.device-key__face--back {
  inset: var(--key-radius) 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 0.5px rgba(224, 233, 246, 0.45);
}
.device-key__face--back {
  transform: translateZ(calc(-1 * var(--key-depth)));
  background: #485366;
}
/* Closely spaced rounded cross-sections retain the capsule silhouette from
   oblique angles without the square corners of perpendicular rectangular walls. */
.device-key__shell {
  position: absolute;
  display: block;
  top: 0;
  left: calc(var(--key-layer) * 100%);
  width: var(--key-depth);
  height: 100%;
  border-radius: 999px;
  transform-origin: left center;
  transform: rotateY(90deg);
  background: linear-gradient(90deg, #bdc8d7, #768499 28%, #4b586c 82%, #323e50);
  pointer-events: none;
  backface-visibility: visible;
}
.device-key--horizontal > .device-key__shell {
  top: calc(var(--key-layer) * 100%);
  left: 0;
  width: 100%;
  height: var(--key-depth);
  transform-origin: center top;
  transform: rotateX(-90deg);
  background: linear-gradient(#cbd5e2, #8290a5 28%, #4b586c 82%, #323e50);
}
.device-key--horizontal > .device-key__face {
  inset: 0 var(--key-radius);
}

/* Symmetric galleries (2026-10-12): side-by-side phones mirror each other
   instead of all resting at the same angle. The last phone in a 2- or 3-phone
   gallery is the mirror image of the first (rotation axis and angle both
   reflected across the vertical plane), and the middle phone of three sits
   square-on. Desktop only: phones and reduced-motion stay flat (above). */
.campaign-main :is(.subject-shots__grid, .ap-exam__shots) > :last-child:not(:first-child) .device-tilt,
.campaign-main :is(.subject-shots__grid, .ap-exam__shots) > :last-child:not(:first-child) .device-tilt.is-device-revealed {
  rotate: -1 4 0 calc(var(--device-rest-angle) * -1);
}
.campaign-main :is(.subject-shots__grid, .ap-exam__shots) > :nth-child(2):nth-last-child(2) .device-tilt,
.campaign-main :is(.subject-shots__grid, .ap-exam__shots) > :nth-child(2):nth-last-child(2) .device-tilt.is-device-revealed {
  rotate: 0deg;
}
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .campaign-main :is(.subject-shots__grid, .ap-exam__shots) > :last-child:not(:first-child) .device-tilt:not(.is-device-revealed) {
    rotate: -2 5 0 44deg;
  }
}
