/* ==========================================================================
   PAKMAN FX — styles for public/fx.js (all pages)
   Full motion lives under html[data-motion="full"]; Calm keeps the same look, still.
   ========================================================================== */
:root {
  --fx-gold-grad: linear-gradient(115deg, #8a6a3a 0%, #c9a565 28%, #f6e7c6 50%, #c9a565 72%, #8a6a3a 100%);
  --fx-ease: cubic-bezier(.16, 1, .3, 1);
  --fx-ease-io: cubic-bezier(.77, 0, .18, 1);
}

/* ---------- Gold curtain between pages ---------- */
html.fx-leaving::after,
html.fx-arriving::after {
  content: "PAKMAN";
  position: fixed; inset: 0; z-index: 2147483000;
  display: grid; place-items: center;
  font-family: "Archivo Black", "Arial Black", "Helvetica Neue", system-ui, sans-serif; font-weight: 900;
  font-size: clamp(42px, 9vw, 120px); letter-spacing: -.04em; color: #0a0908;
  background: var(--fx-gold-grad);
  pointer-events: none;
}
html.fx-leaving::after { animation: fx-curtain-in .5s var(--fx-ease-io) both; }
html.fx-arriving::after { transform: translateY(0); }
html.fx-arrived::after { transform: translateY(-101%); transition: transform .85s var(--fx-ease-io); }
@keyframes fx-curtain-in { from { transform: translateY(101%); } to { transform: translateY(0); } }

/* ---------- Living gold field ---------- */
.fx-gold { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fx-gold-canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.8s ease; }
.fx-gold-ready .fx-gold-canvas { opacity: 1; }
.fx-gold-fallback {
  background:
    radial-gradient(55% 45% at 72% 38%, rgba(217, 183, 122, .16), transparent 70%),
    radial-gradient(40% 35% at 20% 80%, rgba(217, 183, 122, .08), transparent 70%);
}

/* ---------- Marquee bands ---------- */
.fx-marquee {
  position: relative; overflow: hidden;
  padding: clamp(14px, 2vw, 22px) 0;
  border-top: 1px solid rgba(245, 241, 232, .12); border-bottom: 1px solid rgba(245, 241, 232, .12);
  background: #0c0a08;
  user-select: none;
}
.fx-marquee::before, .fx-marquee::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 12vw; z-index: 2; pointer-events: none;
}
.fx-marquee::before { left: 0; background: linear-gradient(90deg, #0c0a08, transparent); }
.fx-marquee::after { right: 0; background: linear-gradient(270deg, #0c0a08, transparent); }
.fx-marquee-track { display: flex; width: max-content; will-change: transform; transform-origin: 50% 50%; }
.fx-marquee-item {
  display: inline-flex; align-items: center; gap: clamp(18px, 2.4vw, 34px); padding-right: clamp(18px, 2.4vw, 34px);
  font-family: var(--display, "Archivo Black"), sans-serif; font-weight: 900;
  font-size: clamp(30px, 4.6vw, 72px); line-height: 1; letter-spacing: -.035em; text-transform: uppercase;
  color: #f5f1e8; white-space: nowrap;
}
.fx-marquee-item em {
  font-family: var(--serif, "Instrument Serif"), serif; font-style: italic; font-weight: 400;
  text-transform: none; letter-spacing: -.03em;
  background: var(--fx-gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: .06em;
}
.fx-marquee-item .fx-star { font-size: .42em; color: #d9b77a; transform: translateY(-.1em); }
.fx-marquee.is-outline .fx-marquee-item { color: transparent; -webkit-text-stroke: 1px rgba(245, 241, 232, .55); }
.fx-marquee.is-gold { background: var(--fx-gold-grad); border-color: transparent; }
.fx-marquee.is-gold::before { background: linear-gradient(90deg, #8a6a3a, transparent); }
.fx-marquee.is-gold::after { background: linear-gradient(270deg, #8a6a3a, transparent); }
.fx-marquee.is-gold .fx-marquee-item { color: #0a0908; font-size: clamp(22px, 3vw, 44px); }
.fx-marquee.is-gold .fx-marquee-item em { background: none; color: #0a0908; }
.fx-marquee.is-gold .fx-star { color: #0a0908; }
.fx-marquee.is-small .fx-marquee-item { font-size: clamp(18px, 2.2vw, 30px); }

/* ---------- Wipe reveals ---------- */
html.fx-on[data-motion="full"] [data-fx-reveal]:not(.fx-in) { clip-path: inset(100% 0 0 0); }
html.fx-on[data-motion="full"] [data-fx-reveal].fx-in { clip-path: inset(0 0 0 0); transition: clip-path 1.25s var(--fx-ease-io); }
html.fx-on[data-motion="full"] [data-fx-reveal].fx-in img { animation: fx-unzoom 1.8s var(--fx-ease) backwards; }
@keyframes fx-unzoom { from { transform: scale(1.22); } }
html.fx-on[data-motion="full"] [data-fx-reveal]:nth-child(2).fx-in { transition-delay: .08s; }
html.fx-on[data-motion="full"] [data-fx-reveal]:nth-child(3).fx-in { transition-delay: .16s; }
html.fx-on[data-motion="full"] [data-fx-reveal]:nth-child(4).fx-in { transition-delay: .24s; }
html.fx-on[data-motion="full"] [data-fx-reveal]:nth-child(5).fx-in { transition-delay: .32s; }
html.fx-on[data-motion="full"] [data-fx-reveal]:nth-child(6).fx-in { transition-delay: .4s; }

/* ---------- 3D tilt + glare ---------- */
[data-fx-tilt] { position: relative; }
html[data-motion="full"] [data-fx-tilt] {
  transform: perspective(1000px) rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg));
  transition: transform .7s var(--fx-ease);
}
html[data-motion="full"] [data-fx-tilt].fx-tilting { transition: transform .12s linear; }
.fx-glare {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--fx-gx, 50%) var(--fx-gy, 50%), rgba(255, 238, 205, .22), rgba(255, 238, 205, 0) 52%);
  mix-blend-mode: screen; transition: opacity .5s ease;
}
html[data-motion="full"] .fx-tilting > .fx-glare { opacity: 1; }

/* ---------- Cursor glow ---------- */
.fx-spot {
  position: fixed; left: 0; top: 0; z-index: 50;
  width: 620px; height: 620px; margin: -310px 0 0 -310px; border-radius: 50%;
  pointer-events: none; opacity: 0; transition: opacity .8s ease;
  background: radial-gradient(circle, rgba(217, 183, 122, .085) 0%, rgba(217, 183, 122, .035) 32%, rgba(217, 183, 122, 0) 66%);
  mix-blend-mode: screen; will-change: transform;
}
html[data-motion="full"] .fx-spot { opacity: 1; }

/* ---------- Motion switch ---------- */
.motion-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; margin: 0; background: none; border: 0; cursor: pointer;
  font-family: var(--mono, "JetBrains Mono"), monospace; font-size: inherit; letter-spacing: inherit; text-transform: uppercase;
  color: inherit; white-space: nowrap;
}
.motion-toggle i {
  position: relative; flex: none; width: 24px; height: 13px; border-radius: 13px;
  background: rgba(245, 241, 232, .14); box-shadow: inset 0 0 0 1px rgba(245, 241, 232, .22);
  transition: background .35s ease;
}
.motion-toggle i::after {
  content: ""; position: absolute; top: 2.5px; left: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: #c9c4b7; transition: transform .35s var(--fx-ease), background .35s ease;
}
.motion-toggle[aria-pressed="true"] i { background: var(--fx-gold-grad); box-shadow: none; }
.motion-toggle[aria-pressed="true"] i::after { transform: translateX(10px); background: #0a0908; }
.motion-toggle:hover, .motion-toggle:focus-visible { color: #f6e7c6; }
.motion-toggle:focus-visible { outline: 1px solid #d9b77a; outline-offset: 4px; }

/* ---------- Rotating seal ---------- */
.fx-seal {
  position: absolute; z-index: 6; display: block;
  width: clamp(112px, 11vw, 158px); aspect-ratio: 1;
  color: #f5f1e8; text-decoration: none;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .55));
}
.fx-seal svg { width: 100%; height: 100%; overflow: visible; display: block; }
.fx-seal-ring { transform-origin: 100px 100px; }
.fx-seal text { font-family: var(--mono, "JetBrains Mono"), monospace; font-size: 13.5px; letter-spacing: 2.4px; fill: currentColor; text-transform: uppercase; }
.fx-seal-disc { fill: rgba(10, 9, 8, .78); stroke: rgba(217, 183, 122, .45); stroke-width: 1; }
.fx-seal-core { fill: url(#fxSealGold); transition: transform .5s var(--fx-ease); transform-origin: 100px 100px; }
.fx-seal-play { fill: #0a0908; }
html[data-motion="full"] .fx-seal-ring { animation: fx-spin 22s linear infinite; }
html[data-motion="full"] .fx-seal:hover .fx-seal-ring { animation-duration: 6s; }
.fx-seal:hover .fx-seal-core, .fx-seal:focus-visible .fx-seal-core { transform: scale(1.1); }
.fx-seal.is-live .fx-seal-core { fill: #ff2d2d; }
.fx-seal.is-live .fx-seal-play { fill: #fff; }
.fx-seal:focus-visible { outline: 1px solid #d9b77a; outline-offset: 6px; border-radius: 50%; }
@keyframes fx-spin { to { transform: rotate(360deg); } }

/* ---------- Signature wordmark (entrance) ---------- */
.fx-sign { line-height: 1; }
.fx-sign-svg { display: block; width: min(86vw, 1080px); height: auto; margin: 0 auto; overflow: visible; }
.fx-sign-svg text {
  font-family: var(--serif, "Instrument Serif"), serif; font-style: italic; font-weight: 400;
  font-size: 300px; letter-spacing: -10px;
}
.fx-sign-stroke { fill: none; stroke: url(#fxSignGold); stroke-width: 1.4; stroke-dasharray: 2200; stroke-dashoffset: 2200; opacity: 0; }
.fx-sign-fill { fill: url(#fxSignGold); opacity: 0; }
.fx-sign-shine { transform: translateX(-320px); }
.fx-sign.is-ready .fx-sign-fill { opacity: 1; transition: opacity .9s ease; }
html[data-motion="full"] .fx-sign.is-ready .fx-sign-stroke { opacity: 1; animation: fx-draw 2.3s cubic-bezier(.65, 0, .35, 1) .15s forwards; }
html[data-motion="full"] .fx-sign.is-ready .fx-sign-fill { opacity: 0; animation: fx-fill 1.3s ease 1.75s forwards; transition: none; }
html[data-motion="full"] .fx-sign.is-ready .fx-sign-shine { animation: fx-shine 5.5s cubic-bezier(.65, 0, .35, 1) 3s infinite; }
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
@keyframes fx-fill { to { opacity: 1; } }
@keyframes fx-shine { 0% { transform: translateX(-320px); } 45%, 100% { transform: translateX(1320px); } }

/* ---------- Hero shimmer on the alias (a wave of light through each letter) ---------- */
html[data-motion="full"] .fx-shimmer .lr-char {
  background: linear-gradient(100deg, #c9a565 0%, #dcbc82 38%, #fff4da 50%, #dcbc82 62%, #c9a565 100%);
  background-size: 420% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: .07em; margin-right: -.07em;
  animation: fx-shimmer 6.5s ease-in-out 2.6s infinite;
}
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(2) .lr-char { animation-delay: 2.67s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(3) .lr-char { animation-delay: 2.74s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(4) .lr-char { animation-delay: 2.81s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(5) .lr-char { animation-delay: 2.88s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(6) .lr-char { animation-delay: 2.95s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(7) .lr-char { animation-delay: 3.02s; }
html[data-motion="full"] .fx-shimmer .lr-wrap:nth-child(8) .lr-char { animation-delay: 3.09s; }
@keyframes fx-shimmer { 0% { background-position: 100% 0; } 35%, 100% { background-position: 0 0; } }

/* ---------- Section rules draw in ---------- */
.fx-rule { display: block; height: 1px; background: var(--fx-gold-grad); transform-origin: 0 50%; }
html.fx-on[data-motion="full"] .fx-rule[data-fx-reveal] { clip-path: none !important; transform: scaleX(0); }
html.fx-on[data-motion="full"] .fx-rule[data-fx-reveal].fx-in { transform: scaleX(1); transition: transform 1.4s var(--fx-ease-io); }

@media (max-width: 768px) {
  .fx-spot { display: none; }
  .fx-marquee::before, .fx-marquee::after { width: 8vw; }
}
@media print {
  .fx-gold, .fx-spot, .fx-marquee { display: none !important; }
}
