/* LIDABI — efectos.css · paquete "Costura térmica en movimiento"
   Cargar DESPUÉS de main.css. Todo lo animado vive bajo html.fx (lo pone el <head>
   solo si NO hay prefers-reduced-motion). Sin html.fx la página queda estática y completa.
   Se animan transform / opacity / clip-path; excepciones anotadas (color del H1, --fx-a). */

@property --fx-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ---------- FX1 · Campo térmico del hero (canvas) ---------- */
.fx-field {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
  opacity: 0; transition: opacity 1400ms var(--ease-out);
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 98%); mask-image: linear-gradient(180deg, #000 60%, transparent 98%);
}
.fx-field.is-on { opacity: 1; }

/* ---------- FX2 · Titular que pasa de calor a confort ---------- */
/* Nunca opacidad 0: el H1 se pinta en el primer fotograma (LCP intacto). */
.fx-w { display: inline-block; }
html.fx .c-hero__title:not(.fx-split) { color: var(--fire-500); }   /* estado previo al split: sin parpadeo blanco->naranja */
html.fx .fx-split .fx-w { animation: fx-thaw 1500ms var(--ease-out) both; animation-delay: calc(var(--i) * 60ms + 60ms); }
@keyframes fx-thaw {
  0%   { color: var(--fire-500); transform: translateY(.14em); }
  45%  { color: var(--ice-300); transform: none; }
  100% { color: var(--text); transform: none; }
}
@media (min-width: 900px) {
  html.fx .fx-split .fx-w { animation-name: fx-thaw-glow; }
}
@keyframes fx-thaw-glow {
  0%   { color: var(--fire-500); transform: translateY(.14em); text-shadow: 0 0 22px rgba(255,122,47,.45); }
  45%  { color: var(--ice-300); transform: none; text-shadow: 0 0 18px rgba(124,196,255,.35); }
  100% { color: var(--text); transform: none; text-shadow: 0 0 0 rgba(124,196,255,0); }
}
html.fx .c-hero__seam { animation-delay: 700ms; }   /* la costura se dibuja cuando el titular ya "enfrió" */

