/* ==========================================================================
   Motion layer — springy, fluid, "alive". Paired with js/motion.js.
   ========================================================================== */
:root {
  --spring: cubic-bezier(.2, 1.3, .35, 1);
  --soft: cubic-bezier(.3, 1.12, .4, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
}

/* page entry: the content fades in under a top bar that never moves.
   No View Transitions on purpose: their overlay blocks every click until it ends,
   so the menu couldn't be used to switch pages quickly.
   Opacity only and fill "backwards", so nothing lingers after the fade
   (no containing block for the fixed viewer, no fight with other opacity states). */
main, .socials-row, .foot { animation: page-in .45s var(--out) backwards; }
@keyframes page-in { from { opacity: 0; } }

/* scroll reveal: rise, unblur, settle with a little overshoot */
.reveal { opacity: 0; transform: translateY(34px) scale(.96); filter: blur(8px);
  transition: opacity .7s var(--out), transform 1s var(--spring), filter .8s var(--out); }
.reveal.in { opacity: 1; transform: none; filter: none; }

/* letter-by-letter titles */
.ch { display: inline-block; animation: chUp 1s var(--spring) both; animation-delay: calc(var(--d, 0ms) + var(--i) * 38ms); }
@keyframes chUp { from { transform: translateY(.55em) rotate(7deg) scale(.9); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }

/* slides: gentle crossfade, almost no zoom */
.door .slides img, .page-hero .bg img { transform: scale(1.02); transition: opacity 1.6s ease, transform 8s linear; }
.door .slides img.on, .page-hero .bg img.on { transform: scale(1); }

/* doors: hover only lights the outline and turns the arrow; the picture stays put */
.door-arrow { transition: background .3s, color .3s, transform .5s var(--spring); }
.door .door-meta p { transition: opacity .4s, translate .6s var(--spring); }
.door:hover .door-meta p { opacity: 1; translate: 0 -2px; }

/* magnetic buttons */
.btn { transition: background .25s, color .25s, border-color .25s, transform .25s var(--ease), translate .6s var(--spring); }
.icon-btn { transition: background .2s, color .2s, border-color .2s, translate .6s var(--spring); }

/* 3D tilt */
.proj img { transition: transform .55s var(--spring), box-shadow .3s; }
.tilting img { transition: transform .12s linear !important; }
.tile, .vid .th, .credit .cover, .product .cover { transition: transform .7s var(--spring); }
.tile.tilting, .vid .th.tilting, .credit .cover.tilting, .product .cover.tilting { transition: transform .12s linear; }

/* sliding highlight behind the active filter */
.filters { position: relative; isolation: isolate; }
.filters .ind { position: absolute; left: 0; top: 0; z-index: -1; border-radius: 99px; background: var(--accent); pointer-events: none;
  transition: transform .6s var(--spring), width .6s var(--spring), height .6s var(--spring); }
.filters.has-ind button[aria-pressed="true"] { background: transparent; border-color: transparent; }

/* Labs images: lift, glow and tilt under the pointer; all of them open the viewer */
.build-media > img, .shots img { cursor: zoom-in; transition: transform .7s var(--spring), box-shadow .35s; }
.build-media > img:hover, .shots img:hover { box-shadow: 0 0 0 2px var(--accent), 0 30px 60px -24px rgba(0,0,0,.85) !important; }
img.tilting { transition: transform .12s linear, box-shadow .35s !important; }

/* Labs fact tables respond to the pointer */
.build ul.facts li { transition: background .3s; }
.build ul.facts li:hover { background: var(--bg-3); }
.build ul.facts li b { display: inline-block; transition: translate .5s var(--spring), color .3s; }
.build ul.facts li:hover b { translate: 3px 0; color: var(--accent); }

/* reading progress */
.progress { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }

/* shutter flash (Light) */
.flash { position: fixed; inset: 0; z-index: 110; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .34s ease-out; }
@keyframes flash { 15% { opacity: .5; } 100% { opacity: 0; } }

/* ---------- home: one fixed backdrop (grid floor + dark falloff) ---------- */
body.home { background: radial-gradient(ellipse 120% 80% at 50% 120%, rgba(0,0,0,.6), transparent), var(--bg); }

/* home backdrop: a 3D viewport grid (cousin of the Labs blueprint) drifting toward you */
.floor { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; perspective: 600px; perspective-origin: 50% 30%; }
.floor::before { content: ""; position: absolute; left: -80%; right: -80%; bottom: -10%; height: 110%; transform-origin: 50% 100%; transform: rotateX(70deg);
  background:
    linear-gradient(rgba(255,255,255,.16) 1.5px, transparent 1.5px) 0 0 / 90px 90px,
    linear-gradient(90deg, rgba(255,255,255,.16) 1.5px, transparent 1.5px) 0 0 / 90px 90px;
  -webkit-mask: linear-gradient(to top, #000 0%, rgba(0,0,0,.7) 35%, transparent 80%); mask: linear-gradient(to top, #000 0%, rgba(0,0,0,.7) 35%, transparent 80%);
  animation: floor 7s linear infinite; }
.floor::after { content: ""; position: absolute; inset: 0 0 45% 0;
  background: radial-gradient(rgba(255,255,255,.2) 1px, transparent 1.5px) 0 0 / 26px 26px;
  -webkit-mask: linear-gradient(#000, transparent); mask: linear-gradient(#000, transparent); opacity: .8; }
@keyframes floor { to { background-position: 0 90px, 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .floor::before { animation: none; }
  .ch { animation: none; }
  .reveal { filter: none; }
  .progress { display: none; }
  main, .socials-row, .foot { animation: none; }
}
