/**
 * Flowsoft Harbor — Option B: calm motion + graphics + Flow mascot + network band
 * Spec: motion/MOTION-SPEC.md. Animate transform/opacity only (one documented
 * exception: stroke-dashoffset for the draft flight-path line, per spec §3.4).
 * Every animated/hidden state is gated behind html classes added by JS
 * (.fs-reveal / .fs-ambient / .fs-paused) so no-JS and reduced-motion = static + fully visible.
 */

:root {
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 250ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-inout: cubic-bezier(0.4, 0, 0.2, 1);
  --reveal-x: 16px;
  --dir: 1; /* LTR */
  --navy-shadow: 0 24px 40px -18px rgba(11, 31, 58, 0.38), 0 6px 14px rgba(11, 31, 58, 0.12);
}
html[dir="rtl"] { --dir: -1; }

/* clip (not hidden) keeps position:sticky working and guards 16px reveal offsets */
body { overflow-x: clip; }

/* ---------- Nav / buttons / toggle: 150ms colour + shadow, no layout shift ---------- */
.btn, .nav-desktop a, .nav-mobile a, .lang-toggle a, .card-link {
  transition-duration: var(--motion-fast);
  transition-timing-function: var(--ease-out);
}
.lang-toggle a {
  min-width: 2.5rem;
  text-align: center;
  transition-property: background-color, color;
}
.header-actions .btn-sm { min-width: 7.5rem; }
/* Pre-existing mobile header overflow fix: at narrow widths the Contact link lives in the mobile menu */
@media (max-width: 479px) {
  .header-actions .btn-sm { display: none; }
  .header-actions { gap: 0.5rem; }
}
.btn-primary:hover { box-shadow: 0 6px 14px -6px rgba(43, 179, 192, 0.7); }
@keyframes fsFade { from { opacity: 0.35; } to { opacity: 1; } }
html.fs-lang-fade main,
html.fs-lang-fade .nav-desktop,
html.fs-lang-fade .nav-mobile,
html.fs-lang-fade .site-footer .container { animation: fsFade var(--motion-fast) var(--ease-out); }

/* ---------- Scroll reveals (progressive enhancement) ---------- */
.fs-reveal [data-reveal] {
  opacity: 0;
  /* slide in from the inline-start side: right in HE (dir -1), left in EN (dir 1) */
  translate: calc(var(--reveal-x) * var(--dir) * -1) 0;
  transition:
    opacity var(--motion-slow) var(--ease-out) var(--rd, 0ms),
    translate var(--motion-slow) var(--ease-out) var(--rd, 0ms),
    transform var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}
.fs-reveal [data-reveal].is-in { opacity: 1; translate: 0 0; }
.fs-failsafe [data-reveal] { opacity: 1 !important; translate: none !important; }

/* ---------- Offer cards: lift + teal accent line ---------- */
.offer-card { position: relative; }
.offer-card::after {
  content: "";
  position: absolute;
  inset-inline: -1px;
  inset-block-start: -1px;
  height: 3px;
  background: var(--fs-color-accent);
  border-start-start-radius: var(--fs-radius-lg);
  border-start-end-radius: var(--fs-radius-lg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--motion-base) var(--ease-out);
  pointer-events: none;
}
html[dir="rtl"] .offer-card::after { transform-origin: right; }
.offer-card {
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}
.offer-card:hover,
.offer-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--fs-shadow-lg);
  border-color: var(--fs-color-neutral-300);
}
.offer-card:hover::after,
.offer-card:focus-within::after { transform: scaleX(1); }
.card-link::after { content: none; }

.offer-illus { width: 104px; height: 88px; margin-block-end: var(--fs-space-2); }
.offer-illus .illus { width: 100%; height: 100%; max-width: none; }

