/* VendoPulse - animated product setup section (landing page)
   Data comes from setup-guide.json, which the publish step copies from the POS.
   The section is progressive: without JavaScript the step list still reads as a guide. */

.setup-section {
  --setup-accent: var(--green, #1f6b4d);
  --setup-accent-soft: var(--mint, #e8f4eb);
  --setup-line: var(--line, #dce9df);
  --setup-ink: var(--ink, #17342d);
  --setup-muted: var(--muted, #657971);
  padding-block: clamp(64px, 7vw, 104px);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(44, 138, 99, .10), transparent 62%),
    radial-gradient(900px 480px at 92% 8%, rgba(255, 240, 229, .85), transparent 60%),
    var(--paper, #f7faf6);
  border-top: 1px solid var(--setup-line);
  border-bottom: 1px solid var(--setup-line);
}

.setup-wrap {
  max-width: var(--content, 1120px);
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 34px);
  display: grid;
  gap: clamp(30px, 4vw, 52px);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 960px) {
  .setup-wrap { grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); }
}

/* ---------- headings ---------- */
.setup-eyebrow {
  margin: 0 0 10px;
  font: 700 12px/1 var(--display, sans-serif);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--setup-accent);
}
.setup-title {
  margin: 0 0 14px;
  font: 800 clamp(28px, 3.4vw, 42px)/1.12 var(--display, sans-serif);
  letter-spacing: -.022em;
  color: var(--setup-ink);
  max-width: 16ch;
}
.setup-lead {
  margin: 0 0 24px;
  font-size: clamp(15px, 1.1vw, 16.5px);
  line-height: 1.65;
  color: var(--setup-muted);
  max-width: 52ch;
}

/* ---------- step list ---------- */
.setup-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.setup-step {
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, .58);
  transition: border-color .25s ease, background .25s ease, transform .25s ease, box-shadow .25s ease;
}
.setup-step[hidden] { display: none; }
.setup-step.is-active {
  border-color: #b9dcca;
  background: #fff;
  box-shadow: 0 14px 34px rgba(23, 52, 45, .08);
  transform: translateX(3px);
}
.setup-step-btn {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 13px;
  width: 100%;
  padding: 13px 15px;
  border: 0;
  border-radius: 14px;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.setup-step-btn:focus-visible {
  outline: 3px solid var(--setup-accent);
  outline-offset: 2px;
}
.setup-step-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--setup-accent-soft);
  color: var(--setup-accent);
  font: 800 14px/1 var(--display, sans-serif);
  transition: background .25s ease, color .25s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.setup-step.is-active .setup-step-num {
  background: var(--setup-accent);
  color: #fff;
  transform: scale(1.06);
}
.setup-step-body { min-width: 0; }
.setup-step-title {
  display: block;
  font: 700 15.5px/1.3 var(--display, sans-serif);
  color: var(--setup-ink);
}
.setup-step-detail {
  display: block;
  margin-top: 4px;
  font-size: 13.6px;
  line-height: 1.6;
  color: var(--setup-muted);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .35s ease, opacity .3s ease, margin-top .35s ease;
}
.setup-step.is-active .setup-step-detail { max-height: 220px; opacity: 1; }
.setup-step-screen {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--setup-accent-soft);
  color: var(--setup-accent);
  font: 700 11px/1.6 var(--body, sans-serif);
  letter-spacing: .04em;
}

/* ---------- animated stage ---------- */
.setup-stage {
  position: relative;
  border: 1px solid var(--setup-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 26px 64px rgba(23, 52, 45, .10);
  overflow: hidden;
}
.setup-window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--setup-line);
  background: linear-gradient(180deg, #fbfdfb, #f3f8f4);
}
.setup-window-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d7e6db;
}
.setup-window-bar i:nth-child(1) { background: #f0a58a; }
.setup-window-bar i:nth-child(2) { background: #f0cf8a; }
.setup-window-bar i:nth-child(3) { background: #9ccfb0; }
.setup-window-label {
  margin-left: 8px;
  font: 700 11.5px/1 var(--body, sans-serif);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--setup-muted);
}
.setup-window-version {
  margin-left: auto;
  font: 600 11px/1 var(--body, sans-serif);
  color: #8aa096;
}

.setup-shot {
  position: relative;
  min-height: 330px;
  padding: 22px;
  display: grid;
  gap: 14px;
  align-content: start;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .45s ease, transform .45s ease;
}
.setup-shot.is-active { opacity: 1; transform: none; }

.setup-shot[hidden] { display: none; }

.setup-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--setup-line);
  border-radius: 12px;
  background: #fcfefc;
}
.setup-row .setup-row-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--setup-accent-soft);
  color: var(--setup-accent);
  font-size: 14px;
}
.setup-row strong { display: block; font: 700 13.5px/1.3 var(--body, sans-serif); color: var(--setup-ink); }
.setup-row small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--setup-muted); }
.setup-row .setup-row-tail { margin-left: auto; font: 700 12px/1 var(--body, sans-serif); color: var(--setup-accent); white-space: nowrap; }

