/* =========================================================
   Motion pass 2: smooth scroll, page curtain, cursor, magnetic
   buttons, fill sweeps, link underlines, parallax.
   Loaded after animations.css. Everything here is progressive:
   with JS off or reduced motion the site behaves as before.
   ========================================================= */

/* the old cross-fade is replaced by the curtain below */
@view-transition { navigation: none; }  /* no browser-level fade or zoom between pages */

/* ---------- smooth scroll (Lenis) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent], .lenis [data-lenis-prevent-wheel], .lenis [data-lenis-prevent-touch] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- page curtain ---------- */
html::before {
  content: "";
  position: fixed; inset: 0; z-index: 9998;
  background: #0b0b0b;
  clip-path: inset(100% 0 0 0);
  pointer-events: none;
}
html.pt-exit::before { animation: pt-up .55s var(--ease-expo, cubic-bezier(.16,1,.3,1)) forwards; pointer-events: auto; }
html.pt-enter::before { clip-path: inset(0); animation: pt-away .8s .16s var(--ease-expo, cubic-bezier(.16,1,.3,1)) forwards; }
@keyframes pt-up       { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes pt-away     { from { clip-path: inset(0); } to { clip-path: inset(0 0 100% 0); } }

/* animated mark on the curtain: draws on the way out, rests, then fades as the curtain lifts */
.ptc {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  pointer-events: none; opacity: 0;
}
.ptc svg { width: 64px; height: 64px; overflow: visible; }
.ptc, .ptc svg, .ptc path { transform: none !important; scale: none !important; translate: none !important; }
.ptc path {
  fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round;
  stroke-width: 15; stroke-dasharray: 1 2; stroke-dashoffset: 0;
}
html.pt-exit .ptc { opacity: 1; animation: ptc-in .2s .05s ease both; }
html.pt-exit .ptc path { animation: ptc-draw .5s .08s cubic-bezier(.55, 0, .25, 1) both; }
html.pt-enter .ptc { opacity: 1; animation: ptc-out .38s .14s ease both; }
@keyframes ptc-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes ptc-out   { from { opacity: 1; } to { opacity: 0; } }
@keyframes ptc-draw  { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ---------- custom cursor (fine pointers only) ---------- */
.cur {
  position: fixed; left: 0; top: 0; z-index: 9997;
  width: 0; height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.cur.is-on { opacity: 1; }
.cur__in {
  /* Two-tone on purpose: dark core + white halo + thin dark edge,
     so it reads on white, on black, on photos and on the green pill. */
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #0b0b0b;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(11, 11, 11, .55);
  transition: width .5s var(--ease-expo), height .5s var(--ease-expo), margin .5s var(--ease-expo), background-color .35s, box-shadow .35s, transform .3s;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500;
  color: transparent;
}
.cur.is-link .cur__in {
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 1.5px rgba(11, 11, 11, .7);
}
.cur.is-view .cur__in {
  width: 96px; height: 96px; margin: -48px 0 0 -48px;
  background: #39eea0; color: #000;
  box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 4px #fff;
}
.cur.is-down .cur__in { transform: scale(.88); }
html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor .case, html.has-cursor [role="button"] { cursor: none; }

/* ---------- buttons: magnetic pull + fill sweep from entry side ---------- */
.btn, .logo { translate: var(--mx, 0px) var(--my, 0px); }
.btn { transition: transform .5s var(--ease-expo), translate .6s var(--ease-expo), color .45s var(--ease-soft); }
.logo { transition: transform .6s var(--ease-expo), translate .6s var(--ease-expo), box-shadow .4s var(--ease-soft); }
.btn { position: relative; overflow: hidden; isolation: isolate; --x: 50%; --y: 50%; }
.btn::before {
  content: "";
  position: absolute; inset: -1px; z-index: -1;
  background: #000;
  clip-path: circle(0 at var(--x) var(--y));
  transition: clip-path .75s var(--ease-expo);
}
.btn:hover::before, .btn:focus-visible::before { clip-path: circle(150% at var(--x) var(--y)); }
.btn--outline:hover, .btn--outline:focus-visible { background: transparent; color: #fff; }
.btn--solid:hover, .btn--solid:focus-visible { background: #000; color: #000; }
.btn--solid::before { background: #39eea0; }

/* ---------- nav underline: draws in and out ---------- */
.menu a::after { transform-origin: right center; }
.menu a:hover::after, .menu a:focus-visible::after { transform-origin: left center; }

/* ---------- cards: image follows the cursor a little ---------- */
.case__bg img {
  translate: calc(var(--tx, 0) * 1px) calc(var(--ty, 0) * 1px);
  transition: transform 1.6s var(--ease-expo), translate 1.2s var(--ease-expo);
}

/* ---------- scroll parallax targets ---------- */
.cs-top__media:not(.cs-top__media--out) img, .about-hero__photo img { scale: 1.12; will-change: translate; }

@media (hover: none), (pointer: coarse) { .cur { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html::before, .ptc, .cur { display: none !important; }
  .btn, .logo { translate: none; }
  .btn::before { transition: none; }
  .case__bg img { translate: none; }
  .cs-top__media:not(.cs-top__media--out) img, .about-hero__photo img { scale: 1; translate: none; }
}

/* header logo: the new mark sits in the same white circle */
.logo__mark { display: block; width: 30px; height: 30px; }
