/* ==========================================================================
   Product page — Block 04: setup in 3 steps (plug in, scan, done).
   One strip with three cards; each card animates its step in turn (progress
   bar on top). Plays ONCE, the first time the strip scrolls into view, and
   then stays on the finished state.
   Everything runs on one clock: every animation below uses --cycle and the
   percentages line up: step 1 = 0–30%, step 2 = 30–60%, step 3 = 60–100%.
   ========================================================================== */

.psetup {
  --cycle: 8s;
  padding: 96px var(--gutter);
  background: var(--c-ink);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.psetup__inner { max-width: 1160px; margin: 0 auto; }

.psetup__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 36px;
}

.psetup__head .eyebrow { color: var(--c-accent); }
.psetup__head .display { font-size: clamp(44px, 5.5vw, 80px); }
.psetup__head .display em { font-style: normal; color: var(--c-accent); }

.psetup__text { max-width: 36ch; margin: 0; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, 0.65); }

/* ---------- strip ---------- */

.psetup__strip {
  position: relative;
  padding: 22px 12px 12px;
  border-radius: 24px;
  background: #121212;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* progress bar across the top of the strip */
.psetup__bar {
  position: absolute;
  top: 10px;
  left: 24px;
  right: 24px;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.psetup__bar span {
  display: block;
  height: 100%;
  background: var(--c-accent);
  transform-origin: left;
  transform: scaleX(0);
  animation: ps-bar var(--cycle) linear;
}

@keyframes ps-bar {
  0% { transform: scaleX(0); }
  30% { transform: scaleX(0.3333); }
  60% { transform: scaleX(0.6667); }
  72%, 100% { transform: scaleX(1); }
}

.psetup__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- step card ---------- */

.ps-step {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #181818;
}

/* volt outline while it's this step's turn */
.ps-step::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--c-accent);
  opacity: 0;
  pointer-events: none;
}

.ps-step--1::after { animation: ps-on1 var(--cycle); }
.ps-step--2::after { animation: ps-on2 var(--cycle); }
.ps-step--3::after { animation: ps-on3 var(--cycle); }

@keyframes ps-on1 { 0%, 29% { opacity: 1; } 31%, 100% { opacity: 0; } }
@keyframes ps-on2 { 0%, 29% { opacity: 0; } 31%, 59% { opacity: 1; } 61%, 100% { opacity: 0; } }
@keyframes ps-on3 { 0%, 59% { opacity: 0; } 61%, 100% { opacity: 1; } }

/* illustration area */
.ps-art {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #242322;              /* plain wall, one flat colour */
}

.ps-copy { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; padding: 18px 20px 22px; }

.ps-num {
  grid-row: 1 / 3;
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 0.9;
  color: var(--c-accent);
}

.ps-copy h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

.ps-copy p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.6); }

/* ---------- the LED panel (steps 1 + 3) ---------- */

.ps-panel {
  position: absolute;
  top: 30.6%;
  left: 12%;
  width: 58%;
  aspect-ratio: 2 / 1;
  padding: 3%;
  border-radius: 8px;
  background: #0e0e0e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 14px 30px rgba(0, 0, 0, 0.5);
}

.ps-step--3 .ps-panel { left: 18%; width: 64%; top: 29%; }

