.phs {
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 900ms;
  --item-h: 340px;
  --item-w: calc(var(--item-h) * 0.8);
  --bg-rx: 30%;
  --bg-ry: 78%;
  --bg-at: 24% 50%;
  --text-side: right;
  --prod-side: left;
  --glow-size: 1;
  --glow-strength: 100%;
  --base-max-l: 0.5;
  --spin: 1;
  --wheel-base: 0deg;
  position: relative;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  min-height: 600px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  border-radius: 24px;
  color: var(--phs-text, #fff);
  background: #222;
}

.phs-section[dir="ltr"] .phs {
  --spin: -1;
  --wheel-base: 180deg;
  --bg-at: 76% 50%;
  --text-side: left;
  --prod-side: right;
}

.phs__bg {
  --base-safe: var(--base);
  --glow-c: var(--glow);
  --glow-stops: var(--glow-c) 0%, var(--base-safe) 100%;
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse min(calc(var(--bg-rx) * var(--glow-size)), 32%) calc(var(--bg-ry) * var(--glow-size)) at var(--bg-at), var(--glow-stops));
  will-change: opacity;
}
.phs--linear .phs__bg {
  background: linear-gradient(to var(--text-side), var(--glow-stops)) var(--prod-side) / calc(36% * var(--glow-size)) 100% no-repeat var(--base-safe);
}
.phs--solid .phs__bg { background: var(--base-safe); }
@supports (color: color-mix(in oklab, red 50%, blue)) {
  .phs__bg {
    --glow-c: color-mix(in oklab, var(--glow) var(--glow-strength), var(--base-safe));
    --glow-stops:
      var(--glow-c) 0%,
      color-mix(in oklab, var(--glow-c) 80%, var(--base-safe)) 18%,
      color-mix(in oklab, var(--glow-c) 52%, var(--base-safe)) 40%,
      color-mix(in oklab, var(--glow-c) 26%, var(--base-safe)) 60%,
      color-mix(in oklab, var(--glow-c) 9%, var(--base-safe)) 80%,
      var(--base-safe) 100%;
  }
}

.phs__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
  padding: 48px clamp(24px, 5vw, 72px);
}
.phs__brand { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; }
.phs__slides { display: grid; }
.phs__slide {
  --base-ink: var(--base);
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 350ms ease;
}
.phs__slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 450ms ease 250ms;
}
.phs__slide > * { max-width: 100%; transform: translateY(18px); transition: transform 600ms var(--ease); }
.phs__slide.is-active > * { transform: translateY(0); transition-delay: 250ms; }
.phs__slide.is-active > :nth-child(2) { transition-delay: 320ms; }
.phs__slide.is-active > :nth-child(3) { transition-delay: 390ms; }
.phs__slide.is-active > :nth-child(4) { transition-delay: 460ms; }
.phs__slide.is-active > :nth-child(5) { transition-delay: 530ms; }

@supports (color: oklch(from red min(l, 0.5) c h)) {
  .phs__bg { --base-safe: oklch(from var(--base) min(l, var(--base-max-l)) c h); }
  .phs__slide { --base-ink: oklch(from var(--base) min(l, 0.5) c h); }
}

.phs__tag {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  background: color-mix(in srgb, currentColor 16%, transparent);
  font-size: 0.9rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.phs__title { margin: 0; font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.phs__title a { color: inherit; text-decoration: none; }
.phs__desc {
  display: -webkit-box;
  margin: 0;
  max-width: 34ch;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.8;
  opacity: 0.9;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}
.phs__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 4px 0 0; font-size: 1rem; }
.phs__amount { font-size: 2rem; font-weight: 800; }
.phs__old { opacity: 0.7; }
.phs__badge {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  background: color-mix(in srgb, currentColor 16%, transparent);
  font-size: 0.85rem;
  font-weight: 500;
}
.phs__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 8px; }
.phs__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 30px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--base-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.45);
  transition: transform 200ms ease;
}
@layer base {
  .phs .phs__btn[hidden] { display: inline-flex !important; }
}
.phs__btn:hover { transform: translateY(-2px); }
.phs__btn:disabled { cursor: progress; }
.phs__btn svg { width: 20px; height: 20px; }
.phs__link { color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 6px; }

