/* =========================================================
   ACE motion layer — live drawings, character scroll, pinned gallery, intro
   ========================================================= */

/* ---------- Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; align-content: center; gap: 14px;
  background: var(--ink); color: #fff;
  clip-path: inset(0 0 0 0);
  transition: clip-path 1s cubic-bezier(.8, 0, .2, 1);
  animation: introFailsafe 0s linear 4.5s forwards; /* never block the page */
}
.intro.is-done { clip-path: inset(0 0 100% 0); }
@keyframes introFailsafe { to { visibility: hidden; } }
.intro__draw { display: block; width: min(520px, 80vw); height: auto; aspect-ratio: 600 / 160; justify-self: center; fill: none; stroke: rgba(255,255,255,.7); stroke-width: 1.5; }
.intro__draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: bpDraw 1.1s cubic-bezier(.65,.05,.25,1) forwards; }
.intro__draw path:nth-child(2) { animation-delay: .25s; }
.intro__draw path:nth-child(3) { animation-delay: .45s; }
.intro__draw path:nth-child(4) { animation-delay: .7s; }
.intro__red { stroke: var(--red); stroke-width: 2.5; }
.intro__brand { font-size: clamp(4rem, 12vw, 9rem); font-weight: 800; font-stretch: 80%; letter-spacing: -.04em; line-height: .9; animation: introUp 1s cubic-bezier(.2,.8,.1,1) .35s both; }
.intro__tag { color: var(--on-dark-muted); margin: 0; animation: introUp 1s cubic-bezier(.2,.8,.1,1) .55s both; }
.intro__count { position: absolute; right: var(--gutter); bottom: 28px; color: var(--on-dark-muted); }
.intro__count span { color: #fff; }
@keyframes introUp { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Scroll progress ---------- */
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; background: var(--red); transform-origin: left; transform: scaleX(0); }

/* ---------- Live drawings ---------- */
.about, .services, .quality, .projects, .contact { position: relative; isolation: isolate; }
.about, .services { overflow: clip; } /* clip, not hidden: keeps the sticky services column working */
.about > .wrap, .services > .wrap, .projects > .wrap, .quality > .wrap, .contact > .wrap { position: relative; z-index: 1; }

.bp { position: absolute; inset: -6% 0; z-index: 0; pointer-events: none; color: var(--navy); opacity: .14; will-change: transform; }
.bp svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bp--dark { color: #CBD5F2; opacity: .16; }
.bp--hero { color: #fff; opacity: .2; z-index: -1; inset: 0; }

.bp-s { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.bp-heavy { stroke-width: 2.1; }
.bp-thin { stroke-width: .7; }
.bp-red { stroke: var(--red); }
.bp-fill { fill: currentColor; fill-opacity: .5; }
.bp-t { fill: currentColor; font-family: var(--mono); letter-spacing: .08em; opacity: 0; }
.bp-f { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0; }
.bp-dash { stroke-dasharray: 18 6 3 6; }
.bp-live { opacity: 0; }
.bp-dot { fill: var(--red); }
.bp-scan { stroke: var(--red); stroke-width: 2; stroke-dasharray: 5 7; }
.bp-pulse circle { fill: none; stroke: var(--red); stroke-width: 2.5; }

.is-drawn .bp-s { animation: bpDraw 1.4s cubic-bezier(.65,.05,.25,1) var(--de, 0s) forwards; }
.is-drawn .bp-t, .is-drawn .bp-f, .is-drawn .bp-live { animation: bpFade .9s ease var(--de, 0s) forwards; }
@keyframes bpDraw { to { stroke-dashoffset: 0; } }
@keyframes bpFade { to { opacity: 1; } }

/* ---------- Hero CAD cursor ---------- */
.cad { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s; }
.cad.is-on { opacity: 1; }
.cad__h, .cad__v { position: absolute; background: rgba(255,255,255,.22); }
.cad__h { left: 0; right: 0; top: 0; height: 1px; transform: translateY(var(--y)); }
.cad__v { top: 0; bottom: 0; left: 0; width: 1px; transform: translateX(var(--x)); }
.cad__box { position: absolute; left: 0; top: 0; width: 18px; height: 18px; border: 1px solid rgba(255,255,255,.85); transform: translate(calc(var(--x) - 9px), calc(var(--y) - 9px)); }
.cad__read { position: absolute; left: 0; top: 0; transform: translate(calc(var(--x) + 16px), calc(var(--y) + 14px)); font-size: .66rem; color: #fff; background: rgba(10,22,51,.55); border: 1px solid rgba(255,255,255,.15); padding: 4px 8px; border-radius: 4px; white-space: nowrap; }

/* ---------- Character split ---------- */
.split .w { display: inline-block; white-space: nowrap; }
.split--chars .c { display: inline-block; }

/* hero title: characters rise from behind a mask once the intro lifts */
.split--load .w { overflow: hidden; padding: 0 .02em .12em; margin: 0 -.02em -.12em; vertical-align: top; }
.split--load .c { transform: translateY(115%); }
.is-ready .split--load .c { animation: charUp 1.1s cubic-bezier(.2,.8,.1,1) calc(var(--i) * 30ms) both; }
@keyframes charUp { from { transform: translateY(115%) rotate(8deg); } to { transform: none; } }

/* section headings: each character sharpens in as the heading scrolls up */
.split--chars:not(.split--load) .c {
  --t: clamp(0, calc(var(--p, 0) * (var(--n) + 14) - var(--i)), 1);
  opacity: calc(.1 + .9 * var(--t));
  transform: translate3d(0, calc((1 - var(--t)) * .35em), 0) rotate(calc((1 - var(--t)) * 6deg));
}
/* quote: word-by-word highlight */
.split--words .w {
  --t: clamp(0, calc(var(--p, 0) * (var(--n) + 4) - var(--i)), 1);
  opacity: calc(.16 + .84 * var(--t));
}

/* ---------- Image wipes ---------- */
.wipe { clip-path: inset(0 0 100% 0); transition: clip-path 1.3s cubic-bezier(.75,0,.2,1) var(--wd, 0s); }
.wipe.is-in { clip-path: inset(0 0 0 0); }
.wipe img { transform: scale(1.25); transition: transform 1.9s cubic-bezier(.2,.7,.1,1) var(--wd, 0s); }
.wipe.is-in img { transform: scale(1); }
.about__img.wipe.is-in:hover img { transform: scale(1.04); transition-delay: 0s; }

/* About concept drawing: the sketch draws first, then the design, then the detail */
.about__concept { display: block; width: 100%; height: 100%; background: var(--ink); }
.about__concept .d { stroke-dasharray: 1; stroke-dashoffset: 1; }
.about__concept .f { opacity: 0; }
.wipe.is-in .about__concept .d { animation: bpDraw 1.6s cubic-bezier(.65,.05,.25,1) calc(var(--de, 0s) + .5s) forwards; }
.wipe.is-in .about__concept .f { animation: bpFade 1s ease calc(var(--de, 0s) + .5s) forwards; }

/* ---------- Careers media ---------- */
.careers__media { position: relative; }
.careers__quote {
  position: absolute; right: -28px; bottom: 36px; max-width: 290px; margin: 0;
  padding: 20px 22px; border-radius: 14px; background: var(--ink); color: #fff;
  font-size: 1.05rem; font-weight: 550; font-stretch: 94%; line-height: 1.35;
  box-shadow: 0 30px 60px -30px rgba(10,22,51,.7);
}
.careers__quote .mono { display: block; color: #FF8A90; font-size: .66rem; margin-bottom: 8px; }
@media (max-width: 1024px) {
  .careers__img { aspect-ratio: 16 / 10; }
  .careers__quote { right: 16px; bottom: -28px; }
  .careers__media { margin-bottom: 28px; }
}

/* ---------- Kinetic band ---------- */
.band {
  background: var(--paper); padding: clamp(28px, 4vw, 52px) 0; overflow: hidden; border-top: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
/* Each row holds two identical halves and loops by exactly -50%, so every phrase passes by.
   Spacing uses margins (not gap) so both halves are the same width and the loop is seamless.
   Constant speed, GPU-composited, never sped up or paused, so the motion stays smooth. */
.band__row {
  display: flex; align-items: center; width: max-content; white-space: nowrap;
  will-change: transform; backface-visibility: hidden; transform: translate3d(0, 0, 0);
  animation: bandLoop 55s linear infinite;
  font-size: clamp(1.7rem, 3.8vw, 3.4rem); font-weight: 800; font-stretch: 78%; letter-spacing: -.02em; line-height: 1.15; text-transform: uppercase; color: var(--ink);
}
.band__row--alt { color: var(--navy); font-size: clamp(1.3rem, 2.7vw, 2.4rem); margin-top: .35em; }
.band__row .o { color: transparent; -webkit-text-stroke: 1.2px currentColor; }
.band__row .o { -webkit-text-stroke-color: var(--ink); }
.band__row--alt .o { -webkit-text-stroke-color: var(--navy); }
.band__row i { font-style: normal; color: var(--red); font-size: .45em; margin: 0 1.2em; }
.band__row--alt { animation-name: bandLoopRev; animation-duration: 50s; }
@keyframes bandLoop { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }
@keyframes bandLoopRev { from { transform: translate3d(-50%, 0, 0); } to { transform: translate3d(0, 0, 0); } }

/* ---------- Horizontal gallery strip (native scroll, never pins the page) ---------- */
.hgal { position: relative; background: var(--paper); }
.hgal__pin { padding: clamp(80px, 10vw, 130px) 0 24px; }
.hgal__head { display: flex; justify-content: space-between; align-items: end; gap: 32px; margin-bottom: clamp(24px, 3vw, 40px); }
.hgal__meta { max-width: 360px; width: 100%; display: grid; gap: 12px; }
.hgal__meta p { margin: 0; color: var(--muted); }
.hgal__meta .mono { color: var(--muted); }
.hgal__bar { height: 2px; background: var(--line); overflow: hidden; }
.hgal__bar i { display: block; height: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform .15s linear; }
.hgal__nav { display: flex; align-items: center; gap: 8px; }
.hgal__nav .mono { margin-right: auto; }
.hgal__arrow { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; transition: background .25s, color .25s, border-color .25s, opacity .25s; }
.hgal__arrow:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: #fff; }
.hgal__arrow:disabled { opacity: .35; cursor: default; }
.hgal__track {
  display: flex; align-items: stretch; gap: 22px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
  padding-left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
  padding-right: var(--gutter); padding-bottom: 12px;
  scroll-padding-left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
}
.hgal__track::-webkit-scrollbar { display: none; }
.hgal__track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.hgal__track.is-dragging .hgal__card { pointer-events: none; }
.hgal__card { flex: none; display: grid; gap: 12px; align-content: start; text-align: left; scroll-snap-align: start; width: min(80vw, 440px); cursor: pointer; }
.hgal__img { display: block; position: relative; overflow: hidden; border-radius: 16px; background: var(--paper-2); aspect-ratio: 3 / 2; }
.hgal__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.hgal__card:hover .hgal__img img { transform: scale(1.04); }
.hgal__img::after { content: "+"; position: absolute; right: 14px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ink); font-size: 1.4rem; opacity: 0; transform: scale(.6); transition: all .35s var(--ease); }
.hgal__card:hover .hgal__img::after, .hgal__card:focus-visible .hgal__img::after { opacity: 1; transform: none; }
.hgal__cap { display: flex; gap: 10px; color: var(--muted); }
.hgal__cap b { color: var(--red); font-weight: 500; }
.hgal__end { flex: none; align-self: center; width: clamp(260px, 30vw, 440px); padding: 0 12px 0 24px; }
.hgal__end .mono { color: var(--red); }
.hgal__end h3 { font-size: clamp(2rem, 3.6vw, 3.4rem); font-weight: 750; font-stretch: 84%; letter-spacing: -.02em; line-height: 1.02; }
.hgal__end em { font-style: normal; color: var(--red); }

.gallery { padding: 28px 0 clamp(60px, 8vw, 110px); }
.gallery .gallery__more { margin-top: 0; }
.gallery__grid { margin-top: 32px; }
.gallery__grid[hidden] { display: none; }

/* ---------- Spotlight hover ---------- */
.svc { background: radial-gradient(380px circle at var(--mx, -999px) var(--my, -999px), rgba(215,38,47,.075), transparent 60%), var(--card); }
.proj { background: radial-gradient(340px circle at var(--mx, -999px) var(--my, -999px), rgba(255,255,255,.09), transparent 60%), linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025)); }
.voice:not(:nth-child(2)) { background: radial-gradient(360px circle at var(--mx, -999px) var(--my, -999px), rgba(27,45,107,.07), transparent 60%), var(--card); }
.contact__cards li { background: radial-gradient(300px circle at var(--mx, -999px) var(--my, -999px), rgba(255,255,255,.08), transparent 60%), rgba(255,255,255,.05); }

/* ---------- Footer wordmark (small sign-off line) ---------- */
.footer__mega {
  font-size: clamp(1rem, 1.4vw, 1.4rem); font-weight: 700; font-stretch: 80%; letter-spacing: .14em; line-height: 1.2;
  text-transform: uppercase; text-align: center; white-space: nowrap; padding: 0 0 22px; user-select: none;
  color: rgba(255,255,255,.4);
}

/* ---------- Responsive / reduced motion ---------- */
@media (max-width: 720px) {
  .bp { opacity: .1; }
  .bp--hero { opacity: .18; }
  .bp--dark { opacity: .12; }
  .hgal__head { flex-direction: column; align-items: start; }
  .hgal__arrow { display: none; }
  .band__row .o { -webkit-text-stroke-width: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  .split--load .c { transform: none; }
  .wipe, .wipe img { clip-path: none; transform: none; }
  .bp-s { stroke-dashoffset: 0; }
  .bp-t, .bp-f, .bp-live { opacity: 1; }
  .about__concept .d { stroke-dashoffset: 0; }
  .about__concept .f { opacity: 1; }
  .intro { display: none; }
}