.ps-screen {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: radial-gradient(circle, #202020 0 0.8px, transparent 1.1px) 0 0 / 2.5px 2.5px, #000;
  font-family: "Silkscreen", var(--font-mono);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

/* dot-matrix mask over the screen text */
.ps-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 0 0.9px, #000 1.25px) 0 0 / 2.5px 2.5px;
  pointer-events: none;
}

/* power port */
.ps-port {
  position: absolute;
  top: 50%;
  right: -3px;
  width: 4px;
  height: 10px;
  border-radius: 1px;
  background: #2a2a2a;
  transform: translateY(-50%);
}


/* ---------- step 1: plug in (cable from the panel into the wall socket) ---------- */

.ps-socket {
  position: absolute;
  top: 43.3%;
  left: 81%;
  width: 10%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22%;
  border-radius: 4px;
  background: linear-gradient(180deg, #ecece8 0%, #cfcfca 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* the two slots */
.ps-socket i { width: 9%; height: 34%; border-radius: 1px; background: #2a2a2a; }

/* cable: starts at the panel's port, grows as the plug moves to the socket */
.ps-cable {
  position: absolute;
  top: 50%;
  left: 70%;
  width: 3%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: #111;
  animation: ps-cable var(--cycle) var(--ease);
}

.ps-plughead {
  position: absolute;
  top: 50%;
  left: 73%;
  width: 16px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, #1c1c1c 0%, #080808 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 3px 6px rgba(0, 0, 0, 0.6);
  transform: translate(-30%, -50%);
  animation: ps-plughead var(--cycle) var(--ease);
}

@keyframes ps-cable {
  0%, 5% { width: 3%; }
  13%, 100% { width: 13%; }
}

@keyframes ps-plughead {
  0%, 5% { left: 73%; }
  13%, 100% { left: 83%; }
}

.ps-boot {
  font-size: clamp(12px, 1.6vw, 18px);
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: ps-boot var(--cycle);
}

@keyframes ps-boot {
  0%, 16% { opacity: 0; }
  17% { opacity: 1; } 18% { opacity: 0.3; } 19%, 100% { opacity: 1; }
}

/* ---------- step 2: scan the code ---------- */

.ps-phone {
  position: absolute;
  top: 12.6%;
  left: 36%;
  width: 28%;
  aspect-ratio: 9 / 18;
  padding: 3.5%;
  border-radius: 16px;
  background: #0d0d0d;
  box-shadow: inset 0 0 0 2px #333, 0 16px 34px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(40%);
  animation: ps-phone var(--cycle) var(--ease);
}

@keyframes ps-phone {
  0%, 30% { opacity: 0; transform: translateY(40%); }
  36%, 100% { opacity: 1; transform: none; }
}

.ps-phone__screen {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: #1b1b1b;
}

/* camera viewfinder corners */
.ps-viewfinder {
  position: relative;
  width: 78%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background:
    linear-gradient(var(--c-accent), var(--c-accent)) 0 0 / 14px 2px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 0 0 / 2px 14px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 100% 0 / 14px 2px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 100% 0 / 2px 14px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 0 100% / 14px 2px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 0 100% / 2px 14px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 100% 100% / 14px 2px no-repeat,
    linear-gradient(var(--c-accent), var(--c-accent)) 100% 100% / 2px 14px no-repeat;
}

.ps-qr { width: 76%; height: auto; padding: 6%; border-radius: 3px; background: #fff; color: #0a0a0a; }

/* scan line sweeping down */
.ps-scanline {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 8%;
  height: 2px;
  background: var(--c-accent);
  box-shadow: 0 0 10px var(--c-accent);
  opacity: 0;
  animation: ps-scan var(--cycle) linear;
}

@keyframes ps-scan {
  0%, 37% { top: 8%; opacity: 0; }
  38% { top: 8%; opacity: 1; }
  45% { top: 90%; opacity: 1; }
  52% { top: 8%; opacity: 1; }
  53%, 100% { top: 8%; opacity: 0; }
}

/* scanned: volt check over the code */
.ps-scanned {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 10, 0.75);
  opacity: 0;
  animation: ps-scanned var(--cycle);
}

.ps-scanned span {
  display: grid;
  place-items: center;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

.ps-scanned svg { width: 55%; height: 55%; }

@keyframes ps-scanned {
  0%, 53% { opacity: 0; transform: scale(0.8); }
  56%, 100% { opacity: 1; transform: none; }
}

/* ---------- step 3: done, live ---------- */

.ps-live {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10%;
  width: 100%;
  opacity: 0;
  animation: ps-live var(--cycle);
}

.ps-live__top { font-size: clamp(8px, 0.9vw, 11px); color: #bbb; }
.ps-live__score { display: flex; align-items: center; gap: 0.5em; font-size: clamp(14px, 1.9vw, 22px); color: #fff; }
.ps-live__score b { font-weight: 700; color: var(--team); text-shadow: 0 0 8px var(--team); }
.ps-live__score i { font-style: normal; text-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }

@keyframes ps-live {
  0%, 61% { opacity: 0; }
  62% { opacity: 1; } 63% { opacity: 0.3; } 64%, 100% { opacity: 1; }
}

/* "You're live" badge */
.ps-badge {
  position: absolute;
  top: 10%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) scale(0.6);
  animation: ps-badge var(--cycle) var(--ease);
}

.ps-badge svg { width: 13px; height: 13px; }

@keyframes ps-badge {
  0%, 67% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  71%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ---------- play once, when it first comes on screen (class set by pdp-setup.js) ---------- */

.psetup *,
.psetup *::before,
.psetup *::after { animation-play-state: paused; animation-iteration-count: 1 !important; animation-fill-mode: both !important; }

.psetup.is-on *,
.psetup.is-on *::before,
.psetup.is-on *::after { animation-play-state: running; }

/* ---------- responsive ---------- */

@media (max-width: 800px) {
  .psetup { padding: 64px var(--gutter); }
  .psetup__head { margin-bottom: 24px; }
  .psetup__steps { grid-template-columns: 1fr; }
  .ps-step { display: grid; grid-template-columns: 44% 1fr; align-items: center; }
  .ps-copy { padding: 14px 16px; grid-template-columns: 1fr; }
  .ps-num { grid-row: auto; font-size: 28px; margin-bottom: 6px; }
  .ps-copy h3 { font-size: 20px; }
  .ps-copy p { font-size: 13px; }
  .ps-boot { font-size: 11px; }
  .ps-live__top { font-size: 6px; }
  .ps-live__score { font-size: 10px; gap: 0.35em; }
  .ps-phone { border-radius: 10px; }
  .ps-phone__screen { border-radius: 6px; }
  .ps-badge { font-size: 9px; padding: 4px 8px; }
}

/* reduced motion: no animation, every card shows its finished state */
@media (prefers-reduced-motion: reduce) {
  .psetup *, .psetup *::before, .psetup *::after { animation: none !important; }
  .psetup__bar span { transform: none; }
  .ps-cable { width: 13%; }
  .ps-plughead { left: 83%; }
  .ps-boot, .ps-phone, .ps-scanned, .ps-live { opacity: 1; transform: none; }
  .ps-badge { opacity: 1; transform: translateX(-50%); }
}
