/* =========================================================================
   fx.css — שכבת אנימציה משותפת לדמואים של סטודיו מחר
   עובד יחד עם fx.js. כל האפקטים מופעלים ע"י data-fx="..." בלבד.
   בלי JS / בלי GSAP / prefers-reduced-motion → הכול גלוי וסטטי.
   ========================================================================= */

:root {
  --fx-accent: #00ffd1;
  --fx-ink: #0d0d0d;
  --fx-paper: #ffffff;
  --fx-nav-bg: rgba(13, 13, 13, .72);
  --fx-nav-ink: #ffffff;
  --fx-talk-bg: var(--fx-accent);
  --fx-talk-ink: var(--fx-ink);
  --fx-ease-out: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- מניעת הבהוב עד ש-fx.js מאתחל (עם failsafe ב-CSS בלבד) ---------- */
html.fx-pending [data-fx~="split"],
html.fx-pending [data-fx~="cards"] > *,
html.fx-pending [data-fx~="reveal-img"],
html.fx-pending [data-fx~="fade"] {
  opacity: 0;
  animation: fx-failsafe 0s linear 3.5s forwards; /* אם JS לא רץ תוך 3.5ש' — מציגים */
}
@keyframes fx-failsafe { to { opacity: 1; } }

/* ---------- הגנה מגלילה אופקית (כרטיסים עקומים, נצנוצים, פרלקסה) ----------
   clip (לא hidden) — לא יוצר scroll container, אז position:sticky ממשיך לעבוד */
html, body { overflow-x: clip; }

/* ---------- Lenis ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- split ---------- */
[data-fx~="split"] .fx-w {
  display: inline-block;
  white-space: nowrap;           /* מילה לא נשברת באמצע */
  vertical-align: top;
}
[data-fx~="split"][data-fx-style="up"] .fx-w,
[data-fx~="split"]:not([data-fx-style]) .fx-w {
  overflow: hidden;              /* "עולה מתחת לקו" */
  padding-block: .12em;          /* מקום לניקוד ולאותיות יורדות (ק, ן, ץ) */
  margin-block: -.12em;
}
[data-fx~="split"] .fx-wi,
[data-fx~="split"] .fx-c { display: inline-block; will-change: transform; }

/* ---------- cards ---------- */
[data-fx~="cards"] > * { will-change: transform; }

/* ---------- pin-dots ---------- */
[data-fx~="pin-dots"] {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
[data-fx~="pin-dots"] > .fx-dots {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  pointer-events: none;
  z-index: 0;
}
[data-fx~="pin-dots"] > .fx-dots i {
  display: block;
  border-radius: 50%;
  background: var(--fx-dots-color, var(--fx-accent));
  transform: scale(var(--fx-dot-s0, .05));
  will-change: transform;
}
[data-fx~="pin-dots"] > :not(.fx-dots) { position: relative; z-index: 1; }
[data-fx~="pin-dots"] .fx-dots-after { opacity: 0; }
html.fx-static [data-fx~="pin-dots"] .fx-dots-after,
html:not(.fx-on) [data-fx~="pin-dots"] .fx-dots-after { opacity: 1; }

/* ---------- reveal-img ---------- */
[data-fx~="reveal-img"] { overflow: hidden; display: block; }
[data-fx~="reveal-img"] img { display: block; width: 100%; height: auto; will-change: transform; }

/* ---------- marquee ---------- */
[data-fx~="marquee"] {
  overflow: hidden;
  white-space: nowrap;
  max-width: 100%;
  contain: paint;
  direction: ltr;               /* פריסה LTR כדי שהגלישה תהיה צפויה; הפריטים עצמם RTL */
  text-align: left;
}
[data-fx~="marquee"] .fx-marquee-track {
  display: inline-flex;
  direction: ltr;               /* המסלול LTR, הטקסט עצמו RTL */
  will-change: transform;
}
[data-fx~="marquee"] .fx-marquee-copy {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--fx-marquee-gap, 2rem);
  padding-inline-end: var(--fx-marquee-gap, 2rem);
}
[data-fx~="marquee"] .fx-marquee-copy > * { direction: rtl; unicode-bidi: isolate; flex-shrink: 0; }

/* ---------- magnetic / tilt ---------- */
[data-fx~="magnetic"] { display: inline-block; will-change: transform; }
[data-fx~="magnetic"] .fx-magnetic-inner { display: inline-block; pointer-events: none; }
[data-fx~="tilt"] { transform-style: preserve-3d; will-change: transform; }

/* ---------- alive ---------- */
.fx-alive-wrap { position: relative; display: inline-block; line-height: 0; }
[data-fx~="alive"] { cursor: pointer; transform-origin: 50% 100%; }
.fx-alive-wrap > [data-fx~="alive"] { display: block; max-width: 100%; height: auto; }
.fx-alive-layer {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}
/* אדי חום */
.fx-steam {
  position: absolute;
  bottom: 62%;
  width: 18%;
  aspect-ratio: 1 / 2.4;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 60%, rgba(255,255,255,.85) 0%, rgba(255,255,255,.35) 45%, rgba(255,255,255,0) 72%);
  filter: blur(6px);
  opacity: 0;
  mix-blend-mode: screen;
}
.fx-alive-wrap[data-fx-steam-dark] .fx-steam { mix-blend-mode: normal; background: radial-gradient(ellipse at 50% 60%, rgba(120,120,120,.55) 0%, rgba(120,120,120,.2) 45%, rgba(120,120,120,0) 72%); }
/* נצנוצים */
.fx-sparkle {
  position: absolute;
  width: var(--s, 22px);
  height: var(--s, 22px);
  margin: calc(var(--s, 22px) / -2) 0 0 calc(var(--s, 22px) / -2);
  background: var(--fx-sparkle-color, #fff6c8);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 6px rgba(255, 230, 140, .9));
  transform: scale(0);
  opacity: 0;
}

/* ---------- stack (CSS בלבד — כרטיסים נערמים, כמו אצל חוי) ---------- */
.fx-stack > * {
  position: sticky;
  top: calc(var(--fx-stack-top, 90px) + var(--i, 0) * var(--fx-stack-step, 20px));
}

/* =========================================================================
   תפריט גלולה צף
   <nav class="fx-pill-nav"><a class="fx-pill-logo">…</a><a href="#" class="is-active">בית</a>…</nav>
   ========================================================================= */
.fx-pill-nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 999px;
  background: var(--fx-nav-bg);
  color: var(--fx-nav-ink);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  overflow-x: auto;
  scrollbar-width: none;
  transition: transform .5s var(--fx-ease-out), opacity .5s;
}
.fx-pill-nav::-webkit-scrollbar { display: none; }
.fx-pill-nav.fx-hide { transform: translate(-50%, calc(-100% - 24px)); opacity: 0; }
.fx-pill-nav a {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .3s, color .3s;
}
.fx-pill-nav a:hover, .fx-pill-nav a:focus-visible { background: rgba(255, 255, 255, .12); outline: none; }
.fx-pill-nav a.is-active, .fx-pill-nav a[aria-current="page"] { background: var(--fx-accent); color: var(--fx-ink); }
.fx-pill-nav .fx-pill-logo { font-weight: 800; padding-inline: 14px; }
@media (max-width: 767px) {
  .fx-pill-nav { top: 10px; padding: 4px; }
  .fx-pill-nav a { padding: 8px 12px; font-size: 14px; }
}