/* ---------- FX3 · Termostato 95°F -> 72°F ---------- */
.fx-thermo {
  --p: 1; /* 0 = 95°F (calor) · 1 = 72°F (confort). Sin JS de scroll queda en 1 */
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 84px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; background: rgba(7,10,14,.84); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08); color: #EAF1F8; pointer-events: none;
}
.fx-thermo__dial { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); overflow: visible; }
.fx-thermo circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.fx-thermo__track { stroke: rgba(255,255,255,.10); stroke-dasharray: 75 100; }
.fx-thermo__arc { stroke: url(#fx-g); stroke-dasharray: calc(75 - 60 * var(--p)) 100; }
.fx-thermo__read { position: relative; display: flex; align-items: flex-start; margin-top: -4px; font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 800; font-size: 26px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fx-thermo__read small { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: .08em; margin: 2px 0 0 2px; color: #9FB0C3; font-stretch: normal; }
.fx-thermo__ico { position: absolute; bottom: 13px; width: 14px; height: 14px; }
.fx-thermo__ico .is-hot { color: var(--fire-500); opacity: calc(1 - var(--p)); }
.fx-thermo__ico .is-cold { color: var(--ice-300); opacity: var(--p); }
.fx-thermo.is-done { box-shadow: 0 0 0 1px rgba(124,196,255,.35), 0 0 34px rgba(124,196,255,.28), 0 10px 30px rgba(0,0,0,.35); transition: box-shadow 600ms var(--ease-out); }
@media (min-width: 900px) { .fx-thermo { top: 18px; right: 18px; width: 100px; } .fx-thermo__read { font-size: 31px; } }

/* ---------- FX4 · Tarjetas de servicio: costura que gira + inclinación con luz ---------- */
.c-service::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0;
  background: conic-gradient(from var(--fx-a), transparent 0 50%, var(--ice-500) 62%, var(--ice-300) 72%, var(--brass-400) 82%, var(--fire-500) 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  transition: opacity var(--dur-3) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .c-service:hover::after, .c-service:focus-within::after { opacity: 1; }
  html.fx .c-service:hover::after { animation: fx-spin 3.6s linear infinite; }
  html.fx .c-service.is-tilt { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(46,123,196,.10), transparent 45%), var(--surface); transition: box-shadow var(--dur-2) var(--ease-out), transform 140ms linear; }
}
@keyframes fx-spin { to { --fx-a: 360deg; } }

/* ---------- FX5 · Galería: apertura cinematográfica + escáner de costura ---------- */
html.fx .c-work__open { clip-path: inset(22% 0 0 0 round var(--radius-lg)); transition: clip-path 1100ms var(--ease-out); }
html.fx .c-work__open img { transform: scale(1.16); transition: transform 1500ms var(--ease-out); }
html.fx .c-work__open::before { content: ""; position: absolute; left: 0; right: 0; top: 22%; height: 2px; z-index: 2; background: var(--seam); opacity: 0; pointer-events: none; }
html.fx .c-work.fx-in .c-work__open { clip-path: inset(0 0 0 0 round var(--radius-lg)); }
html.fx .c-work.fx-in .c-work__open img { transform: none; }
html.fx .c-work.fx-in .c-work__open::before { animation: fx-scan 1100ms var(--ease-out) both; }
html.fx .c-work.fx-in .c-work__open:hover img { transform: scale(1.05); transition-duration: 600ms; }
@keyframes fx-scan { 0% { top: 22%; opacity: 1; } 80% { opacity: 1; } 100% { top: 0; opacity: 0; } }

/* ---------- FX6 · CTA WhatsApp: barrido de brillo, halo y magnetismo ---------- */
.c-btn { position: relative; transition: background-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), border-color var(--dur-1), translate 450ms var(--ease-out); }
.c-btn > * { position: relative; z-index: 1; }
.c-btn.is-mag { transition-duration: var(--dur-1), var(--dur-2), var(--dur-2), var(--dur-1), 90ms; }
.c-btn--wa { overflow: hidden; isolation: isolate; }
.c-btn--wa::after {
  content: ""; position: absolute; inset: -2px; z-index: 0; pointer-events: none; transform: translateX(-130%);
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.5) 48%, rgba(255,236,214,.18) 56%, transparent 70%);
}
html.fx :is(.c-hero__actions, .c-mobilebar, .c-final__actions) .c-btn--wa::after { animation: fx-shine 6s var(--ease-inout) 2.2s infinite; }
@keyframes fx-shine { 0%, 74% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
/* Barra móvil: la costura se "carga" y el botón WhatsApp emite 2 pulsos de calor al aparecer */
html.fx .c-mobilebar[data-visible="true"] .c-btn--wa { animation: fx-halo 1.6s var(--ease-out) 350ms 2; }
@keyframes fx-halo { from { box-shadow: 0 0 0 0 rgba(255,122,47,.6), inset 0 1px 0 rgba(255,255,255,.28); } to { box-shadow: 0 0 0 12px rgba(255,122,47,0), inset 0 1px 0 rgba(255,255,255,.28); } }
html.fx .c-mobilebar::before { transform: scaleX(0); transform-origin: left; transition: transform 700ms var(--ease-out) 120ms; }
html.fx .c-mobilebar[data-visible="true"]::before { transform: none; }

/* ---------- FX7 · Cambio de idioma: velo de grafito + barrido de costura (una sola capa: barato) ---------- */
.fx-veil { position: fixed; inset: 0; z-index: calc(var(--z-sticky) - 1); pointer-events: none; opacity: 0; background: radial-gradient(70% 60% at 50% 40%, rgba(17,24,33,.9), rgba(7,10,14,.97)); transition: opacity 340ms var(--ease-out); }
.fx-veil::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--seam); transform: scaleX(0); transform-origin: left; transition: transform 520ms var(--ease-inout); }
.fx-veil.is-on { opacity: 1; transition-duration: 160ms; }
.fx-veil.is-on::after { transform: scaleX(1); }

/* ---------- FX8 · Costuras de sección que se dibujan + profundidad suave ---------- */
.c-section > .c-seam, .fx-field, .fx-thermo { overflow-anchor: none; }  /* nunca anclas de scroll mientras se animan */
html.fx .c-section > .c-seam { transform: scaleX(0); transform-origin: left; transition: transform 1300ms var(--ease-out); }
html.fx .c-section > .c-seam.fx-in { transform: none; }
html.fx .reveal .c-eyebrow::before { transform: scaleX(0); transform-origin: left; transition: transform 800ms var(--ease-out) 300ms; }
html.fx .reveal.is-in .c-eyebrow::before { transform: none; }
