/* =========================================================================
   Codex BIM — scroll-driven homepage & motion system
   Loads after main.css. Everything here degrades gracefully:
     · no JS            → nothing is hidden, scenes are static
     · reduced motion   → html.motion-off: no reveals, no pinning, all steps visible
   Only transform / opacity are animated. Drafting language: hairlines, grid, dimension marks.
   ========================================================================= */

:root {
  --page-bg: #FFFFFF;
  --paper: #F4F5F5;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --shot-radius: 12px;
}
html[data-bg="paper"] { --page-bg: var(--paper); }
body { background: var(--page-bg); transition: background-color .9s ease; }
.home .section--alt { background: transparent; }
.home .strip { border-bottom: 0; }

/* ------------------------------------------------------- drafting layer */
.drafting {
  position: fixed; inset: -12vh 0; z-index: -1; pointer-events: none;
  transform: translate3d(0, var(--py, 0px), 0);
  background-image:
    linear-gradient(to right, rgba(45,41,38,.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(45,41,38,.16) 1px, transparent 1px),
    linear-gradient(to right, rgba(45,41,38,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(45,41,38,.05) 1px, transparent 1px);
  background-size: 320px 320px, 320px 320px, 64px 64px, 64px 64px;
  background-position: center top;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.35) 40%, rgba(0,0,0,.5));
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.35) 40%, rgba(0,0,0,.5));
  opacity: .55; transition: opacity .9s ease;
}
html[data-bg="paper"] .drafting { opacity: .35; }
.site-header, .site-main, .site-footer, main { position: relative; z-index: 1; }
.site-header { z-index: 100; }

/* ---------------------------------------------------------------- reveals */
.motion-on [data-reveal] {
  opacity: 0; transform: translateY(22px);
  transition: opacity .8s ease, transform .9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.motion-on [data-reveal="scale"] { transform: scale(.96) translateY(12px); }
.motion-on [data-reveal="row"] { transform: translateY(12px); transition-delay: calc(var(--i, 0) * 55ms); }
.motion-on [data-reveal="panel"] { transform: translateY(32px) scale(.985); transition-duration: 1s, 1.1s; }
.motion-on [data-reveal].is-in { opacity: 1; transform: none; }
.motion-on [data-reveal-group] > * { will-change: opacity, transform; }
.motion-on [data-reveal].is-in, .motion-on [data-reveal-group] > .is-in { will-change: auto; }

/* ------------------------------------------------------------------- hero */
.hero {
  position: relative; display: grid; align-items: center; overflow: clip;
  min-height: calc(100svh - var(--header-h));
  padding-block: clamp(1.25rem, 3.5vh, 3rem) clamp(1.5rem, 4vh, 3rem);
}
.hero__inner {
  display: grid; grid-template-columns: minmax(0, 10fr) minmax(0, 14fr);
  gap: clamp(2rem, 3.5vw, 4rem); align-items: center;
}
.hero__copy { max-width: 560px; margin: 0; text-align: left; }
.hero__title { font-size: clamp(1.85rem, .95rem + 2.1vw, 2.85rem); line-height: 1.06; margin-bottom: 1.15rem; }
.hero__lead { font-size: clamp(1.02rem, .95rem + .3vw, 1.2rem); line-height: 1.5; max-width: 46ch; margin: 0 0 1.75rem; }
.hero__lead p { margin: 0 0 .75rem; }
.hero__lead p:last-child { margin-bottom: 0; }
.hero__actions { justify-content: flex-start; margin-bottom: 1.1rem; }
.hero__note { font-size: .84rem; max-width: 46ch; margin: 0; }
.eyebrow--hero { color: var(--accent-ink); }

/* entrance choreography */
.motion-on .hero__in {
  opacity: 0; transform: translateY(16px);
  transition: opacity .8s ease, transform .9s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 90ms + 60ms);
}
.motion-on .hero.is-ready .hero__in { opacity: 1; transform: none; }

