/* =========================================================================
   GLASYN — motion layer
   Loaded after styles.css. Everything here is progressive enhancement:
   with JS off or reduced-motion on, the page stays fully readable.
   ========================================================================= */

/* ---- Reduced motion: opt out of the whole layer ------------------------- */
@media (prefers-reduced-motion: reduce) {
  .intro, .cursor, .cursor__ring, .curtain { display: none !important; }
  [data-split] .word__i,
  [data-split] .char__i { transform: none !important; opacity: 1 !important; }
  .parallax-media img { transform: none !important; }
}

/* =========================================================================
   1 — Intro curtain (first visit per session)
   ========================================================================= */
.intro {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg-deep);
  display: grid; place-items: center;
  transition: transform 1.05s var(--ease-out), opacity .5s linear .55s;
}
.intro.is-done { transform: translateY(-101%); opacity: 0; pointer-events: none; }
.intro__inner { text-align: center; }
.intro__word {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(2.4rem, 9vw, 6rem); letter-spacing: -.03em; line-height: 1;
  display: flex; gap: .01em; overflow: hidden;
}
.intro__word span {
  display: inline-block; transform: translateY(110%);
  animation: introUp .9s var(--ease-out) forwards;
}
.intro__bar {
  margin: 30px auto 0; width: min(280px, 60vw); height: 2px;
  background: var(--line-2); overflow: hidden; border-radius: 2px;
}
.intro__bar i {
  display: block; height: 100%; width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  animation: introBar 1.15s var(--ease) .15s forwards;
}
@keyframes introUp  { to { transform: translateY(0); } }
@keyframes introBar { to { transform: scaleX(1); } }

/* Hold the page still until the intro lifts */
body.is-loading { overflow: hidden; }

/* =========================================================================
   2 — Page-transition curtain
   ========================================================================= */
.curtain {
  position: fixed; inset: 0; z-index: 190; background: var(--bg-deep);
  transform: translateY(100%); pointer-events: none;
  transition: transform .62s var(--ease-out);
}
.curtain.is-in { transform: translateY(0); }

/* =========================================================================
   3 — Custom cursor (fine pointers only)
   ========================================================================= */
.cursor, .cursor__ring {
  position: fixed; top: 0; left: 0; z-index: 210; pointer-events: none;
  border-radius: 50%; mix-blend-mode: difference;
  will-change: transform;
}
.cursor { width: 7px; height: 7px; background: #fff; margin: -3.5px 0 0 -3.5px; }
.cursor__ring {
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 1px solid rgba(255,255,255,.55);
  transition: width .32s var(--ease), height .32s var(--ease),
              margin .32s var(--ease), background-color .32s var(--ease),
              border-color .32s var(--ease), opacity .3s;
  display: grid; place-items: center;
}
.cursor__ring b {
  font-family: var(--font-display); font-size: .62rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: #000;
  opacity: 0; transition: opacity .25s var(--ease);
}
body.cur-hover .cursor__ring {
  width: 62px; height: 62px; margin: -31px 0 0 -31px;
  background: rgba(255,255,255,.9); border-color: transparent;
}
body.cur-hover .cursor { opacity: 0; }
body.cur-view .cursor__ring {
  width: 92px; height: 92px; margin: -46px 0 0 -46px;
  background: var(--accent); border-color: transparent; mix-blend-mode: normal;
}
body.cur-view .cursor__ring b { opacity: 1; color: #fff; }
body.cur-view .cursor { opacity: 0; }
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor, .cursor__ring { display: none !important; }
}
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }

/* =========================================================================
   4 — Scroll progress
   ========================================================================= */
.scrollbar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 120;
  background: transparent; pointer-events: none;
}
.scrollbar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left;
}

/* =========================================================================
   5 — Split-text reveal
   ========================================================================= */
/* Hidden only until the split has run — GSAP then owns the animation, and the
   masked line wrappers do the clipping. Never leave text stuck at opacity 0. */
[data-split]:not(.in) { visibility: hidden; }
[data-split].in { visibility: visible; }
/* SplitText's line + mask wrappers shrink-wrap by default, which knocks
   centred headings off-axis. Force them full width and let text-align win. */
[data-split] .line__i,
[data-split] .line__i-mask {
  display: block; width: 100%; text-align: inherit;
}

/* =========================================================================
   5b — Scroll-linked text fill
   ========================================================================= */