/* ---------- Gradient wash + faint dot/grid texture (CSS only) ---------- */
.hero-home {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(70% 90% at 50% -10%, rgba(43, 179, 192, 0.16), transparent 65%),
    linear-gradient(165deg, var(--fs-color-accent-muted) 0%, #fff 55%, var(--fs-color-neutral-50) 100%);
}
.hero-home::before,
.page-hero::before,
.heritage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(currentColor 1px, transparent 1.3px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%);
  opacity: 0.12;
}
.hero-home::before { color: var(--fs-color-primary); }
.page-hero, .heritage { position: relative; isolation: isolate; overflow: hidden; }
.page-hero {
  background:
    radial-gradient(60% 120% at 50% -20%, rgba(43, 179, 192, 0.28), transparent 62%),
    linear-gradient(160deg, var(--fs-color-primary) 0%, var(--fs-color-primary-muted) 100%);
}
.page-hero::before, .heritage::before { color: #fff; opacity: 0.1; }

/* ---------- F-mark watermark (existing Flowsoft mark, <= 0.06 opacity, never flipped) ---------- */
.page-hero::after,
.heritage::after,
.cta-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(280px, 46%);
  aspect-ratio: 1;
  inset-inline-end: -20px;
  inset-block-end: -48px;
  background-color: #fff;
  opacity: 0.05;
  -webkit-mask: url("../img/f-mark.svg") center / contain no-repeat;
  mask: url("../img/f-mark.svg") center / contain no-repeat;
  pointer-events: none;
}
.cta-panel { position: relative; isolation: isolate; overflow: hidden; }
.cta-panel::after { background-color: var(--fs-color-primary); opacity: 0.05; inset-block-end: -60px; }

