/* ============================================================
   MS AGENCY — UPGRADE v2 (CR7, built by hand)
   Same division, exactly: Hero → Bento → About → Work → Clients →
   Logofolio → Print → Reels → Contact. Same words, same order.
   Every section redesigned: new layout details, new motion, new
   interactions — driven by the skills actually read for this build:
   ui-ux-pro-max · figma-use-motion · canonical-motion-moves ·
   motion-bible · gsap-scrolltrigger · gsap-performance ·
   liquid-glass-25d · design-taste-frontend-v1 · safe-zone-qa
   + ~/workspace/design-library + ~/workspace/animation-library.

   Motion language (one job per moment):
   --v2-ease   quint out  (0.22,1,0.36,1)  — rises, reveals
   --v2-spring back.out   (0.34,1.56,0.64,1) — pops, springs
   --v2-snap   expo out   (0.16,1,0.3,1)   — cuts, slides
   base 280ms · rise 600ms · hero 800ms · stagger 40ms
   Exits are always faster than entrances. Transform + opacity ONLY.
   Motion always runs (site ruling — no reduced-motion gating).
   ============================================================ */

:root {
  --v2-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --v2-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --v2-snap: cubic-bezier(0.16, 1, 0.3, 1);
  --v2-orange: #ff5400;
}

/* ---------- v1 wins, kept (they were right) ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--v2-orange); z-index: 120; pointer-events: none;
}
.sec-num { color: var(--v2-orange); }
.pill-link, .pill-contact { min-height: 44px; display: inline-flex; align-items: center; }
.sound-pill { width: 44px; height: 44px; }
.top-logo { padding: 10px 0; }
.rail-btn { min-height: 44px; }
:focus-visible { outline: 2px solid var(--v2-orange); outline-offset: 3px; }
.coil-divider { display: block; width: 100%; height: 132px; object-fit: cover; }

/* ---------- the reveal system: one entrance per element ----------
   v2.js adds .in when an element enters the viewport. Rise (move 01):
   +30px, 0.6s, quint out. --d staggers siblings by 40ms steps. */
.v2-rev {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(6px);
  transition: opacity 0.6s var(--v2-ease) var(--d, 0s),
    transform 0.6s var(--v2-ease) var(--d, 0s),
    filter 0.6s var(--v2-ease) var(--d, 0s);
  will-change: opacity, transform, filter;
}
.v2-rev.in { opacity: 1; transform: translateY(0); filter: blur(0); }

/* ---------- HERO: cinematic entrance ----------
   The old wordmark split (whole-word rise + ghost layers) is replaced
   by a letter stagger (TextStagger): each letter rises 26px out of an
   8px blur, 40ms apart; the orange "." pops last with a spring. */
.wordmark .split-main { animation: none; }
.wordmark::before, .wordmark::after { display: none; }
.wordmark .wm-l {
  display: inline-block;
  opacity: 0;
  transform: translateY(26px);
  filter: blur(8px);
  transition: opacity 0.5s var(--v2-ease) var(--d, 0s),
    transform 0.5s var(--v2-ease) var(--d, 0s),
    filter 0.5s var(--v2-ease) var(--d, 0s);
}
.wordmark.in .wm-l { opacity: 1; transform: translateY(0); filter: blur(0); }
.wordmark .accent {
  display: inline-block;
  transform: scale(0);
  transition: transform 0.45s var(--v2-spring) 0.62s;
}
.wordmark.in .accent { transform: scale(1); }
/* sheen sweeps after the letters land, not during */
.wordmark-sheen { animation-delay: 1.15s; }
/* the studio line types itself (move 05: 0.04s/char) */
.studio-line .st-c { opacity: 0; transition: opacity 0.04s linear var(--d, 0s); }
.studio-line.typing .st-c { opacity: 1; }
/* portrait: Blur-in (move 07) — 20px blur to crystal, 0.5s */
.figure-form { animation: v2-figure-in 0.5s var(--v2-ease) 0.15s backwards; }
@keyframes v2-figure-in {
  from { filter: blur(20px); opacity: 0.4; transform: translateY(18px); }
  to { filter: blur(0); opacity: 1; transform: translateY(0); }
}
/* para slides in from the right (move 06, power4) */
.hero-para { animation: v2-para-in 0.4s var(--v2-snap) 1.05s backwards; }
@keyframes v2-para-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
/* the orbit becomes a real 3D ring: perspective on the container,
   cards tilt into the ring (home.js adds rotateY per card) */