/* the scene */
/* the scene bleeds into the right margin (as far as the margin allows) so the product reads larger than the text column */
.hero__visual { min-width: 0; width: calc(100% + clamp(0px, (100vw - var(--container)) / 2 - var(--gutter), 8vw)); }
.scene { position: relative; padding: 6% 6% 8% 4%; }
.scene__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.scene__lines line { stroke: rgba(45,41,38,.22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.scene__lines .draw--dim { stroke: rgba(101,80,162,.6); }
.motion-on .scene__lines .draw {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.3s var(--ease-out); transition-delay: calc(var(--d, 0s) + .2s);
}
.motion-on .hero.is-ready .scene__lines .draw { stroke-dashoffset: 0; }
.scene__tag {
  position: absolute; right: 6%; top: 0; transform: translateY(-50%);
  font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  background: var(--page-bg); padding: 0 .4rem; transition: background-color .9s ease;
}
.scene__stage {
  position: absolute; right: 7%; bottom: 0; transform: translateY(50%);
  font-size: .7rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink);
  background: var(--page-bg); padding: 0 .4rem; transition: background-color .9s ease;
}
.scene__frame-wrap { position: relative; z-index: 1; }
.scene__frame { display: block; aspect-ratio: 16 / 10; text-decoration: none; transform: translate3d(0, var(--py, 0px), 0); }
.scene__img { width: 100%; height: 100%; object-fit: cover; }
.scene__img--crop { transform: scale(1.1); transform-origin: 50% 12%; }
.scene__frame .frame__play { opacity: 0; transition: opacity .25s ease, transform .2s ease; }
.scene__frame:hover .frame__play, .scene__frame:focus-visible .frame__play { opacity: 1; }

/* screenshots that belong to the page rather than sit on it */
.shot {
  position: relative; border-radius: var(--shot-radius); overflow: hidden; background: #ECECEC;
  box-shadow: 0 1px 2px rgba(45,41,38,.08), 0 40px 80px -40px rgba(45,41,38,.5);
}
.shot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(45,41,38,.1);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
/* fades the bottom of the bundled preview frames (they carry burnt-in captions) into the surface */
.shot--veil::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, #ECECEC 45%, rgba(236,236,236,0));
}

