/* ============================================
   Hero effects: kinetic name, playful folder,
   custom cursor, magnetic buttons, scroll exit and petal burst.
   Everything hangs off html.fx, which hero-fx.js only sets when
   the visitor hasn't asked for reduced motion.
   ============================================ */

/* ---------- 2. Name: letters rise one by one, Garzón gets circled ---------- */
.fx .fx-word { display: inline-block; white-space: nowrap; }
.fx .fx-char {
  display: inline-block;
  animation: fx-rise .9s cubic-bezier(.2, 1.25, .4, 1) backwards;
  animation-delay: calc(.2s + var(--i) * 45ms);
  transition: transform .35s cubic-bezier(.3, 1.7, .5, 1), color .2s;
}
@keyframes fx-rise {
  from { transform: translateY(.6em) rotate(8deg); opacity: 0; filter: blur(6px); }
  to   { transform: none; opacity: 1; filter: none; }
}
.fx-pointer .fx-char:hover { transform: translateY(-.12em) rotate(-5deg); color: var(--accent); }
.fx-pointer .ink-accent .fx-char:hover { color: var(--accent-deep); }

/* Garzón gets circled with a thin marker oval that doesn't quite close, plus a little star */
.fx .fx-circled { position: relative; display: inline-block; }
.fx-oval {
  position: absolute;
  left: -9%; top: -16%;
  width: 118%; height: 130%;
  overflow: visible;
  pointer-events: none;
}
.fx-oval path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: fx-draw 1s cubic-bezier(.6, 0, .2, 1) forwards;
  animation-delay: calc(.6s + var(--n) * 45ms);
}
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
.fx-star {
  position: absolute;
  right: -.6em; top: .18em;
  width: .38em; height: .38em;
  animation: fx-star-pop .6s cubic-bezier(.3, 1.8, .5, 1) backwards;
  animation-delay: calc(1.3s + var(--n) * 45ms);
}
.fx-star path { fill: var(--ink); }
@keyframes fx-star-pop { from { transform: scale(0) rotate(-90deg); opacity: 0; } }

/* ---------- 1. Folder: opens once, contents stay out to play with ---------- */
.fx .folder-scene.fx-play .fs-item {
  animation: fx-pop-once 1.1s cubic-bezier(.3, 1.35, .5, 1) both;
  animation-delay: calc(1.05s + var(--d, 0s));
}
@keyframes fx-pop-once {
  0%   { transform: translate(-50%, calc(-50% + 5em)) scale(.4) rotate(0deg); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--r)); opacity: 1; }
}
.fx .folder-scene.fx-play .fs-front { animation: fx-open-once .6s ease-in-out .9s both; }
@keyframes fx-open-once { from { transform: rotateX(0deg); } to { transform: rotateX(-20deg); } }
.fx .folder-scene.fx-play .fs-cursor { animation: fx-cursor-once 1.6s ease-in-out both; }
.fx .folder-scene.fx-replayed .fs-cursor { display: none; }
@keyframes fx-cursor-once {
  0%   { transform: translate(9em, 7em); opacity: 0; }
  15%  { opacity: 1; }
  45%  { transform: translate(0, 0) scale(1); }
  55%  { transform: translate(0, 0) scale(.8); }
  62%  { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(6em, 6em); opacity: 0; }
}

/* clicking the folder tucks everything back in, then it opens again */
.fx .folder-scene.fx-closing .fs-item {
  animation: fx-tuck .4s cubic-bezier(.5, 0, .75, 0) both;
}
@keyframes fx-tuck {
  from { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--r)); opacity: 1; }
  to   { transform: translate(-50%, calc(-50% + 5em)) scale(.4) rotate(0deg); opacity: 0; }
}
.fx .folder-scene.fx-closing .fs-front { animation: fx-open-once .3s ease-in reverse both; }

.fx-pointer .folder-scene .fs-item { pointer-events: auto; cursor: grab; user-select: none; touch-action: none; }
.fx-pointer .folder-scene .fs-item.is-grabbed { cursor: grabbing; z-index: 5; }
.fx-pointer .folder-scene .fs-front { pointer-events: auto; cursor: pointer; }
.fx-layer { will-change: transform; }
.fs-item img { -webkit-user-drag: none; }

/* ---------- 4. Scroll: the folder tucks its things away and leaves ---------- */
@supports (animation-timeline: view()) {
  .fx .hero { view-timeline: --hero; }
  .fx .fs-stage {
    animation: fx-folder-exit linear both;
    animation-timeline: --hero;
    animation-range: exit 0% exit 75%;
  }
  @keyframes fx-folder-exit {
    to { transform: translateY(-4em) scale(.82) rotate(-5deg); opacity: 0; }
  }
  .fx .fs-items {
    transform-origin: 50% 62%;
    animation: fx-items-tuck linear both;
    animation-timeline: --hero;
    animation-range: exit 0% exit 45%;
  }
  @keyframes fx-items-tuck {
    to { transform: translateY(7em) scale(.45); opacity: 0; }
  }
}

/* ---------- 3. Custom cursor and magnetic buttons ---------- */
.fx-cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
}
.fx-cursor.is-on { opacity: 1; }
.fx-cursor__dot {
  position: absolute;
  left: 0; top: 0;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  transition: width .3s cubic-bezier(.3, 1.4, .5, 1), height .3s cubic-bezier(.3, 1.4, .5, 1), background .2s, border-color .2s;
  border: 1.5px solid transparent;
}
.fx-cursor.is-link .fx-cursor__dot {
  width: 38px; height: 38px;
  background: rgba(245, 50, 123, .08);
  border-color: var(--accent);
}
.fx-cursor.is-view .fx-cursor__dot { width: 78px; height: 78px; background: var(--accent); }
.fx-cursor__label {
  font: 700 13px/1 var(--font-sans);
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .2s, transform .3s cubic-bezier(.3, 1.4, .5, 1);
  white-space: nowrap;
}
.fx-cursor.is-view .fx-cursor__label { opacity: 1; transform: none; }

.fx-magnet { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }

/* ---------- 5. Petal burst on click ---------- */
.fx-petal {
  position: fixed;
  z-index: 1500;
  height: auto;
  pointer-events: none;
}
