/* Perets — How It Works | Elementor widget styles
   האלמנט שקוף כברירת מחדל — כל הצבעים דרך CSS variables (וגם דרך פאנל העיצוב באלמנטור):
   --phiw-bg (רקע האזור, ברירת מחדל: שקוף), --phiw-ink (טקסט), --phiw-accent, --phiw-blush,
   --phiw-frame-bg (רקע מסגרת התמונה), --phiw-sticky-bg (רקע הרצועה הדביקה במובייל),
   --phiw-sticky-top (מרווח ההידבקות מלמעלה). */

.phiw {
  --phiw-bg: transparent;
  --phiw-ink: #1A1A1A;
  --phiw-accent: #A1B994;
  --phiw-blush: #F0CDC6;
  --phiw-frame-bg: transparent;
  --phiw-sticky-bg: #F9F0E7;
  --phiw-sticky-top: 96px; /* מרווח מתחת לתפריט דביק — נשלט מאלמנטור */
  --phiw-ratio: 4 / 3.4;   /* יחס התמונה */
  --phiw-stack-max: none;  /* גובה מקסימלי לתמונה */
  --phiw-dim: 0.45;
  --phiw-radius: 6px;

  --phiw-muted: color-mix(in srgb, var(--phiw-ink) 62%, transparent);
  --phiw-soft: color-mix(in srgb, var(--phiw-ink) 30%, transparent);
  --phiw-faint: color-mix(in srgb, var(--phiw-ink) 18%, transparent);
  --phiw-line: color-mix(in srgb, var(--phiw-ink) 14%, transparent);

  box-sizing: border-box;
  container-type: inline-size;
  background: var(--phiw-bg);
  color: var(--phiw-ink);
  font-family: 'Google Sans', 'Google Sans Text', 'Product Sans', 'Rubik', system-ui, -apple-system, sans-serif;
  padding: clamp(40px, 5.5cqi, 84px) clamp(20px, 4cqi, 64px);
  /* אין overflow על האלמנט — כל overflow שאינו visible שובר את ה-sticky של עמודת התמונה */
  -webkit-font-smoothing: antialiased;
}
.phiw *, .phiw *::before, .phiw *::after { box-sizing: border-box; }

.phiw__inner { max-width: 1400px; margin: 0 auto; }

/* ---------- כותרות ---------- */
.phiw__head { margin-bottom: clamp(26px, 3.2cqi, 48px); }
.phiw__eyebrow {
  display: flex; align-items: center; gap: 12px; margin: 0 0 10px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--phiw-muted);
}
.phiw__eyebrowline { display: block; width: 34px; height: 1px; background: var(--phiw-blush); }
.phiw__headrow {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: clamp(12px, 2.4cqi, 48px);
}
.phiw__title {
  flex: 1 1 380px; max-width: 22ch; margin: 0;
  font-size: clamp(28px, 4.6cqi, 62px); font-weight: 300; line-height: 1.1;
  letter-spacing: -0.01em; text-wrap: pretty; color: inherit;
}
.phiw__sub {
  flex: 0 1 300px; margin: 0 0 6px;
  font-size: clamp(15px, 1.4cqi, 20px); line-height: 1.7; text-wrap: pretty;
  color: var(--phiw-muted);
}

/* ---------- גריד ---------- */
.phiw__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(26px, 3.2cqi, 60px);
  align-items: start;
}
.phiw--flip .phiw__visual { order: 2; }
.phiw--novisual .phiw__grid { grid-template-columns: minmax(0, 1fr); }
.phiw--novisual .phiw__steps { max-width: 760px; }

/* ---------- פאנל ויזואלי (דביק) ---------- */
/* בדסקטופ העמודה נמתחת לגובה עמודת השלבים, וההידבקות היא על המסגרת הפנימית —
   כך יש לה טווח גלילה אמיתי. */
.phiw__visual { align-self: stretch; }
.phiw--sticky .phiw__frameouter { position: sticky; top: var(--phiw-sticky-top); }
.phiw__frameouter { position: relative; padding: 10px 10px 0 0; }
.phiw__blush {
  position: absolute; top: 0; inset-inline-end: 0; width: 62%; height: 52%;
  background: var(--phiw-blush); border-radius: var(--phiw-radius);
}
.phiw__frame {
  position: relative; padding: 8px; background: var(--phiw-frame-bg);
  border: 1px solid var(--phiw-line); border-radius: var(--phiw-radius);
}
.phiw__stack {
  position: relative; width: 100%;
  aspect-ratio: var(--phiw-ratio);
  max-height: var(--phiw-stack-max);
  border-radius: 4px; overflow: hidden;
}
.phiw__layer {
  position: absolute; inset: 0; margin: 0; opacity: 0;
  transition: opacity 620ms cubic-bezier(.22, .61, .36, 1);
}
.phiw__layer.is-active { opacity: 1; }
.phiw__layer img { width: 100%; height: 100%; object-fit: cover; display: block; }

.phiw__meta {
  position: relative; height: 44px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 6px;
}
.phiw__captions { position: relative; flex: 1; height: 22px; }
.phiw__caption {
  position: absolute; inset-inline-start: 0; top: 0; white-space: nowrap;
  font-size: 14px; color: var(--phiw-muted); opacity: 0;
  transition: opacity 420ms ease;
}
.phiw__caption.is-active { opacity: 1; }
.phiw__counter {
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: 16px;
  letter-spacing: 0.14em; color: var(--phiw-soft); white-space: nowrap;
}