.orbit { perspective: 900px; }
.orbit-card { transform-style: preserve-3d; }
/* pill rises last, from below */
.pill { animation: v2-pill-in 0.6s var(--v2-ease) 1.55s backwards; }
@keyframes v2-pill-in {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- BENTO: statement word reveal + magnetic CTA ----------
   The words are already split (.w > .wi, --i stagger) and rise when
   .bento gets .in. v2 keeps the trigger, quickens the stagger
   (60ms → 40ms) and adds the Blur-in per word (Rise + Blur-in). */
.bento-statement .wi {
  transition: transform 0.6s var(--v2-ease) calc(var(--i) * 40ms),
    filter 0.6s var(--v2-ease) calc(var(--i) * 40ms);
}
html.js .bento-statement .wi { filter: blur(6px); }
html.js .bento.in .bento-statement .wi { filter: blur(0); }
/* magnetic buttons: v2.js moves them toward the pointer; the spring
   back lives here (transform is the only thing v2.js writes) */
.magnetic { transition: transform 0.45s var(--v2-spring); will-change: transform; }
/* tiles lift with a real shadow, not just a scale */
.tile-clients, .tile-about {
  transition: transform 0.28s var(--v2-ease), box-shadow 0.28s var(--v2-ease);
}
.tile-clients:hover, .tile-about:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 84, 0, 0.35);
}

/* ---------- ABOUT: the timeline draws itself ----------
   The line already exists (.timeline-line) and already draws on .in.
   v2 makes the draw scroll-linked: v2.js writes --p 0→1 as you scroll
   through the timeline. Rows slide in further (-40px, snap) with the
   existing nth-child stagger kept. */
html.js [data-reveal="timeline"] .timeline-line,
html.js [data-reveal="timeline"].in .timeline-line {
  transform: scaleY(var(--p, 0));
  transition: transform 0.12s linear;
}
html.js [data-reveal="timeline"] .tl-row {
  transform: translateX(-40px);
  transition: opacity 0.4s var(--v2-snap), transform 0.4s var(--v2-snap);
}
.tl-row:hover { background: rgba(255, 84, 0, 0.06); }
.tl-row:hover .tl-period { color: var(--v2-orange); }
/* the portrait drifts slower than the scroll (parallax, v2.js) */
.about-portrait { will-change: transform; }

/* ---------- WORK: spring indicator + Reframe on switch ----------
   The nav pill indicator springs (back.out) instead of sliding flat;
   the front cover reframes (move 09) when the category changes. */
.pill-ind { transition: left 0.45s var(--v2-spring), width 0.45s var(--v2-spring), transform 0.45s var(--v2-spring) !important; }
.work-stack.reframing .stack-card.d0 {
  animation: v2-reframe 0.8s var(--v2-ease);
}
@keyframes v2-reframe {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(0.94); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}
.work-item {
  transition: transform 0.28s var(--v2-ease), box-shadow 0.28s var(--v2-ease);
}
.work-item:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
/* real 3D fan: perspective on the stack, back cards lean away */
.work-stack { perspective: 1400px; }
.stack-card.d1 { transform: translateY(10px) scale(.955) rotateX(4deg); }
.stack-card.d2 { transform: translateY(20px) scale(.91) rotateX(8deg); }

/* ---------- CLIENTS: settle + orange edge glow ----------
   The grids are baked images, so the whole grid lifts and glows. */
.clients-grid {
  transition: transform 0.28s var(--v2-ease), box-shadow 0.28s var(--v2-ease);
}
.clients-grid:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(255, 84, 0, 0.5), 0 14px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- LOGOFOLIO: tiles Pop in, then tilt ----------
   Pop (move 02): 0.6 → 1.0 with overshoot, 0.45s, staggered. */
