/* The phone frame stays still; only the content window moves. */
.phrase-swipe-demo {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 320px;
  color: #f5f0e9;
}

.phrase-swipe-demo__screen {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
}

.phrase-swipe-demo__chrome {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
}

.phrase-swipe-demo__window {
  position: absolute;
  z-index: 1;
  inset: 14.8% 0 auto;
  height: 63.5%;
  overflow: hidden;
  touch-action: pan-y;
  background: #fff;
  cursor: grab;
  user-select: none;
  opacity: 0;
  visibility: hidden;
}

.phrase-swipe-demo__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.phrase-swipe-demo__slide {
  position: absolute;
  inset: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  visibility: hidden;
  transform-origin: 50% 85%;
}

.phrase-swipe-demo__slide.is-current { visibility: visible; z-index: 2; }
.phrase-swipe-demo__slide.is-under { visibility: visible; z-index: 1; }
.phrase-swipe-demo__window.is-dragging { cursor: grabbing; }

.phrase-swipe-demo__slide > img {
  position: absolute;
  top: -23.307%;
  left: 0;
  width: 100%;
  height: auto;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.phrase-swipe-demo__copy {
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 34cqw;
  padding: .3cqw 5% 0;
  color: #171717;
  background: #fff;
  text-align: left;
  font-family: var(--font-rounded);
}

/* Native captures already contain the phrase and translation; keep the live
   copy available to assistive technology without painting a second card. */
.phrase-swipe-demo__copy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.phrase-swipe-demo__phrase,
.phrase-swipe-demo__translation {
  display: block;
  margin: 0;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.phrase-swipe-demo__phrase {
  font-size: clamp(14px, 9cqw, 34px);
  line-height: 1.16;
  font-weight: 900;
}

.phrase-swipe-demo__translation {
  margin-top: 3cqw;
  color: #827b70;
  font-size: clamp(11px, 4.85cqw, 18px);
  line-height: 1.3;
  font-weight: 500;
}

.phrase-swipe-demo__counter {
  position: absolute;
  z-index: 3;
  top: 89.4%;
  left: 35%;
  width: 30%;
  margin: 0;
  height: 5cqw;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #827b70;
  background: #fff;
  font: 400 3.1cqw/1.1 var(--font-rounded);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.phrase-swipe-demo__nav {
  position: absolute;
  z-index: 4;
  top: 87.3%;
  width: 16%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: transparent;
  cursor: pointer;
  visibility: hidden;
}

.phrase-swipe-demo__nav--next { right: 7%; }

.phrase-swipe-demo__nav--prev { left: 7%; }

.phrase-swipe-demo__nav:focus-visible {
  outline: 2px solid #e01822;
  outline-offset: 2px;
}

.phrase-swipe-demo__controls {
  display: none;
  justify-content: center;
  margin-top: .7rem;
}

.phrase-swipe-demo.is-ready .phrase-swipe-demo__window,
.phrase-swipe-demo.is-ready .phrase-swipe-demo__counter,
.phrase-swipe-demo.is-ready .phrase-swipe-demo__nav { opacity: 1; visibility: visible; }
.phrase-swipe-demo.is-ready .phrase-swipe-demo__controls { display: flex; }

.phrase-swipe-demo__toggle {
  min-height: 2rem;
  padding: .35rem .75rem;
  border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
  border-radius: 999px;
  color: inherit;
  background: transparent;
  font: 600 .8rem/1 var(--font-rounded);
  cursor: pointer;
}

.phrase-swipe-demo__toggle:focus-visible {
  outline: 2px solid #e01822;
  outline-offset: 3px;
}

/* The hero already supplies its own phone bezel. Keep the mobile screen cycle. */
.hero-shots .phrase-swipe-demo--hero {
  position: absolute;
  inset: 0;
  max-width: none;
  color: #242020;
  pointer-events: auto;
}

.phrase-swipe-demo--hero .phrase-swipe-demo__screen {
  max-width: none;
  border: 0;
  border-radius: 28px;
  filter: none;
}

.phrase-swipe-demo--hero .phrase-swipe-demo__chrome { border-radius: inherit; }

@media (max-width: 960px) {
  .phrase-swipe-demo--hero .phrase-swipe-demo__screen { border-radius: 22px; }
}

@media (max-width: 560px) {
  .hero-shots .phrase-swipe-demo--hero { display: none; }
}