/* ---------- שלבים ---------- */
.phiw__steps { position: relative; list-style: none; margin: 0; padding: 0; overflow-x: clip; }
.phiw__rail {
  position: absolute; inset-inline-start: 7px; top: 10px; bottom: 10px;
  width: 1px; background: var(--phiw-line);
}
.phiw__railfill {
  position: absolute; inset: 0; background: var(--phiw-accent);
  transform: scaleY(0); transform-origin: top center;
  transition: transform 240ms linear;
}
.phiw__step {
  position: relative;
  padding-inline-start: clamp(34px, 4cqi, 54px);
  padding-block: clamp(14px, 1.8cqi, 22px);
}
.phiw__dot {
  position: absolute; inset-inline-start: 1px;
  top: calc(clamp(14px, 1.8cqi, 22px) + 17px);
  width: 13px; height: 13px; border-radius: 50%;
  background: transparent; border: 1px solid var(--phiw-soft);
  transition: background 420ms ease, border-color 420ms ease, transform 420ms ease;
}
.phiw__step.is-active .phiw__dot {
  background: var(--phiw-accent); border-color: var(--phiw-accent); transform: scale(1.15);
}
.phiw__stephead { display: flex; align-items: center; gap: clamp(14px, 2cqi, 26px); }
.phiw__num {
  font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 300;
  font-size: clamp(44px, 5.6cqi, 72px); line-height: 0.85;
  color: var(--phiw-faint); transition: color 520ms ease;
}
.phiw__step.is-active .phiw__num { color: var(--phiw-accent); }
.phiw__icon { display: flex; color: var(--phiw-soft); transition: color 520ms ease; }
.phiw__icon svg { width: 34px; height: 34px; display: block; }
.phiw__step.is-active .phiw__icon { color: var(--phiw-accent); }

.phiw__steptitle {
  margin: 10px 0 5px; font-size: clamp(20px, 2.1cqi, 29px); font-weight: 500;
  line-height: 1.25; letter-spacing: -0.005em; color: inherit;
}
.phiw__lead {
  margin: 0 0 5px; font-size: clamp(15px, 1.35cqi, 18px); font-weight: 600; line-height: 1.6;
  opacity: var(--phiw-dim); transition: opacity 520ms ease;
}
.phiw__text {
  margin: 0; max-width: 46ch; font-size: clamp(14px, 1.25cqi, 17px); line-height: 1.7;
  text-wrap: pretty; color: var(--phiw-muted); opacity: var(--phiw-dim);
  transition: opacity 520ms ease;
}
.phiw__step.is-active .phiw__lead, .phiw__step.is-active .phiw__text { opacity: 1; }

/* ---------- הופעה הדרגתית (מתווסף רק כשה-JS רץ) ---------- */
.phiw.is-js[data-reveal="1"] .phiw__step {
  opacity: 0; transform: translateY(22px);
  transition: opacity 760ms cubic-bezier(.22, .61, .36, 1), transform 760ms cubic-bezier(.22, .61, .36, 1);
}
.phiw.is-js[data-reveal="1"] .phiw__step.is-in { opacity: 1; transform: none; }

/* ---------- מובייל / טאבלט: timeline אנכי + תמונה דביקה בראש המסך ---------- */
@media (max-width: 1024px) {
  .phiw__grid { display: block; }
  .phiw--flip .phiw__visual { order: initial; }
  .phiw__visual { align-self: initial; }
  .phiw--sticky .phiw__frameouter { position: relative; top: auto; }
  /* התמונה נדבקת לראש המסך והשלבים גוללים מתחתיה */
  .phiw--sticky .phiw__visual {
    position: sticky; top: var(--phiw-sticky-top); z-index: 3;
    padding: 10px 0 4px; margin-bottom: 16px;
    background: var(--phiw-sticky-bg);
  }
  /* דהייה רכה בקצה התחתון, כדי שהמעבר של התוכן מתחת ייראה מכוון */
  .phiw--sticky .phiw__visual::after {
    content: ''; position: absolute; inset-inline: 0; bottom: -18px; height: 18px;
    background: linear-gradient(to bottom, var(--phiw-sticky-bg), transparent);
    pointer-events: none;
  }
  .phiw__frameouter { padding: 8px 8px 0 0; max-width: 460px; }
  .phiw { --phiw-ratio: 16 / 10; --phiw-stack-max: 30vh; }
  .phiw__meta { height: 38px; }
  .phiw__blush { height: 46%; }
  .phiw__steps { max-width: 720px; }
}
@media (max-width: 600px) {
  .phiw { padding-inline: 18px; }
  .phiw__title { max-width: none; }
  .phiw__sub { flex-basis: 100%; }
  .phiw__caption { white-space: normal; font-size: 13px; }
  .phiw__meta { height: 40px; }
  .phiw__step { padding-inline-start: 30px; }
  .phiw__text { max-width: none; }
}

/* ---------- נגישות ---------- */
@media (prefers-reduced-motion: reduce) {
  .phiw *, .phiw *::before, .phiw *::after {
    transition-duration: 0.01ms !important; animation-duration: 0.01ms !important;
  }
  .phiw.is-js[data-reveal="1"] .phiw__step { opacity: 1 !important; transform: none !important; }
}
.phiw :focus-visible { outline: 2px solid var(--phiw-accent); outline-offset: 3px; }
