/* How It Works (process.html): layout and motion (docs/design-atmosphere.md).
 * The journey reads as a climb: a rail fills as the visitor scrolls, each phase lights its marker as it is
 * reached, and each phase opens on a picture from the same mountain world as the homepage. A full-bleed
 * interlude holds the page's one promise and lights it word by word. Colours are tokens from
 * css/falmera-palette.css. Motion runs only when js/falmera-process.js adds .fm-proc-live (JavaScript and
 * motion allowed); without it every picture, word and marker is simply shown. Moving properties are
 * opacity, translate, scale and clip-path. */

/* ── Hero ──────────────────────────────────────────────────────────────── */
.fm-process .fm-page-hero { position: relative; overflow: clip; }
.fm-process .fm-hero-split__media { position: relative; border-radius: 28px; box-shadow: 0 40px 80px -40px rgb(58 34 54 / 0.45); }
.fm-process .fm-hero-split__media img { object-position: 50% 62%; }
@media (prefers-reduced-motion: no-preference) {
  /* The picture settles in on arrival; the scale leaves room for the shared parallax. */
  .fm-process .fm-hero-split__media img { scale: 1.1; animation: fm-proc-settle 2.4s var(--at-ease) both; }
  @keyframes fm-proc-settle { from { scale: 1.24; } to { scale: 1.1; } }
}

/* ── The journey ──────────────────────────────────────────────────────── */
.fm-process #journey { background: linear-gradient(180deg, var(--at-porcelain) 0%, var(--at-rose-mist) 55%, var(--at-blush) 100%); }
.fm-process .fm-phases { position: relative; gap: clamp(3.5rem, 2.5rem + 4vw, 7rem); }
.fm-phase__body { display: grid; gap: var(--fm-space-5); min-width: 0; }

/* Each phase opens on its picture. */
.fm-phase__media {
  position: relative; margin: 0; overflow: hidden; border-radius: 24px;
  aspect-ratio: 16 / 10; background: var(--at-blush);
  box-shadow: 0 34px 70px -40px rgb(58 34 54 / 0.5);
}
@media (min-width: 768px) { .fm-phase__media { aspect-ratio: 21 / 9; } }
.fm-phase__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fm-phase__media--discover img { object-position: 50% 62%; }
.fm-phase__media--propose img { object-position: 50% 72%; }
.fm-phase__media--build img { object-position: 50% 55%; }
.fm-phase__media--launch img { object-position: 50% 40%; }

/* The rail and the phase markers. On desktop the labels sit in their own column beside the rail; on phones and
   tablets the rail runs down the left edge of the phases, with each marker beside its label. */
.fm-journey__rail {
  display: block; position: absolute; left: 7px; top: 0.75rem; bottom: 0; width: 2px; border-radius: 2px;
  background: rgb(var(--fm-navy-rgb) / 0.12); pointer-events: none;
}
.fm-journey__rail i {
  position: absolute; inset: 0 0 auto; height: calc(var(--journey-p, 1) * 100%); border-radius: inherit;
  background: linear-gradient(180deg, var(--at-action), var(--at-violet) 35%, var(--at-rose) 70%, var(--at-coral));
}
/* The light that leads the climb. */
.fm-journey__rail i::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; translate: -50% 0;
  border-radius: 50%; background: var(--at-snow);
  box-shadow: 0 0 0 4px rgb(118 82 193 / 0.22), 0 0 22px 6px rgb(246 148 119 / 0.55);
}
.fm-process .fm-phase__label::before {
  content: ""; position: absolute; left: 0; top: 0.1rem; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--at-violet); background: var(--at-violet); box-shadow: 0 0 0 6px rgb(118 82 193 / 0.14);
  transition: background-color 500ms var(--at-ease), border-color 500ms var(--at-ease), box-shadow 500ms var(--at-ease), scale 500ms var(--at-ease);
}
.fm-proc-live .fm-phase:not(.is-reached) .fm-phase__label::before {
  background: var(--at-porcelain); border-color: rgb(var(--fm-navy-rgb) / 0.22); box-shadow: none; scale: 0.8;
}
@media (max-width: 1023px) {
  .fm-process .fm-phase { padding-left: 2.25rem; }
  .fm-process .fm-phase__label { position: relative; }
  .fm-process .fm-phase__label::before { left: -2.25rem; }
}
@media (min-width: 1024px) {
  .fm-process .fm-phase__label {
    position: sticky; top: calc(var(--fm-header-h) + 2.5rem); align-self: start; padding-left: 2.5rem;
  }
  .fm-process .fm-phase__label h3 { font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.25rem); letter-spacing: -0.035em; font-weight: 500; }
}