.phs__controls { display: flex; align-items: center; gap: 10px; }
.phs__ctrl {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 200ms ease;
}
.phs__ctrl:hover { background: rgba(255, 255, 255, 0.16); background: color-mix(in srgb, currentColor 16%, transparent); }
.phs__ctrl svg { width: 20px; height: 20px; }
.phs-section[dir="ltr"] .phs__ctrl[data-dir] svg,
.phs-section[dir="ltr"] .phs__toggle .icon-play { transform: scaleX(-1); }
.phs__toggle .icon-play { display: none; }
.phs__toggle.is-paused .icon-play { display: block; }
.phs__toggle.is-paused .icon-pause { display: none; }
.phs__dots {
  display: flex;
  flex: none;
  gap: 6px;
  inline-size: calc(var(--n, 4) * 16px + 12px);
  block-size: 10px;
  margin: 0 6px;
  padding: 0;
  list-style: none;
  contain: size layout;
}
.phs__dot {
  position: relative;
  display: block;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  background: color-mix(in srgb, currentColor 40%, transparent);
  color: inherit;
  cursor: pointer;
}
.phs__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity 300ms ease;
}
.phs__dot[aria-current="true"] { width: 28px; }
.phs__dot[aria-current="true"]::after { opacity: 1; }
.phs__count {
  flex: none;
  inline-size: 7ch;
  block-size: 1.5em;
  margin-inline-start: auto;
  line-height: 1.5em;
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.9;
  contain: size layout;
}
.phs :focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

.phs__stage { position: relative; align-self: stretch; min-height: 600px; touch-action: pan-y; }
.phs__wheel {
  position: absolute;
  left: calc(50% - var(--r, 520px));
  top: 50%;
  width: 0;
  height: 0;
  transform: rotate(0deg);
  transition: transform var(--dur) var(--ease);
  will-change: transform;
}
.phs-section[dir="ltr"] .phs__wheel { left: calc(50% + var(--r, 520px)); }
@supports (width: calc(1px * sin(1deg))) {
  .phs__wheel { --r: calc(348px / sin(var(--step))); }
}
.phs__item {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--item-w);
  height: var(--item-h);
  margin: calc(var(--item-h) / -2) 0 0 calc(var(--item-w) / -2);
  transform: rotate(calc(var(--wheel-base) + var(--spin) * var(--j) * var(--step))) translateX(var(--r, 520px)) rotate(calc(var(--wheel-base) * -1));
  cursor: pointer;
}
.phs__visual {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  transform: scale(0.78);
  transition: transform var(--dur) var(--ease), opacity var(--dur) ease;
  will-change: transform, opacity;
}
.phs__visual--cutout::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 12%;
  right: 12%;
  bottom: -5%;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), transparent);
}
.phs__item.is-active { z-index: 1; }
.phs__item.is-active .phs__visual {
  opacity: 1;
  transform: scale(1);
}
.phs__frame {
  position: absolute;
  inset: 0;
  transform: scale(var(--scale, 1));
  transform-origin: 50% 100%;
}
.phs__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  -webkit-user-drag: none;
  user-select: none;
}
.phs__card {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 10%;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.5);
}
.phs__card img { object-position: 50% 50%; }
.phs__parallax { position: absolute; inset: 0; }

.phs__stage { transform: translateY(0); transition: opacity 1s ease, transform 1.1s var(--ease); }
.phs.is-waiting .phs__stage { opacity: 0; transform: translateY(60px); }
.phs.is-waiting .phs__slide.is-active { opacity: 0; }
.phs.is-waiting .phs__slide.is-active > * { transform: translateY(18px); }

@keyframes phs-parallax {
  from { transform: translateY(40px); }
  to { transform: translateY(-40px); }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .phs__parallax {
      animation: phs-parallax linear both;
      animation-timeline: view();
      animation-range: cover;
    }
  }
}

.phs__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 800px) {
  .phs {
    --item-h: 240px;
    --spin: -1;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .phs-section[dir="ltr"] .phs { --spin: 1; }
  .phs__stage {
    order: -1;
    min-height: 330px;
    overflow: hidden;
    overflow: clip;
    -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent);
    mask-image: linear-gradient(to bottom, #000 88%, transparent);
  }
  .phs__visual { opacity: 0.22; transform: scale(0.66); }
  .phs__bg {
    background:
      linear-gradient(to bottom, transparent 250px, var(--base-safe) 330px),
      radial-gradient(ellipse calc(64% * var(--glow-size)) calc(230px * var(--glow-size)) at 50% 165px, var(--glow-stops));
  }
  .phs--linear .phs__bg {
    background:
      linear-gradient(to bottom, transparent 250px, var(--base-safe) 330px),
      linear-gradient(to bottom, var(--glow-stops)) top / 100% calc(300px * var(--glow-size)) no-repeat var(--base-safe);
  }
  .phs__count { display: none; }
  .phs__wheel,
  .phs-section[dir="ltr"] .phs__wheel { --wheel-base: -90deg; left: 50%; top: calc(50% + var(--r, 320px)); }
  @supports (width: calc(1px * sin(1deg))) {
    .phs__wheel { --r: calc(min(42vw, 190px) / sin(var(--step))); }
  }
  .phs__content { gap: 24px; padding: 4px 20px 28px; }
  .phs__desc { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .phs__stage,
  .phs__wheel,
  .phs__visual,
  .phs__slide,
  .phs__slide > * { transition-duration: 1ms !important; transition-delay: 0s !important; }
}
