/**
 * /features: the sticky phone "stage" (js/tour-story.js), its progress rail, callout and
 * finger-tap ripple, plus small .ph-* helpers used by the static phone screens.
 * Animations are transform/opacity only. The phone screen stays light (it mirrors the app).
 */

/* ---------------------------------------------------------- stage */
.stage {
  --s: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  height: 100%;
}
.stage__device { position: relative; flex: none; }
.stage__box { width: calc(300px * var(--s)); height: calc(633px * var(--s)); }
.stage__scale { width: 300px; height: 633px; transform: scale(var(--s)); transform-origin: 0 0; }
.stage .phone { --phone-w: 300px; }
.stage__screen { contain: layout paint; }
.stage__layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--ui-bg);
  will-change: transform, opacity;
}

/* rail: chapter number + name */
.stage__rail { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); width: 56px; flex: none; }
.stage__ch {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: var(--grad-button); color: #fff; font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.stage__chname {
  max-width: 64px; text-align: center; font-size: 11px; line-height: 1.2;
  font-weight: var(--fw-bold); color: var(--text-muted);
}
/* callout bubble naming the option being shown */
.stage__callout {
  position: absolute;
  right: calc(100% + 18px);
  top: 0;
  z-index: 3;
  width: max-content;
  max-width: 210px;
  margin: 0;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  background: var(--cc-midnight);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  box-shadow: var(--sh-md);
  transform: translateY(calc(var(--cy, 300px) * var(--s) - 50%));
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur);
}
.stage__callout::after {
  content: ''; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px;
  background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 2px;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .stage__callout { background: #fff; color: var(--cc-midnight); }
}
/* manual dark (theme toggle) */
:root[data-theme="dark"] .stage__callout { background: #fff; color: var(--cc-midnight); }

/* mobile stage (one per chapter) */
.chapter-stage .stage { height: auto; gap: var(--sp-2); }
.chapter-stage .stage__device { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.chapter-stage .stage__callout {
  position: static; max-width: min(300px, 80vw); text-align: center; transform: none;
  font-size: var(--fs-xs); padding: 0.45rem 0.75rem;
}
.chapter-stage .stage__callout::after { display: none; }
.chapter-stage .stage__rail { width: 40px; gap: var(--sp-2); }
.chapter-stage .stage__ch { width: 34px; height: 34px; border-radius: 10px; font-size: var(--fs-xs); }
.chapter-stage .stage__chname { display: none; }

/* finger-tap indicator */
.fx-tap {
  position: absolute; left: 0; top: 0; z-index: 20; width: 38px; height: 38px;
  margin: -19px 0 0 -19px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: rgba(106, 77, 245, 0.22); border: 2px solid rgba(106, 77, 245, 0.9);
  box-shadow: 0 0 0 6px rgba(106, 77, 245, 0.12);
}
.fx-tap.is-static { opacity: 0.9; }

/* ---------------------------------------------------------- .ph-* screen helpers */
.ph-pt0 { padding-top: 0 !important; }
.ph-pt4 { padding-top: 4px !important; }
.ph-mt { margin-top: 10px !important; }
.ph-left { text-align: left; }
.ph-i12 { width: 12px !important; height: 12px !important; vertical-align: -2px; }
.ph-layer { position: absolute; inset: 0; z-index: 6; background: var(--ui-bg); opacity: 0; visibility: hidden; }
.ph-fab {
  position: absolute; right: 14px; bottom: 20px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px; padding: 12px 16px; border-radius: 16px;
  background: linear-gradient(120deg, #2e3192, #6a4df5); color: #fff; font-weight: 800; font-size: 12px;
  box-shadow: 0 10px 24px -8px rgba(46, 49, 146, 0.7);
}
.ph-cardwrap { position: absolute; inset: 0; }
.ph-flash { position: absolute; inset: 0; z-index: 8; background: #fff; opacity: 0; pointer-events: none; }
.ph-skip { position: absolute; right: 26px; bottom: 50px; color: #fff; font-size: 11px; font-weight: 700; }
.ph-gallery {
  position: absolute; left: 30px; bottom: 38px; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.18); color: #fff;
}
.ph-manual {
  position: absolute; left: 50%; top: 62%; transform: translateX(-50%); white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  color: #fff; font-size: 11px; font-weight: 700;
}
.ph-sheet { color: var(--ui-text); }
.ph-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph-thumbs span { aspect-ratio: 1.3; border-radius: 8px; background: #e2e8f0; }
.ph-thumbs .is-picked { position: relative; background: #334155; outline: 3px solid #6a4df5; outline-offset: 1px; }
.ph-mini {
  position: absolute; inset: 22% 14%; border-radius: 3px;
  background: linear-gradient(135deg, #fff, #eef2ff);
}
.ph-url {
  display: flex; align-items: center; gap: 6px; margin: 0 10px 6px; padding: 6px 10px;
  border-radius: 999px; background: #e2e8f0; color: #334155; font-size: 11px;
}
.ph-price { display: flex; justify-content: space-between; align-items: baseline; }
.ph-price b { font-size: 18px; font-weight: 800; }
.ph-price small { color: var(--ui-muted); font-size: 10.5px; }
.ph-meter { height: 8px; border-radius: 8px; background: #e2e8f0; overflow: hidden; margin: 6px 0 4px; }
.ph-meter > span { display: block; height: 100%; background: linear-gradient(90deg, #2e3192, #6a4df5); transform-origin: left; }
.ph-tick {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #10b981; color: #fff; flex: none;
}
.ph-tick .ui-icon { width: 14px; height: 14px; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-dd {
  position: absolute; z-index: 5; left: 14px; right: 14px; padding: 4px; border-radius: 12px;
  background: #fff; box-shadow: 0 16px 30px -10px rgba(11, 17, 32, 0.45); color: var(--ui-text);
}
.ph-dd span { display: block; padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.ph-dd .is-on { background: #eef2ff; color: #2e3192; }

@media (prefers-reduced-motion: reduce) {
  .stage__callout { transition: none; }
}
