/* ====================================================================================== */
/* Rediseño 2027 de mia-ia.app: movimiento nativo (scroll-driven + view transitions) y la  */
/* capa de GSAP (js/mia.js). Va después de estilos.css. Respeta prefers-reduced-motion y  */
/* sin JavaScript la página se ve completa.                                                */
/* ====================================================================================== */
@property --giro { syntax: "<angle>"; inherits: false; initial-value: 0deg }
:root { --cristal: color-mix(in srgb, var(--night) 72%, transparent); --brillo: color-mix(in srgb, var(--honey) 55%, transparent) }

/* Transiciones entre páginas del sitio: la página se funde y la marca se queda en su lugar */
@view-transition { navigation: auto }
::view-transition-old(root) { animation: 260ms cubic-bezier(.4, 0, .2, 1) both vt-sale }
::view-transition-new(root) { animation: 420ms cubic-bezier(.2, .8, .2, 1) both vt-entra }
@keyframes vt-sale { to { opacity: 0; transform: translateY(-10px) scale(.99) } }
@keyframes vt-entra { from { opacity: 0; transform: translateY(14px) } }
.brand { view-transition-name: marca }

/* Lenis (scroll suave) */
html.lenis, html.lenis body { height: auto }
.lenis.lenis-smooth { scroll-behavior: auto !important }
.lenis.lenis-stopped { overflow: hidden }

/* Barra de avance de lectura, 100% CSS */
.progreso { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #E9AE4A, #F07A5A 50%, #9AA5F5); pointer-events: none }
@supports (animation-timeline: scroll()) {
  .progreso { animation: avance linear both; animation-timeline: scroll(root) }
  @keyframes avance { to { transform: scaleX(1) } }
}

/* Barra superior flotante, de cristal */
.top { position: sticky; top: 0; z-index: 50; background: var(--cristal); backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid transparent; transition: padding .3s, background .3s, border-color .3s }
.top.compacta { padding-block: 9px; background: color-mix(in srgb, var(--night) 88%, transparent); border-bottom-color: rgba(255, 255, 255, .08) }
.top .brand img { transition: width .3s, height .3s }
.top.compacta .brand img { width: 30px; height: 30px }
.top a.mini { padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); transition: background .2s }
.top a.mini:hover { background: rgba(255, 255, 255, .14) }
.top-nav { display: flex; align-items: center; gap: 18px }
.top-nav a.enlace { font-size: 14px; color: #CFC6DA; text-decoration: none }
.top-nav a.enlace:hover { color: #fff }
@media (max-width: 720px) { .top-nav a.enlace { display: none } }

/* Hero con aurora animada, rejilla y grano */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-top: 72px; padding-bottom: 96px }
.aurora { position: absolute; inset: -20% -10% auto; height: 140%; z-index: -2; pointer-events: none; filter: blur(80px) saturate(1.15); opacity: .62 }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: deriva 18s ease-in-out infinite alternate }
.aurora i:nth-child(1) { width: 46vw; height: 46vw; left: 50%; top: 2%; background: #5C6BD6; animation-duration: 16s }
.aurora i:nth-child(2) { width: 38vw; height: 38vw; left: -6%; top: 38%; background: #E9AE4A; opacity: .55; animation-duration: 21s }
.aurora i:nth-child(3) { width: 30vw; height: 30vw; left: 28%; top: 52%; background: #F07A5A; opacity: .45; animation-duration: 25s }
@keyframes deriva {
  0% { transform: translate(0, 0) scale(1) }
  50% { transform: translate(6vw, -4vh) scale(1.12) }
  100% { transform: translate(-5vw, 5vh) scale(.94) }
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%) }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .14; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") }
.hero h1 { font-size: clamp(36px, 6vw, 72px); letter-spacing: -.035em }
.hero h1 em, .hero h1 em .palabra > span { background: linear-gradient(100deg, #E9AE4A 10%, #FFD58A 35%, #F07A5A 60%, #E9AE4A 90%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: destello 7s linear infinite }
@keyframes destello { to { background-position: -220% 0 } }
.palabra { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em }
.palabra > span { display: inline-block }

/* Teléfono de cristal con borde que gira */
.hero .phone { position: relative; border: 0; box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .08) }
.hero .phone::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--giro), transparent 0 60%, #E9AE4A, #9AA5F5, transparent 85%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: girar 6s linear infinite }
@keyframes girar { to { --giro: 360deg } }
.escribiendo { align-self: flex-start; display: flex; align-items: center; gap: 4px; padding: 0 12px; border-radius: 13px; background: var(--bot); overflow: hidden; height: 0; opacity: 0 }
.escribiendo i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: punto 1s infinite ease-in-out }
.escribiendo i:nth-child(2) { animation-delay: .15s }
.escribiendo i:nth-child(3) { animation-delay: .3s }
@keyframes punto { 0%, 80%, 100% { transform: translateY(0); opacity: .4 } 40% { transform: translateY(-4px); opacity: 1 } }

/* Botones con destello al pasar el puntero */
.btn { position: relative; overflow: hidden; transition: transform .2s, box-shadow .25s }
.btn.main, .btn.light { box-shadow: 0 10px 30px -10px var(--brillo) }
.btn.main::after, .btn.light::after { content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transition: transform .7s }
.btn.main:hover::after, .btn.light:hover::after { transform: translateX(120%) }
.btn:active { transform: scale(.97) }

/* Tarjetas: brillo que sigue al puntero, borde luminoso y elevación */
.card, .area, .example, .manual, .guias li, .trait { position: relative; isolation: isolate }
.card, .area, .example, .manual, .guias li { transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .35s }
.card::before, .area::before, .example::before, .manual::before, .guias li::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--honey) 16%, transparent), transparent 60%); transition: opacity .3s }
.card:hover, .area:hover, .example:hover, .manual:hover, .guias li:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--honey) 55%, var(--line));
  box-shadow: 0 24px 60px -28px color-mix(in srgb, var(--honey) 45%, transparent) }
