/* ==========================================================================
   Falmera motion layer: slow, soft and consistent across every public page.
   --------------------------------------------------------------------------
   - One curve: --fm-ease, cubic-bezier(0.22, 1, 0.36, 1) (falmera.css tokens).
   - Reveals run 600-1000ms; hovers and presses 200-400ms.
   - Only transform and opacity animate, so motion stays on the compositor.
   - Every animated rule sits behind prefers-reduced-motion: no-preference.
     Nothing is hidden unless JS is running (.fm-js is set by falmera-nav.js),
     so content always shows if a script fails.
   Behaviour lives in js/falmera-motion.js and js/falmera-nav.js.
   ========================================================================== */

/* ── Link underlines (colour-only fallback when motion is reduced) ──────── */
.fm-footer__list a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
}
.fm-footer__list a:hover, .fm-footer__list a:focus-visible { text-decoration: none; background-size: 100% 1px; }

/* ── Form micro-interactions: focus rings ease in, invalid fields are calm ─ */
.fm-input, .fm-select, .fm-textarea {
  transition: border-color var(--fm-dur) var(--fm-ease), box-shadow var(--fm-dur) var(--fm-ease), background-color var(--fm-dur) var(--fm-ease);
}
.fm .fm-input:focus-visible, .fm .fm-select:focus-visible, .fm .fm-textarea:focus-visible {
  box-shadow: 0 0 0 4px rgb(var(--fm-blue-rgb) / 0.14);
}
.fm-check input { transition: transform 200ms var(--fm-ease); }

@media (prefers-reduced-motion: no-preference) {
  /* Underlines draw from the left on hover. */
  .fm-footer__list a { transition: background-size 360ms var(--fm-ease), color 240ms var(--fm-ease); }
  .fm-hero__work-link { transition: color 280ms var(--fm-ease), text-underline-offset 280ms var(--fm-ease); }
  .fm-hero__work-link:hover { text-underline-offset: 8px; }
  .fm-hero__work-link span { display: inline-block; transition: transform 320ms var(--fm-ease); }
  .fm-hero__work-link:hover span { transform: translate(2px, -2px); }

  /* ── Buttons: gentle lift, soft press, glow shift ───────────────────── */
  .fm-btn {
    transition: transform 320ms var(--fm-ease), box-shadow 400ms var(--fm-ease),
      background-color 320ms var(--fm-ease), border-color 320ms var(--fm-ease), color 320ms var(--fm-ease);
  }
  .fm-btn:hover { transform: translateY(-2px); }
  .fm-btn:active { transform: translateY(0) scale(0.985); transition-duration: 120ms; }
  /* Primary CTA: the light sweep runs slower, and once after the hero entrance
     (.is-glint from falmera-motion.js) to draw the eye without looping. */
  .fm-btn--brand:is(:hover, :focus-visible)::after { animation: fm-sheen 900ms var(--fm-ease); }
  .fm-btn--brand.is-glint::after { animation: fm-sheen 1400ms var(--fm-ease) 1; }

  /* ── Cards: lift with a soft shadow shift ───────────────────────────── */
  @media (hover: hover) {
    /* Hover lift uses the independent `translate` property at zero
       specificity, so it never replaces the scroll-reveal transition. */
    :where(.fm-feature, .fm-values > li, .fm-statement, #integrations .fm-card) {
      transition: translate 380ms var(--fm-ease), box-shadow 380ms var(--fm-ease);
    }
    .fm-js :where(.fm-feature, .fm-values > li, .fm-statement, #integrations .fm-card)[data-reveal] {
      transition: opacity 900ms var(--fm-ease), transform 1000ms var(--fm-ease), translate 380ms var(--fm-ease), box-shadow 380ms var(--fm-ease);
      transition-delay: var(--fm-reveal-delay, 0ms), var(--fm-reveal-delay, 0ms), 0ms, 0ms;
    }
    :where(.fm-feature, .fm-values > li, .fm-statement, #integrations .fm-card):hover {
      translate: 0 -4px;
      box-shadow: 0 18px 40px -18px rgb(var(--fm-navy-rgb) / 0.28);
    }
    .fm-home-project__screen { transition: transform 400ms var(--fm-ease), box-shadow 400ms var(--fm-ease); }
    .fm-home-project__screen img { transition: transform 900ms var(--fm-ease); }
    .fm-home-project:hover .fm-home-project__screen { transform: translateY(-4px); box-shadow: 0 22px 48px -22px rgb(var(--fm-navy-rgb) / 0.35); }
    .fm-home-project:hover .fm-home-project__screen img { transform: scale(1.02); }
    .fm-benefit svg { transition: transform 360ms var(--fm-ease); }
    .fm-benefit:hover svg { transform: translateY(-2px) rotate(-4deg); }
    .fm-arrow-ring { transition: transform 320ms var(--fm-ease), background-color 320ms var(--fm-ease); }
  }

  /* ── FAQ and tabs ───────────────────────────────────────────────────── */
  .fm-faq__icon { transition: transform 400ms var(--fm-ease), background-color 300ms var(--fm-ease), color 300ms var(--fm-ease), border-color 300ms var(--fm-ease); }
  .fm-faq details[open] > p, .fm-faq details[open] > div { animation: fm-soft-rise 600ms var(--fm-ease) both; }
  .fm-tabs__tab { transition: background-color 300ms var(--fm-ease), color 300ms var(--fm-ease), box-shadow 300ms var(--fm-ease); }
  .fm-tabs__panel:not([hidden]) { animation: fm-soft-rise 600ms var(--fm-ease) both; }
  .fm-check input:active { transform: scale(0.9); }
  /* Form status messages arrive softly instead of popping in. */
  .fm-form [data-status]:not([hidden]), .fm-form-card__success:not([hidden]) { animation: fm-soft-rise 600ms var(--fm-ease) both; }

  /* ── Mobile menu: drops in, links follow in a short cascade ─────────── */
  .fm-header .fm-mobile-nav:not([hidden]) { animation: fm-menu-in 480ms var(--fm-ease) both; }
  .fm-header .fm-mobile-nav.is-closing { animation: fm-menu-out 260ms var(--fm-ease) both; pointer-events: none; }
  .fm-header .fm-mobile-nav:not([hidden]):not(.is-closing) :is(.fm-mobile-nav__list li, .fm-mobile-nav__actions) {
    animation: fm-soft-rise 560ms var(--fm-ease) both;
  }
  .fm-mobile-nav__list li:nth-child(2) { animation-delay: 40ms !important; }
  .fm-mobile-nav__list li:nth-child(3) { animation-delay: 80ms !important; }
  .fm-mobile-nav__list li:nth-child(4) { animation-delay: 120ms !important; }
  .fm-mobile-nav__list li:nth-child(5) { animation-delay: 160ms !important; }
  .fm-mobile-nav__list li:nth-child(6) { animation-delay: 200ms !important; }
  .fm-mobile-nav__actions { animation-delay: 240ms !important; }
  .fm-header .fm-nav-toggle__text { animation: none; }
  .fm-header .fm-nav-toggle[aria-expanded="true"] .fm-nav-toggle__open,
  .fm-header .fm-nav-toggle[aria-expanded="false"] .fm-nav-toggle__closed { animation: fm-fade 300ms var(--fm-ease) both; }

  /* ── Parallax depth (values written by falmera-motion.js) ───────────── */
  [data-parallax] { translate: 0 var(--fm-parallax, 0px); will-change: translate; }

  @keyframes fm-soft-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @keyframes fm-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes fm-menu-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }
  @keyframes fm-menu-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-8px) scale(0.985); } }
}