[data-fill].is-split .fill__w { color: rgba(255,255,255,.13); }
[data-fill].is-split em { color: inherit; font-style: normal; }
[data-fill].is-filled .fill__w { color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  [data-fill] .fill__w { color: var(--ink) !important; }
  [data-fill] em .fill__w { color: var(--accent) !important; }
}

/* =========================================================================
   6 — Hero: prism artwork + parallax
   ========================================================================= */
/* The prism sits low and to the right so it frames the headline instead of
   colliding with it; the headline block always stays on clean canvas. */
.hero__art {
  position: absolute; right: -6%; bottom: -6%; width: min(68vw, 1050px); height: 88%;
  z-index: 0; pointer-events: none; overflow: hidden;
}
.hero__art img {
  width: 100%; height: 100%; object-fit: cover; object-position: 60% 40%;
  opacity: .5; will-change: transform;
  mask-image: radial-gradient(78% 78% at 68% 62%, #000 18%, transparent 72%);
  -webkit-mask-image: radial-gradient(78% 78% at 68% 62%, #000 18%, transparent 72%);
}
/* Scrim: keeps the left/centre — where the headline lives — properly dark,
   and lets the prism read only at the right edge. */
.hero__art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(26,25,28,.82) 26%, rgba(26,25,28,.1) 62%, transparent 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 42%);
}
@media (max-width: 900px) {
  .hero__art { right: -22%; width: 120vw; height: 60%; bottom: -6%; }
  .hero__art img { opacity: .3; }
}
/* Paint order: prism (0) → glow + vignette (1) → grain (2) → content (3) */
.hero__glow { z-index: 1; }
.hero__art.is-off { display: none; }
.hero__inner { position: relative; z-index: 3; }
.hero__grain {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
}

/* =========================================================================
   7 — Marquee reacts to scroll velocity
   ========================================================================= */
.marquee { --skew: 0deg; }
.marquee__track {
  transform: skewX(var(--skew));
  transition: transform .5s var(--ease-out);
}
.marquee:hover .marquee__item { color: var(--ink-soft); }
.marquee__item { transition: color .4s var(--ease); }

/* =========================================================================
   8 — Horizontal capability rail (sticky scroll-jack, bounded)
   ========================================================================= */
.rail { position: relative; }
.rail__sticky {
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  gap: clamp(26px, 5vh, 56px);
}
.rail__track {
  display: flex; gap: 26px; padding-inline: var(--gutter);
  will-change: transform;
}
.rail__card {
  flex: 0 0 clamp(258px, 28vw, 380px);
  min-height: clamp(240px, 34vh, 320px); padding: 28px 28px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: border-color .4s var(--ease), background-color .4s var(--ease);
}
.rail__card:hover { border-color: var(--accent); background: var(--panel-2); }
.rail__card h3 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem); text-transform: none; letter-spacing: -.02em;
}
.rail__card p { color: var(--ink-soft); font-size: .95rem; margin-top: 12px; }
.rail__card > div { margin-top: auto; }
.rail__n {
  font-family: var(--font-display); font-size: .78rem; letter-spacing: .12em;
  color: var(--accent-2);
}
.rail__head { padding-inline: var(--gutter); flex: none; }
.rail__head .sec-head__title { margin: 0; }
@media (max-width: 860px) {
  .rail__sticky { position: static; height: auto; padding-block: 20px; }
  .rail__track { transform: none !important; overflow-x: auto; scroll-snap-type: x mandatory;
                 padding-bottom: 20px; -webkit-overflow-scrolling: touch; }
  .rail__card { scroll-snap-align: start; }
}

/* =========================================================================
   9 — Work cards: media parallax + hover
   ========================================================================= */
/* Work cards are links into the service that delivers that kind of work. */
a.work-card { display: block; color: inherit; text-decoration: none; }
a.work-card:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 6px; }
a.work-card:hover .work-card__arrow {
  background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(45deg);
}

.parallax-media { overflow: hidden; }
.parallax-media img {
  width: 100%; height: 118%; object-fit: cover;
  transform: translateY(-8%) scale(1.02);
  will-change: transform;
  transition: filter .6s var(--ease);
}
.work-card:hover .parallax-media img { filter: brightness(1.08) saturate(1.1); }

/* =========================================================================
   10 — Counters + big CTA letters
   ========================================================================= */
.stat__n { font-variant-numeric: tabular-nums; }

.cta__big .char__i {
  transition: transform .5s var(--ease-out), color .4s var(--ease);
}
.cta__big .char__i:hover { transform: translateY(-14px) !important; color: var(--accent); }

/* =========================================================================
   11 — Magnetic buttons
   ========================================================================= */
