/* app.css — "שינוי אפשרי, גם אצלך"
   הפלטה נמשכה מהדף החי של אריה, לא שוערה. הקהל פוגש את הקישור שניות אחרי
   שראה את לולאת ההפסקה הממותגת — רצף ויזואלי הוא אמון מיידי.

   מנוע השלבים: מועתק מ-matan-portal עם שני תיקונים —
   המעבר התלת-ממדי הוחלף במעבר שקיפות (הפורטל הכהה של מתן לא שייך כאן),
   ו-text-shadow הוסר (הוא נכתב לטקסט לבן על כהה; על קרם הוא בוץ). */

/* ===== הפונט — עברית בלבד, 12 קילו, מקומי. בלי תלות ברשת חיצונית ===== */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/heebo-1.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

:root {
  --paper: #FDFBF7;
  --card: #FFF7EC;
  --warm: #FBEAD3;
  --line: #F6E0C2;
  --action: #E67E17;
  --action-2: #F6A23C;
  --action-d: #C2691A;
  --gold: #E4B25A;
  --ink: #4A3E30;
  --dim: #8A7A62;
  --wa: #25D366;
  --night: #4A3E30;

  --maxw: 560px;
  --dur: 420ms;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r: 16px;
  --r-pill: 999px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overscroll-behavior: none;
}
img, video { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 3px; border-radius: 8px; }

/* ===== מנוע השלבים ===== */
.stage { position: fixed; inset: 0; overflow: hidden; }
.step {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(20px, calc(env(safe-area-inset-top) + 16px)) 20px max(24px, calc(env(safe-area-inset-bottom) + 44px));
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  overflow: hidden;
}
.step.is-active {
  opacity: 1; visibility: visible; transform: none; z-index: 2;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.step.is-exit {
  opacity: 0; visibility: visible; transform: translateY(-12px); z-index: 1;
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}
.step:focus, .step:focus-visible { outline: none; }
.step-inner { width: 100%; max-width: var(--maxw); margin: auto; text-align: center; }

/* המדף הוא המסך היחיד שמותר לו לגלול — הוא מדף, לא שלב */
.step.scrolls { justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.step.scrolls .step-inner { margin: 0 auto; }

/* ===== טיפוגרפיה ===== */
h1, h2 { font-weight: 800; line-height: 1.18; margin: 0 0 12px; text-wrap: balance; }
h1 { font-size: clamp(26px, 6.4vw, 34px); }
h2 { font-size: clamp(22px, 5.4vw, 28px); }
p { margin: 0 0 14px; text-wrap: pretty; }
.lead { font-size: 18px; }
.sub { color: var(--dim); font-size: 15px; line-height: 1.55; }
.tiny { color: var(--dim); font-size: 14px; line-height: 1.5; }
.count { color: var(--dim); font-size: 14px; font-weight: 600; }

/* ===== כפתורים — אחד כתום למסך, תמיד ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 360px; min-height: 56px; padding: 0 26px;
  border-radius: var(--r-pill); font-weight: 600; font-size: 18px;
  color: #fff; background: linear-gradient(180deg, var(--action-2), var(--action));
  box-shadow: 0 6px 20px rgba(230, 126, 23, .25);
  transition: transform 120ms var(--ease), box-shadow 200ms var(--ease), opacity 200ms;
}
.btn:active { background: var(--action-d); transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; box-shadow: none; }
.btn.wa { background: var(--wa); box-shadow: 0 6px 20px rgba(37, 211, 102, .22); }
.btn.ghost {
  background: none; color: var(--action-d); box-shadow: none;
  border: 1.5px solid var(--line); font-weight: 600;
}
.link {
  display: inline-block; min-height: var(--tap); padding: 11px 8px;
  color: var(--dim); font-size: 15px; text-decoration: underline;
  text-underline-offset: 3px; background: none;
}
.actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 18px; }

/* ===== סרגל התקדמות ===== */
.bar { position: fixed; inset-inline: 0; top: 0; height: 3px; background: var(--line); z-index: 40; }
.bar > i {
  display: block; height: 100%; width: 0; background: var(--gold);
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  transition: width var(--dur) var(--ease);
}

/* ===== כרטיס הווידאו ===== */
.vwrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--r); overflow: hidden; background: var(--warm);
  border: 1px solid var(--line);
}
.vwrap video, .vwrap img.poster { width: 100%; height: 100%; object-fit: cover; }
.vwrap img.poster { position: absolute; inset: 0; }
.playbtn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(74, 62, 48, .18);
}
.playbtn i {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(180deg, var(--action-2), var(--action));
  box-shadow: 0 6px 22px rgba(74, 62, 48, .3);
  display: block; position: relative;
}
.playbtn i::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-58%, -50%);
  border-style: solid; border-width: 13px 0 13px 21px;
  border-color: transparent transparent transparent #fff;
}
.vprog { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .28); }
.vprog > i { display: block; height: 100%; width: 0; background: var(--gold); }
.who { margin-top: 10px; font-size: 15px; }
.who b { font-weight: 600; }
.who span { color: var(--dim); }

