/* ───────────────────────────────────────────────────────────────────────────
   Skindra Landing — animated product demos ("Scan. Versteh. Pflege.")
   One phone loops through three product moments (scan → ingredient check →
   plan). Three switchable presentation TYPES share that phone:
     · keynote — centered phone, calm gradient stage, minimal caption
     · float   — tilted phone, UI elements float out with parallax depth
     · story   — split layout, chapters highlight in sync with the phone
   Phase is driven by JS toggling [data-phase] on .demos; CSS handles all the
   easing. Autoplay + seamless loop; full static fallback under reduced-motion.
   ─────────────────────────────────────────────────────────────────────────── */

.demos {
  --demo-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --demo-helpful: var(--sk-status-helpful);
  --demo-neutral: #b98f3e;
  --demo-meiden: var(--sk-status-irritating);
  padding-top: 0;
}
.demos .wrap { position: relative; }

/* ── Section head ──────────────────────────────────────────────────────────── */
.demo-head { text-align: center; max-width: 640px; margin: 0 auto; }

/* ── Stage ─────────────────────────────────────────────────────────────────── */
.demo-stage {
  position: relative;
  margin: clamp(28px, 5vw, 52px) auto 0;
  width: 100%;
  max-width: 1040px;
  min-height: 600px;
  border-radius: var(--sk-radius-xl, 32px);
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 50% 6%, #fff 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(168deg, #f7eef0 0%, #faf4ef 52%, #f3e7e4 100%);
  box-shadow: var(--sk-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
/* soft drifting light blobs for depth */
.demo-stage::before,
.demo-stage::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
.demo-stage::before {
  width: 340px; height: 340px;
  top: -60px; left: -40px;
  background: radial-gradient(circle, rgba(184, 92, 74, 0.22), transparent 70%);
  animation: blobA 16s var(--demo-ease) infinite;
}
.demo-stage::after {
  width: 300px; height: 300px;
  bottom: -70px; right: -30px;
  background: radial-gradient(circle, rgba(155, 79, 106, 0.2), transparent 70%);
  animation: blobB 19s var(--demo-ease) infinite;
}
@keyframes blobA { 50% { transform: translate(40px, 30px) scale(1.12); } }
@keyframes blobB { 50% { transform: translate(-34px, -26px) scale(1.1); } }

/* ── The phone (reuses the .device bezel from screens.css) ─────────────────── */
.demo-phone {
  position: relative;
  z-index: 2;
  transition: transform 900ms var(--demo-ease);
  will-change: transform;
}
.demo-phone .device { --dev-w: clamp(248px, 30vw, 300px); }

/* the three product screens, stacked */
.demo-screens { position: absolute; inset: 0; }
.demo-scr {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px 14px;
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition: opacity 640ms var(--demo-ease), transform 640ms var(--demo-ease);
  pointer-events: none;
}
.demos[data-phase="scan"]  .demo-scr[data-scr="scan"],
.demos[data-phase="check"] .demo-scr[data-scr="check"],
.demos[data-phase="plan"]  .demo-scr[data-scr="plan"] {
  opacity: 1;
  transform: none;
}
/* outgoing screens drift the other way for a soft cross-dissolve */
.demos[data-phase="check"] .demo-scr[data-scr="scan"],
.demos[data-phase="plan"]  .demo-scr[data-scr="check"] {
  transform: translateY(-12px) scale(0.985);
}

.demo-scr .scr-status {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--sk-text-primary);
  padding: 13px 8px 10px;
}
.demo-scr .scr-status .sig { display: inline-flex; gap: 4px; font-size: 13px; }
.demo-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── SCREEN 1 · Scan ───────────────────────────────────────────────────────── */
.dscan { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.dscan-view {
  position: relative;
  flex: 1;
  border-radius: 22px;
  background:
    radial-gradient(80% 60% at 50% 38%, #fff 0%, #f4ece7 100%);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(44, 31, 26, 0.05);
}
.dscan-bottle {
  font-size: 92px;
  color: var(--sk-primary);
  opacity: 0.92;
  filter: drop-shadow(0 14px 22px rgba(184, 92, 74, 0.22));
}
.dscan-corners i {
  position: absolute;
  width: 26px; height: 26px;
  border: 2.5px solid var(--sk-primary);
}
.dscan-corners i:nth-child(1) { top: 18px; left: 18px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.dscan-corners i:nth-child(2) { top: 18px; right: 18px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.dscan-corners i:nth-child(3) { bottom: 18px; left: 18px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.dscan-corners i:nth-child(4) { bottom: 18px; right: 18px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.dscan-beam {
  position: absolute;
  left: 10px; right: 10px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(180deg, transparent, rgba(184, 92, 74, 0.32), transparent);
  box-shadow: 0 0 14px 2px rgba(184, 92, 74, 0.28);
  top: 8%;
}
.dscan-barcode {
  position: absolute;
  bottom: 30px;
  left: 50%; transform: translateX(-50%);
  width: 92px; height: 30px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--sk-text-primary) 0 2px, transparent 2px 5px, var(--sk-text-primary) 5px 6px, transparent 6px 9px);
  opacity: 0.5;
}
.dscan-meta { text-align: center; padding-bottom: 4px; }
.dscan-brand { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--sk-text-tertiary); }
.dscan-name { font-family: var(--sk-font-heading); font-weight: 600; font-size: 17px; color: var(--sk-text-primary); margin: 2px 0 9px; }
.dscan-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--sk-primary);
  background: var(--sk-status-irritating-bg);
  padding: 7px 14px; border-radius: var(--sk-radius-full);
}
.dspin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(184, 92, 74, 0.3);
  border-top-color: var(--sk-primary);
  animation: dspin 0.8s linear infinite;
}
@keyframes dspin { to { transform: rotate(360deg); } }
.dscan-beam { animation: beamSweep 2.5s ease-in-out infinite; }
@keyframes beamSweep { 0%, 100% { top: 8%; } 50% { top: 76%; } }

/* ── SCREEN 2 · Ingredient check ──────────────────────────────────────────── */
.dcheck { flex: 1; display: flex; flex-direction: column; gap: 11px; padding-top: 4px; }
.dverdict {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 20px;
  background: var(--sk-status-helpful-bg);
}
.dring {
  --p: 82;
  position: relative;
  width: 66px; height: 66px; flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--demo-helpful) calc(var(--p) * 1%), rgba(90, 138, 94, 0.18) 0);
  display: grid; place-items: center;
}
.dring::after {
  content: ""; position: absolute; inset: 7px;
  background: var(--sk-surface); border-radius: 50%;
}
.dring b {
  position: relative; z-index: 1;
  font-family: var(--sk-font-heading); font-weight: 600; font-size: 23px;
  color: var(--demo-helpful);
}
.dverdict-txt { display: flex; flex-direction: column; }
.dverdict-txt b { font-family: var(--sk-font-heading); font-weight: 600; font-size: 19px; color: var(--demo-helpful); }
.dverdict-txt span { font-size: 12.5px; color: var(--sk-text-secondary); margin-top: 1px; }

