/* =========================================================
   原田亜美 OFFICIAL WEB SITE — Animations (fx.css)
   html.fx が付いているとき（JavaScript 有効時）だけ演出します。
   ========================================================= */

/* ---------- Opening loader (top page, first visit) ---------- */
#fx-loader {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-content: center; justify-items: center; gap: 6px;
  background:
    radial-gradient(60% 60% at 50% 40%, rgba(177, 143, 247, .35), transparent 70%),
    var(--grad-deep);
  color: #fff;
  transition: clip-path 1s cubic-bezier(.77, 0, .18, 1);
  clip-path: inset(0 0 0 0);
}
html:not(.fx) #fx-loader, html.no-loader #fx-loader { display: none; }
#fx-loader.done { clip-path: inset(0 0 100% 0); }
.fx-loader__sig { width: min(78vw, 620px); height: auto; overflow: visible; }
.fx-loader__sig text {
  font-family: var(--script); font-size: 150px; fill: transparent;
  stroke: #fff; stroke-width: 1.2; stroke-dasharray: 1400; stroke-dashoffset: 1400;
}
#fx-loader.go .fx-loader__sig text { animation: sigDraw 2s cubic-bezier(.6, .1, .3, 1) forwards, sigFill .7s ease 1.6s forwards; }
@keyframes sigDraw { to { stroke-dashoffset: 0; } }
@keyframes sigFill { to { fill: #fff; stroke-width: 0; } }
.fx-loader__sub {
  font-family: var(--en); font-weight: 600; font-size: 12px; letter-spacing: .2em; opacity: 0;
  transition: letter-spacing 1.4s var(--ease) 1.4s, opacity 1s ease 1.4s;
}
#fx-loader.go .fx-loader__sub { opacity: .85; letter-spacing: .6em; }
.fx-loader__heart { width: 22px; height: 22px; margin-top: 18px; opacity: 0; transition: opacity .6s ease 1.8s; }
.fx-loader__heart svg { width: 100%; height: 100%; fill: var(--pink-300); animation: beat 1s ease-in-out infinite; }
#fx-loader.go .fx-loader__heart { opacity: 1; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }

/* ---------- Page wipe transition ---------- */
html.wipe-in::after {
  content: ""; position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: var(--grad-deep);
  animation: wipeOut .8s cubic-bezier(.77, 0, .18, 1) .05s forwards;
}
@keyframes wipeOut { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }
#fx-wipe {
  position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: var(--grad-deep); clip-path: inset(100% 0 0 0);
  display: grid; place-items: center;
}
#fx-wipe.go { animation: wipeIn .55s cubic-bezier(.77, 0, .18, 1) forwards; }
#fx-wipe span { font-family: var(--script); font-size: clamp(60px, 9vw, 110px); color: rgba(255, 255, 255, .9); opacity: 0; transition: opacity .3s .25s; }
#fx-wipe.go span { opacity: 1; }
@keyframes wipeIn { to { clip-path: inset(0 0 0 0); } }

/* ---------- Scroll progress ---------- */
#fx-progress {
  position: fixed; left: 0; top: 0; z-index: 60; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--v-400), var(--v-600), var(--pink-500));
  transform-origin: left; transform: scaleX(0);
}

