.cv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 5rem);
}

.cv-layout > * { min-inline-size: 0; }
.cv-layout[data-cv-phone-left] > .cv-stage { order: -1; }

.cv-stage {
  --cv-width: 286px;
  --cv-ease: var(--ax-ease, cubic-bezier(.16, 1, .3, 1));
  display: grid;
  place-items: center;
  min-inline-size: 0;
  padding: 1rem clamp(.75rem, 3vw, 2.25rem) 1.5rem;
  perspective: 1000px;
}

.cv-reveal {
  inline-size: min(100%, var(--cv-width));
  transform-style: preserve-3d;
}

[data-cv-ready]:not([data-cv-entered]):not([data-cv-static]) .cv-reveal {
  opacity: 0;
  transform: translateY(28px) rotateX(9deg) rotateY(-13deg) rotateZ(-4deg);
}

[data-cv-ready][data-cv-entered]:not([data-cv-static]) .cv-reveal {
  animation: cv-enter .88s var(--cv-ease) both;
  animation-play-state: var(--cv-play-state, paused);
}

[data-cv-running] .cv-reveal { --cv-play-state: running; }

@keyframes cv-enter {
  from { opacity: 0; transform: translateY(28px) rotateX(9deg) rotateY(-13deg) rotateZ(-4deg); }
  to { opacity: 1; transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0); }
}

.cv-device {
  --cv-radius: clamp(1.65rem, 4vw, 2.6rem);
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  aspect-ratio: 390 / 780;
  padding: 7px;
  border: 1px solid #858890;
  border-radius: var(--cv-radius);
  background: linear-gradient(138deg, #bbc0c6 0%, #2e3035 12%, #14161a 42%, #666b74 79%, #17181b 100%);
  box-shadow: inset 0 0 0 2px #181a1e, 0 30px 44px -20px #05070eb8, 0 8px 16px #06070a36;
  transform: rotateX(var(--cv-rx, 0deg)) rotateY(var(--cv-ry, 0deg));
  transition: transform .35s var(--cv-ease);
}

.cv-device::before,
.cv-device::after {
  position: absolute;
  z-index: -1;
  inline-size: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #53565d, #202228);
  content: "";
}

.cv-device::before { inset: 21% auto 67% -3px; }
.cv-device::after { inset: 27% -3px 64% auto; }

.cv-screen {
  position: relative;
  block-size: 100%;
  overflow: hidden;
  border-radius: max(1.2rem, calc(var(--cv-radius) - 7px));
  color: #171818;
  background: #f7f7f5;
  container-type: inline-size;
}

.cv-screen::before,
.cv-screen::after {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  content: "";
}

.cv-screen::before {
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(132deg, #fff4, transparent 22%, transparent 81%, #fff1);
  box-shadow: inset 0 0 0 1px #13131355;
}

.cv-screen::after {
  inset: auto 32% 1.4%;
  block-size: 3px;
  border-radius: 99px;
  background: #767773;
}

.cv-island {
  position: absolute;
  z-index: 5;
  inset-block-start: 1.6%;
  inset-inline-start: 50%;
  inline-size: 29%;
  block-size: 3.5%;
  border-radius: 99px;
  background: #101115;
  transform: translateX(-50%);
}

.cv-island::after {
  position: absolute;
  inset: 28% 10% 28% auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #393e66, #111321 62%);
  content: "";
}

.cv-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
  scroll-behavior: auto;
}

.cv-page { position: relative; min-block-size: 100%; }
.cv-image { display: block; inline-size: 100%; block-size: auto; }
.cv-screen [hidden], [data-cv-pause][hidden] { display: none !important; }

.cv-finger {
  --cv-touch-size: clamp(18px, 8cqw, 27px);
  position: absolute;
  z-index: 6;
  inset: 0 auto auto 0;
  inline-size: var(--cv-touch-size);
  block-size: var(--cv-touch-size);
  border: 1px solid #fff9;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff9, #c3f1d94d 70%);
  box-shadow: 0 0 0 1px #20372a5c, 0 2px 8px #0c231738;
  opacity: var(--cv-finger-opacity, 0);
  pointer-events: none;
  transform: translate3d(var(--cv-x, 0px), var(--cv-y, 0px), 0) translate(-50%, -50%) scale(var(--cv-press, 1));
}

.cv-finger::after {
  position: absolute;
  inset: -1px;
  border: 1.5px solid #f4fff0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px #1e38257a;
  opacity: var(--cv-wave-opacity, 0);
  transform: scale(var(--cv-wave, 1));
  content: "";
}

.cv-screen [data-cv-pressed] { filter: brightness(.9); }

@media (max-width: 47.99rem) {
  .cv-layout { grid-template-columns: minmax(0, 1fr); }
  .cv-layout[data-cv-phone-left] > .cv-stage { order: 0; }
  .cv-stage { --cv-width: 244px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-cv] .cv-reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .cv-device { transform: none; transition: none; }
  .cv-finger { display: none; }
}
