/* ============================================================
   J CONNECT — motion layer (pairs with assets/motion.js)
   Builds on site.js: .reveal → .is-visible. Transform/opacity-first.
   Honours prefers-reduced-motion and html.motion-paused.
   Hidden start states only apply on screens with scripting enabled.
   ============================================================ */
:root { --mo-ease: cubic-bezier(.16, 1, .3, 1); --mo-ease-io: cubic-bezier(.65, 0, .35, 1); }

/* ---- scroll progress (injected into .site-header) ---- */
.mo-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; z-index: 1; pointer-events: none; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--gold)); box-shadow: 0 0 12px rgba(255, 127, 0, .45); }

/* ---- section headings: eyebrow rule + marker sweep (static without JS) ---- */
.eyebrow::before { content: ""; display: inline-block; width: 22px; height: 2px; margin-right: 10px; vertical-align: .32em; border-radius: 2px; background: currentColor; transform-origin: 0 50%; }
.h2 :is(.ja, .en) { background: linear-gradient(transparent 64%, rgba(255, 127, 0, .32) 64%, rgba(255, 127, 0, .32) 90%, transparent 90%) no-repeat 0 0 / 100% 100%; }

/* ---- hero headline split (motion.js wraps chars; originals stay in .sr-only) ---- */
.mo-w { display: inline-block; white-space: nowrap; }
.mo-c { display: inline-block; }
.mo-count { font-variant-numeric: tabular-nums; }

/* ---- hero extras (index) ---- */
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .1; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.mo-spot { position: absolute; left: 0; top: 0; z-index: -1; width: 620px; height: 620px; margin: -310px 0 0 -310px; border-radius: 50%; pointer-events: none; opacity: 0; mix-blend-mode: screen; transition: opacity .6s ease;
  background: radial-gradient(circle, rgba(255, 140, 30, .26), rgba(40, 100, 210, .14) 42%, transparent 68%); }
.mo-spot-on .mo-spot { opacity: 1; }
.motion-paused .mo-spot { opacity: 0; }

/* ---- hashtag tape (index, injected before #gallery) ---- */
.mo-band { position: relative; overflow: hidden; background: var(--night); padding: 34px 0 30px; margin-bottom: -1px; }
.mo-band__strip { margin: 0 -4%; padding: 14px 0; overflow: hidden; }
.mo-band__strip--a { position: relative; z-index: 1; rotate: -2deg; background: var(--accent); color: var(--brand-deep); box-shadow: 0 14px 40px rgba(0, 0, 0, .35); }
.mo-band__strip--b { position: absolute; left: 0; right: 0; top: 50%; margin-top: -34px; rotate: 2.5deg; background: var(--night-2); color: rgba(255, 255, 255, .5); border-block: 1px solid rgba(255, 255, 255, .08); }
.mo-band__track { display: flex; width: max-content; will-change: transform; font: 800 clamp(24px, 4.2vw, 50px)/1.1 var(--font-latin); letter-spacing: -.02em; white-space: nowrap; }
.mo-band__strip--b .mo-band__track { font-size: clamp(16px, 2.2vw, 24px); letter-spacing: .02em; }
.mo-band__track span { display: inline-flex; align-items: center; }
.mo-band__track span::after { content: "✦"; margin: 0 .55em; font-size: .5em; }
.mo-band__strip--a .mo-band__track span:nth-child(even) { color: transparent; -webkit-text-stroke: 1.5px var(--brand-deep); }
.mo-band__strip--a .mo-band__track span:nth-child(even)::after { color: var(--brand-deep); -webkit-text-stroke: 0; }

/* ---- card tilt + glare (fine pointers only; motion.js adds the classes) ---- */
.mo-glare { position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .45s ease;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 160, 70, .2), rgba(255, 255, 255, .06) 35%, transparent 60%); }
.mo-hover > .mo-glare { opacity: 1; }
.mo-hover { --mo-tt: .16s; }
.mo-hover:is(.card, .stat, .tl-card, .join-card, .flow > li) { box-shadow: var(--shadow-lg); }
.g.mo-hover { box-shadow: 0 22px 44px rgba(0, 0, 0, .4); }
html .mo-t { transition: transform var(--mo-tt, .6s) var(--mo-ease), box-shadow .4s ease, border-color .3s ease; }

/* ---- buttons: shine + magnetic pull ---- */
.btn--primary { position: relative; overflow: hidden; isolation: isolate; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, translate .55s var(--mo-ease); }
.btn--primary.mo-mag { transition: transform .15s ease, box-shadow .15s ease, background .15s ease, translate .16s linear; }
.btn--primary::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 55%; z-index: -1; pointer-events: none; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-170%) skewX(-18deg); }
@media (hover: hover) { .btn--primary:hover::after { transform: translateX(280%) skewX(-18deg); transition: transform .8s var(--mo-ease-io); } }

/* ---- ambient loops (paused by html.motion-paused) ---- */
@keyframes mo-orb { to { translate: -90px -60px; scale: 1.15; } }
@keyframes mo-spin { to { rotate: 360deg; } }