.ding-group {
  background: var(--sk-surface);
  border-radius: 16px;
  padding: 12px 13px;
  box-shadow: var(--sk-shadow-sm);
}
.ding-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ding-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ding-head .lbl { font-weight: 700; font-size: 12.5px; }
.ding-head .n { margin-left: auto; font-weight: 700; font-size: 12.5px; }
.ding-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ding-chips .chip {
  font-size: 11.5px; font-weight: 600;
  padding: 5px 11px; border-radius: var(--sk-radius-full);
}
.chip.helpful { background: var(--sk-status-helpful-bg); color: var(--demo-helpful); }
.chip.neutral { background: var(--sk-status-neutral-bg); color: var(--demo-neutral); }
.chip.meiden  { background: var(--sk-status-irritating-bg); color: var(--demo-meiden); }

/* stagger the verdict + groups in when the check phase is active */
.demo-scr[data-scr="check"] > .dcheck > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity 560ms var(--demo-ease), transform 560ms var(--demo-ease);
}
.demos[data-phase="check"] .demo-scr[data-scr="check"] > .dcheck > * { opacity: 1; transform: none; }
.demos[data-phase="check"] .demo-scr[data-scr="check"] > .dcheck > :nth-child(1) { transition-delay: 120ms; }
.demos[data-phase="check"] .demo-scr[data-scr="check"] > .dcheck > :nth-child(2) { transition-delay: 260ms; }
.demos[data-phase="check"] .demo-scr[data-scr="check"] > .dcheck > :nth-child(3) { transition-delay: 380ms; }
.demos[data-phase="check"] .demo-scr[data-scr="check"] > .dcheck > :nth-child(4) { transition-delay: 500ms; }
/* a soft pulse on the verdict ring as it lands */
.demos[data-phase="check"] .demo-scr[data-scr="check"] .dverdict { animation: verdictPulse 1100ms var(--demo-ease) 360ms; }
@keyframes verdictPulse {
  0% { box-shadow: 0 0 0 0 rgba(90, 138, 94, 0); }
  35% { box-shadow: 0 0 0 8px rgba(90, 138, 94, 0.16); }
  100% { box-shadow: 0 0 0 0 rgba(90, 138, 94, 0); }
}

