/* Motor de movimiento y micro-interacciones GPU (60/120 FPS · Verde Activo + Lima #97D13F)
   Recetas basadas en Emil Kowalski (skills-main), taste-skill (design-taste-frontend) e Impeccable */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-arrive: cubic-bezier(0.16, 1, 0.3, 1);
  --g-noise-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .12 0 0 0 0 .32 0 0 0 0 .08 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 1. Transición suave entre páginas (Cross-Document View Transitions API) */
@view-transition { navigation: auto; }
@keyframes vtOut { from { opacity: 1; transform: translate3d(0, 0, 0); } to { opacity: 0; transform: translate3d(0, -8px, 0); } }
@keyframes vtIn { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }
::view-transition-old(root) { animation: vtOut .22s var(--ease-out) both; }
::view-transition-new(root) { animation: vtIn .36s var(--ease-arrive) both; }

/* 1b. Transición cinematográfica de la foto principal del Hero + Cortina de entrada */
@keyframes heroCurtain {
  from { clip-path: inset(8% 2% 8% 2% round 1.75rem); opacity: 0; transform: translate3d(0, 22px, 0) scale(0.965); }
  to { clip-path: inset(0 0 0 0 round 1.75rem); opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes heroFullReveal {
  from { opacity: 0; transform: scale(1.035); filter: blur(4px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes heroKenBurns {
  0%, 100% { transform: scale(1) translate3d(0, 0, 0); }
  50% { transform: scale(1.055) translate3d(-1.2%, -1.2%, 0); }
}
@keyframes heroHaloPulse {
  0%, 100% { transform: rotate(3deg) scale(1); opacity: .82; }
  50% { transform: rotate(5deg) scale(1.03); opacity: 1; }
}
.hero-photo-halo { animation: heroHaloPulse 7s ease-in-out infinite; will-change: transform, opacity; }
.hero-photo-stage { animation: heroCurtain .95s var(--ease-arrive) both; will-change: transform, opacity, clip-path; }
.hero-full-stage { animation: heroFullReveal .85s var(--ease-arrive) both; }
@keyframes heroSketchToColor {
  0% { filter: grayscale(1) contrast(1.85) brightness(1.08); transform: scale(1.03); }
  55% { filter: grayscale(0.45) contrast(1.3) brightness(1.02); }
  100% { filter: grayscale(0) contrast(1) brightness(1); transform: scale(1); }
}
.hero-sketch-to-color {
  animation: heroSketchToColor 2.6s var(--ease-arrive) both;
  will-change: filter, transform;
}
.hero-photo-stage::after {
  content: ""; position: absolute; inset: -20% auto -20% -65%; width: 50%; pointer-events: none; z-index: 2;
  background: linear-gradient(108deg, transparent 20%, rgba(255, 255, 255, .28) 50%, transparent 80%);
  transform: translate3d(-100%, 0, 0) skewX(-16deg);
  transition: transform .85s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .hero-photo-stage:hover::after { transform: translate3d(380%, 0, 0) skewX(-16deg); }
  .hero-photo-stage:hover .hero-photo-img { animation-play-state: paused; transform: scale(1.07); }
}
.hero-photo-img { animation: heroKenBurns 14s ease-in-out infinite; transition: transform .65s var(--ease-out); will-change: transform; }

/* 1c. Coreografía escalonada de entrada en Hero (Emil Kowalski Non-Uniform Stagger Wave) */
@keyframes heroWaveIn {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
.hero-stagger-item {
  animation: heroWaveIn .58s var(--ease-out) both;
  animation-delay: var(--hero-d, 0ms);
}

/* 1d. Fondos atmosféricos taste-skill (Topglow + Ruled Grid + Liquid Mesh) */
.fx-hero-atmosphere { position: relative; isolation: isolate; }
.fx-hero-atmosphere::before {
  content: ""; position: absolute; inset: -25% -15%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 38% 42% at 22% 32%, rgba(151, 209, 63, .22), transparent 70%),
    radial-gradient(ellipse 34% 38% at 78% 68%, rgba(62, 145, 38, .28), transparent 72%),
    radial-gradient(ellipse 26% 28% at 55% 18%, rgba(255, 255, 255, .10), transparent 65%);
  animation: fxLiquidMesh 22s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes fxLiquidMesh {
  from { transform: translate3d(-4%, -2%, 0) skewX(-4deg) scaleY(.96); }
  to { transform: translate3d(4%, 2%, 0) skewX(4deg) scaleY(1.04); }
}

/* 1e. Edge Glow animado (taste-skill .cx-ring) para tarjetas destacadas y tableros Hero */
@property --fx-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@keyframes fxEdgeSpin { to { --fx-angle: 360deg; } }
.fx-edge-glow { position: relative; }
.fx-edge-glow::before {
  content: ""; position: absolute; inset: -1.5px; padding: 1.5px; border-radius: inherit;
  pointer-events: none; z-index: 2; opacity: 0;
  background: conic-gradient(from var(--fx-angle, 0deg), transparent 55%, rgba(151, 209, 63, .85) 88%, #ffffff 96%, 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 exclude, linear-gradient(#000 0 0);
  transition: opacity .35s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .fx-edge-glow:hover::before,
  .fx-edge-glow:focus-within::before {
    opacity: 1;
    animation: fxEdgeSpin 3.6s linear infinite;
  }
}

/* 2. Manifiesto palabra por palabra al scrollear (Orvante) */
.mf-word { display: inline; color: #546A50; opacity: .22; transition: color .28s ease; will-change: opacity; }
.mf-word.is-lit { color: #1F5216; }

/* 3. Tarjetas apilables sticky con escala al scrollear (Mina Projects / Stack Cards) */
.stack-wrap { position: relative; }
.stack-slot { position: sticky; top: 96px; margin-bottom: 24px; will-change: transform; }
.stack-card {
  border-radius: 28px; border: 1.5px solid rgba(151, 209, 63, .35);
  background: linear-gradient(145deg, #1F5216 0%, #2D6F1E 100%); color: #fff;
  box-shadow: 0 24px 50px -18px rgba(21, 56, 15, .45);
  transition: transform .18s var(--ease-out), box-shadow .3s ease;
  transform-origin: center top; will-change: transform;
}
.stack-card.stack-card-light {
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid rgba(31, 82, 22, 0.16);
  border-radius: 24px;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(151, 209, 63, 0.22) inset;
  transition: transform .2s var(--ease-out), box-shadow .3s ease, filter .2s ease;
  transform-origin: center top;
  will-change: transform;
}
#reconocimientos-stack .stack-slot {
  position: sticky;
  margin-bottom: 3rem;
  will-change: transform;
}
@media (min-width: 768px) {
  #reconocimientos-stack .stack-slot {
    margin-bottom: 4.5rem;
  }
}
.stack-card img { border-radius: 20px; transition: transform .55s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .stack-card img:hover { transform: scale(1.025); }
}

/* 4. Panel de Confianza con tiles de cristal (Orvante Trust) */
.trust-panel { position: relative; border-radius: 28px; border: 1px solid rgba(151, 209, 63, .38); background: linear-gradient(135deg, #1F5216 0%, #347C22 55%, #1F5216 100%); color: #fff; overflow: hidden; }
.trust-glass-tile {
  position: absolute; width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(164, 220, 74, .45);
  backdrop-filter: blur(10px); color: #A4DC4A; pointer-events: none;
  box-shadow: 0 12px 28px -8px rgba(15, 45, 10, .38);
}
.trust-card { transition: transform .32s var(--ease-out), box-shadow .32s ease; will-change: transform; }
@media (hover: hover) and (pointer: fine) {
  .trust-card:hover { transform: translate3d(0, -6px, 0); box-shadow: 0 22px 42px -14px rgba(15, 45, 10, .38); }
}

/* 5. Spotlight lima #97D13F + hairline superior + elevación 3D sutil en tarjetas (pointer-gated) */
.fx-card {
  position: relative; overflow: hidden;
  transition: transform .34s var(--ease-out), box-shadow .34s ease, border-color .28s ease;
}
.fx-card::before {
  content: ""; position: absolute; inset: 0 12% auto 12%; height: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, transparent, rgba(151, 209, 63, .65), transparent);
  opacity: 0; transition: opacity .3s ease, inset .38s var(--ease-out);
}
.fx-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(151, 209, 63, .18), transparent 66%);
  transition: opacity .28s ease;
}
.fx-card svg { transition: transform .32s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .fx-card:hover::before { opacity: 1; inset: 0 4% auto 4%; }
  .fx-card:hover::after { opacity: 1; }
  .fx-card:hover { box-shadow: 0 20px 42px -16px rgba(31, 82, 22, .18), 0 0 0 1px rgba(151, 209, 63, .45); }
  .fx-card:hover svg { transform: translate3d(0, -2px, 0) scale(1.08); }
}

/* 6. Brillo líquido (Sheen) + flecha animada en botones CTA */
.fx-sheen {
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform .18s var(--ease-out), background-color .2s ease, box-shadow .22s ease;
}
.fx-sheen::before {
  content: ""; position: absolute; inset: -40% auto -40% -65%; width: 52%; pointer-events: none; z-index: 1;
  background: linear-gradient(110deg, transparent 15%, rgba(255, 255, 255, .38) 50%, transparent 85%);
  transform: translate3d(-120%, 0, 0) skewX(-18deg);
  transition: transform .68s var(--ease-out);
}
.fx-sheen svg { transition: transform .22s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .fx-sheen:hover::before { transform: translate3d(380%, 0, 0) skewX(-18deg); }
  .fx-sheen:hover svg[data-icon="arrow-right"],
  .fx-sheen:hover svg[data-icon="external"],
  .fx-sheen:hover svg[data-icon="send"] { transform: translate3d(3px, 0, 0); }
  .fx-sheen:hover svg[data-icon="download"] { transform: translate3d(0, 2px, 0); }
}

/* 6b. Píldora indicadora deslizante universal (Emil Kowalski Sliding Pill Indicator) */
.fx-pill-group {
  position: relative;
  isolation: isolate;
}
.fx-pill-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 9999px;
  background: #1F5216;
  box-shadow: 0 8px 20px -6px rgba(31, 82, 22, .38);
  opacity: 0;
  transition:
    transform .28s var(--ease-out),
    width .28s var(--ease-out),
    height .24s var(--ease-out),
    opacity .18s ease;
  will-change: transform, width, height;
}
.fx-pill-group.has-indicator .fx-pill-indicator { opacity: 1; }
.fx-pill-group.has-indicator > button,
.fx-pill-group.has-indicator > [role="tab"] {
  position: relative;
  z-index: 1;
}
.fx-pill-group.has-indicator > button[aria-pressed="true"],
.fx-pill-group.has-indicator > [role="tab"][aria-selected="true"] {
  background-color: transparent !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

/* 6c. Transición con desenfoque sutil de costura (Emil Kowalski Crossfade Blur Seam Masking <4px) */
@keyframes fxSeamSwap {
  0% { opacity: .45; filter: blur(2.5px); transform: translate3d(0, 6px, 0) scale(0.992); }
  100% { opacity: 1; filter: blur(0px); transform: translate3d(0, 0, 0) scale(1); }
}
.fx-seam-swap {
  animation: fxSeamSwap .28s var(--ease-out) both;
}

/* 7. Desplegables <details> / FAQ con apertura fluida */
details summary { transition: color .2s ease; }
details summary svg { transition: transform .32s var(--ease-out); }
@keyframes detailsOpen { from { opacity: 0; transform: translate3d(0, -6px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }
details[open] > :not(summary) { animation: detailsOpen .3s var(--ease-out) both; }
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details::details-content { height: 0; overflow: clip; opacity: 0; transition: height .32s var(--ease-out), opacity .26s ease, content-visibility .32s allow-discrete; }
  details[open]::details-content { height: auto; opacity: 1; }
}

/* 8. Respiración ambiental luminosa en secciones verdes */
@keyframes ambientBreath { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
section.bg-bosque, footer.bg-bosque {
  background-image: radial-gradient(62% 72% at 84% 20%, rgba(151, 209, 63, .26), transparent 60%), radial-gradient(55% 65% at 12% 85%, rgba(62, 145, 38, .48), transparent 65%);
  background-size: 135% 135%;
  animation: ambientBreath 14s ease-in-out infinite;
}

/* 9. Barras de progreso elásticas, marquee y carrusel automático estilo Shop (Hitos por eje) */
.fx-bar { transform-origin: left center; transform: scaleX(0); transition: transform .95s var(--ease-arrive); will-change: transform; }
.fx-bar.is-filled { transform: scaleX(1); }
.scroll-marquee-track { display: flex; gap: 14px; width: max-content; will-change: transform; }
/* 9. Constelación flotante de tarjetas estilo Shop en teléfono + grilla 3x2 en PC */
.shop-hitos-viewport { position: relative; overflow: hidden; padding: 14px 0 18px; }
.shop-hitos-track { position: relative; display: grid; place-items: center; min-height: 410px; touch-action: pan-y; }
.shop-hito-slide {
  grid-area: 1 / 1; width: min(82vw, 316px);
  transition: transform .72s var(--ease-out), opacity .58s var(--ease-out), filter .58s ease;
  will-change: transform, opacity, filter;
}
.shop-hito-slide[data-pos="center"] { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); opacity: 1; z-index: 4; filter: blur(0); }
.shop-hito-slide[data-pos="next"] { transform: translate3d(42%, 14px, 0) scale(.86) rotate(4.5deg); opacity: .78; z-index: 3; filter: blur(.6px); cursor: pointer; }
.shop-hito-slide[data-pos="prev"] { transform: translate3d(-42%, 14px, 0) scale(.86) rotate(-4.5deg); opacity: .78; z-index: 3; filter: blur(.6px); cursor: pointer; }
.shop-hito-slide[data-pos="far-next"] { transform: translate3d(68%, 28px, 0) scale(.70) rotate(9deg); opacity: 0; z-index: 2; filter: blur(5px); pointer-events: none; }
.shop-hito-slide[data-pos="far-prev"] { transform: translate3d(-68%, 28px, 0) scale(.70) rotate(-9deg); opacity: 0; z-index: 2; filter: blur(5px); pointer-events: none; }
.shop-hito-slide[data-pos="hidden"] { transform: translate3d(0, 36px, 0) scale(.62); opacity: 0; z-index: 1; filter: blur(6px); pointer-events: none; transition: none; }
.shop-hito-card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .10), 0 2px 4px -2px rgba(0, 0, 0, .10);
  transition: transform .32s var(--ease-out), box-shadow .32s ease;
}
.shop-hito-slide[data-pos="center"] .shop-hito-card { box-shadow: 0 18px 36px -12px rgba(0, 0, 0, .18), 0 4px 10px -4px rgba(0, 0, 0, .08); }
@media (hover: hover) and (pointer: fine) {
  .shop-hito-card:hover { transform: translate3d(0, -6px, 0); box-shadow: 0 14px 28px -8px rgba(0, 0, 0, .14), 0 4px 10px -4px rgba(0, 0, 0, .08); }
}
.shop-deck-dot { width: 8px; height: 8px; border-radius: 9999px; background: #cbd5e1; transition: width .32s var(--ease-out), background-color .28s ease; }
.shop-deck-dot.is-active { width: 26px; background: #1F5216; }
@media (min-width: 768px) {
  .shop-hitos-viewport { overflow: hidden; padding: 18px 8px 24px; -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 3%, #000 97%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0%, #000 3%, #000 97%, transparent 100%); }
  .shop-hitos-track { min-height: 430px; }
  .shop-hito-slide { width: calc((100% - 48px) / 3); height: 100%; }
  .shop-hito-slide[data-pos="prev"] { transform: translate3d(calc(-100% - 20px), 0, 0) scale(.985) rotate(0deg); opacity: 1; z-index: 3; filter: blur(0); }
  .shop-hito-slide[data-pos="center"] { transform: translate3d(0, -6px, 0) scale(1.01) rotate(0deg); opacity: 1; z-index: 4; filter: blur(0); }
  .shop-hito-slide[data-pos="next"] { transform: translate3d(calc(100% + 20px), 0, 0) scale(.985) rotate(0deg); opacity: 1; z-index: 3; filter: blur(0); }
  .shop-hito-slide[data-pos="far-prev"] { transform: translate3d(calc(-132% - 28px), 22px, 0) scale(.82) rotate(-4deg); opacity: 0; z-index: 1; filter: blur(5px); pointer-events: none; }
  .shop-hito-slide[data-pos="far-next"] { transform: translate3d(calc(132% + 28px), 22px, 0) scale(.82) rotate(4deg); opacity: 0; z-index: 1; filter: blur(5px); pointer-events: none; }
  .shop-hito-slide[data-pos="hidden"] { transform: translate3d(calc(145% + 28px), 28px, 0) scale(.76) rotate(5deg); opacity: 0; z-index: 0; filter: blur(6px); pointer-events: none; transition: none; }
}

/* 10. Línea de tiempo con máquina de escribir + trazado progresivo */
.tl-item::before {
  background: linear-gradient(180deg, #1F5216, #3E8E26, #97D13F);
  transform-origin: top center; transform: scaleY(0);
  transition: transform .88s var(--ease-arrive); will-change: transform;
}
.tl-item.is-active::before, .tl-item.is-typed::before { transform: scaleY(1); }
.tl-dot { opacity: 0; transform: scale(.75); transition: transform .36s var(--ease-out), opacity .28s ease; }
.tl-item.is-active .tl-dot, .tl-item.is-typed .tl-dot { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px #97D13F, 0 0 0 6px rgba(151, 209, 63, .28); }
.tl-bullet { opacity: 0; transition: opacity .22s ease; }
.tl-bullet.is-shown, .tl-item.is-typed .tl-bullet { opacity: 1; }
.tl-meta { opacity: 0; transform: translate3d(0, 8px, 0); transition: opacity .42s ease, transform .42s var(--ease-out); }
.tl-item.is-typed .tl-meta { opacity: 1; transform: translate3d(0, 0, 0); }
.tl-typing::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 3px;
  vertical-align: -0.12em; background: #2E741E; animation: tlCaret .55s steps(1) infinite;
}
@keyframes tlCaret { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@media (min-width: 1024px) {
  .tl-item::before { background: linear-gradient(90deg, #1F5216, #3E8E26, #97D13F); transform-origin: left center; transform: scaleX(0); }
  .tl-item.is-active::before, .tl-item.is-typed::before { transform: scaleX(1); }
}

/* 11. Animaciones de validación e interacción en formularios y campos (UX/UI Rules) */
@keyframes fxShakeError {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-6px, 0, 0); }
  40% { transform: translate3d(5px, 0, 0); }
  60% { transform: translate3d(-3px, 0, 0); }
  80% { transform: translate3d(2px, 0, 0); }
}
.fx-input-error {
  animation: fxShakeError .36s var(--ease-out);
}
input:not([type="checkbox"]):not([type="range"]),
select,
textarea {
  transition:
    border-color .18s var(--ease-out),
    box-shadow .2s var(--ease-out),
    background-color .18s ease,
    transform .18s var(--ease-out);
}
input:not([type="checkbox"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  transform: translate3d(0, -1px, 0);
}

/* 12. Tarjetas de línea de tiempo académica/profesional con pulso vivo al entrar */
.fx-timeline-card {
  position: relative;
  transition: transform .28s var(--ease-out), box-shadow .28s ease, border-color .24s ease;
}
@media (hover: hover) and (pointer: fine) {
  .fx-timeline-card:hover {
    transform: translate3d(4px, -2px, 0);
    border-color: rgba(151, 209, 63, .55);
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root), section.bg-bosque, footer.bg-bosque, details[open] > :not(summary), .hero-photo-halo, .hero-photo-stage, .hero-full-stage, .hero-sketch-to-color, .hero-photo-img, .shop-hitos-track, .hero-stagger-item, .fx-hero-atmosphere::before, .fx-seam-swap, .fx-input-error { animation: none !important; filter: none !important; }
  .mf-word { opacity: 1 !important; color: #1F5216; }
  .fx-card, .fx-sheen::before, .fx-bar, .fx-pill-indicator { transform: none !important; transition: none !important; }
  .tl-item::before, .tl-dot, .tl-bullet, .tl-meta { transform: none !important; opacity: 1 !important; transition: none !important; }
  .tl-typing::after { display: none; }
}
