/* Shapesound motion (tech/motion.css), paired with tech/motion.js. Load after draft.css.
   The feel of the page: the hero headline rising into place, calm reveals, product cards that answer the
   pointer, buttons that press, a nav that firms up once you scroll, and product windows that morph into
   their own page. It adds no colours or layout of its own: every rule is either a state motion.js
   switches on or a smoother version of something draft.css already does. */

/* ---------- Cross-document view transitions (home page card <-> product page stage) ---------- */
/* Each card's window carries view-transition-name: shot-<id> (set by motion.js); the product page gives
   its stage image the same name, so the window glides from the card into its page and back. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-group(*) {
  animation-duration: 450ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.1, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Hero entrance ---------- */
/* Pure CSS, so the hero always arrives softly even if motion.js is late or missing. When motion.js is in
   time it swaps this for the full version (each line rising from behind a mask) and the lead and buttons
   following on. */
@keyframes mo-rise {
  from { opacity: 0; translate: 0 var(--mo-rise, 20px); }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .display {
    --mo-rise: 0.16em;
    animation: mo-rise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .display ~ .hero-row,
  .display ~ .lead,
  .display ~ .hero-actions,
  [data-hero-follow] {
    --mo-rise: 16px;
    animation: mo-rise 800ms cubic-bezier(0.2, 0.7, 0.2, 1) 320ms both;
  }
}
/* The line masks motion.js builds (it also sets the essentials inline, so they never depend on this file). */
.mo-line { display: inline-block; }
.mo-line-in { display: block; }

/* ---------- Reveals ---------- */
/* Only ever added by motion.js, only to things below the fold, and only once it has an observer ready
   to take it off again. */
.mo-rv { opacity: 0; translate: 0 20px; }
.mo-rv[data-reveal="fade"] { translate: none; }
@media print {
  .mo-rv { opacity: 1 !important; translate: none !important; }
}

/* ---------- Sticky nav ---------- */
/* Once the page scrolls under it, a slightly stronger background and a clearer hairline fade in. */
.nav.mo-nav::before {
  content: "";
  position: absolute;
  inset: 0 0 -1px;
  z-index: -1;
  background: rgba(7, 9, 12, 0.55);
  border-bottom: 1px solid rgba(43, 54, 68, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.nav.mo-nav.mo-stuck::before { opacity: 1; }

/* ---------- Buttons ---------- */
.btn {
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.3s, 0.3s, 0.3s, 0.09s;
}
/* Buy buttons: one faint band of light crosses once on hover. */
.btn-buy.mo-sweep-on { position: relative; isolation: isolate; }
.mo-sweep {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.mo-sweep::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.07) 30%,
    rgba(255, 255, 255, 0.24) 50%,
    rgba(255, 255, 255, 0.07) 70%,
    rgba(255, 255, 255, 0) 100%);
  opacity: 0;
  transform: translateX(-105%);
  /* On leave: fade where it is, then go back to the start unseen. */
  transition: opacity 0.3s ease, transform 0s linear 0.3s;
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .btn-buy:hover > .mo-sweep::before {
    opacity: 1;
    transform: translateX(175%);
    transition: opacity 0.25s ease, transform 1.1s cubic-bezier(0.3, 0.1, 0.2, 1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
  .mo-sweep { display: none; }
}

/* ---------- Product cards ---------- */
/* While motion.js drives a card it carries .mo-active and owns its transforms; draft.css's own hover lift
   steps aside so the two never fight. */
.mo-tilt .card:hover,
.mo-tilt .card:hover .plinth > img { transform: none; }
.card.mo-active { transition: border-color 0.3s ease; }
.card.mo-active .plinth > img { transition: none; }
.mo-cards .card:focus-visible { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
/* The window paints above the glow and shadow layers motion.js puts behind it. */
.mo-cards .plinth > img { position: relative; }

.mo-glow,
.mo-shade,
.mo-sheen {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}
/* The accent light under the window, a little brighter while the card is lifted. */
.mo-glow {
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 102%,
    color-mix(in srgb, var(--accent) 30%, transparent), transparent 72%);
}
/* A deeper, softer shadow that fades in under the window as it rises. */
.mo-shade {
  left: 12%;
  top: 20%;
  width: 76%;
  height: 60%;
  border-radius: 10px;
  box-shadow:
    0 58px 110px -18px rgba(0, 0, 0, 0.62),
    0 26px 50px -14px rgba(0, 0, 0, 0.34);
}
/* A soft highlight that follows the pointer across the plinth. */
.mo-sheen {
  left: 0;
  top: 0;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(255, 255, 255, 0.068),
    rgba(255, 255, 255, 0.032) 45%,
    rgba(255, 255, 255, 0.01) 75%,
    rgba(255, 255, 255, 0));
}
