/* =========================================================
   Visual components for Problem, Privacy and Rules sections
   ========================================================= */

/* ---------- Shared: silhouette as a CSS mask (no faces) ---------- */
:root {
  --sil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 100'%3E%3Ccircle cx='20' cy='11' r='8.5'/%3E%3Cpath d='M7 27 Q20 19 33 27 L37 58 L31 60 L29 98 L22 98 L20 66 L18 98 L11 98 L9 60 L3 58 Z'/%3E%3C/svg%3E");
}

/* =========================================================
   1. PROBLEM: three screens every owner knows
   ========================================================= */
.problem-points li { flex-direction: column; gap: 1.1rem; }
.vign {
  position: relative; block-size: 236px; inline-size: 100%;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
}

/* Camera wall */
.vign-cams { background: var(--device); border-color: var(--device); padding: 8px; }
.cams-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; block-size: 100%; }
.cams-grid i {
  border-radius: 4px; background: url("../assets/store-cam.webp") var(--bx) var(--by) / 340% no-repeat;
  filter: saturate(0.7) brightness(0.85);
  animation: cam-flicker 4.2s steps(1) 1; animation-delay: calc(var(--bx) / 10% * -0.37s);
}
@keyframes cam-flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.55; } 49% { opacity: 1; } 83% { opacity: 0.8; } }
.cams-timer {
  position: absolute; inset-block-end: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap;
  padding: 0.3rem 0.8rem; border-radius: 999px; background: rgba(20, 22, 27, 0.88); color: #fff;
  font-size: 0.8125rem; font-weight: 500; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
}
.cams-timer b { font-family: var(--font-mono); font-weight: 500; color: #FFB4AE; }

/* Chat */
.vign-chat { background: #ECE7DF; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-top { display: flex; align-items: center; gap: 0.5rem; margin-inline: -12px; padding: 0.55rem 0.8rem; background: #F7F5F2; border-block-end: 1px solid rgba(0, 0, 0, 0.06); font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.chat-avatar { inline-size: 26px; block-size: 26px; border-radius: 50%; display: grid; place-items: center; background: #C9D7F2; color: #253B6E; font-size: 0.75rem; }
.wa { position: relative; max-inline-size: 78%; padding: 0.45rem 0.7rem 0.95rem; border-radius: 10px; font-size: 0.875rem; line-height: 1.35; color: #1B1F24; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); }
.wa time { position: absolute; inset-block-end: 3px; inset-inline-end: 8px; font-size: 0.6875rem; color: #6B7280; }
.wa-out { align-self: flex-end; background: #D9FDD3; border-end-end-radius: 3px; }
.wa-in { align-self: flex-start; background: #fff; border-end-start-radius: 3px; }
.wa-note { margin-block-start: auto; display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.65rem; border-radius: 8px; background: rgba(255, 255, 255, 0.75); font-size: 0.8125rem; font-weight: 600; color: var(--danger-text); }
.wa-note i { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--fail); flex: none; }

/* POS summary */
.vign-pos { background: #fff; padding: 12px 16px; display: grid; align-content: start; gap: 0.25rem; }
.pos-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 0.875rem; padding-block-end: 0.45rem; border-block-end: 1px dashed var(--line-strong); }
.pos-head .ti { color: var(--muted); font-size: 1.1rem; }
.pos-row { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--muted); }
.pos-row b { color: var(--text); font-weight: 600; }
.pos-missing { margin-block-start: 0.5rem; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1.5px dashed var(--fail); background: #FEF3F2; font-size: 0.8125rem; color: var(--danger-text); }
.pos-missing b { display: block; }

/* Sequenced entrance once the column is revealed */
.js .vign-chat .wa, .js .vign-chat .wa-note, .js .vign-pos .pos-missing, .js .cams-timer { opacity: 0; transform: translateY(6px); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); }
.js .vign-cams .cams-timer { transform: translate(-50%, 6px); }
.js .is-in .vign-chat .wa-out { opacity: 1; transform: none; transition-delay: 300ms; }
.js .is-in .vign-chat .wa-in { opacity: 1; transform: none; transition-delay: 1100ms; }
.js .is-in .vign-chat .wa-note { opacity: 1; transform: none; transition-delay: 2100ms; }
.js .is-in .vign-pos .pos-missing { opacity: 1; transform: none; transition-delay: 1200ms; }
.js .is-in .cams-timer { opacity: 1; transform: translate(-50%, 0); transition-delay: 500ms; }

/* =========================================================
   2. PRIVACY: the image shrinks into one line of text
   ========================================================= */
.sv { --p: 1; }
.sv { --b: clamp(0, calc((var(--p) - 0.3) / 0.2), 1); --s: clamp(0, calc((var(--p) - 0.6) / 0.18), 1); --e: clamp(0, calc((var(--p) - 0.74) / 0.16), 1); }
.sv-steps { list-style: none; padding: 0; display: flex; gap: 0.4rem; inline-size: 100%; margin-block-end: 0.9rem; counter-reset: svs; }
.sv-steps li {
  flex: 1; display: flex; align-items: center; gap: 0.4rem; justify-content: center; text-align: center;
  padding: 0.45rem 0.5rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: var(--subtle);
  background: var(--bg); border: 1px solid var(--line); transition: color 250ms ease, border-color 250ms ease, background-color 250ms ease;
  counter-increment: svs;
}
.sv-steps li::before { content: counter(svs); display: grid; place-items: center; inline-size: 1.25rem; block-size: 1.25rem; border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.6875rem; flex: none; }
.sv[data-active="1"] .sv-steps [data-step="1"], .sv[data-active="2"] .sv-steps [data-step="2"], .sv[data-active="3"] .sv-steps [data-step="3"] { color: var(--brand-ink); border-color: var(--brand); background: var(--brand-soft); }

.sv-frame { position: relative; aspect-ratio: 16 / 10; margin-block: 1rem; border-radius: 12px; overflow: hidden; background: var(--bg-soft); outline: 1.5px dashed rgba(138, 147, 168, calc(var(--s) * 0.8)); outline-offset: -1.5px; }
.sv-frame img, .sv-ghosts {
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%;
  transform: scale(calc(1 - var(--s) * 0.5)); opacity: calc(1 - var(--s));
  border-radius: 12px; will-change: transform, opacity;
}
.sv-frame img { object-fit: cover; filter: blur(calc(var(--b) * 14px)) grayscale(calc(var(--b) * 0.7)); }
.sv-ghosts { direction: ltr; opacity: calc(var(--b) * (1 - var(--s))); }
.sv-ghosts .person { transition: none; }
.sv-delete {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.9rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  font-size: var(--fs-small); font-weight: 600; color: var(--muted); opacity: var(--s);
}
.sv-event { opacity: var(--e); transform: translateY(calc((1 - var(--e)) * -28px)); }
.sv .boundary span { transition: background-color 250ms ease, color 250ms ease; }
.sv[data-active="3"] .boundary span { background: var(--brand); color: #fff; border-color: var(--brand); }

/* =========================================================
   3. RULES: a player that demos each rule
   ========================================================= */
.rp { display: grid; gap: 1.25rem; margin-block-start: clamp(2rem, 1.5rem + 2vw, 3rem); }
@media (min-width: 960px) { .rp { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 2rem; align-items: start; } }

.rp-list { display: grid; gap: 0.35rem; }
.rp-list button {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0.75rem; align-items: center;
  text-align: start; padding: 0.75rem 0.95rem; border-radius: 12px; border: 1px solid transparent; background: transparent;
  transition: background-color var(--dur-ui) ease, border-color var(--dur-ui) ease;
  -webkit-tap-highlight-color: transparent;
}
.rp-list button b { font-weight: 600; }
.rp-list button > span:last-child { grid-column: 2; color: var(--muted); font-size: var(--fs-small); }
.rp-sense { grid-row: 1 / span 2; display: inline-flex; gap: 2px; padding: 0.4rem; border-radius: 10px; background: var(--bg-soft); color: var(--brand); font-size: 1.15rem; }
.rp-list button[aria-selected="true"] { background: var(--brand-soft); border-color: var(--brand); }
.rp-list button[aria-selected="true"] .rp-sense { background: var(--bg); }
.rp-both .rp-sense { background: var(--brand-soft); }
@media (hover: hover) and (pointer: fine) { .rp-list button:hover:not([aria-selected="true"]) { background: var(--bg-soft); } }

.rp-stage { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; background: var(--device); box-shadow: var(--shadow-2); overflow: hidden; }
.rp-scene { position: absolute; inset: 0; padding: 14px; display: grid; grid-template-rows: 1fr auto; gap: 12px; opacity: 0; visibility: hidden; transition: opacity 300ms ease, visibility 0s linear 300ms; }
.rp-scene.is-active { opacity: 1; visibility: visible; transition: opacity 300ms ease; }

.rp-cam, .rp-audio, .rp-chart { position: relative; border-radius: 12px; overflow: hidden; min-block-size: 0; }
.rp-cam { background: url("../assets/store-cam.webp") var(--pos) / 250% no-repeat; }
.rp-cam::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 3px); pointer-events: none; }
.rp-cam-label {
  position: absolute; inset-block-start: 10px; inset-inline-start: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 999px;
  background: rgba(20, 22, 27, 0.82); color: var(--device-text); font-size: 0.8125rem; font-weight: 600;
}
.rp-counter {
  position: absolute; inset-block-end: 10px; inset-inline-end: 10px; z-index: 2;
  padding: 0.3rem 0.75rem; border-radius: 999px; background: rgba(20, 22, 27, 0.85); color: #fff; font-size: 0.875rem; font-weight: 500;
}
.rp-counter b { font-family: var(--font-mono); font-weight: 500; }

/* silhouettes in scenes */
.rp-queue, .rp-one, .rp-meet { position: absolute; inset: 0; direction: ltr; }
.rp-queue i, .rp-one i, .rp-meet i { position: absolute; bottom: 14%; block-size: 46%; aspect-ratio: 0.4; filter: blur(2.6px); color: rgba(26, 20, 16, 0.85); }
.rp-queue i::before, .rp-one i::before, .rp-meet i::before { content: ""; position: absolute; inset: 0; background: currentColor; -webkit-mask: var(--sil) center / contain no-repeat; mask: var(--sil) center / contain no-repeat; }
.rp-queue i:nth-child(1) { left: 50%; bottom: 10%; block-size: 46%; } .rp-queue i:nth-child(2) { left: 61%; bottom: 17%; block-size: 41%; } .rp-queue i:nth-child(3) { left: 71%; bottom: 23%; block-size: 37%; }
.rp-one i { left: 46%; }
.rp-meet .c { left: 62%; }
.rp-meet .s { left: 8%; color: rgba(20, 34, 46, 0.9); }

/* audio scenes */
.rp-audio { background: #1D2129; display: grid; align-content: center; justify-items: center; gap: 1.2rem; padding: 2.75rem 1.25rem 1.25rem; }
.rp-wave { display: flex; align-items: center; gap: 4px; block-size: 64px; }
.rp-wave i { inline-size: 6px; block-size: 20%; border-radius: 3px; background: #8F8CF0; }
.rp-line { color: var(--device-text); font-size: 1.05rem; line-height: 1.6; text-align: center; max-inline-size: 34ch; }
.rp-line mark { color: inherit; padding: 0.05em 0.3em; border-radius: 4px; background: transparent; transition: background-color 300ms ease; }
.rp-bubble { position: absolute; z-index: 2; inset-block-start: 22%; left: 30%; direction: rtl; padding: 0.45rem 0.8rem; border-radius: 14px 14px 14px 4px; background: #fff; color: var(--text); font-size: 0.875rem; font-weight: 600; box-shadow: var(--shadow-1); }

/* chart scene */
.rp-chart { background: #1D2129; padding: 1rem 1.1rem 0.75rem; display: grid; grid-template-rows: auto 1fr auto; gap: 0.6rem; }
.rp-chart-title { color: var(--device-muted); font-size: 0.875rem; }
.rp-chart-title b { display: block; color: var(--device-text); font-size: 2rem; font-weight: 300; font-family: var(--font-mono); line-height: 1.1; }
.rp-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; }
.rp-bars i { block-size: var(--v); border-radius: 5px 5px 2px 2px; background: #6C69E6; transform-origin: bottom; }
.rp-bars i:nth-child(4) { background: #A9A6FF; }
.rp-hours { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; text-align: center; color: var(--device-muted); font-size: 0.75rem; direction: ltr; }

/* verdict row */
.rp-verdict { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--device-2); color: var(--device-text); font-size: 0.875rem; }
.rp-verdict i { inline-size: 10px; block-size: 10px; border-radius: 50%; flex: none; }
.rp-verdict b { white-space: nowrap; }
.rp-verdict span { color: var(--device-muted); }
.rp-verdict.ok i { background: var(--ok); }
.rp-verdict.fail i { background: var(--fail); }
.rp-verdict.info i { background: #8F8CF0; }

/* scene choreography (runs each time a scene becomes active) */
.js .rp-scene .rp-verdict { opacity: 0; transform: translateY(8px); }
.js .rp-scene.is-active .rp-verdict { animation: rp-up 400ms var(--ease-out) both; animation-delay: 2.2s; }
.js .rp-scene.is-active .rp-queue i { animation: rp-pop 450ms var(--ease-out) both; }
.js .rp-scene.is-active .rp-queue i:nth-child(1) { animation-delay: 200ms; }
.js .rp-scene.is-active .rp-queue i:nth-child(2) { animation-delay: 800ms; }
.js .rp-scene.is-active .rp-queue i:nth-child(3) { animation-delay: 1400ms; }
.js .rp-scene.is-active .rp-one i { animation: rp-pop 450ms var(--ease-out) both 200ms; }
.js .rp-scene.is-active .rp-meet .c { animation: rp-pop 450ms var(--ease-out) both 100ms; }
.js .rp-scene.is-active .rp-meet .s { animation: rp-walk 1.6s var(--ease-in-out) both 400ms; }
.js .rp-scene.is-active .rp-bubble { animation: rp-up 400ms var(--ease-out) both 1.9s; }
.js .rp-scene.is-active .rp-wave i { animation: rp-wave 900ms ease-in-out 5 alternate; }
.rp-wave i:nth-child(3n) { animation-delay: -300ms !important; } .rp-wave i:nth-child(3n+1) { animation-delay: -600ms !important; } .rp-wave i:nth-child(4n) { animation-duration: 700ms !important; }
.js .rp-scene.is-active .rp-line mark.ok { animation: mark-ok 1ms linear both 1.4s; }
.js .rp-scene.is-active .rp-line mark.bad { animation: mark-bad 1ms linear both 1.4s; }
.js .rp-scene.is-active .rp-bars i { animation: rp-grow 700ms var(--ease-out) both; }
.rp-bars i:nth-child(2) { animation-delay: 80ms !important; } .rp-bars i:nth-child(3) { animation-delay: 160ms !important; } .rp-bars i:nth-child(4) { animation-delay: 240ms !important; } .rp-bars i:nth-child(5) { animation-delay: 320ms !important; } .rp-bars i:nth-child(6) { animation-delay: 400ms !important; } .rp-bars i:nth-child(7) { animation-delay: 480ms !important; } .rp-bars i:nth-child(8) { animation-delay: 560ms !important; }
.js .rp-scene .rp-bubble { opacity: 0; }
.no-js .rp-line mark.ok, .rp-line mark.ok.is-static { background: rgba(63, 182, 122, 0.3); }
.no-js .rp-line mark.bad, .rp-line mark.bad.is-static { background: rgba(229, 83, 75, 0.35); }

@keyframes rp-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rp-pop { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes rp-walk { from { left: 8%; } to { left: 50%; } }
@keyframes rp-wave { from { block-size: 15%; } to { block-size: 100%; } }
@keyframes rp-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes mark-ok { to { background: rgba(63, 182, 122, 0.3); } }
@keyframes mark-bad { to { background: rgba(229, 83, 75, 0.35); } }

.rp-note { display: flex; align-items: center; gap: 0.5rem; margin-block-start: 1.5rem; color: var(--muted); font-size: var(--fs-small); }
.rp-note .ti { color: var(--brand); font-size: 1.2rem; flex: none; }

/* Mobile: chips row above the stage */
@media (max-width: 959px) {
  .rp-list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; scroll-snap-type: x proximity; gap: 0.4rem; margin-inline: calc(-1 * var(--gutter)); padding: 0.2rem var(--gutter) 0.5rem; scrollbar-width: none; }
  .rp-list::-webkit-scrollbar { display: none; }
  .rp-list button { grid-template-columns: auto auto; grid-template-rows: auto; padding: 0.55rem 0.85rem; border-color: var(--line); border-radius: 999px; scroll-snap-align: start; min-block-size: 44px; }
  .rp-list button > span:last-child { display: none; }
  .rp-sense { grid-row: auto; padding: 0; background: none !important; font-size: 1rem; }
  .rp-stage { aspect-ratio: auto; block-size: 380px; }
  .rp-line { font-size: 0.95rem; }
}

/* Reduced motion: everything in its final state, no loops */
@media (prefers-reduced-motion: reduce) {
  .cams-grid i, .rp-wave i { animation: none !important; }
  .js .vign-chat .wa, .js .vign-chat .wa-note, .js .vign-pos .pos-missing, .js .cams-timer, .js .rp-scene .rp-verdict, .js .rp-scene .rp-bubble { opacity: 1 !important; transform: none !important; animation: none !important; }
  .js .vign-cams .cams-timer { transform: translateX(-50%) !important; }
  .js .rp-scene.is-active * { animation: none !important; }
  .rp-meet .s { left: 50% !important; }
  .rp-line mark.ok { background: rgba(63, 182, 122, 0.3); }
  .rp-line mark.bad { background: rgba(229, 83, 75, 0.35); }
  .rp-wave i:nth-child(odd) { block-size: 70%; } .rp-wave i:nth-child(even) { block-size: 35%; }
}

/* Mobile: only the active privacy step shows its label */
@media (max-width: 767px) {
  .sv-steps li { flex: 0 0 auto; font-size: 0; padding: 0.35rem; gap: 0; }
  .sv[data-active="1"] .sv-steps [data-step="1"],
  .sv[data-active="2"] .sv-steps [data-step="2"],
  .sv[data-active="3"] .sv-steps [data-step="3"] { flex: 1; font-size: 0.8125rem; gap: 0.4rem; padding-inline: 0.7rem; }
}