/* ---------- Hero intro ---------- */
.fx .hero__eyebrow, .fx .hero__lead, .fx .hero__cta, .fx .hero__jp small,
.fx .hero__color, .fx .scroll-cue {
  opacity: 0; transform: translateY(22px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.fx .hero__jp .ch {
  display: inline-block; opacity: 0; transform: translateY(.6em) rotate(8deg); filter: blur(6px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: calc(1s + var(--i) * .09s);
}
.fx .hero__script {
  clip-path: inset(-30% 100% -40% -6%);
  transition: clip-path 2s cubic-bezier(.65, .05, .3, 1) .25s;
}
.fx .badge-rotate { opacity: 0; transform: scale(.3) rotate(-90deg); transition: opacity .8s var(--ease) 1.5s, transform 1.1s cubic-bezier(.34, 1.56, .64, 1) 1.5s; }
.fx .hero__color { transform: translateX(30px); transition-delay: 1.7s; }
.fx .arch__slide.photo { transform: scale(1.25); }
.arch__curtain {
  position: absolute; inset: 0; z-index: 2; background: var(--grad); transform-origin: top;
  transition: transform 1.3s cubic-bezier(.77, 0, .18, 1) .45s;
}
.fx .arch__frame { opacity: 0; transform: scale(.94); transition: opacity 1.2s var(--ease) 1.1s, transform 1.4s var(--ease) 1.1s; }

.is-ready .hero__script { clip-path: inset(-30% -10% -40% -6%); }
.is-ready .hero__eyebrow { opacity: 1; transform: none; transition-delay: .1s; }
.is-ready .hero__jp .ch, .is-ready .hero__jp small { opacity: 1; transform: none; filter: none; }
.is-ready .hero__jp small { transition-delay: 1.5s; }
.is-ready .hero__lead { opacity: 1; transform: none; transition-delay: 1.6s; }
.is-ready .hero__cta { opacity: 1; transform: none; transition-delay: 1.8s; }
.is-ready .scroll-cue { opacity: 1; transform: none; transition-delay: 2.2s; }
.is-ready .arch__curtain { transform: scaleY(0); }
.is-ready .arch__slide.photo.is-active { transform: scale(1); transition: opacity 1.4s var(--ease), transform 2.6s var(--ease) .5s; }
.is-ready .arch__frame { opacity: 1; transform: none; }
.is-ready .badge-rotate { opacity: 1; transform: none; }
.is-ready .hero__color { opacity: 1; transform: none; }

/* Hero mouse parallax target */
.hero__visual { transition: transform .8s var(--ease); will-change: transform; }

/* ---------- Particles ---------- */
.fx-particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero__inner { z-index: 1; }
.page-hero .wrap { position: relative; z-index: 1; }

/* ---------- Sub page hero intro ---------- */
.fx .page-hero__en .ch {
  display: inline-block; opacity: 0; transform: translateY(.5em);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: calc(.15s + var(--i) * .06s);
}
.fx .page-hero__jp, .fx .crumbs { opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease) .6s, transform .9s var(--ease) .6s; }
.fx .page-hero::after { opacity: 0; transform: translateX(40px); transition: opacity 1.4s var(--ease) .4s, transform 1.6s var(--ease) .4s; }
.is-ready .page-hero__en .ch, .is-ready .page-hero__jp, .is-ready .crumbs { opacity: 1; transform: none; }
.is-ready .page-hero::after { opacity: 1; transform: none; }

/* ---------- Section titles ---------- */
.ch-space { display: inline-block; width: .3em; }
.fx .sec-title__en .ch { display: inline-block; opacity: 0; transform: translateY(.55em); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i) * .05s); }
.fx .sec-title__en > span:last-child { opacity: 0; transform: scale(0); transition: opacity .6s var(--ease) .5s, transform .7s cubic-bezier(.34, 1.56, .64, 1) .5s; }
.fx .sec-title__jp { opacity: 0; transition: opacity 1s var(--ease) .5s; }
.fx .sec-head[data-script]::before { opacity: 0; translate: -30px 0; transition: opacity 1.4s var(--ease), translate 1.6s var(--ease); }
.fx .sec-head--center[data-script]::before { translate: -50% 0; transform: translateX(-30px); transition: opacity 1.4s var(--ease), transform 1.6s var(--ease); }
.fx .sec-head .more { opacity: 0; transform: translateX(-10px); transition: opacity .8s var(--ease) .6s, transform .8s var(--ease) .6s; }
.fx .sec-head.fx-on .sec-title__en .ch, .fx .sec-head.fx-on .sec-title__en > span:last-child, .fx .sec-head.fx-on .more { opacity: 1; transform: none; }
.fx .sec-head.fx-on .sec-title__jp { opacity: 1; }
.fx .sec-head.fx-on[data-script]::before { opacity: .7; translate: 0 0; }
.fx .sec-head--center.fx-on[data-script]::before { translate: -50% 0; transform: none; }

/* ---------- Staggered lists ---------- */
.fx .fx-stagger > * { opacity: 0; transform: translateY(30px) scale(.98); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * .09s); }
.fx .fx-stagger.fx-on > * { opacity: 1; transform: none; }

/* Image reveal (circle / arch) */
.fx .fx-img { clip-path: circle(0% at 50% 50%); transition: clip-path 1.6s cubic-bezier(.65, .05, .3, 1); }
.fx .fx-img.fx-on { clip-path: circle(75% at 50% 50%); }
.fx .fx-img-up { clip-path: inset(100% 0 0 0 round 220px 220px 28px 28px); transition: clip-path 1.5s cubic-bezier(.65, .05, .3, 1) .1s; }
.fx .fx-img-up.fx-on { clip-path: inset(0 0 0 0 round 220px 220px 28px 28px); }

/* ---------- Buttons: shine ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); transition: left .8s var(--ease);
}
.btn--primary::after { z-index: 0; }
.btn:hover::after { left: 130%; }
.btn--primary > * { position: relative; z-index: 1; }

/* ---------- Tilt cards ---------- */
.fx-tilt { transform-style: preserve-3d; will-change: transform; }
.fx-tilt::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .35), transparent 45%);
  opacity: 0; transition: opacity .4s;
}
.fx-tilt:hover::before { opacity: 1; }
.banner.fx-tilt::before { z-index: 0; }