/* ── SCREEN 3 · Plan ───────────────────────────────────────────────────────── */
.dplan { flex: 1; display: flex; flex-direction: column; gap: 11px; padding-top: 4px; }
.dplan-card {
  background: var(--sk-surface); border-radius: 18px; padding: 14px;
  box-shadow: var(--sk-shadow-sm);
}
.dplan-title { font-family: var(--sk-font-heading); font-weight: 600; font-size: 18px; color: var(--sk-text-primary); }
.dplan-meta { display: flex; align-items: center; gap: 8px; margin: 7px 0 0; }
.dplan-meta .rating-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--sk-radius-full); background: var(--sk-status-neutral-bg); color: var(--demo-neutral); }
.dplan-meta .pdate { font-size: 11.5px; color: var(--sk-text-tertiary); }
.dplan-goal { display: flex; gap: 8px; align-items: flex-start; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--sk-border-subtle); }
.dplan-goal ion-icon { color: var(--sk-primary); font-size: 15px; margin-top: 1px; flex: none; }
.dplan-goal p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--sk-text-secondary); }
.dstep {
  display: flex; gap: 11px; align-items: center;
  background: var(--sk-surface); border-radius: 16px; padding: 12px 13px;
  box-shadow: var(--sk-shadow-sm);
}
.dstep-num {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: var(--sk-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.dstep-img { width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--sk-surface-subtle); display: grid; place-items: center; }
.dstep-img ion-icon { font-size: 18px; color: var(--sk-text-tertiary); }
.dstep-info { flex: 1; min-width: 0; overflow: hidden; }
.dstep-name { display: block; font-weight: 600; font-size: 13px; color: var(--sk-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dstep-pills { display: flex; gap: 5px; margin-top: 4px; }
.dstep-pills .ppill { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: var(--sk-radius-full); background: var(--sk-surface-subtle); color: var(--sk-text-secondary); display: inline-flex; align-items: center; gap: 3px; }
.dstep-pills .ppill ion-icon { font-size: 10px; }
.demo-scr[data-scr="plan"] > .dplan > * { opacity: 0; transform: translateY(16px); transition: opacity 540ms var(--demo-ease), transform 540ms var(--demo-ease); }
.demos[data-phase="plan"] .demo-scr[data-scr="plan"] > .dplan > * { opacity: 1; transform: none; }
.demos[data-phase="plan"] .demo-scr[data-scr="plan"] > .dplan > :nth-child(1) { transition-delay: 100ms; }
.demos[data-phase="plan"] .demo-scr[data-scr="plan"] > .dplan > :nth-child(2) { transition-delay: 240ms; }
.demos[data-phase="plan"] .demo-scr[data-scr="plan"] > .dplan > :nth-child(3) { transition-delay: 360ms; }

/* ════════════════════════════════════════════════════════════════════════════
   TYPE · FLOAT (only active type)
   ════════════════════════════════════════════════════════════════════════════ */
.demo-phone { transform: rotateY(-16deg) rotateX(6deg) rotateZ(-2deg); animation: floatyTilt 8s ease-in-out infinite; }
@keyframes floatyTilt {
  0%, 100% { transform: rotateY(-16deg) rotateX(6deg) rotateZ(-2deg) translateY(0); }
  50% { transform: rotateY(-13deg) rotateX(5deg) rotateZ(-2deg) translateY(-12px); }
}
.demo-stage { perspective: 1400px; }
.demo-floaters { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.float-card {
  position: absolute;
  background: var(--sk-surface);
  border-radius: 16px;
  box-shadow: var(--sk-shadow-lg, 0 24px 50px -18px rgba(44, 31, 26, 0.32));
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  opacity: 0;
  transition: opacity 600ms var(--demo-ease), transform 700ms var(--demo-ease);
}
.float-card .fc-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.float-card .fc-txt b { display: block; font-size: 13px; font-weight: 700; color: var(--sk-text-primary); line-height: 1.1; }
.float-card .fc-txt span { font-size: 11px; color: var(--sk-text-secondary); }
.float-ring {
  position: absolute;
  width: 92px; height: 92px; border-radius: 50%;
  background: conic-gradient(var(--demo-helpful) 82%, rgba(90, 138, 94, 0.16) 0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--sk-shadow-lg, 0 24px 50px -18px rgba(44, 31, 26, 0.32));
  opacity: 0;
  transition: opacity 600ms var(--demo-ease), transform 700ms var(--demo-ease);
}
.float-ring::after { content: ""; position: absolute; inset: 9px; background: var(--sk-surface); border-radius: 50%; }
.float-ring b { position: relative; z-index: 1; font-family: var(--sk-font-heading); font-weight: 600; font-size: 30px; color: var(--demo-helpful); }
.float-ring small { position: relative; z-index: 1; font-size: 10px; font-weight: 700; color: var(--demo-helpful); margin-top: -2px; }
/* resting positions (around the tilted phone) + a slow parallax drift */
.float-card[data-f="1"] { top: 14%; left: 6%; }
.float-card[data-f="2"] { top: 50%; left: 1%; }
.float-card[data-f="3"] { bottom: 13%; right: 7%; }
.float-ring          { top: 16%; right: 7%; }
.float-card,
.float-ring { opacity: 1; }
.float-card[data-f="1"] { animation: drift1 9s ease-in-out infinite; }
.float-card[data-f="2"] { animation: drift2 11s ease-in-out infinite; }
.float-card[data-f="3"] { animation: drift3 10s ease-in-out infinite; }
.float-ring { animation: drift2 12s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(8px, -16px); } }
@keyframes drift2 { 50% { transform: translate(-10px, -12px); } }
@keyframes drift3 { 50% { transform: translate(6px, 14px); } }

/* ── Reduced motion: freeze on the most informative frame, no loops ─────────── */
@media (prefers-reduced-motion: reduce) {
  .demo-stage::before, .demo-stage::after,
  .demo-phone, .dscan-beam, .dspin,
  .float-card, .float-ring, .demo-caption .cap { animation: none !important; }
  .demos .demo-scr { transition: none; }
}
