/* Direction D "Scroll film" (2026-11-14, prototype). A pinned, scroll-scrubbed hero:
   the owner's drone clip plays with the scroll and three chapters (our own service copy)
   hand over as the camera rises past the chimney and down to the foundation.
   Without JS, GSAP, or with reduced motion / "Pause motion", .g-film is absent: the
   frame is the poster, the headline sits on it, and the chapters are a plain list. */

.film{background:var(--paper)}
.film-pin{position:relative;display:grid;grid-template-rows:auto auto}
.film-frame{position:relative;inset:auto;z-index:0;overflow:hidden;min-height:clamp(320px,58svh,760px);margin-inline:var(--edge);border-radius:var(--r-panel);background:var(--stucco)}
.film-poster,.film-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 45%}
.film-poster{animation:none!important}
.film-video{opacity:0}
.film-shade{position:absolute;inset:0;background:linear-gradient(180deg,rgb(22 22 20 / .22),transparent 28%);pointer-events:none}
.film-frame .c-measure{z-index:2}
.film-intro{position:relative;margin:calc(-1 * clamp(150px,22svh,230px)) auto 0 var(--edge);width:min(520px,calc(100% - 2 * var(--edge)));z-index:3;border-radius:0 var(--r-panel) 0 var(--r-panel)}
.film-intro h1{font-size:clamp(2.75rem,6.2vw,5.5rem)}
.film-chapters{list-style:none;margin:0;padding:28px var(--edge) 8px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(18px,3vw,48px)}
.film-chapter{border-top:1px solid var(--ink);padding-top:14px}
.film-chapter h2{font-size:clamp(1.5rem,2.4vw,2.1rem);margin:6px 0 10px}
.film-chapter p{color:var(--muted)}
.film-num{font-family:var(--mono);font-size:.78rem;letter-spacing:0;color:var(--faint)!important}
.film-num span{color:var(--chalk,#2753a3);font-weight:600}
.film-link{display:inline-flex;align-items:center;min-height:44px;margin-top:6px;color:var(--ink);font-weight:600;text-decoration:underline;text-underline-offset:4px}
.film-rail,.film-hint{display:none}
@media(max-width:767px){
  .film-frame{min-height:min(52svh,440px)}
  .film-intro{margin:-84px var(--edge) 0;width:auto;border-radius:0 var(--r-panel) 0 0}
  .film-chapters{grid-template-columns:1fr}
}

/* ---- Pinned film (only when the head script set .g-film and g-scroll.mjs is running) ---- */
/* v9: the pin is the full large viewport (lvh), so the iOS toolbar collapsing never exposes a gap */
.g-film .film-pin{display:block;height:100vh;height:100lvh;overflow:hidden;background:var(--ink,#161614)}
.g-film .film-frame{position:absolute;inset:0;min-height:0;margin:0;border-radius:0}
.g-film .film-poster,.g-film .film-video{object-position:60% 50%}
.g-film .film-video{transition:opacity .5s var(--ease-set,ease)}
.g-film .film-video.is-ready{opacity:1}
.g-film .film-intro{position:absolute;left:var(--edge);bottom:12px;margin:0;width:min(520px,calc(100% - 2 * var(--edge)));will-change:transform,opacity}
.g-film .film-chapters{position:absolute;z-index:5;inset:auto auto 12px var(--edge);display:block;width:min(520px,calc(100% - 2 * var(--edge)));padding:0;pointer-events:none}
.g-film .film-chapter{position:absolute;left:0;bottom:0;width:100%;padding:clamp(22px,2.6vw,38px);background:var(--paper);border-top:0;border-radius:0 var(--r-panel) 0 var(--r-panel);opacity:0;visibility:hidden}
.g-film .film-chapter>*{will-change:transform,opacity}
.g-film .film-chapter h2{font-size:clamp(2rem,3.6vw,3.2rem);margin:8px 0 12px}
.g-film .film-chapter .film-link{pointer-events:auto}
.g-film .film-rail{display:block;position:absolute;z-index:4;right:calc(var(--edge) + 18px);top:16%;bottom:16%;width:2px;background:rgb(255 255 255 / .42);pointer-events:none}
.g-film .film-rail-fill{position:absolute;inset:0;background:#fff;transform:scaleY(0);transform-origin:top}
.g-film .film-rail b{position:absolute;right:-5px;width:12px;height:2px;background:rgb(255 255 255 / .75)}
.g-film .film-rail b:nth-of-type(1){top:0}.g-film .film-rail b:nth-of-type(2){top:50%}.g-film .film-rail b:nth-of-type(3){top:100%}
.g-film .film-rail b.is-on{background:var(--chalk-light,#9fb8e6);right:-8px;width:18px}
.g-film .film-hint{display:block;position:absolute;z-index:4;right:calc(var(--edge) + 18px);bottom:28px;margin:0;color:#fff;font:600 .72rem/1 var(--mono);text-transform:uppercase;letter-spacing:.12em;text-shadow:0 1px 8px rgb(0 0 0 / .5)}
.g-film .film-hint::after{content:"";display:block;width:2px;height:28px;margin:8px 0 0 auto;background:#fff;transform-origin:top;animation:g-hint 1.8s var(--ease-set,ease) infinite}
@keyframes g-hint{0%{transform:scaleY(0)}60%{transform:scaleY(1)}100%{transform:scaleY(1);opacity:0}}
@media(max-width:767px){
  .g-film .film-frame{inset:0}
  .g-film .film-poster,.g-film .film-video{object-position:50% 50%}
  .g-film .film-intro,.g-film .film-chapters{left:var(--edge);right:var(--edge);width:auto;bottom:10px}
  .g-film .film-chapter{padding:18px 18px 16px}
  .g-film .film-chapter h2{font-size:1.75rem;margin:4px 0 8px}
  .g-film .film-chapter p:not(.film-num){font-size:.9rem;line-height:1.4}
  .g-film .film-rail{right:calc(var(--edge) + 10px)}
  .g-film .film-hint{right:calc(var(--edge) + 10px)}
}
@media(prefers-reduced-motion:reduce){.film-hint{display:none!important}}
html[data-motion-paused=true] .film-hint{display:none!important}

/* About lines: words come up to full strength as the paragraph crosses the screen */
.g-words .g-w{display:inline-block}

/* ---- 3D layer (g-3d.mjs adds .g-3d to <html> only after WebGL is up) ---- */
.film-veil,.film-gl{display:none}
.g-3d .film-veil{display:block;position:absolute;inset:0;z-index:1;pointer-events:none;
  background:transparent}
.g-3d .film-gl{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;pointer-events:none}
.g-3d .film-shade{z-index:1}

/* v8: the hero is the whole first screen; the page below rises into place on scroll */
.g-film .film-shade{background:linear-gradient(180deg,rgb(22 22 20 / .3),transparent 30%),linear-gradient(0deg,rgb(22 22 20 / .38),transparent 38%)}
.g-film .film-dim{position:absolute;inset:0;z-index:3;background:rgb(22 22 20);opacity:0;pointer-events:none}
.film-dim{display:none}
.g-film .film-dim{display:block}

/* ---- v9: layered masthead ---- */
.g-film .arrival{position:fixed;left:0;right:0;top:0;z-index:20;transform:translateY(-110%);opacity:0;pointer-events:none;
  background:color-mix(in srgb,var(--paper) 82%,transparent);border-bottom:1px solid var(--rule);
  transition:transform .55s cubic-bezier(.22,1,.36,1),opacity .35s ease}
.g-film.nav-on .arrival{transform:none;opacity:1;pointer-events:auto}
@media(prefers-reduced-motion:reduce){.g-film .arrival{transition:none}}

/* ---- v9: layered page below the hero ---- */
.g-film main>section:not(.film){position:relative;z-index:2;border-radius:28px 28px 0 0;margin-top:-28px;box-shadow:0 -18px 40px -22px rgb(22 22 20 / .45)}
.g-film main>section.services,.g-film main>section.contact,.g-film main>section.questions{background:var(--paper)}
.g-film main>section.work,.g-film main>section.brothers{background:var(--ink)}
.g-film main>section.film{z-index:1;border-radius:0;margin-top:0;box-shadow:none}
.g-film .g-par{will-change:transform}
@media(max-width:767px){.g-film main>section:not(.film){border-radius:20px 20px 0 0;margin-top:-20px}}

/* ---- v11: mobile hero panel. An inset, rounded card laid over the film (like the section cards
   below it), with real gutters, a balanced headline and a calmer eyebrow. Desktop is unchanged. ---- */
@media(max-width:767px){
  .film .film-intro.hero-title-panel{
    --card-gap:16px;
    padding:22px 22px 22px;border-radius:20px;
    background:rgb(244 244 241 / .96);
    box-shadow:0 18px 44px -14px rgb(10 12 20 / .55),0 0 0 1px rgb(255 255 255 / .35) inset;
    -webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2)}
  .film .film-intro .eyebrow{font-family:'DM Sans',system-ui,sans-serif;font-size:.875rem;font-weight:500;letter-spacing:.01em;text-transform:none;color:#4a4843;margin:0 0 10px}
  .film .film-intro h1{font-size:clamp(2.35rem,11.2vw,2.9rem);line-height:.98;text-wrap:balance;margin:0}
  .film .film-intro h1 br{display:none}
  .film .film-intro .hero-lede{font-size:1rem;line-height:1.45;max-width:30ch;margin:12px 0 0;text-wrap:pretty}
  .film .film-intro .hero-actions{margin-top:18px}
  .film .film-intro .hero-actions .button{width:100%;justify-content:space-between;padding-left:22px}
  /* static (no-JS / reduced-motion) page: same card, overlapping the poster */
  html:not(.g-film) .film-intro.hero-title-panel{margin:-64px 20px 0;width:auto}
  /* pinned film: card sits above the iOS toolbar zone, chapter cards match it */
  .g-film .film-intro,.g-film .film-chapters{left:20px;right:20px;bottom:max(20px,env(safe-area-inset-bottom))}
  .g-film .film-chapter{padding:20px 22px 18px;border-radius:20px;box-shadow:0 18px 44px -14px rgb(10 12 20 / .55)}
  .g-film .film-hint{display:none}
}
@media(max-width:360px){
  .film .film-intro.hero-title-panel{padding:18px 18px 18px}
  .film .film-intro h1{font-size:2.2rem}
  .g-film .film-intro,.g-film .film-chapters{left:16px;right:16px}
}

/* v12: blueprint sheet under the drawing. Present only while .g-sketch is set (JS running, motion allowed);
   g-3d.mjs lifts it once the house is drafted, and removes the class when the opening ends. */
.g-sketch .film-veil{display:block;position:absolute;inset:0;z-index:1;pointer-events:none;
  background:
    radial-gradient(ellipse at 50% 45%,rgb(0 0 0 / 0) 40%,rgb(6 22 58 / .45) 100%),
    linear-gradient(rgb(255 255 255 / .16) 1px,transparent 1px) 0 0/160px 160px,
    linear-gradient(90deg,rgb(255 255 255 / .16) 1px,transparent 1px) 0 0/160px 160px,
    linear-gradient(rgb(255 255 255 / .07) 1px,transparent 1px) 0 0/32px 32px,
    linear-gradient(90deg,rgb(255 255 255 / .07) 1px,transparent 1px) 0 0/32px 32px,
    #1d4c9b}

/* v14: first paint is the blueprint sheet. The inline head script adds .g-sketch together with .g-film, so
   the sheet above is painted by the very first frame (no JS needed to show it) and covers the poster and the
   video. Everything else in the hero that would show through before the sheet lifts is held back here, in CSS,
   and given back when g-3d.mjs / g-scroll.mjs remove .g-sketch (or on any fallback). */
.g-sketch .film-intro{clip-path:inset(100% 0% 0% 0% round 20px)}
.g-sketch .film-rail,.g-sketch .film-hint,.g-sketch .film-chapters,.g-sketch .film-frame .c-measure{visibility:hidden;clip-path:inset(100%)}
.g-sketch .film-frame{background:#1d4c9b}

/* v13: compositing hygiene for the scrubbed hero. The film layers get their own GPU layers up front
   (they are the only things that move every frame), so iOS does not promote and repaint them mid-scroll. */
.g-film .film-video,.g-film .film-poster{will-change:transform;backface-visibility:hidden}
.g-film .film-chapter>*{will-change:auto}
.g-film .film-chapter{will-change:transform,opacity}
