/* ============================================================
   Sagar Software — Apple-style scroll motion
   Used by the homepage and /work/. All effects are transform/opacity only
   and switch off for prefers-reduced-motion.
============================================================ */

/* Scroll progress bar */
.m-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none;
  background: linear-gradient(90deg, #1EC8A0, #17A882 60%, #111); transform-origin: 0 50%; transform: scaleX(0); }

/* Reveal: fade + rise + soft blur, Apple ease */
.m-in { opacity: 0; transform: translate3d(0, 34px, 0) scale(.985); filter: blur(6px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform 1.1s cubic-bezier(.2,.7,.2,1), filter .9s ease;
  transition-delay: var(--m-d, 0s); will-change: opacity, transform; }
.m-in.m-on { opacity: 1; transform: none; filter: none; }

/* Headline mask reveal */
.m-head { clip-path: inset(0 0 100% 0); transform: translate3d(0, 24px, 0);
  transition: clip-path 1.1s cubic-bezier(.2,.7,.2,1), transform 1.1s cubic-bezier(.2,.7,.2,1); }
.m-head.m-on { clip-path: inset(0 0 -20% 0); transform: none; }

/* ── Scroll story: sticky statement, words light up ── */
.m-story { position: relative; height: 260vh; background: #0B0B0C; color: #fff; }
.m-story-pin { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; overflow: hidden; }
.m-story-glow { position: absolute; width: 70vmax; height: 70vmax; left: 50%; top: 50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(30,200,160,.22), rgba(30,200,160,0) 60%); transform: translate(-50%, -50%) scale(var(--g, .6)); pointer-events: none; }
.m-story-inner { position: relative; max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.m-story-kicker { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: #1EC8A0; margin-bottom: 22px; }
.m-story-text { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(1.7rem, 4vw, 3.5rem); line-height: 1.12; letter-spacing: -.02em; color: #fff; }
.m-story-text .w { color: rgba(255,255,255,.14); transition: color .35s ease; }
.m-story-text .w.on { color: #fff; }
.m-story-text .w.hl.on { color: #1EC8A0; }

/* ── Horizontal gallery driven by vertical scroll ── */
.m-gal { position: relative; height: 420vh; background: #0B0B0C; }
.m-gal-pin { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.m-gal-head { max-width: 1280px; width: 100%; margin: 0 auto 34px; padding: 0 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.m-gal-head h2 { color: #fff; font-size: clamp(1.8rem, 3.6vw, 3rem); font-weight: 700; letter-spacing: -.02em; }
.m-gal-head p { color: rgba(255,255,255,.55); max-width: 380px; font-size: .95rem; }
.m-gal-track { display: flex; gap: 22px; padding: 0 24px; will-change: transform; }
.m-gal-item { flex: 0 0 auto; width: min(64vw, 620px); border-radius: 22px; overflow: hidden; background: #161618; border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 30px 80px rgba(0,0,0,.45); cursor: pointer; text-align: left; padding: 0; color: inherit; font: inherit; }
.m-gal-item .im { aspect-ratio: 16 / 9; overflow: hidden; background: #111; }
.m-gal-item img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transform: scale(1.08); transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.m-gal-item:hover img { transform: scale(1.02); }
.m-gal-item .cap { padding: 16px 20px 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.m-gal-item b { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; color: #fff; }
.m-gal-item span { font-size: .78rem; color: rgba(255,255,255,.5); white-space: nowrap; }
.m-gal-bar { max-width: 1280px; width: calc(100% - 48px); margin: 30px auto 0; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.m-gal-bar i { display: block; height: 100%; background: #1EC8A0; transform-origin: 0 50%; transform: scaleX(0); }

/* ── Capability wall (category counts) ── */
.m-caps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.m-cap { position: relative; border-radius: 18px; padding: 22px 20px; background: #fff; border: 1px solid #E8EAED; overflow: hidden; text-align: left;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s, border-color .4s; text-decoration: none; color: inherit; display: block; }
.m-cap:hover { transform: translateY(-6px); box-shadow: 0 18px 50px rgba(0,0,0,.08); border-color: var(--c); }
.m-cap::before { content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; height: 3px; background: var(--c); transform: scaleX(.18); transform-origin: 0; transition: transform .5s; }
.m-cap:hover::before { transform: scaleX(1); }
.m-cap .n { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 2.4rem; line-height: 1; color: #111; }
.m-cap .t { margin-top: 10px; font-weight: 600; font-size: .92rem; color: #111; }
.m-cap .s { margin-top: 4px; font-size: .78rem; color: #888; line-height: 1.45; }
@media (max-width: 900px) { .m-caps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Mobile: shorter pinned sections */
@media (max-width: 640px) {
  .m-story { height: 200vh; }
  .m-gal { height: 320vh; }
  .m-gal-item { width: 82vw; }
  .m-gal-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .m-in, .m-head { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; transition: none !important; }
  .m-story, .m-gal { height: auto; }
  .m-story-pin, .m-gal-pin { position: relative; height: auto; padding: 90px 0; }
  .m-story-text .w { color: #fff; }
  .m-gal-track { overflow-x: auto; }
  .m-progress { display: none; }
}

/* Hero rise-up entrance (motion.js adds .hpre, then .hin when in view) */
#home.hpre > .max-w-7xl > .grid > div:first-child > *, #home.hpre .hero-right-vis { opacity: 0; transform: translate3d(0, 46px, 0); transition: opacity .7s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1); }
#home.hin > .max-w-7xl > .grid > div:first-child > *, #home.hin .hero-right-vis { opacity: 1; transform: none; }
#home.hin > .max-w-7xl > .grid > div:first-child > *:nth-child(2) { transition-delay: .08s; }
#home.hin > .max-w-7xl > .grid > div:first-child > *:nth-child(3) { transition-delay: .16s; }
#home.hin > .max-w-7xl > .grid > div:first-child > *:nth-child(4) { transition-delay: .24s; }
#home.hin > .max-w-7xl > .grid > div:first-child > *:nth-child(5) { transition-delay: .32s; }
#home.hin .hero-right-vis { transition-delay: .2s; }
@media (prefers-reduced-motion: reduce) { #home.hpre > .max-w-7xl > .grid > div:first-child > *, #home.hpre .hero-right-vis { opacity: 1 !important; transform: none !important; transition: none !important; } }
