/* About (about.html): layout and motion (docs/design-atmosphere.md).
 * The page reads as a visit: a worktable on a terrace above the clouds (the hero), the studio itself (who we
 * are), a story in three chapters with one picture that changes as each chapter is read, a dusk band for the
 * mission and vision whose words light as they are read, five values each with its own still life, and the
 * founder's note (the shared component in css/falmera-home-partners.css). Colours are tokens from
 * css/falmera-palette.css. Moving states run only when js/falmera-about.js adds .fm-about-live (JavaScript and
 * motion allowed); without it every picture and word is simply shown. */

/* ── Hero: the studio above the clouds ─────────────────────────────────── */
.fm-about-hero.fm-page-hero {
  position: relative; isolation: isolate; overflow: clip;
  padding: 0; background: var(--at-porcelain);
  display: flex; flex-direction: column;
  margin-top: calc(-1 * var(--fm-header-h));
}
.fm-about-hero__media { position: relative; order: 2; overflow: hidden; aspect-ratio: 5 / 4; background: var(--at-blush); }
.fm-about-hero__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 82% 62%; }
.fm-about-hero__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, var(--at-porcelain) 0%, rgb(247 239 234 / 0) 22%),
    linear-gradient(0deg, var(--at-porcelain) 0%, rgb(247 239 234 / 0) 16%);
}
.fm-about-hero__inner { order: 1; padding-block: calc(var(--fm-header-h) + clamp(1.5rem, 1rem + 2vw, 2.5rem)) var(--fm-space-4); }
.fm-about-hero .fm-about-hero__copy { max-width: 40rem; gap: var(--fm-space-5); }
.fm-about-hero .fm-h1 { text-wrap: balance; }
.fm-about-hero .fm-stats--facts { margin: var(--fm-space-2) 0 0; }
.fm-about-hero .fm-stat { background: rgb(252 246 242 / 0.78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (max-width: 1023px) {
  .fm-about-hero .fm-stats--facts { gap: 0.6rem; }
  .fm-about-hero .fm-stat { padding: 0.85rem 1rem; border-radius: 16px; }
  .fm-about-hero .fm-stats--facts dd { font-size: 1.0625rem; }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .fm-about-hero__media { aspect-ratio: 16 / 10; }
  .fm-about-hero__media img { object-position: 70% 60%; }
}
@media (min-width: 1024px) {
  .fm-about-hero.fm-page-hero { display: grid; align-items: center; min-height: clamp(40rem, 100svh, 62rem); }
  .fm-about-hero__media { position: absolute; inset: 0; aspect-ratio: auto; z-index: -1; }
  .fm-about-hero__media img { object-position: 66% 60%; }
  .fm-about-hero__media::after {
    background:
      linear-gradient(90deg, rgb(247 239 234 / 0.9) 0%, rgb(247 239 234 / 0.74) 30%, rgb(247 239 234 / 0.2) 50%, rgb(247 239 234 / 0) 60%),
      linear-gradient(0deg, var(--at-porcelain) 0%, rgb(247 239 234 / 0) 16%);
  }
  .fm-about-hero__inner { padding-block: calc(var(--fm-header-h) + 3rem) 5rem; width: 100%; }
  .fm-about-hero .fm-about-hero__copy { max-width: min(37rem, 46vw); }
  .fm-about-hero .fm-stats--facts { grid-template-columns: repeat(4, auto); max-width: none; justify-content: start; }
}
/* Phones and tablets: the picture fills the hero behind the copy, as on desktop. The sharp picture holds the lower
   part with the worktable in view; above it a soft blur of the same picture carries the sky up behind the copy. */
@media (max-width: 1023px) {
  .fm-about-hero.fm-page-hero { min-height: max(100svh, 48rem); }
  .fm-about-hero__media { position: absolute; inset: 0; aspect-ratio: auto; z-index: -1; }
  .fm-about-hero__media::before {
    content: ""; position: absolute; inset: -8%;
    background: url("../assets/img/about/studio-960.webp") 60% 0 / cover no-repeat;
    filter: blur(26px) saturate(1.05);
  }
  .fm-about-hero__media img {
    position: absolute; inset: auto 0 0 0; height: max(58%, 25rem); object-position: 72% 62%;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24%); mask-image: linear-gradient(180deg, transparent 0, #000 24%);
  }
  .fm-about-hero__media::after {
    background:
      linear-gradient(180deg, rgb(247 239 234 / 0.9) 0%, rgb(247 239 234 / 0.66) 36%, rgb(247 239 234 / 0) 58%),
      linear-gradient(0deg, var(--at-porcelain) 0%, rgb(247 239 234 / 0) 12%);
  }
  .fm-about-hero__inner { padding-bottom: max(34svh, 16rem); }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .fm-about-hero__media img { object-position: 66% 60%; }
}

/* ── Who we are: copy beside the studio ───────────────────────────────── */
.fm-about-who__grid { display: grid; gap: clamp(2rem, 1rem + 3vw, 4.5rem); align-items: center; }
.fm-about-who__copy { display: grid; gap: var(--fm-space-5); }
.fm-about-who__copy > * { margin: 0; }
.fm-about-who__media {
  position: relative; margin: 0; overflow: hidden; border-radius: 28px; aspect-ratio: 4 / 3; background: var(--at-blush);
  box-shadow: 0 40px 80px -44px rgb(58 34 54 / 0.5);
}
.fm-about-who__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 1024px) { .fm-about-who__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }

/* ── Our story: three chapters ─────────────────────────────────────────── */
.fm-story { background: linear-gradient(180deg, var(--at-porcelain) 0%, var(--at-rose-mist) 50%, var(--at-porcelain) 100%); }
.fm-story__grid { display: grid; gap: clamp(2.5rem, 1.5rem + 3vw, 4rem); margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.fm-story__stage { display: none; }
.fm-story__chapters { display: grid; gap: clamp(3rem, 2rem + 4vw, 5rem); }
.fm-chapter { display: grid; gap: var(--fm-space-5); }
.fm-chapter__media {
  margin: 0; overflow: hidden; border-radius: 24px; aspect-ratio: 1; background: var(--at-blush);
  box-shadow: 0 34px 70px -40px rgb(58 34 54 / 0.5);
}
.fm-chapter__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.fm-chapter__copy { display: grid; gap: var(--fm-space-4); max-width: 38rem; }
.fm-chapter__copy > * { margin: 0; }
.fm-chapter__num {
  display: flex; align-items: center; gap: 0.75rem;
  font: 500 var(--fm-text-xs)/1.4 var(--fm-font-mono); letter-spacing: var(--fm-tracking-label); text-transform: uppercase; color: var(--at-label);
}
.fm-chapter__num span {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 1.5px solid rgb(118 82 193 / 0.45); color: var(--at-action-ink); background: var(--at-shell);
}
.fm-chapter__title { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.75rem); letter-spacing: -0.03em; line-height: 1.1; color: var(--at-ink); }
.fm-chapter .fm-body-copy { font-size: var(--fm-text-lg); line-height: 1.7; color: var(--at-ink-muted); }

/* The one picture that changes as each chapter is read: beside the chapters on desktop, pinned under the header
   on phones and tablets while the chapters scroll beneath it. */
.fm-story__stage {
  display: block; position: sticky; overflow: hidden; background: var(--at-blush);
}
.fm-story__frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; opacity: 0; }
.fm-story__frame:first-child,
.fm-story__stage.is-driven .fm-story__frame.is-on { opacity: 1; }
.fm-story__stage.is-driven .fm-story__frame:first-child:not(.is-on) { opacity: 0; }
.fm-story__progress {
  position: absolute; left: 1.5rem; right: 1.5rem; bottom: 1.5rem; height: 3px; border-radius: 3px;
  background: rgb(255 255 255 / 0.4); overflow: hidden;
}
.fm-story__progress i {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--sp, 1) * 100%); border-radius: inherit;
  background: linear-gradient(90deg, var(--at-action), var(--at-violet) 50%, var(--at-coral));
}
.fm-chapter__media { display: none; }
@media (max-width: 1023px) {
  .fm-story { --stage-h: clamp(15rem, 42svh, 26rem); }
  .fm-story__grid { grid-template-columns: minmax(0, 1fr); }
  .fm-story__stage, .fm-story__chapters { grid-area: 1 / 1; }
  .fm-story__stage {
    top: var(--fm-header-h); z-index: 2; align-self: start; height: var(--stage-h);
    margin-inline: calc(-1 * var(--fm-gutter)); border-radius: 0 0 28px 28px;
    box-shadow: 0 30px 60px -36px rgb(58 34 54 / 0.55);
  }
  .fm-story__frame { object-position: 50% 50%; }
  .fm-story__chapters { padding-top: calc(var(--stage-h) + 2rem); }
  .fm-chapter { min-height: 58svh; align-content: start; }
}
@media (min-width: 1024px) {
  .fm-story__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; column-gap: clamp(3rem, 2rem + 3vw, 6rem); }
  .fm-story__stage {
    top: calc(var(--fm-header-h) + 6svh);
    height: min(80svh, 48rem); border-radius: 28px;
    box-shadow: 0 50px 100px -50px rgb(58 34 54 / 0.55);
  }
  .fm-chapter { min-height: 72svh; align-content: center; }
}