/* כרטיס נפילה — כשהווידאו לא נטען, פנים וציטוט ופס אודיו */
.fallcard {
  display: flex; gap: 14px; align-items: center; text-align: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
}
.fallcard img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.fallcard q { display: block; font-size: 16px; line-height: 1.5; }

/* ===== סקאלת חמש הדרגות — מד חום, לא ציון ===== */
.scale { display: flex; align-items: flex-end; justify-content: center; gap: 6px; margin: 20px 0 8px; }
.scale button {
  flex: 1 1 0; max-width: 68px; height: 64px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px;
}
.scale button i {
  display: block; border-radius: 50%;
  border: 2px solid var(--line); background: var(--paper);
  transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
}
.scale button:nth-child(1) i { width: 28px; height: 28px; }
.scale button:nth-child(2) i { width: 32px; height: 32px; }
.scale button:nth-child(3) i { width: 36px; height: 36px; }
.scale button:nth-child(4) i { width: 40px; height: 40px; }
.scale button:nth-child(5) i { width: 44px; height: 44px; }
.scale button.on i { border-color: transparent; transform: scale(1.04); }
.scale button.on:nth-child(-n+2) i { background: var(--gold); }
.scale button.on:nth-child(n+3) i { background: var(--action); }
.scale-ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; }

/* ===== שבבי בחירה ===== */
.chips { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
.chip {
  width: 100%; min-height: 64px; padding: 14px 18px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r);
  font-size: 17px; text-align: start; line-height: 1.4;
  transition: border-color 160ms, background 160ms, transform 120ms var(--ease);
}
.chip:active { transform: scale(.985); }
.chip.on { border-color: var(--action); background: var(--warm); font-weight: 600; }
.chip.quiet { background: none; color: var(--dim); min-height: 52px; font-size: 16px; }

/* ===== שדה טקסט ===== */
.field {
  width: 100%; min-height: 56px; padding: 0 18px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r);
  font-family: inherit; font-size: 18px; color: var(--ink); text-align: start;
}
.field:focus { outline: none; border-color: var(--action); }

/* ===== סרגל 0 עד 10 ===== */
.slider { margin: 26px 0 10px; }
.slider .num {
  height: 68px; font-size: 60px; font-weight: 800; line-height: 1;
  color: var(--action); display: flex; align-items: center; justify-content: center;
}
.slider .num.empty { color: var(--line); font-size: 40px; }
.rail {
  position: relative; height: 40px; display: flex; align-items: center;
  touch-action: none; cursor: pointer;
}
.rail::before {
  content: ''; position: absolute; inset-inline: 0; height: 12px; border-radius: var(--r-pill);
  /* RTL: אפס מימין, עשר משמאל */
  background: linear-gradient(to left, var(--warm), var(--action-2));
}
.rail .knob {
  position: absolute; width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: 3px solid var(--action);
  box-shadow: 0 3px 12px rgba(74, 62, 48, .22);
  transform: translateX(50%); pointer-events: none; opacity: 0;
  transition: opacity 160ms;
}
.rail .knob.on { opacity: 1; }
.rail-ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; margin-top: 2px; }