/* ================= animated states (motion allowed + JS on) ================= */
@media screen and (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  /* reveals: rise on the independent `translate` property so card hover/tilt transforms stay free */
  .reveal { transform: none; translate: 0 34px; }
  .reveal.is-visible { translate: none; }
  html .reveal { transition: opacity .9s var(--mo-ease) var(--mo-d, 0s), translate 1s var(--mo-ease) var(--mo-d, 0s), clip-path 1.15s var(--mo-ease-io) var(--mo-d, 0s), scale 1s var(--mo-ease) var(--mo-d, 0s), transform var(--mo-tt, .6s) var(--mo-ease), box-shadow .4s ease, border-color .3s ease, background-color .3s ease; }
  .reveal[data-mo="left"]:not(.is-visible) { translate: -40px 0; }
  .reveal[data-mo="scale"]:not(.is-visible) { translate: 0 40px; scale: .95; }
  /* photo wipe (upward). Clip sits on the <img>: IntersectionObserver ignores a fully clipped target */
  .reveal[data-mo="clip"] > img { clip-path: inset(0); transition: clip-path 1.2s var(--mo-ease-io) calc(var(--mo-d, 0s) + .1s), scale 1.6s var(--mo-ease) var(--mo-d, 0s); }
  .reveal[data-mo="clip"]:not(.is-visible) > img { clip-path: inset(100% 0 0 0); scale: 1.18; }
  /* stagger containers stay put; their children animate */
  .reveal[data-mo="stagger"] { opacity: 1; translate: none; }
  html .mo-item { transition: opacity .8s var(--mo-ease) calc(var(--i, 0) * 75ms + 60ms), translate .95s var(--mo-ease) calc(var(--i, 0) * 75ms + 60ms), scale .95s var(--mo-ease) calc(var(--i, 0) * 75ms + 60ms), clip-path 1.1s var(--mo-ease-io) calc(var(--i, 0) * 75ms), transform var(--mo-tt, .6s) var(--mo-ease), box-shadow .4s ease; }
  html .mo-done { transition: transform var(--mo-tt, .6s) var(--mo-ease), box-shadow .4s ease, border-color .3s ease, background-color .3s ease; }
  .reveal:not(.is-visible) .mo-item { opacity: 0; translate: 0 30px; }
  .reveal:not(.is-visible) .mo-item--pop { translate: 0 24px; scale: .86; }
  .mo-item--clip { clip-path: inset(0 round 14px); }
  .reveal:not(.is-visible) .mo-item--clip { opacity: 1; translate: none; clip-path: inset(100% 0 0 0 round 14px); }
  /* photos settle inside their wipe */
  html :is(.mo-item--clip, .fmt__media) img { transition: scale 1.5s var(--mo-ease) var(--mo-d, 0s), transform .6s ease; }
  :is(.reveal:not(.is-visible) .mo-item--clip, .reveal:not(.is-visible) .fmt__media) img { scale: 1.18; }

  /* headings */
  .reveal:not(.is-visible) .eyebrow::before { transform: scaleX(0); }
  .reveal .eyebrow::before { transition: transform .9s var(--mo-ease) .2s; }
  .reveal:not(.is-visible) .h2 :is(.ja, .en) { background-size: 0 100%; }
  .reveal .h2 :is(.ja, .en) { transition: background-size 1.2s var(--mo-ease-io) .35s; }

  /* page-load intro (pure CSS: never waits on JS, ends fully visible) */
  .hero__bg { animation: mo-zoom 1.9s var(--mo-ease) both; scale: 1.06; }
  .hero__pill { animation: mo-rise .9s var(--mo-ease) .05s both; }
  .hero__sub { animation: mo-rise .9s var(--mo-ease) .4s both; }
  .hero__cta { animation: mo-rise .9s var(--mo-ease) .5s both; }
  .hero__float { animation: mo-fade 1.2s ease .55s both; }
  .hero__marquee { animation: mo-rise 1s var(--mo-ease) .45s both; }
  .mo-c { animation: mo-char 1s var(--mo-ease) both; animation-delay: calc(var(--i) * 24ms + 80ms); }
  .mo-ready .hero__title .hl { background-repeat: no-repeat; background-size: 0 100%; animation: mo-hl .9s var(--mo-ease-io) .7s forwards; }
  /* headline is hidden only until motion.js has split it; failsafe shows it at 1.2s if the script never runs */
  html:not(.mo-ready) :is(.hero__title, #page-title) { animation: mo-failsafe 1ms 1.2s both; }

  .ev-hero::before { animation: mo-orb 14s ease-in-out infinite alternate; }
  .collage::before { animation: mo-spin 40s linear infinite; }
  .motion-paused :is(.ev-hero, .collage)::before { animation-play-state: paused; }
}
@keyframes mo-rise { from { opacity: 0; translate: 0 26px; } }
@keyframes mo-fade { from { opacity: 0; } }
@keyframes mo-zoom { from { scale: 1.22; } to { scale: 1.06; } }
@keyframes mo-char { from { opacity: 0; transform: translateY(.62em) rotate(6deg); filter: blur(12px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes mo-hl { to { background-size: 100% 100%; } }
@keyframes mo-failsafe { from { opacity: 0; } to { opacity: 1; } }

/* ================= reduced motion / print: everything static and visible ================= */
@media (prefers-reduced-motion: reduce) {
  .reveal, .mo-item { opacity: 1 !important; translate: none !important; scale: none !important; clip-path: none !important; transition: none !important; }
  .mo-c, .hero__title .hl { animation: none !important; }
  .mo-band, .mo-spot { display: none; }
  .btn--primary::after { display: none; }
  .mo-progress { transition: none; }
}
@media print {
  .reveal, .mo-item { opacity: 1 !important; translate: none !important; scale: none !important; clip-path: none !important; }
  .mo-band, .mo-spot, .mo-progress, .mo-glare { display: none !important; }
}