/* floating chips */
.scene__chip-wrap { position: absolute; z-index: 2; }
.scene__chip-wrap--1 { left: 0; top: 3%; }
.scene__chip-wrap--2 { right: 0; top: 48%; }
.scene__chip-wrap--3 { left: 14%; bottom: 0; }
.scene__chip {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .85rem .5rem .5rem;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(45,41,38,.08); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(45,41,38,.06), 0 24px 50px -24px rgba(45,41,38,.45);
  font-size: .8rem; font-weight: 600; color: var(--ink); white-space: nowrap; line-height: 1.2;
  transform: translate3d(0, var(--py, 0px), 0);
}
.scene__chip .feature__icon { width: 30px; height: 30px; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.scene__chip .feature__icon .icon { width: 15px; height: 15px; }
.scene__chip-text { display: grid; gap: .1rem; }
.scene__chip-text small { font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }

@media (max-width: 1180px) { .scene__chip { font-size: .76rem; } .scene__chip-wrap--2 { right: -2%; } }
@media (max-width: 899px) {
  .hero { min-height: 0; padding-block: clamp(2.5rem, 7vw, 4rem) clamp(2.5rem, 6vw, 4rem); }
  .hero__inner { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero__visual { width: 100%; }
  .hero__copy { max-width: 620px; }
  .scene { padding: 4% 0 6%; }
  .scene__chip-wrap--1 { left: -2%; top: -6%; }
  .scene__chip-wrap--2 { display: none; }
  .scene__chip-wrap--3 { left: auto; right: 0; bottom: -4%; }
  .scene__tag { right: 0; }
  .scene__stage { right: 0; }
}
@media (max-height: 800px) and (min-width: 900px) {
  .hero { padding-block: 1.15rem 1.35rem; }
  .hero__title { margin-bottom: .8rem; }
  .hero__lead { margin-bottom: 1.1rem; font-size: 1.02rem; }
  .hero__actions { margin-bottom: .7rem; }
  .hero__note { font-size: .8rem; }
}
@media (max-height: 640px) and (min-width: 900px) {
  .hero { min-height: 0; padding-block: 2.5rem; }
}

/* ------------------------------------------------------------------ strip */
.home .strip--statement { padding-block: clamp(2.5rem, 6vw, 5rem); }
.home .strip--statement .strip__title {
  font-size: clamp(1.55rem, 1.1rem + 1.4vw, 2.15rem); letter-spacing: -.025em; max-width: 36ch; margin: 0 0 1.25rem;
}
.home .strip--statement .strip__prose { max-width: 62ch; color: var(--text-2); font-size: 1.08rem; line-height: 1.55; }
.home .strip--statement .strip__prose p { margin: 0 0 1rem; }
.home .strip--statement .strip__prose p:last-child { margin-bottom: 0; color: var(--ink); font-weight: 600; }
.home .strip__list { padding-block: clamp(1.5rem, 3vw, 2.25rem); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home .strip__list { gap: .75rem 2.25rem; }
.home .strip__item { font-family: var(--mono); font-size: .74rem; letter-spacing: .02em; text-transform: uppercase; }
.home .strip__item::before { content: ""; width: 6px; height: 6px; border: 1px solid var(--grey); transform: rotate(45deg); flex-shrink: 0; }

/* --------------------------------------------------------- story (pinned) */
.story { padding-block: 0; }
.story__track { position: relative; }
.story__sticky { padding-block: var(--section); }
.story__inner { display: grid; gap: clamp(2rem, 4vh, 3.5rem); }
.story__head .section__intro { margin-top: .75rem; }
.story__grid { position: relative; display: grid; gap: 1.5rem clamp(2rem, 5vw, 5rem); }
.story__steps { list-style: none; display: grid; gap: 3rem; }
.story__step { display: grid; gap: 1.25rem; }
.story__step-btn {
  display: flex; align-items: center; gap: .9rem; padding: 0; border: 0; background: none; cursor: default; text-align: left; color: inherit;
}
.story__num {
  width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-strong); font-size: .82rem; font-weight: 600; color: var(--text-muted); background: var(--page-bg);
  transition: background-color .4s ease, color .4s ease, border-color .4s ease;
}
.story__step-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -.015em; color: var(--ink); }
.story__step-text { color: var(--text-2); font-size: .98rem; margin: 0; }
.story__step-media { margin: 0; position: relative; }
.story__shot { aspect-ratio: 16 / 10; }
.story__img { transform: scale(1.1); transform-origin: 50% 8%; }
.story__img--2 { transform: scale(1.32); transform-origin: 50% 46%; }
.story__facts { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.story__facts li {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2);
  padding: .3rem .6rem; border: 1px solid var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.7);
}
.story__rail { display: none; }
.story__more { margin: 0; }