/* ---------- Marquee pause on hover ---------- */
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ---------- Cursor sparkles ---------- */
.fx-spark {
  position: fixed; z-index: 150; pointer-events: none; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  animation: spark .9s ease-out forwards;
}
.fx-spark svg { width: 100%; height: 100%; }
@keyframes spark {
  0% { transform: translate(0, 0) scale(.2) rotate(0); opacity: 1; }
  40% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(160deg); opacity: 0; }
}

/* ---------- Heart burst ---------- */
.fx-burst {
  position: fixed; z-index: 150; pointer-events: none; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  animation: burst 1s cubic-bezier(.2, .8, .3, 1) forwards;
}
.fx-burst svg { width: 100%; height: 100%; }
@keyframes burst {
  0% { transform: translate(0, 0) scale(.3); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(var(--s, 1)) rotate(var(--r, 0deg)); opacity: 0; }
}

/* ---------- Lightbox ---------- */
.fx-lightbox {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 70px 20px 40px;
  background: rgba(29, 14, 51, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: opacity .45s var(--ease), visibility 0s linear .45s;
}
.fx-lightbox.is-open { opacity: 1; visibility: visible; transition: opacity .45s var(--ease); }
.fx-lightbox figure { position: relative; display: grid; gap: 16px; justify-items: center; transform: scale(.92) translateY(20px); transition: transform .6s var(--ease); }
.fx-lightbox.is-open figure { transform: none; }
.fx-lightbox img { max-height: 76vh; max-width: min(88vw, 820px); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.fx-lightbox figcaption { display: flex; gap: 16px; align-items: center; color: #fff; font-family: var(--en); font-size: 12px; letter-spacing: .24em; font-weight: 600; }
.fx-lightbox figcaption a { display: inline-flex; gap: 8px; align-items: center; padding: 9px 18px 7px; border-radius: 999px; background: #fff; color: var(--v-800); }
.fx-lightbox figcaption a .icon { margin-top: -2px; }
.fx-lb-btn {
  position: absolute; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff; transition: background .3s;
}
.fx-lb-btn:hover { background: rgba(255, 255, 255, .3); }
.fx-lb-btn .icon { width: 16px; height: 16px; }
.fx-lb-close { top: 18px; right: 18px; font-family: var(--en); font-size: 22px; line-height: 1; }
.fx-lb-prev { left: 18px; top: 50%; transform: translateY(-50%) rotate(180deg); }
.fx-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .fx-lb-prev, .fx-lb-next { top: auto; bottom: 18px; transform: none; } .fx-lb-prev { transform: rotate(180deg); } }

/* ---------- History timeline fill ---------- */
.tl__fill {
  position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; z-index: 1;
  background: linear-gradient(var(--v-600), var(--pink-500));
  transform-origin: top; transform: scaleY(var(--p, 0));
  box-shadow: 0 0 10px rgba(255, 111, 191, .6);
}
.tl__item::before { transition: background .5s var(--ease), border-color .5s, transform .5s cubic-bezier(.34, 1.56, .64, 1); z-index: 2; }
.tl__item.is-passed::before { background: var(--v-600); border-color: #fff; transform: scale(1.15); }
.tl__item.is-highlight.is-passed::before { background: var(--pink-500); }

/* ---------- Floating decoration ---------- */
.about__photo-wrap .about__photo { animation: floaty 6s ease-in-out infinite; }
.profile-photo .photo { animation: floaty 7s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }

/* ---------- Reduced motion: show everything, no motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #fx-loader, html.wipe-in::after, #fx-wipe, .fx-particles, .fx-spark, .fx-burst, .arch__curtain { display: none !important; }
  .fx .hero__eyebrow, .fx .hero__lead, .fx .hero__cta, .fx .hero__jp small, .fx .hero__jp .ch, .fx .hero__color, .fx .scroll-cue,
  .fx .badge-rotate, .fx .arch__frame, .fx .page-hero__en .ch, .fx .page-hero__jp, .fx .crumbs, .fx .page-hero::after,
  .fx .sec-title__en .ch, .fx .sec-title__en > span:last-child, .fx .sec-title__jp, .fx .sec-head .more,
  .fx .fx-stagger > *, .fx .arch__slide.photo { opacity: 1 !important; transform: none !important; filter: none !important; translate: none !important; }
  .fx .hero__script, .fx .fx-img, .fx .fx-img-up { clip-path: none !important; }
  .fx .arch__slide.photo:not(.is-active) { opacity: 0 !important; }
}
