/*
 * Movimiento del sitio (v1.1.0). Idea: "la fuente". Los elementos brotan desde abajo y se asientan,
 * los botones dejan una onda al tocarlos y todo lo que se despliega abre suave.
 * Solo se anima transform, opacity y clip-path. Los estados ocultos dependen de html.fot-motion,
 * que se agrega en <head> solo si el visitante no pidió "reducir movimiento".
 * La lógica vive en assets/js/motion.js.
 */

:root { --fx-ease: cubic-bezier(.22, 1, .36, 1); }

/* ---------- Barra de progreso de lectura ---------- */
.fx-progress { position: fixed; z-index: 60; inset: 0 0 auto; height: 3px; background: var(--fot-brand); transform-origin: 0 50%; transform: scaleX(var(--fx-p, 0)); pointer-events: none; }
body.admin-bar .fx-progress { top: 32px; }
@media (max-width: 782px) { body.admin-bar .fx-progress { top: 46px; } }

/* ---------- Capítulos (puntos a la derecha, solo escritorio) ---------- */
.fx-chapters { position: fixed; z-index: 40; right: 18px; top: 50%; translate: 0 -50%; display: grid; gap: 10px; }
.fx-chapters a { position: relative; display: block; width: 10px; height: 10px; border-radius: 6px; background: #8fa3b2; opacity: .55; transition: height .5s var(--fx-ease), background .3s, opacity .3s; }
.fx-chapters a.is-current { height: 28px; background: var(--fot-brand); opacity: 1; }
.fx-chapters a > span { position: absolute; right: 20px; top: 50%; translate: 0 -50%; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; border-radius: 14px; background: var(--fot-nav); color: white; font: 700 13px/1.4 Inter, sans-serif; opacity: 0; transition: opacity .3s; pointer-events: none; }
.fx-chapters a:hover > span, .fx-chapters a:focus-visible > span { opacity: 1; }
@media (max-width: 1099px) { .fx-chapters { display: none; } }

/* ---------- Revelados al hacer scroll ---------- */
.fot-motion .fx-up { opacity: 0; transform: translateY(28px); }
.fot-motion .fx-tilt { opacity: 0; transform: translateY(48px) rotate(-1.5deg); }
.fot-motion .fx-title { opacity: 0; transform: translateY(.45em); clip-path: inset(0 0 100% 0); }
.fot-motion .fx-unveil { clip-path: inset(100% 0 0 0 round 16px); }
.fot-motion .fx-unveil img { transform: scale(1.14); }
.fot-motion .fx-word { display: inline-block; opacity: 0; transform: translateY(40%) rotate(4deg); filter: blur(6px); }

.fot-motion .fx-up, .fot-motion .fx-tilt { transition: opacity .9s var(--fx-ease), transform .9s var(--fx-ease); transition-delay: calc(var(--fx-i, 0) * 90ms); }
.fot-motion .fx-title { transition: opacity .6s ease, transform 1s var(--fx-ease), clip-path 1s var(--fx-ease); transition-delay: calc(var(--fx-i, 0) * 90ms); }
.fot-motion .fx-unveil { transition: clip-path 1.2s var(--fx-ease); transition-delay: calc(var(--fx-i, 0) * 90ms); }
.fot-motion .fx-unveil img { transition: transform 1.6s var(--fx-ease); }
.fot-motion .fx-word { transition: opacity .9s var(--fx-ease), transform .9s var(--fx-ease), filter .9s var(--fx-ease); transition-delay: calc(var(--fx-w, 0) * 110ms + 150ms); }

.fot-motion .fx-up.is-in, .fot-motion .fx-tilt.is-in { opacity: 1; transform: none; }
.fot-motion .fx-title.is-in { opacity: 1; transform: none; clip-path: inset(0 0 -20% 0); }
.fot-motion .fx-unveil.is-in { clip-path: inset(0 0 0 0 round 16px); }
.fot-motion .fx-unveil.is-in img { transform: none; }
.fot-motion .is-in .fx-word, .fot-motion .fx-word.is-in { opacity: 1; transform: none; filter: none; }
/* Parallax: motion.js mueve con la propiedad translate, así no pisa transforms existentes. */
.fx-parallax { will-change: translate; }

/* ---------- Botones ---------- */
.button { position: relative; isolation: isolate; overflow: hidden; transition: border-color .18s ease, background .18s ease, color .18s ease, transform .5s var(--fx-ease), box-shadow .5s var(--fx-ease); }
/* Destello que cruza el botón */
.button::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(110deg, transparent 30%, #ffffff73 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s var(--fx-ease); pointer-events: none; }
.button--ghost::before { background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, currentColor 14%, transparent) 50%, transparent 70%); }
.button:hover::before { transform: translateX(120%); }
.button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px #39c6f3a6; }
.button--ghost:hover { box-shadow: none; }
.button:active { transform: translateY(0) scale(.97); transition-duration: .12s; }
/* Flecha que "fluye": sale y vuelve a entrar en su dirección */
.button > span[aria-hidden] { display: inline-block; --fx-dx: 14px; --fx-dy: 0px; }
.button[data-fx-arrow="down"] > span[aria-hidden] { --fx-dx: 0px; --fx-dy: 12px; }
.button[data-fx-arrow="up"] > span[aria-hidden] { --fx-dx: 0px; --fx-dy: -12px; }
.button[data-fx-arrow="diag"] > span[aria-hidden] { --fx-dx: 10px; --fx-dy: -10px; }
.button:hover > span[aria-hidden] { animation: fx-flow .6s var(--fx-ease); }
@keyframes fx-flow {
  0% { transform: none; }
  45% { transform: translate(var(--fx-dx), var(--fx-dy)); opacity: 0; }
  46% { transform: translate(calc(var(--fx-dx) * -1), calc(var(--fx-dy) * -1)); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
/* Gota: onda desde el punto del clic */
.fx-ripple { position: absolute; z-index: -1; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: currentColor; opacity: .26; pointer-events: none; animation: fx-drop .75s var(--fx-ease) forwards; }
.fx-ripple--ring { background: none; border: 2px solid currentColor; opacity: .45; animation-duration: 1s; animation-delay: .08s; }
@keyframes fx-drop { to { transform: scale(var(--fx-s, 30)); opacity: 0; } }

/* ---------- Cards ---------- */
.community-card, .event-card { position: relative; transition: transform .5s var(--fx-ease), box-shadow .5s var(--fx-ease); }
.community-card::after, .event-card::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--fot-brand); opacity: 0; transform: scale(.98); transition: opacity .5s var(--fx-ease), transform .5s var(--fx-ease); pointer-events: none; }
.community-card:hover, .event-card:hover { transform: translateY(-6px); box-shadow: 0 24px 40px -26px #0a111973; }
.community-card:hover::after, .event-card:hover::after { opacity: 1; transform: none; }
.community-card__photo { transition: transform .9s var(--fx-ease); transform-origin: 50% 100%; }
.community-card:hover .community-card__photo { transform: scale(1.06); }

/* Equipo (Nosotros): se inclina siguiendo el cursor */
.team-card { perspective: 800px; }
.team-card__photo { position: relative; overflow: hidden; transform: rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg)); transition: transform .45s var(--fx-ease), box-shadow .45s var(--fx-ease); }
.team-card:hover .team-card__photo { box-shadow: 0 24px 40px -24px #000000b3; }
.team-card__photo > img { transition: transform .9s var(--fx-ease), filter .9s; }
.team-card__photo--image > img { filter: saturate(.9); }
.team-card:hover .team-card__photo > img { transform: scale(1.06); filter: saturate(1.08); }
.team-card__photo::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at var(--fx-mx, 50%) var(--fx-my, 50%), #ffffff2e, transparent 45%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.team-card:hover .team-card__photo::after { opacity: 1; }
.team-card h3 { text-decoration: underline 2px transparent; text-underline-offset: 6px; transition: text-decoration-color .4s; }
.team-card:hover h3 { text-decoration-color: var(--fot-brand); }
.team-grid.fx-resizing { overflow: hidden; transition: height .7s var(--fx-ease); }
.team-card.fx-enter { animation: fx-rise .8s var(--fx-ease) both; animation-delay: calc(var(--fx-i, 0) * 80ms); }
.team-card.fx-leave { animation: fx-sink .45s var(--fx-ease) both; animation-delay: calc(var(--fx-i, 0) * 40ms); }
@keyframes fx-rise { from { opacity: 0; transform: translateY(36px) scale(.96); } }
@keyframes fx-sink { to { opacity: 0; transform: translateY(16px) scale(.97); } }

/* ---------- Desplegables ---------- */
/* Acordeones <details>: motion.js anima la altura; aquí el texto y el "+" */
.belief__toggle::before, .belief__toggle::after { transition: transform .5s var(--fx-ease); }
.belief[open] .belief__toggle::before { transform: rotate(180deg); }
.belief__content { transition: opacity .45s ease .08s, transform .5s var(--fx-ease) .08s; }
.belief:not([open]) .belief__content, .belief.fx-closing .belief__content { opacity: 0; transform: translateY(-8px); }
.fx-accordion-body { overflow: hidden; transition: height .55s var(--fx-ease); }

/* Menús: aparecen y se van con fundido corto (navegadores modernos; los demás, como antes). */
.mega-menu, .mobile-panel, .mobile-community { transition: opacity .35s var(--fx-ease), transform .35s var(--fx-ease), display .35s allow-discrete; }
.mega-menu[hidden], .mobile-panel[hidden], .mobile-community[hidden] { opacity: 0; transform: translateY(-10px); }
@starting-style {
  .mega-menu:not([hidden]), .mobile-panel:not([hidden]), .mobile-community:not([hidden]) { opacity: 0; transform: translateY(-10px); }
}
.mega-menu:not([hidden]) .mega-menu__grid > *, .mobile-panel:not([hidden]) .mobile-panel__body > * { animation: fx-rise .6s var(--fx-ease) both; }
.mega-menu__grid > :nth-child(2), .mobile-panel__body > :nth-child(2) { animation-delay: .06s !important; }
.mega-menu__grid > :nth-child(3), .mobile-panel__body > :nth-child(3) { animation-delay: .12s !important; }
.mega-menu__grid > :nth-child(4), .mobile-panel__body > :nth-child(4) { animation-delay: .18s !important; }
.mobile-panel__body > :nth-child(5) { animation-delay: .24s !important; }

/* Aviso "En preparación" */
dialog[open] { animation: fx-pop .45s var(--fx-ease); }
dialog[open]::backdrop { animation: fx-fade .35s ease; }
@keyframes fx-pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes fx-fade { from { opacity: 0; } }

/* ---------- Pantallas táctiles ---------- */
/* Sin mouse, :hover queda activo después del toque y deja el botón o la card desplazados. */
@media (hover: none) {
  .button:hover, .community-card:hover, .event-card:hover { transform: none; box-shadow: none; }
  .button:hover::before { transform: translateX(-120%); }
  .community-card:hover::after, .event-card:hover::after { opacity: 0; }
  .community-card:hover .community-card__photo { transform: none; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-progress { transition: none; }
  .button:hover, .community-card:hover, .event-card:hover { transform: none; }
  .team-card__photo { transform: none; }
  .fx-ripple { display: none; }
}