/* Step cards: a little more air, numbers set large and quiet. */
.fm-process .fm-step-card__num { font-size: 1.125rem; letter-spacing: -0.02em; }

@media (prefers-reduced-motion: no-preference) {
  /* The picture opens from a smaller window and settles; the image drifts slower than the page. */
  .fm-proc-live .fm-phase__media {
    clip-path: inset(12% 9% 12% 9% round 24px);
    transition: clip-path 1.5s var(--at-ease);
  }
  .fm-proc-live .fm-phase__media img {
    scale: 1.32; translate: 0 var(--py, 0px);
    transition: scale 2.2s var(--at-ease);
  }
  .fm-proc-live .fm-phase__media.is-unveiled { clip-path: inset(0 0 0 0 round 24px); }
  .fm-proc-live .fm-phase__media.is-unveiled img { scale: 1.14; }
}
@media (prefers-reduced-motion: no-preference) {
  /* Phases ahead of the climb wait a little quieter until the rail reaches them. */
  .fm-proc-live .fm-phase__label h3 { transition: opacity 600ms var(--at-ease); }
  .fm-proc-live .fm-phase:not(.is-reached) .fm-phase__label h3 { opacity: 0.55; }
}

/* ── The interlude: one route, agreed up front ─────────────────────────── */
.fm-trail { position: relative; background: var(--at-blush); }
.fm-trail__stage {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: min(92svh, 58rem); display: flex; align-items: flex-start;
}
.fm-trail__media { position: absolute; inset: 0; z-index: -1; margin: 0; }
.fm-trail__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 70%; }
/* Soft edges into the neighbouring sections, and a light veil under the words. */
.fm-trail__media::before, .fm-trail__media::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.fm-trail__media::before {
  background: linear-gradient(180deg, var(--at-blush) 0%, rgb(246 211 200 / 0) 22%, rgb(247 239 234 / 0) 62%, rgb(247 239 234 / 0.55) 84%, var(--at-porcelain) 100%);
}
.fm-trail__media::after {
  background: radial-gradient(70% 60% at 22% 26%, rgb(251 241 236 / 0.62), rgb(251 241 236 / 0) 70%);
}
.fm-trail__copy { position: relative; padding-block: calc(var(--fm-header-h) + clamp(3rem, 2rem + 6svh, 6rem)) 4rem; }
.fm-trail__copy .fm-eyebrow { margin-bottom: var(--fm-space-4); color: var(--at-label); }
.fm-trail__title {
  margin: 0; max-width: 15ch; color: var(--at-ink); text-wrap: balance;
  font-size: clamp(2.25rem, 1.3rem + 3.6vw, 4.75rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1.02;
}
@media (max-width: 767px) {
  .fm-trail__media img { object-position: 64% 70%; }
  .fm-trail__media::after { background: radial-gradient(120% 55% at 30% 22%, rgb(251 241 236 / 0.7), rgb(251 241 236 / 0) 75%); }
}

@media (prefers-reduced-motion: no-preference) {
  /* The stage holds while the words light and the trail settles; scrolling stays native. */
  .fm-proc-live .fm-trail { height: 175svh; }
  .fm-proc-live .fm-trail__stage { position: sticky; top: 0; height: 100svh; min-height: 0; }
  .fm-proc-live .fm-trail__media img {
    scale: calc(1.2 - var(--tp, 0) * 0.14);
    translate: 0 calc(var(--tp, 0) * -2.5%);
  }
  .fm-proc-live .fm-trail__copy { translate: 0 calc((1 - var(--tp, 0)) * 3svh); }
  .fm-proc-live .fm-trail__title {
    --lt: clamp(0, calc((var(--tp, 0) - 0.06) / 0.5), 1);
  }
  .fm-proc-live .fm-trail__title .fm-word {
    --w: clamp(0, calc(var(--lt) * var(--n) - var(--i)), 1);
    opacity: calc(0.22 + var(--w) * 0.78);
  }
}

/* ── Commitments: a quiet lift on hover ───────────────────────────────── */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .fm-process #commitments .fm-feature { transition: translate 500ms var(--at-ease), box-shadow 500ms var(--at-ease); }
  .fm-process #commitments .fm-feature:hover { translate: 0 -4px; box-shadow: 0 24px 48px -28px rgb(58 34 54 / 0.4); }
  .fm-process #commitments .fm-feature .fm-card__icon { transition: scale 500ms var(--at-ease), rotate 500ms var(--at-ease); }
  .fm-process #commitments .fm-feature:hover .fm-card__icon { scale: 1.08; rotate: -6deg; }
}