/* =========================================================================
   כפתור "בואו נדבר" קבוע בפינה
   <a class="fx-talk" href="https://wa.me/972…">בואו נדבר <span aria-hidden="true">«</span></a>
   ========================================================================= */
.fx-talk {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--fx-talk-bg);
  color: var(--fx-talk-ink);
  font-weight: 800;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 4px 0 0 var(--fx-ink), 0 12px 28px rgba(0, 0, 0, .22);
  transition: transform .35s var(--fx-ease-out), box-shadow .35s var(--fx-ease-out);
}
.fx-talk::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--fx-talk-bg);
  animation: fx-talk-ring 2.4s ease-out infinite;
  pointer-events: none;
}
.fx-talk:hover, .fx-talk:focus-visible { transform: translateY(-3px); box-shadow: 0 7px 0 0 var(--fx-ink), 0 16px 32px rgba(0, 0, 0, .25); outline: none; }
.fx-talk:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--fx-ink); }
.fx-talk > span { display: inline-block; transition: transform .35s var(--fx-ease-out); }
.fx-talk:hover > span { transform: translateX(-4px); }
@keyframes fx-talk-ring {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fx-talk-bg) 60%, transparent); }
  70%  { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (max-width: 767px) {
  .fx-talk { left: 12px; bottom: 12px; padding: 11px 18px; font-size: 15px; }
}

/* =========================================================================
   נגישות: prefers-reduced-motion → הכול סטטי וגלוי
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html.fx-pending [data-fx] , html.fx-pending [data-fx] > * { opacity: 1 !important; animation: none !important; }
  [data-fx~="pin-dots"] .fx-dots-after { opacity: 1 !important; }
  [data-fx~="pin-dots"] > .fx-dots { display: none; }
  .fx-talk::before { animation: none; }
  .fx-pill-nav, .fx-talk, .fx-talk > span { transition: none; }
}