/* default (small screens, reduced motion, no JS): stacked list, frame above each step */
.story__step-media { order: -1; }
.story__step + .story__step { padding-top: 2.5rem; border-top: 1px solid var(--line); }
.story__step-btn .story__num { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (min-width: 900px) and (min-height: 561px) {
  .motion-on .story__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; }
  .motion-on .story__steps { display: contents; }
  .motion-on .story__step { display: contents; }
  .motion-on .story__step-body { grid-column: 1; padding-left: 3.25rem; position: relative; }
  .motion-on .story__step-btn .story__num { position: absolute; left: 0; top: 0; background: var(--page-bg); color: var(--text-muted); border-color: var(--line-strong); }
  .motion-on .story__step-text { margin-top: .55rem; }
  .motion-on .story__step-media { grid-area: 1 / 2 / span var(--steps, 4) / 3; align-self: center; order: 0; }
  .motion-on .story__rail { display: block; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 1px; background: var(--line-strong); }
  .motion-on .story__rail::after {
    content: ""; position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--p, 0) * 100%);
    background: var(--accent); transition: height .2s linear;
  }
  .motion-on .story__step-btn { cursor: pointer; }
  .motion-on .story__step-btn:focus-visible .story__num { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* pinned behaviour */
  .motion-on .story__track { height: calc(var(--steps, 4) * 100vh); }
  .motion-on .story__sticky {
    position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
    display: grid; align-content: center; padding-block: 2rem; overflow: hidden;
  }
  .motion-on .story__step-body { transition: opacity .5s ease; opacity: .38; }
  .motion-on .story__step.is-active .story__step-body { opacity: 1; }
  .motion-on .story__step.is-active .story__num { background: var(--accent); color: #fff; border-color: var(--accent); }
  .motion-on .story__step.is-past .story__num { border-color: var(--accent); color: var(--accent-ink); }
  .motion-on .story__step-media { opacity: 0; transform: translateY(14px) scale(1.03); transition: opacity .7s ease, transform 1s var(--ease-out); pointer-events: none; }
  .motion-on .story__step.is-active .story__step-media { opacity: 1; transform: none; pointer-events: auto; }
  .motion-on .story__step.is-past .story__step-media { transform: translateY(-10px) scale(.98); }
  .motion-on .story__facts li { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .6s var(--ease-out); transition-delay: 0s; }
  .motion-on .story__step.is-active .story__facts li { opacity: 1; transform: none; transition-delay: calc(.35s + var(--i, 0) * .12s); }
}


/* ----------------------------------------------------- feature spotlight */
.spotlight { display: grid; gap: 2.5rem; }
.spotlight__list { list-style: none; display: grid; gap: 2.5rem; }
.spotlight__item { display: grid; gap: 1.25rem; }
.spotlight__title { font-size: 1.35rem; letter-spacing: -.015em; margin-bottom: .6rem; }
.spotlight__text { color: var(--text-2); margin: 0; font-size: 1rem; }
.spotlight__media { margin: 0; }
.spotlight__shot { aspect-ratio: 16 / 10; }
.spotlight__img { transition: transform 1.2s var(--ease-out); transform-origin: 50% 50%; }
.features--spotlight .section__more { margin-top: 1rem; }

/* default (small screens, reduced motion, no JS): stacked, frame above each feature */
.spotlight__media { order: -1; }
.spotlight__item + .spotlight__item { padding-top: 2.5rem; border-top: 1px solid var(--line); }
.spotlight__img { transform: scale(1.06); transform-origin: 50% 10%; }

@media (min-width: 900px) {
  .motion-on .spotlight { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0 clamp(2.5rem, 5vw, 5.5rem); align-items: start; }
  .motion-on .spotlight__list, .motion-on .spotlight__item { display: contents; }
  .motion-on .spotlight__body { grid-column: 1; padding-block: clamp(2.5rem, 9vh, 5.5rem); border-top: 1px solid var(--line); }
  .motion-on .spotlight__item:first-child .spotlight__body { border-top: 0; padding-top: 1rem; }
  .motion-on .spotlight__media {
    grid-area: 1 / 2 / span var(--n, 6) / 3; align-self: start; order: 0;
    position: sticky; top: calc(var(--header-h) + 10vh);
  }
  .motion-on .spotlight__body { transition: opacity .5s ease; opacity: .42; }
  .motion-on .spotlight__item.is-active .spotlight__body { opacity: 1; }
  .motion-on .spotlight__media { opacity: 0; transition: opacity .7s ease; pointer-events: none; }
  .motion-on .spotlight__item.is-active .spotlight__media { opacity: 1; pointer-events: auto; }

  /* controlled zoom into the part of the interface each feature is about (bundled preview frames);
     the zoom pivots on that region (transform-origin) so the frame never shows an empty edge */
  .motion-on .spotlight__media .spotlight__img { transform: scale(1.06); transform-origin: 50% 40%; }
  .motion-on .focus--model .spotlight__img      { transform-origin: 18% 46%; }
  .motion-on .focus--site .spotlight__img       { transform-origin: 50% 42%; }
  .motion-on .focus--assistant .spotlight__img  { transform-origin: 50% 66%; }
  .motion-on .focus--egress .spotlight__img     { transform-origin: 50% 48%; }
  .motion-on .focus--separation .spotlight__img { transform-origin: 84% 46%; }
  .motion-on .focus--report .spotlight__img     { transform-origin: 50% 44%; }
  .motion-on .spotlight__item.is-active .focus--model .spotlight__img      { transform: scale(1.35); }
  .motion-on .spotlight__item.is-active .focus--site .spotlight__img       { transform: scale(1.14); }
  .motion-on .spotlight__item.is-active .focus--assistant .spotlight__img  { transform: scale(1.3); }
  .motion-on .spotlight__item.is-active .focus--egress .spotlight__img     { transform: scale(1.28); }
  .motion-on .spotlight__item.is-active .focus--separation .spotlight__img { transform: scale(1.5); }
  .motion-on .spotlight__item.is-active .focus--report .spotlight__img     { transform: scale(1.2); }
}


/* pinned scene on shorter laptop screens: tighter so header, four steps and the link all fit */
@media (min-width: 900px) and (min-height: 561px) and (max-height: 840px) {
  .motion-on .story__sticky { padding-block: 1rem; }
  .motion-on .story__inner { gap: 1.25rem; }
  .motion-on .story__head .section__title { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); }
  .motion-on .story__head .section__intro { margin-top: .4rem; font-size: 1rem; }
  .motion-on .story__grid { row-gap: 1rem; }
  .motion-on .story__step-title { font-size: 1.1rem; }
  .motion-on .story__step-text { font-size: .9rem; margin-top: .35rem; }
  .motion-on .story__step-body { padding-left: 2.75rem; }
  .motion-on .story__num { width: 30px; height: 30px; font-size: .74rem; }
  .motion-on .story__rail { left: 14px; }
  .motion-on .story__facts { margin-top: .75rem; }
  .motion-on .story__shot { aspect-ratio: 16 / 9.5; }
}

