/* ==========================================================================
   Process film — components/marketing/ProcessFilm.tsx.

   A short looping film of a site being designed in Figma, written as code
   and going live, beside three captions. Loaded per page through
   ServicePageData.extraStyles on the web-design pages, and through the
   styles list on /custom-web-design-and-development/. The section header
   uses offer.css (.ofr__eyebrow, .ofr__h2, .ofr__lead), which every one of
   those pages already loads; this sheet owns the frame and the steps.

   NAMESPACE. `pfm-`. The palette is declared here with fallbacks rather than
   inherited from .svcd-section, because /architected-websites/ and the
   custom-web-design page do not load service-devices.css and the section
   has to look the same everywhere.

   THE FRAME is the site's "ours" panel (service-devices.css, .svcd-panel:
   a lit purple panel means ours) with the mat padding of .svcd-frame,
   reproduced under this namespace for the same reason the palette is.

   ALSO HERE. The film as a hero backdrop (.pfm-hero) and the frame on its
   own beside another section's copy (.pfm__inner--head, .pfm-stack).

   MOTION CONTRACT. Everything ships finished. From-states live only behind
   html.has-motion, which motion.js adds solely under
   prefers-reduced-motion: no-preference. .is-in is set on [data-stage] by
   motion.js, with an IntersectionObserver fallback in offer.js. The video is
   decoration: under reduced motion it is hidden and the poster frame stays.
   ========================================================================== */

/* On the frame and the backdrop as well as the section, because both are
   also used on their own inside other pages' sections. */
.pfm,
.pfm__frame,
.pfm-hero {
  --surface-2: #101018;
  --card-border: #1a1a24;
  --purple: #6119ac;
  --purple-light: #8b5cf6;
  --purple-border: rgba(139, 92, 246, 0.22);
  --text-primary: #ffffff;
  --text-body: #e8e8f0;
  --text-secondary: #a1a1b5;
  --text-muted: #8a8a95;
}

/* --- Layout ------------------------------------------------------------------
   Copy on the left, the film on the right and wider, since a 16:9 frame needs
   the width to read. Stacks at the same breakpoint as the other two-column
   bands on these pages (.mwd-reveal__inner, .lwd-story__inner). */

.pfm__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

@media (max-width: 980px) {
  .pfm__inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- The frame --------------------------------------------------------------- */

.pfm__frame {
  position: relative;
  margin: 0;
  padding: clamp(0.6rem, 1.4vw, 1rem);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-lg, 10px);
  background: radial-gradient(120% 120% at 50% 0%, rgba(97, 25, 172, 0.22), transparent 60%),
    var(--surface-2);
  box-shadow: 0 20px 60px rgba(97, 25, 172, 0.18);
  overflow: hidden;
}

.pfm__frame::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}

.pfm__screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius, 4px);
  background: #000;
}

.pfm__screen img,
.pfm__screen video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pfm__caption {
  margin: 0.85rem 0 0;
  font-size: var(--step--2);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 52ch;
}

/* --- The three steps ---------------------------------------------------------
   Numbered rows under the lead, hairline-ruled like the comparison rows. */

.pfm__steps {
  margin: var(--sp-4) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--card-border);
}

.pfm__step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--card-border);
}

.pfm__num {
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 700;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--purple-light);
  padding-top: 0.2em;
}

.pfm__step-title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 700;
  font-size: var(--step-0);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.pfm__step-body {
  margin: 0.3rem 0 0;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-secondary);
}

/* --- Motion ------------------------------------------------------------------ */

.has-motion .pfm__step {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) var(--fd, 0s),
    transform 0.7s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) var(--fd, 0s);
}

.has-motion .pfm__steps.is-in .pfm__step {
  opacity: 1;
  transform: none;
}

/* --- Beside another section's copy ----------------------------------------
   RecentWork on the homepage puts the frame beside its own header, using the
   same split as .pfm__inner; the gallery follows underneath at full width. */

.pfm__inner--head {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

/* Medspa OS, "A website that looks like your craft": the film sits above the
   search-result card in the visual column. */
.pfm-stack {
  display: grid;
  gap: var(--sp-3, 1.5rem);
}

/* The search card under it is the v1 page's 24px card; the frame follows it
   there so the two read as one column. */
.mos-v1 .pfm-stack .pfm__frame {
  border-radius: 24px;
}

.mos-v1 .pfm-stack .pfm__screen {
  border-radius: 14px;
}

/* --- Hero backdrop -------------------------------------------------------------
   The film full bleed behind a ServicePage hero and the fixed nav. The same
   device as .lwd-hero-bg (local-web-design.css), rebuilt here because the
   hub and the med spa page do not load that sheet, and keyed on the hero
   having this backdrop so no other hero changes. */

.svc-hero:has(.pfm-hero) {
  isolation: isolate;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-height: 760px) {
  .svc-hero:has(.pfm-hero) {
    min-height: 0;
  }
}

.pfm-hero {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #0a0a0f;
}

.pfm-hero img,
.pfm-hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 50%;
  opacity: 0.7;
  -webkit-mask-image: linear-gradient(180deg, #000 86%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 86%, transparent 100%);
}

/* Protects the copy column: near-opaque behind the headline, thinning to the
   right where the monitor sits in every shot. */
.pfm-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 10, 15, 0.55), transparent 30%, transparent 70%, rgba(10, 10, 15, 0.6)),
    linear-gradient(
      100deg,
      rgba(10, 10, 15, 0.94) 30%,
      rgba(10, 10, 15, 0.84) 62%,
      rgba(10, 10, 15, 0.5)
    );
}

/* heroMedia renders inside .svc-hero__inner, the centred column. Making the
   inner static hands the containing block back to the full-width hero; the
   copy and the stat rail then take their own layer. */
.svc-hero:has(.pfm-hero) .svc-hero__inner {
  position: static;
}

.svc-hero:has(.pfm-hero) .svc-hero__lead,
.svc-hero:has(.pfm-hero) .svc-stats {
  position: relative;
  z-index: 2;
}

/* On a phone the hero is mostly headline over the film, so the film is
   quieter and the wash even. */
@media (max-width: 640px) {
  .pfm-hero img,
  .pfm-hero video {
    opacity: 0.4;
  }
  .pfm-hero::after {
    background: rgba(10, 10, 15, 0.8);
  }
}

/* A looping film is decoration. Hold the poster frame instead. */
@media (prefers-reduced-motion: reduce) {
  .pfm__screen video,
  .pfm-hero video {
    display: none;
  }
}