/* ===== מסך התזוזה — ההיפוך היחיד בחוויה ===== */
.step.night { background: var(--night); color: var(--paper); }
.step.night .sub, .step.night .tiny { color: rgba(253, 251, 247, .62); }
.glow {
  position: absolute; inset-inline: 50%; top: 50%; width: 320px; height: 320px;
  margin-inline-start: -160px; margin-top: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 178, 90, .22), transparent 68%);
  animation: breathe 5s ease-in-out infinite; pointer-events: none;
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.qcard {
  position: relative; font-size: clamp(21px, 5.2vw, 27px); font-weight: 600; line-height: 1.5;
  min-height: 30vh; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 600ms var(--ease);
}
.qcard.in { opacity: 1; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 22px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(228, 178, 90, .3); }
.dots i.on { background: var(--gold); }

/* ===== חשיפת ההפרש ===== */
.reveal-line { opacity: 0; transition: opacity 520ms var(--ease); }
.reveal-line.in { opacity: 1; }
.num-before { font-size: 40px; font-weight: 600; color: var(--dim); line-height: 1.1; }
.num-after { font-size: 68px; font-weight: 800; color: var(--action); line-height: 1.05; }

/* ===== מדף המתנה ===== */
.gift { text-align: start; }
.track-card {
  background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold);
  border-radius: var(--r); padding: 18px; margin: 16px 0;
}
.player { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.player button.pp {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  background: linear-gradient(180deg, var(--action-2), var(--action));
  box-shadow: 0 6px 20px rgba(230, 126, 23, .25);
  position: relative;
}
.player button.pp:active { background: var(--action-d); transform: scale(.97); }
/* משולש נגינה. במצב ניגון הוא הופך לשני פסים. */
.player button.pp::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-58%, -50%);
  border-style: solid; border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
}
.player button.pp.on::after {
  transform: translate(-50%, -50%);
  border: none; width: 16px; height: 20px;
  background: linear-gradient(90deg, #fff 0 5px, transparent 5px 11px, #fff 11px 16px);
}
.player .ptxt { flex: 1; min-width: 0; }
.ptrack { height: 6px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.ptrack > i { display: block; height: 100%; width: 0; background: var(--gold); }
.ptime { display: flex; justify-content: space-between; color: var(--dim); font-size: 13px; margin-top: 4px; direction: ltr; }

/* ===== פוטר קבוע ===== */
.foot {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  text-align: center; font-size: 13px; color: var(--dim);
  background: linear-gradient(to top, var(--paper) 62%, transparent);
  pointer-events: none;
}
.foot > * { pointer-events: auto; }
.foot a { color: var(--dim); text-decoration: underline; text-underline-offset: 2px; }
.step.night ~ .foot, body.night-on .foot { color: rgba(253, 251, 247, .5); background: none; }

/* ===== שכבה עליונה (איך זה עובד · פרטיות · מצוקה) ===== */
.sheet {
  position: fixed; inset: 0; z-index: 60; background: var(--paper);
  overflow-y: auto; padding: 28px 20px calc(40px + env(safe-area-inset-bottom));
  display: none;
}
.sheet.on { display: block; }
.sheet .inner { max-width: var(--maxw); margin: 0 auto; text-align: start; }
.sheet h2 { text-align: start; }
.sheet p { font-size: 16px; }

/* ===== דסקטופ — אזרח שווה, לא הסתגלות ===== */
@media (min-width: 760px) {
  .step { padding: 40px 24px 72px; }
  .step-inner { max-width: 640px; }
}

/* ===== מי שביקש פחות תנועה ===== */
@media (prefers-reduced-motion: reduce) {
  .step, .step.is-active, .step.is-exit { transition: opacity 1ms linear; transform: none; }
  .glow { animation: none; }
  .qcard, .reveal-line { transition: none; opacity: 1; }
  .btn:active { transform: none; }
}