[data-magnetic] { will-change: transform; }
[data-magnetic] > * { pointer-events: none; }

/* =========================================================================
   11b — Service cards are links now: arrow affordance + keyboard focus
   ========================================================================= */
.svc { color: inherit; text-decoration: none; padding-bottom: 62px; }
.svc__go {
  position: absolute; right: 26px; bottom: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-2); display: grid; place-items: center;
  color: var(--ink); transition: .45s var(--ease);
}
.svc__go svg { width: 17px; height: 17px; }
.svc:hover .svc__go { background: var(--accent); border-color: var(--accent); transform: rotate(45deg); }
.svc--accent .svc__go { border-color: rgba(255,255,255,.45); color: #fff; }
.svc--accent:hover .svc__go { background: #fff; border-color: #fff; color: var(--accent); }
.svc:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; }

/* =========================================================================
   12 — Service page chrome (shared by /services/*)
   ========================================================================= */
/* Service pages carry less imagery than the homepage, so the homepage's
   generous section rhythm reads as dead space here — tighten it. */
.svc-page .section { padding-block: clamp(54px, 6.4vw, 96px); }
.svc-page .sec-head { margin-bottom: clamp(30px, 3.4vw, 48px); }
.svc-page .sec-head__aside { max-width: 52ch; }
.svc-hero { padding-top: clamp(140px, 18vh, 200px); padding-bottom: 40px; position: relative; }
.svc-hero__title {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(2.6rem, 9vw, 7.2rem); line-height: .92; letter-spacing: -.035em;
}
.svc-hero__lede { max-width: 62ch; color: var(--ink-soft); font-size: clamp(1.05rem, 1.6vw, 1.25rem); margin-top: 28px; }
.svc-hero__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.svc-hero__meta span {
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 15px; color: var(--ink-soft);
}

.crumbs { display: flex; gap: 10px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 26px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-2); }

.deliver { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.deliver__item {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 28px 26px; transition: border-color .4s var(--ease), transform .5s var(--ease-out);
}
.deliver__item:hover { border-color: var(--accent); transform: translateY(-4px); }
.deliver__item h3 { font-size: 1.18rem; text-transform: none; letter-spacing: -.01em; margin-bottom: 10px; }
.deliver__item p { color: var(--ink-soft); font-size: .95rem; }
.deliver__n { font-family: var(--font-display); font-size: .78rem; color: var(--muted-2); letter-spacing: .1em; display: block; margin-bottom: 14px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 10px; }
.pill-list span {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 10px 18px; font-size: .9rem; color: var(--ink-soft);
}

.svc-next { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.svc-next a {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  font-family: var(--font-display); font-size: clamp(1.15rem, 2vw, 1.5rem);
  transition: border-color .4s var(--ease), background-color .4s var(--ease);
}
.svc-next a:hover { border-color: var(--accent); background: var(--panel); }
.svc-next svg { width: 22px; height: 22px; flex: none; }

.svc-index { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.svc-row {
  display: grid; grid-template-columns: 90px 1fr minmax(0, 460px) 60px;
  gap: 24px; align-items: center;
  padding: clamp(26px, 3.4vw, 42px) 4px;
  border-bottom: 1px solid var(--line);
  position: relative; transition: padding-left .5s var(--ease);
}
.svc-row:hover { padding-left: 20px; }
.svc-row::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .6s var(--ease-out);
}
.svc-row:hover::after { transform: scaleX(1); }
.svc-row__n { font-family: var(--font-display); color: var(--muted-2); font-size: .84rem; letter-spacing: .1em; }
.svc-row__t {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.5rem, 3.6vw, 2.8rem); letter-spacing: -.025em; line-height: 1;
  transition: color .4s var(--ease);
}
.svc-row:hover .svc-row__t { color: var(--accent-2); }
.svc-row__d { color: var(--ink-soft); font-size: .98rem; }
.svc-row__a { justify-self: end; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2);
              display: grid; place-items: center; transition: .4s var(--ease); }
.svc-row:hover .svc-row__a { background: var(--accent); border-color: var(--accent); transform: rotate(45deg); }
.svc-row__a svg { width: 18px; height: 18px; }

@media (max-width: 900px) {
  .deliver { grid-template-columns: 1fr; }
  .svc-next { grid-template-columns: 1fr; }
  .svc-row { grid-template-columns: 1fr 46px; gap: 12px; }
  .svc-row__n { display: none; }
  .svc-row__d { grid-column: 1 / -1; }
}