/* ── Mission and vision: dusk over the range ──────────────────────────── */
.fm-about-mission { position: relative; isolation: isolate; overflow: clip; background: var(--at-night); padding-bottom: clamp(9rem, 6rem + 12vw, 18rem); }
.fm-about-mission__sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.fm-about-mission__sky img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.fm-about-mission__sky::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, var(--at-night) 0%, rgb(33 28 41 / 0) 30%),
    linear-gradient(0deg, var(--at-porcelain) 0%, rgb(247 239 234 / 0.55) 4%, rgb(247 239 234 / 0) 11%);
}
.fm-about-mission .fm-statement__label { color: var(--at-ember); }
.fm-about-mission .fm-statement__text { color: var(--at-snow); }

/* ── Values: five still lifes ─────────────────────────────────────────── */
.fm-about .fm-about-values { border-top: 0; display: grid; gap: 1.25rem; margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.fm-about .fm-about-values > li {
  display: flex; flex-direction: column; gap: 0; padding: 0; border: 0; overflow: hidden;
  border-radius: 24px; background: var(--at-shell); box-shadow: 0 30px 60px -44px rgb(58 34 54 / 0.45);
}
.fm-value__media { margin: 0; overflow: hidden; aspect-ratio: 4 / 3; background: var(--at-blush); }
.fm-value__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fm-value__copy { display: grid; gap: 0.6rem; padding: 1.4rem 1.5rem 1.6rem; }
.fm-value__copy > * { margin: 0; }
.fm-value__num { font: 500 var(--fm-text-xs)/1.4 var(--fm-font-mono); letter-spacing: var(--fm-tracking-label); color: var(--at-label); }
.fm-about .fm-about-values h3 { font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.75rem); }
@media (min-width: 640px) { .fm-about .fm-about-values { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .fm-about .fm-about-values { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .fm-about .fm-about-values > li { grid-column: span 2; }
  .fm-about .fm-about-values > li:nth-child(n+4) { grid-column: span 3; }
  .fm-about .fm-about-values > li:nth-child(n+4) .fm-value__media { aspect-ratio: 2 / 1; }
}
@media (hover: hover) {
  .fm-value__media img { transition: scale 900ms var(--at-ease); }
  .fm-about-values > li:hover .fm-value__media img { scale: 1.05; }
}

/* ── Motion (only with .fm-about-live) ────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: the picture settles in, then drifts slower than the page as it scrolls away; the copy rises in. */
  .fm-about-live .fm-about-hero__media img {
    translate: 0 calc(var(--hv, 0) * 9%);
    animation: fm-about-settle 2.6s var(--at-ease) both;
  }
  @keyframes fm-about-settle { from { scale: 1.12; } to { scale: 1; } }
  .fm-about-live .fm-about-hero__copy > * { animation: fm-about-rise 1s var(--at-ease) both; }
  .fm-about-live .fm-about-hero__copy > :nth-child(2) { animation-delay: 120ms; }
  .fm-about-live .fm-about-hero__copy > :nth-child(3) { animation-delay: 260ms; }
  .fm-about-live .fm-about-hero__copy > :nth-child(4) { animation-delay: 420ms; }
  @keyframes fm-about-rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

  /* Pictures open from a smaller window, then drift slower than the page. */
  .fm-about-live :is(.fm-about-who__media, .fm-chapter__media) {
    clip-path: inset(10% 8% 10% 8% round 28px); transition: clip-path 1.5s var(--at-ease);
  }
  .fm-about-live :is(.fm-about-who__media, .fm-chapter__media) img { scale: 1.26; translate: 0 var(--py, 0px); transition: scale 2.2s var(--at-ease); }
  .fm-about-live :is(.fm-about-who__media, .fm-chapter__media).is-unveiled { clip-path: inset(0 0 0 0 round 28px); }
  .fm-about-live :is(.fm-about-who__media, .fm-chapter__media).is-unveiled img { scale: 1.1; }
  .fm-about-live .fm-about-who__copy > * { transition: opacity 800ms var(--at-ease), translate 900ms var(--at-ease); }
  .fm-about-live .fm-about-who__copy:not(.is-unveiled) > * { opacity: 0; translate: 0 18px; }
  .fm-about-live .fm-about-who__copy > :nth-child(2) { transition-delay: 100ms; }
  .fm-about-live .fm-about-who__copy > :nth-child(3) { transition-delay: 200ms; }
  .fm-about-live .fm-about-who__copy > :nth-child(4) { transition-delay: 300ms; }

  /* Story: the picture crossfades between chapters; the chapter being read is the bright one. */
  .fm-story__frame { transition: opacity 1.1s var(--at-ease), scale 2.4s var(--at-ease); }
  .fm-about-live .fm-story__frame { scale: 1.08; }
  .fm-about-live .fm-story__frame.is-on { scale: 1; }
  /* The chapter being read is the bright one; the number badge stays at full strength so it always reads. */
  .fm-about-live .fm-chapter__copy { transition: translate 900ms var(--at-ease); }
  .fm-about-live .fm-chapter__copy > :not(.fm-chapter__num) { transition: opacity 700ms var(--at-ease); }
  .fm-about-live .fm-chapter:not(.is-active) .fm-chapter__copy { translate: 0 10px; }
  .fm-about-live .fm-chapter:not(.is-active) .fm-chapter__copy > :not(.fm-chapter__num) { opacity: 0.38; }
  .fm-about-live .fm-chapter:focus-within .fm-chapter__copy { translate: 0 0; }
  .fm-about-live .fm-chapter:focus-within .fm-chapter__copy > * { opacity: 1; }
  .fm-about-live .fm-chapter__num span { transition: background-color 600ms var(--at-ease), color 600ms var(--at-ease), border-color 600ms var(--at-ease); }
  .fm-about-live .fm-chapter.is-active .fm-chapter__num span { background: var(--at-violet); border-color: var(--at-violet); color: var(--at-snow); }

  /* Mission and vision: the sky drifts; each statement lights word by word as it is read. */
  .fm-about-live .fm-about-mission__sky img { translate: 0 var(--my, 0px); scale: 1.12; }
  .fm-about-live [data-scroll-light] .fm-word {
    opacity: calc(0.3 + clamp(0, calc(var(--lp, 1) * var(--n) - var(--i)), 1) * 0.7);
  }

  /* Values: each still life settles as its card arrives. */
  .fm-about-live .fm-about-values > li .fm-value__media img { scale: 1.16; transition: scale 1.8s var(--at-ease); }
  .fm-about-live .fm-about-values > li.is-revealed .fm-value__media img { scale: 1; }
  @media (hover: hover) {
    .fm-about-live .fm-about-values > li.is-revealed:hover .fm-value__media img { scale: 1.05; transition-duration: 900ms; }
  }
}
