/* ============================================================
   Wasser AI — Motion layer (Glacial Clean v2)
   Shared by index / services / about.
   Rules: transform + opacity + clip-path + filter only.
   Everything motion-gated behind html.wm-motion (added by
   motion-v2.js, skipped for prefers-reduced-motion).
============================================================ */

:root {
  --wm-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --wm-inout:  cubic-bezier(0.77, 0, 0.175, 1);
  --wm-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

html { overflow-x: clip; }

/* ------------------------------------------------------------
   Cross-page view transitions (progressive enhancement)
------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @view-transition { navigation: auto; }

  ::view-transition-old(root) {
    animation: wm-vt-out 220ms var(--wm-out) both;
  }
  ::view-transition-new(root) {
    animation: wm-vt-in 420ms var(--wm-out) both;
  }
}
@keyframes wm-vt-out {
  to { opacity: 0; transform: translateY(-10px); }
}
@keyframes wm-vt-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* ------------------------------------------------------------
   Scroll progress hairline
------------------------------------------------------------ */
.wm-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 2000;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--brand-deep-sea, #0d3b54), var(--brand-ice, #5aa3c2));
}

/* ------------------------------------------------------------
   Floating glass nav (injected by motion-v2.js)
------------------------------------------------------------ */
.wm-nav {
  position: fixed;
  top: 14px; left: 50%;
  z-index: 1500;
  display: flex; align-items: center; gap: 2px;
  padding: 7px 7px 7px 16px;
  border-radius: 999px;
  font-family: var(--font-body, "Plus Jakarta Sans", system-ui, sans-serif);
  border: 1px solid rgba(10, 14, 20, 0.10);
  background: rgba(246, 250, 252, 0.78);
  background: color-mix(in oklab, var(--brand-paper, #f6fafc) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 16px 40px -20px rgba(5, 24, 33, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, 0, 0);
  transition: opacity 300ms ease, visibility 300ms;
}
.wm-nav.wm-show { opacity: 1; visibility: visible; }
.wm-motion .wm-nav {
  transform: translate3d(-50%, -90px, 0);
  transition: transform 520ms var(--wm-drawer), opacity 320ms ease, visibility 320ms;
}
.wm-motion .wm-nav.wm-show { transform: translate3d(-50%, 0, 0); }

.wm-nav-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  color: var(--brand-ink, #0a0e14);
  padding-right: 12px;
  white-space: nowrap;
}
.wm-nav-brand img { display: block; }
.wm-nav-brand em {
  font-family: var(--font-italic, Georgia, serif);
  font-style: italic; font-weight: 400;
  font-size: 0.85em;
  color: var(--brand-deep-sea, #0d3b54);
}
.wm-nav-link {
  font-size: 12.5px; font-weight: 500;
  color: var(--brand-ink-mut, #4a5868);
  padding: 8px 13px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}
.wm-nav-link:hover {
  color: var(--brand-deep-sea, #0d3b54);
  background: rgba(13, 59, 84, 0.07);
}
.wm-nav-link.active { color: var(--brand-deep-sea, #0d3b54); }
.wm-nav-cta {
  font-size: 12.5px; font-weight: 600;
  color: var(--brand-snow, #f4f9fb);
  background: var(--brand-deep-sea, #0d3b54);
  padding: 9px 16px;
  margin-left: 8px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 160ms ease;
}
.wm-nav-cta:hover { background: var(--brand-current, #15577f); }
@media (max-width: 680px) {
  .wm-nav-link { display: none; }
  .wm-nav-brand { padding-right: 4px; }
}

/* ------------------------------------------------------------
   Scroll reveal system
   data-reveal            → rise + fade + de-blur
   data-reveal="down"     → drop in from above (nav)
   data-reveal="fade"     → opacity only
   data-reveal="words"    → per-word cascade (spans added by JS)
   data-reveal="clip"     → curtain reveal for images
   --wm-d                 → per-element delay
------------------------------------------------------------ */
.wm-motion [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(6px);
  transition:
    opacity 900ms var(--wm-out),
    transform 900ms var(--wm-out),
    filter 900ms var(--wm-out);
  transition-delay: var(--wm-d, 0ms);
}
.wm-motion [data-reveal].wm-in {
  opacity: 1;
  transform: none;
  filter: none;
}

.wm-motion [data-reveal="down"] { transform: translateY(-18px); filter: none; }

.wm-motion [data-reveal="fade"] { transform: none; filter: none; transition: opacity 1100ms ease; transition-delay: var(--wm-d, 0ms); }

.wm-motion [data-reveal="words"] {
  opacity: 1; transform: none; filter: none; transition: none;
}
.wm-w { display: inline-block; }
.wm-motion [data-reveal="words"] .wm-w {
  opacity: 0;
  transform: translateY(0.55em);
  filter: blur(10px);
  transition:
    opacity 850ms var(--wm-out),
    transform 850ms var(--wm-out),
    filter 850ms var(--wm-out);
  transition-delay: var(--wm-d, 0ms);
}
.wm-motion [data-reveal="words"].wm-in .wm-w {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Curtain goes on the inner img, NOT the observed container — a fully
   clip-pathed element never intersects, so it would never reveal. */
.wm-motion [data-reveal="clip"] {
  opacity: 1; filter: none; transform: none; transition: none;
}
.wm-motion [data-reveal="clip"] img {
  clip-path: inset(100% 0 0 0);
  transform: scale(1.16);
  transition:
    clip-path 1100ms var(--wm-inout),
    transform 1400ms var(--wm-inout);
  transition-delay: var(--wm-d, 0ms);
}
.wm-motion [data-reveal="clip"].wm-in img {
  clip-path: inset(0 0 0 0);
  transform: none;
}

/* ------------------------------------------------------------
   Hero scroll cue (injected by motion-v2.js)
------------------------------------------------------------ */
.wm-cue {
  position: absolute;
  left: 50%; bottom: 24px;
  z-index: 6;
  transform: translateX(-50%);
  font-family: var(--font-mono, monospace);
  font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(244, 249, 251, 0.72);
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(5, 24, 33, 0.8);
}
.wm-cue-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.wm-motion .wm-cue-inner { animation: wm-cue-in 1200ms ease 1500ms both; }
@keyframes wm-cue-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (max-width: 719px) {
  .wm-cue { display: none; }
}
.wm-cue-line {
  width: 1px; height: 44px;
  background: linear-gradient(180deg, transparent, var(--brand-snow, #f4f9fb));
}
.wm-motion .wm-cue-line { animation: wm-cue-draw 2.4s var(--wm-inout) infinite; }
@keyframes wm-cue-draw {
  0%   { transform: scaleY(0); transform-origin: 50% 0; }
  45%  { transform: scaleY(1); transform-origin: 50% 0; }
  55%  { transform: scaleY(1); transform-origin: 50% 100%; }
  100% { transform: scaleY(0); transform-origin: 50% 100%; }
}

/* ------------------------------------------------------------
   Magnetic buttons (JS drives --mx / --my; press scales down)
------------------------------------------------------------ */
.wm-motion .wm-mag {
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) scale(var(--ms, 1));
  transition:
    background-color 200ms var(--wm-out),
    border-color 200ms var(--wm-out),
    color 200ms var(--wm-out),
    box-shadow 200ms var(--wm-out);
}
.wm-motion .wm-mag:active { --ms: 0.97; }

/* ------------------------------------------------------------
   Cursor spotlight on cards (JS drives --wm-x / --wm-y)
------------------------------------------------------------ */
@media (hover: hover) and (pointer: fine) {
  .wm-motion .wm-spot { position: relative; }
  .wm-motion .wm-spot::after {
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 320ms var(--wm-out);
    background: radial-gradient(
      240px circle at var(--wm-x, 50%) var(--wm-y, 50%),
      color-mix(in oklab, var(--brand-ice, #5aa3c2) 17%, transparent),
      transparent 65%
    );
  }
  .wm-motion .wm-spot:hover::after { opacity: 1; }
}

/* ------------------------------------------------------------
   Topics marquee (index)
------------------------------------------------------------ */
.wm-marquee {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 18px 0;
  border-top: 1px solid var(--brand-edge-soft, rgba(10, 14, 20, 0.08));
  border-bottom: 1px solid var(--brand-edge-soft, rgba(10, 14, 20, 0.08));
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.wm-marquee-track {
  display: flex;
  width: max-content;
  animation: wm-marquee 40s linear infinite;
}
.wm-marquee:hover .wm-marquee-track { animation-play-state: paused; }
.wm-mq-item {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand-ink-mut, #4a5868);
  white-space: nowrap;
}
.wm-mq-item::after {
  content: "·";
  color: var(--brand-ice, #5aa3c2);
  margin: 0 28px;
}
@keyframes wm-marquee {
  to { transform: translate3d(-50%, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .wm-marquee-track { animation: none; }
}

/* ------------------------------------------------------------
   Ambient aurora drift on dark strips (index)
------------------------------------------------------------ */
.wm-motion .tt-strip::before {
  animation: wm-aurora 22s var(--wm-inout) infinite alternate;
}
@keyframes wm-aurora {
  from { transform: translate3d(-3%, -4%, 0) scale(1.05); }
  to   { transform: translate3d(3%, 5%, 0) scale(1.18); }
}

/* Parallax targets get compositor hints only while hero is on screen */
.wm-motion .hero-stage,
.wm-motion .hero-flow { will-change: transform, opacity; }