.setup-fields { display: grid; gap: 9px; }
.setup-field {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border: 1px solid var(--setup-line);
  border-radius: 11px;
  background: #fff;
}
.setup-field span { font: 600 11.5px/1 var(--body, sans-serif); letter-spacing: .05em; text-transform: uppercase; color: #8aa096; }
.setup-field b { font: 600 13.5px/1.3 var(--body, sans-serif); color: var(--setup-ink); font-weight: 600; }
.setup-field .setup-caret {
  display: inline-block;
  width: 1.5px;
  height: 13px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--setup-accent);
  animation: setup-blink 1.05s steps(2, start) infinite;
}

.setup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.setup-tile {
  padding: 13px 10px;
  border: 1px solid var(--setup-line);
  border-radius: 11px;
  background: #fff;
  text-align: center;
  opacity: 0;
  transform: translateY(8px) scale(.97);
}
.setup-tile b { display: block; font: 700 12.5px/1.2 var(--body, sans-serif); color: var(--setup-ink); }
.setup-tile small { display: block; margin-top: 3px; font-size: 11px; color: var(--setup-muted); }
.setup-tile.is-in { animation: setup-pop .42s cubic-bezier(.34, 1.4, .64, 1) forwards; }

.setup-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-radius: 13px;
  background: var(--setup-ink);
  color: #fff;
}
.setup-total span { font: 600 12px/1 var(--body, sans-serif); letter-spacing: .09em; text-transform: uppercase; opacity: .72; }
.setup-total b { font: 800 26px/1 var(--display, sans-serif); }

.setup-progress {
  height: 5px;
  border-radius: 999px;
  background: #e8f1ea;
  overflow: hidden;
}
.setup-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--setup-accent), #37a37a);
  transition: width .55s cubic-bezier(.4, 0, .2, 1);
}

.setup-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--setup-muted);
}
.setup-note .setup-tick {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--setup-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

/* ---------- autoplay control ---------- */
.setup-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--setup-line);
  background: #fbfdfb;
}
.setup-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid #cce0d2;
  border-radius: 999px;
  background: #fff;
  color: var(--setup-accent);
  font: 700 12.5px/1 var(--body, sans-serif);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.setup-play:hover { background: var(--setup-accent); color: #fff; border-color: var(--setup-accent); }
.setup-play:focus-visible { outline: 3px solid var(--setup-accent); outline-offset: 2px; }
.setup-play[hidden] { display: none; }
.setup-meta {
  font-size: 12px;
  color: var(--setup-muted);
}
.setup-meta b { color: var(--setup-ink); }

/* ---------- continuous motion: the register keeps working between steps ---------- */
.setup-shot.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 38%, rgba(44, 138, 99, .07) 50%, transparent 62%);
  background-size: 260% 100%;
  animation: setup-sweep 4.2s linear infinite;
}
.setup-shot { position: relative; overflow: hidden; }
.setup-step.is-active .setup-step-btn::after {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 8px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--setup-accent), rgba(44, 138, 99, 0));
  animation: setup-underline 2.6s ease-in-out infinite;
}
.setup-step-btn { position: relative; }
@keyframes setup-sweep {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}
@keyframes setup-underline {
  0%, 100% { opacity: .18; transform: scaleX(.35); transform-origin: left; }
  50% { opacity: .9; transform: scaleX(1); transform-origin: left; }
}

/* ---------- entrance animations (only while the section is in view) ---------- */
.setup-step.is-active .setup-step-num { animation: setup-pulse 2.4s ease-in-out infinite; }
.setup-shot.is-active .setup-row { animation: setup-rise .5s cubic-bezier(.3, .9, .3, 1) backwards; }
.setup-shot.is-active .setup-row:nth-child(1) { animation-delay: .04s; }
.setup-shot.is-active .setup-row:nth-child(2) { animation-delay: .12s; }
.setup-shot.is-active .setup-row:nth-child(3) { animation-delay: .2s; }
.setup-shot.is-active .setup-row:nth-child(4) { animation-delay: .28s; }
.setup-shot.is-active .setup-field { animation: setup-rise .45s cubic-bezier(.3, .9, .3, 1) backwards; }
.setup-shot.is-active .setup-field:nth-child(1) { animation-delay: .06s; }
.setup-shot.is-active .setup-field:nth-child(2) { animation-delay: .16s; }
.setup-shot.is-active .setup-field:nth-child(3) { animation-delay: .26s; }
.setup-shot.is-active .setup-total { animation: setup-rise .5s cubic-bezier(.3, .9, .3, 1) .18s backwards; }
.setup-shot.is-active .setup-note { animation: setup-rise .45s cubic-bezier(.3, .9, .3, 1) .34s backwards; }

@keyframes setup-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes setup-pop {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes setup-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes setup-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 107, 77, .28); }
  50% { box-shadow: 0 0 0 7px rgba(31, 107, 77, 0); }
}

/* ---------- reduced motion: keep the content, drop the movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .setup-shot,
  .setup-step,
  .setup-step-detail,
  .setup-progress i,
  .setup-tile,
  .setup-step-num,
  .setup-shot.is-active::after,
  .setup-step.is-active .setup-step-btn::after {
    animation: none !important;
    transition: none !important;
  }
  .setup-tile { opacity: 1; transform: none; }
  .setup-step-detail { max-height: 220px; opacity: 1; }
  .setup-shot.is-active::after { display: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .setup-shot { min-height: 300px; padding: 16px; }
  .setup-grid { grid-template-columns: repeat(2, 1fr); }
  .setup-field { grid-template-columns: 72px 1fr; }
  .setup-total b { font-size: 22px; }
}