/* ---------- Home hero: Flow mascot (MOTION-SPEC v2; keyframes live in flow-mascot.css) ---------- */
.hero-home > .container { position: relative; }
.hero-visual-flow { width: 100%; max-width: 30rem; justify-self: end; display: flex; flex-direction: column; align-items: flex-start; gap: var(--fs-space-3); }
@media (max-width: 899px) { .hero-visual-flow { justify-self: center; } }
.hero-visual-flow .flow { width: 100%; aspect-ratio: 4 / 3; border-radius: 28px; box-shadow: var(--fs-shadow-lg); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hero-visual-flow .flow svg { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 28px; }
/* one inline SVG; the mobile variant (flow-mascot-mobile.svg) = the same markup minus the .flow-lite parts */
@media (max-width: 600px) { .flow .flow-lite { display: none; } }
/* the play/pause control needs JS, so it only shows when the head script marked the page as JS-enabled */
.flow-toggle { display: none; }
.fs-js .flow-toggle { display: inline-flex; align-items: center; justify-content: center; }
.flow-toggle:hover { background: #fff; }

/* ---------- Offer network band (sticky under the header; JS lights the nodes) ---------- */
:root { --nav-h: 64px; }

/* ---------- Pause / play control (WCAG 2.2.2) ---------- */
.motion-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  border-radius: var(--fs-radius-pill);
  border: 1px solid var(--fs-color-neutral-300);
  background: rgba(255, 255, 255, 0.9);
  color: var(--fs-color-primary);
  font: inherit;
  font-size: var(--fs-text-caption);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.fs-ambient .motion-toggle { display: inline-flex; }
.motion-toggle:hover { border-color: var(--fs-color-accent-text); background: #fff; }
/* Visible, high-contrast keyboard focus ring (solid outline; the global soft ring is too faint for this control) */
.motion-toggle:focus-visible { outline: 3px solid var(--fs-color-accent-text); outline-offset: 3px; box-shadow: 0 0 0 1px #fff; }
.page-hero .motion-toggle:focus-visible { outline-color: var(--fs-color-accent); box-shadow: none; }
.motion-toggle .mt-ico { width: 14px; height: 14px; fill: currentColor; }
.motion-toggle .mt-play, .motion-toggle .mt-label-play { display: none; }
.motion-toggle[aria-pressed="true"] .mt-pause,
.motion-toggle[aria-pressed="true"] .mt-label-pause { display: none; }
.motion-toggle[aria-pressed="true"] .mt-play { display: block; }
.motion-toggle[aria-pressed="true"] .mt-label-play { display: inline; }
.page-hero .motion-toggle { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.page-hero .motion-toggle:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }

/* Ambient animations pause: user pause, tab off-screen (JS toggles .is-offscreen) */
.fs-paused *, .fs-paused *::before, .fs-paused *::after,
[data-loop].is-offscreen, [data-loop].is-offscreen * { animation-play-state: paused !important; }
/* a remembered ambient pause (draft pages) must never freeze the mascot; it has its own pause button */
.fs-paused .flow:not(.is-paused):not(.is-halted) * { animation-play-state: running !important; }

/* ---------- Product mock cards (draft pages): CSS 3D pointer tilt ---------- */
.hero-visual-product {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  overflow: visible;
}
.hero-visual-product::before { display: none; }
.tilt-scene { perspective: 900px; }
.tilt-card {
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
  box-shadow: var(--navy-shadow);
}
.tilt-card:focus-within { transform: translateY(-4px); }
.page-hero .tilt-card { border-color: rgba(255, 255, 255, 0.5); }

/* Draft product mock: ticket chips New -> In progress -> Resolved (8s loop, flows toward inline-end) */
.tf-board { position: relative; padding: 12px; }
.tf-cols, .tf-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tf-col {
  background: var(--fs-color-neutral-100);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}
.tf-head { display: flex; align-items: center; gap: 6px; height: 18px; }
.tf-head svg { width: 14px; height: 14px; flex: none; max-width: none; }
.tf-head b { display: block; flex: 1; height: 6px; border-radius: 3px; background: currentColor; opacity: 0.3; }
.tf-new { color: var(--fs-color-neutral-500); }
.tf-prog { color: #1a7f8a; }
.tf-done { color: var(--fs-color-success); }
.tf-slot { height: 46px; border: 1px dashed var(--fs-color-neutral-300); border-radius: 6px; }
.tf-chips { position: absolute; inset: 12px; pointer-events: none; align-content: start; padding-block-start: 34px; }
.tf-chip {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  margin-inline: 8px;
  margin-block-end: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--fs-color-border);
  border-radius: 6px;
  box-shadow: 0 6px 14px -8px rgba(11, 31, 58, 0.4);
}
.tf-chip .chip { width: 22px; height: 22px; border-radius: 6px; background: var(--fs-color-accent-muted); flex: none; }
.tf-chip .lines { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.tf-chip .lines i { display: block; height: 6px; border-radius: 3px; background: var(--fs-color-neutral-200); }
.tf-chip .lines i:first-child { background: var(--fs-color-neutral-300); }
.tf-chip-0 { grid-row: 1; }
.tf-chip-1 { grid-row: 2; }
.tf-chip-2 { grid-row: 3; }
/* static (no-JS / reduced-motion): chips sit one per column so the flow reads in a still frame */
.tf-chip-1 { transform: translateX(calc(var(--dir) * (100% + 24px))); }
.tf-chip-2 { transform: translateX(calc(var(--dir) * (200% + 48px))); }
@keyframes tfFlow {
  0%   { transform: translateX(0); opacity: 0; }
  8%   { opacity: 1; }
  26%  { transform: translateX(0); }
  36%  { transform: translateX(calc(var(--dir) * (100% + 24px))); }
  58%  { transform: translateX(calc(var(--dir) * (100% + 24px))); }
  68%  { transform: translateX(calc(var(--dir) * (200% + 48px))); }
  88%  { transform: translateX(calc(var(--dir) * (200% + 48px))); opacity: 1; }
  96%  { transform: translateX(calc(var(--dir) * (200% + 48px))); opacity: 0; }
  100% { transform: translateX(0); opacity: 0; }
}
.fs-ambient .tf-chip { animation: tfFlow 8s var(--ease-inout) infinite; animation-delay: calc(var(--i, 0) * -2.67s); }
.fs-ambient .tf-chip-1 { --i: 1; }
.fs-ambient .tf-chip-2 { --i: 2; }

/* Draft product mock: schedule bars + flight-path line drawing (8s loop) */
.az-body { padding: 14px; display: grid; gap: 14px; }
.az-rows { display: grid; gap: 8px; }
.az-row { position: relative; display: block; height: 12px; border-radius: 6px; background: var(--fs-color-neutral-100); }
.az-row i {
  position: absolute;
  inset-block: 0;
  inset-inline-start: var(--o);
  width: var(--w);
  border-radius: 6px;
  background: var(--fs-color-accent);
  transform-origin: left;
}
html[dir="rtl"] .az-row i { transform-origin: right; }
.az-row-1 i, .az-row-3 i { background: #1d4ed8; opacity: 0.85; }
.az-flight { width: 100%; height: auto; max-width: none; background: var(--fs-color-neutral-50); border-radius: 8px; }
html[dir="rtl"] .az-flight { transform: scaleX(-1); } /* time axis + path flow toward inline-end; no text inside */
.az-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes azDraw {
  0%   { stroke-dashoffset: 1; opacity: 1; }
  58%  { stroke-dashoffset: 0; }
  88%  { stroke-dashoffset: 0; opacity: 1; }
  96%  { stroke-dashoffset: 0; opacity: 0; }
  100% { stroke-dashoffset: 1; opacity: 0; }
}
@keyframes azEnd { 0%, 54% { opacity: 0; } 62%, 88% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes azBar { 0%, 6% { transform: scaleX(0); } 30%, 88% { transform: scaleX(1); } 96%, 100% { transform: scaleX(0); } }
.fs-ambient .az-draw { animation: azDraw 8s var(--ease-inout) infinite; }
.fs-ambient .az-end { animation: azEnd 8s var(--ease-inout) infinite; }
.fs-ambient .az-row i { animation: azBar 8s var(--ease-out) infinite; }
.fs-ambient .az-row-1 i { animation-delay: -0.4s; }
.fs-ambient .az-row-2 i { animation-delay: -0.8s; }
.fs-ambient .az-row-3 i { animation-delay: -1.2s; }

@media (min-width: 900px) {
  .page-hero-product .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: var(--fs-space-8); }
}
.page-hero-product .hero-grid { display: grid; gap: var(--fs-space-6); align-items: center; }
.page-hero-product .hero-visual-product { max-width: 440px; width: 100%; }

/* ---------- Trust figure ---------- */
.trust-icon[data-countup] { font-variant-numeric: tabular-nums; }

/* ---------- Reduced motion: everything static, hover = colour/shadow only ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* the mascot/band follow flow-mascot.css: static unless the visitor opts in with the Play button (.is-optin) */
  *:not(.is-optin *), *:not(.is-optin *)::before, *:not(.is-optin *)::after { animation: none !important; }
  .offer-card:hover, .offer-card:focus-within { transform: none; }
  .offer-card::after { transition: none; }
  .tilt-card { transform: none !important; }
  [data-reveal] { opacity: 1 !important; translate: none !important; }
}
/* Touch / coarse pointers: no tilt */
@media not all and (hover: hover) and (pointer: fine) {
  .tilt-card { transform: none !important; }
}

/* Language: each language is its own pre-rendered URL (EN default at /, HE at /he/); no first-paint hold needed. */

/* Balanced headings (avoids single-word orphans, e.g. EN 390 hero) */
h1, h2 { text-wrap: balance; }

/* About: single management card (one leader) - full width on mobile, comfortable measure on larger screens */
.who-grid.who-grid-single { grid-template-columns: 1fr; max-width: 44rem; }