.card:hover::before, .area:hover::before, .example:hover::before, .manual:hover::before, .guias li:hover::before { opacity: 1 }
.area .ico { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; font-size: 28px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--honey) 22%, transparent), color-mix(in srgb, var(--glow) 18%, transparent)) }
.area .go { display: inline-flex; gap: 6px; transition: gap .25s }
.area:hover .go { gap: 12px }
.trait { border-top: 0; padding-top: 18px }
.trait::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--honey), transparent) }

/* Franja de plataformas en movimiento infinito */
.plataformas { margin-inline: -16px; overflow: hidden; padding: 18px 0; border-block: 1px solid var(--line); background: var(--surface);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent) }
.plataformas ul { display: flex; gap: 44px; width: max-content; margin: 0; padding: 0 22px; list-style: none; animation: banda 38s linear infinite }
.plataformas:hover ul { animation-play-state: paused }
.plataformas li { font-family: var(--f-display); font-weight: 500; font-size: 17px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 10px }
.plataformas li::before { content: "✦"; color: var(--honey); font-size: 12px }
@keyframes banda { to { transform: translateX(-50%) } }

/* Precio: brillo que deriva detrás */
.price { position: relative; overflow: hidden; isolation: isolate }
.price::after { content: ""; position: absolute; width: 380px; height: 380px; right: -140px; top: -160px; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, #E9AE4A 35%, transparent), transparent 65%); animation: deriva 14s ease-in-out infinite alternate }

/* Entradas con CSS puro si GSAP no cargó (navegadores con scroll-driven animations) */
@supports (animation-timeline: view()) {
  html:not(.animado) :is(.card, .area, .example, .trait, .sec-head, .manual, .faq details, .guias li) {
    animation: aparece linear both; animation-timeline: view(); animation-range: entry 0% cover 28% }
  @keyframes aparece { from { opacity: 0; transform: translateY(36px) scale(.98) } }
}

/* Detalles */
::selection { background: color-mix(in srgb, var(--honey) 40%, transparent) }
.faq details { transition: border-color .25s }
.faq details[open] { border-color: color-mix(in srgb, var(--honey) 45%, var(--line)) }
.faq summary::marker { color: var(--honey) }
.sec-head .eyebrow { display: inline-flex; align-items: center; gap: 8px }
.sec-head .eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--honey); border-radius: 2px }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important }
  .card:hover, .area:hover, .example:hover, .manual:hover, .guias li:hover { transform: none }
  .escribiendo { display: none }
}

/* Al saltar a una sección, que la barra fija no tape el título */
[id] { scroll-margin-top: 84px }

/* Con 5 areas: 3 arriba y 2 mas anchas abajo (sin una tarjeta huerfana) */
@media (min-width: 1000px) {
  .areas:has(> .area:nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)) }
  .areas:has(> .area:nth-child(5):last-child) > .area { grid-column: span 2 }
  .areas:has(> .area:nth-child(5):last-child) > .area:nth-child(n+4) { grid-column: span 3 }
}