/* large screens without pinning (reduced motion, no JS, short viewports): two columns per step/feature */
@media (min-width: 900px) {
  .story__step, .spotlight__item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(2rem, 4vw, 4rem); }
  .story__step-media, .spotlight__media { order: 0; }
  .story__steps, .spotlight__list { gap: 3.5rem; }
  .story__step + .story__step, .spotlight__item + .spotlight__item { padding-top: 3.5rem; }
}

/* ------------------------------------------------ dark sections as panels */
.home .panel {
  width: min(100% - 2 * var(--gutter), 1400px); margin-inline: auto; border-radius: 24px;
  background: var(--ink);
  background-image: radial-gradient(120% 90% at 85% 0%, rgba(101,80,162,.28), transparent 55%), linear-gradient(to bottom, #332E2B, var(--ink));
  padding-block: clamp(3.5rem, 7vw, 6rem);
}
.home .panel + .section { padding-top: var(--section); }
@media (max-width: 640px) { .home .panel { border-radius: 16px; } }
.home .demo .video { box-shadow: 0 50px 90px -40px rgba(0,0,0,.8); }
.home .cta { margin-block: 0 clamp(2rem, 5vw, 4rem); }

/* ----------------------------------------------- misc homepage refinements */
.home .section--alt .card, .home .section--alt .plan, .home .section--alt .faq__item, .home .section--alt .step { border-color: var(--line); }
.home .jurisdiction-rows, .home .card, .home .plan { background: rgba(255,255,255,.85); }
.home .problem__col--solution { background: #fff; border: 1px solid var(--line); }

/* ---------------------------------------------------------- reduced motion */
.motion-off .drafting { transform: none; }
.motion-off .hero__in, .motion-off [data-reveal] { opacity: 1 !important; transform: none !important; }
.motion-off .story__step-media, .motion-off .story__step-body { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .scene__lines .draw { stroke-dasharray: none; }
}