.logo-grid .logo-tile { opacity: 0; }
.logo-grid.in .logo-tile {
  animation: v2-pop 0.45s var(--v2-spring) var(--d, 0s) backwards;
  opacity: 1;
}
@keyframes v2-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
.logo-grid { perspective: 1200px; }
.logo-tile { transition: transform 0.28s var(--v2-ease), box-shadow 0.28s var(--v2-ease); }
.logo-tile:hover {
  transform: rotateX(5deg) rotateY(-5deg) translateY(-4px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* ---------- PRINT: velocity marquee ----------
   The marquee is JS-driven (site.js driftStep, 0.5 / 0.42 px per
   frame). v2.js writes window.__v2vel from the scroll velocity and
   the v2 site.js multiplies the step by it: the rows speed up when
   you scroll fast and ease back when you stop. */
.print-item { transition: transform 0.28s var(--v2-ease); }
.print-item:hover { transform: scale(1.03); }

/* ---------- REELS: the CTA is a stage ----------
   A pulsing play ring (Pop loop) + magnetic hover. */
.reels-cta { position: relative; }
.reels-cta::before {
  content: ""; position: absolute; inset: -8px; border-radius: inherit;
  border: 1px solid rgba(255, 84, 0, 0.55);
  animation: v2-pulse 2.2s var(--v2-ease) infinite;
}
@keyframes v2-pulse {
  0% { transform: scale(0.98); opacity: 0.9; }
  70% { transform: scale(1.06); opacity: 0; }
  100% { transform: scale(1.06); opacity: 0; }
}

/* ---------- CONTACT: copy-on-click tick ----------
   Clicking the mail copies it; a tick (move 04) confirms. */
.contact-mail { cursor: pointer; position: relative; }
.contact-mail .copy-tick {
  display: inline-block; margin-inline-start: 10px; color: var(--v2-orange);
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.25s var(--v2-ease), transform 0.45s var(--v2-spring);
}
.contact-mail.copied .copy-tick { opacity: 1; transform: scale(1); }

/* ---------- mobile guards: the redesign never breaks the phone ---------- */
/* ---- v2.1: hero figure feather + anti-banding (founder: bottom edge must
   dissolve softly, no sharp cut, no visible blocks in the fade or the glows) ---- */
/* the portrait itself dissolves into the dark over its bottom quarter —
   a mask on .figure (the orbit is its sibling, so the cards are untouched) */
.figure {
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 68%, transparent 93%);
          mask-image: linear-gradient(180deg, #000 0%, #000 68%, transparent 93%);
}
/* the scrim's fades get intermediate stops so the dark gradients stop
   banding into visible steps */
.hero .scrim {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.32) 0%, rgba(0,0,0,0.16) 9%, rgba(0,0,0,0) 18%),
    linear-gradient(0deg, rgba(0,0,0,0.26) 0%, rgba(0,0,0,0.14) 8%, rgba(0,0,0,0.05) 15%, rgba(0,0,0,0) 22%),
    linear-gradient(90deg, rgba(0,0,0,0.30) 0%, rgba(0,0,0,0.15) 20%, rgba(0,0,0,0) 40%);
}
/* the field's own backdrop gets the same treatment — it is the biggest
   gradient on the page and the worst bander */
#field {
  background:
    radial-gradient(120% 90% at 78% 8%, #17181c 0%, #101014 22%, #0a0a0c 42%, #050506 60%, #000000 78%);
}
/* stronger film grain so the remaining gradients dither instead of
   stepping (was 0.05 — too weak to break the bands) */
.grain { opacity: 0.09; }

/* ---- v2.2: Home slogan (founder's pick: "Our Brand.. Our Story.") ----
   typed live, letter by letter, closing the Home right after the bento */
.home-slogan {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: clamp(56px, 10vh, 110px) var(--margin) clamp(72px, 12vh, 130px);
}
.home-slogan-text {
  display: inline;
  font-size: clamp(2.1rem, 5.6vw, 4.8rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--white);
}
.home-slogan-text .hs-c { opacity: 0; transition: opacity 0.08s ease; }
.home-slogan-text .hs-c.on { opacity: 1; }
.home-slogan-text .hs-dot { color: var(--orange); }
.home-slogan-caret {
  display: inline-block;
  width: 0.085em;
  height: 0.95em;
  margin-left: 0.1em;
  vertical-align: -0.1em;
  background: var(--orange);
  opacity: 0;
}
.home-slogan.typing .home-slogan-caret {
  opacity: 1;
  animation: hsCaret 0.9s steps(2, start) infinite;
}
@keyframes hsCaret { 50% { opacity: 0; } }

/* ---- v2.2: bento sheen — the light sweeping "We build strategy around
   you" was a hard-edged rectangle (its top/bottom were cut by the box).
   Feather it vertically so the light is a soft lens, never a square. ---- */
.bento-statement::after {
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
}

@media (max-width: 760px) {
  .work-stack { perspective: 900px; }
  .stack-card.back1 { transform: rotateX(2deg) translateZ(-24px); }
  .stack-card.back2 { transform: rotateX(4deg) translateZ(-48px); }
  .coil-divider { height: 84px; }
  .wordmark .wm-l { transform: translateY(18px); }
}
