/* Efectos globales: grano, transiciones entre páginas, cinta, inclinación 3D, imán, entradas escalonadas (portada incluida) */
/* Reglas de movimiento: curvas propias (nunca ease-in), solo transform/opacity/clip-path, hovers solo con puntero fino,
   y con "reducir movimiento" todo se queda quieto (solo opacidad). Los estados iniciales invisibles van detrás de
   html.fx-ready (la pone fx.js): si el JS no carga, nada queda oculto. */

/* ---------- 1. Tokens ---------- */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --fx-grain: .035;            /* opacidad del grano en modo claro */
  --fx-gutter: clamp(16px, 5vw, 64px);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fx-grain: .05; } }
:root[data-theme="dark"] { --fx-grain: .05; }

/* ---------- 2. Grano de película (debajo de la barra, que está en z-index 50) ---------- */
body::after {
  content: ""; position: fixed; inset: -10%; z-index: 40; pointer-events: none; opacity: var(--fx-grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* ---------- 3. Transiciones entre páginas (View Transitions entre documentos) ----------
   El cambio de tema de script.js usa document.startViewTransition sin tipo: sigue con el fundido de styles.css.
   La navegación entre páginas lleva el tipo "page-nav": salida rápida y entrada que sube un poco. */
@view-transition { navigation: auto; types: page-nav; }
@keyframes fx-vt-out { to { opacity: 0; } }
@keyframes fx-vt-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes fx-vt-in-fade { from { opacity: 0; } }
html:active-view-transition-type(page-nav)::view-transition-group(root) { animation-duration: .26s; }
html:active-view-transition-type(page-nav)::view-transition-old(root) { animation: fx-vt-out .15s var(--ease-out) both; }
html:active-view-transition-type(page-nav)::view-transition-new(root) { animation: fx-vt-in .26s var(--ease-out) both; }

/* ---------- 4. Barra de progreso de lectura (3 px, arriba, sobre la barra) ---------- */
@supports (animation-timeline: scroll()) {
  @keyframes fx-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  html::after {
    content: ""; position: fixed; top: 0; left: 0; z-index: 51; width: 100%; height: 3px; pointer-events: none;
    background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
    animation: fx-progress linear both; animation-timeline: scroll(root block);
  }
}

/* ---------- 5. Botones ---------- */
.btn { transition: transform .16s var(--ease-out), background .2s, color .2s, box-shadow .2s; }
.btn:not(.sold, .soon):not(:disabled):active { transform: scale(.97); transition-duration: .08s; }
.btn.primary { position: relative; overflow: hidden; isolation: isolate; }
/* Brillo que cruza el botón al pasar el puntero */
.btn.primary::after {
  content: ""; position: absolute; inset: -2px; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.55) 50%, transparent 62%);
  transform: translateX(-130%);
}
.btn.primary.is-open::after, .btn.primary.is-limit::after { display: none; }
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover::after { transform: translateX(130%); transition: transform .75s var(--ease-out); }
}

/* ---------- 6. Subrayado de marcador en los títulos ----------
   La palabra en <span> lleva un trazo amarillo "hecho a mano" que se dibuja de izquierda a derecha cuando el título
   entra en pantalla (fx.js le pone .is-drawn al h2 o al .page-title). Va detrás del texto y no parte la frase. */
h2, .page-title, .hero .tagline, .hero .kicker { text-wrap: balance; }
:is(h2, .page-title) > span { position: relative; white-space: nowrap; isolation: isolate; }
:is(h2, .page-title) > span::after {
  content: ""; position: absolute; left: -.08em; right: -.08em; bottom: -.12em; height: .34em; z-index: -1; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 24' preserveAspectRatio='none'%3E%3Cpath d='M4 15C40 9 78 7 118 10c30 2 56 5 78-4' fill='none' stroke='%23f5c542' stroke-width='10' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: .9; clip-path: inset(-30% -4% -30% -4%);
  transition: clip-path .7s var(--ease-out) .3s;
}
.fx-ready :is(h2, .page-title) > span::after { clip-path: inset(-30% 104% -30% -4%); }
.fx-ready :is(h2, .page-title).is-drawn > span::after { clip-path: inset(-30% -4% -30% -4%); }
/* El subtítulo que va pegado al título (margen negativo en styles.css) baja un poco para que el trazo no lo tape */
.page-title + :is(.sub, .legal-date), .shop-head + .sub { margin-top: -.25rem; }
/* Dentro de una sección .reveal espera a que la sección aparezca (script.js le pone .visible) */
.fx-ready .reveal:not(.visible) :is(h2, .page-title) > span::after { clip-path: inset(-30% 104% -30% -4%); transition-delay: 0s; }

/* ---------- A. API: entradas escalonadas ---------- */
.fx-ready [data-stagger] > * {
  opacity: 0; translate: 0 14px;
  /* transform también, por si los hijos son .reveal (tarjetas de shows) y traen su propio transform */
  transition: opacity .5s var(--ease-out), translate .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.fx-ready [data-stagger].is-in > * { opacity: 1; translate: none; }
/* Hijos pintados después en un contenedor que ya entró: fx.js los marca un instante para que entren escalonados */
.fx-ready [data-stagger] > .fx-new { opacity: 0; translate: 0 14px; transition: none; }

/* ---------- A. API: inclinación 3D e imán (fx.js escribe transform / translate en línea) ---------- */
[data-tilt] { transform-style: preserve-3d; }
[data-tilt], [data-magnetic] { backface-visibility: hidden; }
[data-magnetic] { transition: translate 0s; }   /* el resorte lo lleva el JS, sin transición encima */

/* ---------- C1. Portada: el escenario se enciende ---------- */
/* El foco se prende con tres destellos y luego sigue al puntero (fx.js escribe --sx y --sr) */
@keyframes fx-strike {
  0%, 9% { opacity: 0; } 10%, 19% { opacity: .75; } 20%, 33% { opacity: .05; }
  34%, 46% { opacity: .95; } 47%, 60% { opacity: .18; } 61%, 100% { opacity: 1; }
}
.fx-ready .spotlight {
  transform-origin: 50% 0;
  transform: translateX(calc(-50% + var(--sx, 0px))) rotate(var(--sr, 0deg));
  animation: fx-strike .6s linear both, flicker 6s .6s infinite;
}
/* El nombre: cada letra sube dentro de su palabra (overflow hidden) */
.hero-title { text-wrap: initial; }
.hero-title .word { display: inline-block; overflow: hidden; vertical-align: top; padding: .06em .04em 0; margin: -.06em -.04em 0; }
.hero-title .ch { display: inline-block; }
@keyframes fx-rise { from { transform: translateY(105%); } to { transform: none; } }
.fx-ready .hero-title .ch { animation: fx-rise .7s var(--ease-out) calc(.3s + var(--i, 0) * 45ms) backwards; }
/* Kicker, tagline y botones entran después, escalonados */
@keyframes fx-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fx-ready .hero .kicker { animation: fx-up .6s var(--ease-out) .95s backwards; }
.fx-ready .hero .tagline { animation: fx-up .6s var(--ease-out) 1.05s backwards; }
.fx-ready .hero .cta .btn { animation: fx-up .6s var(--ease-out) 1.15s backwards; }
.fx-ready .hero .cta .btn:nth-child(2) { animation-delay: 1.23s; }
.fx-ready .hero .scroll-hint { animation: fx-up .6s var(--ease-out) 1.6s backwards, bob 2s 2.2s infinite; }
/* Micrófono: entra y se balancea una vez desde la base; el halo de la cabeza respira */
.fx-ready .mic { animation: fx-up .8s var(--ease-out) .15s backwards; }
.mic svg { overflow: visible; }
@keyframes fx-sway {
  0% { transform: rotate(-5deg); } 32% { transform: rotate(3.2deg); } 58% { transform: rotate(-1.6deg); }
  80% { transform: rotate(.6deg); } 100% { transform: none; }
}
.fx-ready .mic svg { transform-origin: 50% 100%; animation: fx-sway 1.9s var(--ease-in-out) .25s backwards; }
@keyframes fx-breathe { 50% { opacity: .45; transform: scale(.9); } }
.mic-glow { transform-box: fill-box; transform-origin: center; animation: fx-breathe 3.4s var(--ease-in-out) infinite; }

/* ---------- C1b. Portada: escenario en capas (parallax de SITE.heroLayers, las pinta fx.js) ----------
   Cada capa es un div .hero-layer con la imagen dentro (PNG/WebP en <img>; los SVG del mismo origen van en línea
   para que tomen los colores hl-* de abajo). La caja desborda el hero lo mismo que el máximo desplazamiento
   (12 % + 50 px a los lados, 4 % + 30 px arriba y abajo; fx.js usa las mismas cifras) para que nunca asome un borde.
   Orden: capas de depth < 0 (antes del foco) < foco < micrófono y texto < capas de depth > 0 (z-index 2) < flecha. */
:root {
  --hl-ink: #c9ded0; --hl-ink-2: #d6e6dc; --hl-window: #ffffff; --hl-glow: #ffffff;   /* --muted sobre --hl-ink: 4.6:1 */
  --hl-moon: #f5c542; --hl-moon-dark: #f5c542; --hl-star: transparent;
  --hl-curtain: #d3e2d7; --hl-curtain-dark: #c0d4c7; --hl-curtain-hi: #ffffff;
  --hl-crowd: #9fb8ab; --hl-crowd-2: #adc4b8; --hl-screen: #ffffff; --hl-bokeh: #f5c542;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hl-ink: #0b2520; --hl-ink-2: #071b16; --hl-window: #f5c542; --hl-glow: #f5c542;
    --hl-moon: #e8b93c; --hl-moon-dark: #c99a2a; --hl-star: #ffffff;
    --hl-curtain: #0f2d26; --hl-curtain-dark: #07201a; --hl-curtain-hi: #f5c542;
    --hl-crowd: #03100d; --hl-crowd-2: #071814; --hl-screen: #cfeeff; --hl-bokeh: #f5c542;
  }
}
:root[data-theme="dark"] {
  --hl-ink: #0b2520; --hl-ink-2: #071b16; --hl-window: #f5c542; --hl-glow: #f5c542;
  --hl-moon: #e8b93c; --hl-moon-dark: #c99a2a; --hl-star: #ffffff;
  --hl-curtain: #0f2d26; --hl-curtain-dark: #07201a; --hl-curtain-hi: #f5c542;
  --hl-crowd: #03100d; --hl-crowd-2: #071814; --hl-screen: #cfeeff; --hl-bokeh: #f5c542;
}
.hero.has-layers { isolation: isolate; }   /* el z-index de las capas se resuelve dentro del hero */
.hero-layer {
  position: absolute; inset: calc(-4% - 30px) calc(-12% - 50px); pointer-events: none; user-select: none;
  contain: strict;
}
.hero-layer > img, .hero-layer > svg { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.hero-layer[data-front] { z-index: 2; }
.hero.has-layers .scroll-hint { z-index: 3; }
/* Entrada al cargar: fundido y leve subida, escalonada del fondo al primer plano (fx.js pone .is-in al cargar la imagen) */
@keyframes fx-layer-in { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: none; } }
.fx-ready .hero-layer { opacity: 0; }
.fx-ready .hero-layer.is-in { animation: fx-layer-in 1.1s var(--ease-out) calc(.1s + var(--i, 0) * 120ms) both; }
/* Celular: el hero es vertical (botones abajo), así que baja un poco más el borde para que el público no los toque */
@media (max-width: 760px) { .hero.has-layers { padding-bottom: calc(4rem + 9vh); } }

/* ---------- C2. Cinta de escena ---------- */
.tape { overflow-x: clip; overflow-y: visible; padding: 1.6rem 0; margin-top: -1rem; position: relative; z-index: 1; }
.tape-band {
  width: 106%; margin-left: -3%; transform: rotate(-2deg); background: var(--accent); color: #111;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.tape-track { display: flex; width: max-content; animation: fx-marquee 28s linear infinite; }
.tape-row { white-space: nowrap; padding: .55rem 0; font-family: var(--display); font-size: clamp(1.05rem, 2.2vw, 1.5rem); letter-spacing: .1em; }
@keyframes fx-marquee { to { transform: translateX(-50%); } }
@media (hover: hover) and (pointer: fine) { .tape:hover .tape-track { animation-play-state: paused; } }

/* ---------- C3. Bio ---------- */
.bio-photo { position: relative; border-radius: 18px; }
.bio-photo img { transition: scale 1.1s var(--ease-out) .15s, clip-path .9s var(--ease-out) .15s; }
.fx-ready .bio-photo img { clip-path: inset(100% 0 0 0 round 18px); scale: 1.06; }
.fx-ready .reveal.visible .bio-photo img { clip-path: inset(0 round 18px); scale: 1; }
/* Borde de luz que sigue al puntero (--mx/--my los escribe fx.js) */
.bio-photo::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none; opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(245,197,66,.9), rgba(245,197,66,.15) 55%, transparent 75%);
  -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 .3s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .bio-photo:hover::after { opacity: 1; } }

/* ---------- C4. Clips (Shorts) ---------- */
.clips-sub { color: var(--muted); margin: -.6rem auto 1.8rem; max-width: 46ch; text-wrap: balance; }
.clips { position: relative; margin-bottom: 2rem; }
.clips-row {
  display: flex; gap: .9rem; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin-inline: calc(var(--fx-gutter) * -1); padding: 1rem var(--fx-gutter); scroll-padding-inline: var(--fx-gutter);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.clips-row::-webkit-scrollbar { display: none; }
.clip-card {
  position: relative; flex: 0 0 clamp(180px, 18vw, 240px); aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden;
  scroll-snap-align: start; background: #0b2520; color: #fff; text-align: left; box-shadow: 0 14px 34px var(--shadow);
  outline-offset: 4px;
}
.clip-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: scale .7s var(--ease-out); }
.clip-title {
  position: absolute; inset: auto 0 0 0; padding: 3rem .8rem .8rem; font-weight: 700; font-size: .92rem; line-height: 1.3;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.82)); text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.clip-play {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #111; box-shadow: 0 8px 24px rgba(0,0,0,.4); scale: .92; opacity: .92;
  transition: scale .25s var(--ease-out), opacity .25s var(--ease-out);
}
.clip-play svg { width: 20px; height: 20px; margin-left: 3px; }
.clip-card:focus-visible .clip-play { scale: 1.12; opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .clip-card:hover .clip-play { scale: 1.14; opacity: 1; }
  .clip-card:hover img { scale: 1.05; }
}
/* Flechas (solo en computadora) */
.clips-arrow {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--bg2); color: var(--text); cursor: pointer; box-shadow: 0 8px 22px var(--shadow);
  transition: opacity .2s var(--ease-out), border-color .2s, scale .16s var(--ease-out);
}
.clips-arrow svg { width: 20px; height: 20px; }
.clips-arrow.prev { left: calc(var(--fx-gutter) * -1 + 8px); }
.clips-arrow.next { right: calc(var(--fx-gutter) * -1 + 8px); }
.clips-arrow:disabled { opacity: 0; pointer-events: none; }
.clips-arrow:active { scale: .94; }
@media (hover: hover) and (pointer: fine) { .clips-arrow:hover { border-color: var(--accent); } }
@media (hover: none), (max-width: 760px) { .clips-arrow { display: none; } }
@media (max-width: 760px) { .clip-card { flex-basis: 56vw; } .clips-row { gap: .7rem; } }   /* ~1,6 tarjetas: invita a deslizar */

/* Visor del clip (dialog nativo en 9:16) */
/* margin: auto e inset: 0 devuelven el centrado nativo que el reset "* { margin: 0 }" de styles.css le quita */
.clip-viewer { margin: auto; inset: 0; border: 0; padding: 0; background: transparent; max-width: none; max-height: none; overflow: visible; color: #fff; }
.clip-viewer::backdrop { background: rgba(2, 12, 9, .86); }
.clip-frame {
  width: min(calc(86vh * 9 / 16), calc(100vw - 2rem)); width: min(calc(86dvh * 9 / 16), calc(100vw - 2rem));
  aspect-ratio: 9 / 16; max-height: 86vh; max-height: 86dvh; border-radius: 18px; overflow: hidden; background: #000;
  box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 0 1px rgba(245,197,66,.25);
}
.clip-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.clip-close {
  position: absolute; top: -3rem; right: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.45); color: #fff; font-size: 1rem; cursor: pointer; display: grid; place-items: center;
  transition: background .2s, scale .16s var(--ease-out);
}
.clip-close:active { scale: .94; }
@media (max-height: 560px) { .clip-close { top: .6rem; right: .6rem; } }   /* celular apaisado: la ✕ entra en el marco */
@media (hover: hover) and (pointer: fine) { .clip-close:hover { background: var(--accent); color: #111; border-color: var(--accent); } }
/* Entrada: escala .96 + opacidad (la salida la anima fx.js antes de cerrar) */
.clip-viewer[open] { opacity: 1; scale: 1; transition: opacity .26s var(--ease-out), scale .26s var(--ease-out); }
.clip-viewer[open]::backdrop { opacity: 1; transition: opacity .26s var(--ease-out); }
@starting-style {
  .clip-viewer[open] { opacity: 0; scale: .96; }
  .clip-viewer[open]::backdrop { opacity: 0; }
}
html:has(.clip-viewer[open]) { overflow: hidden; }

/* ---------- Menos movimiento: nada se mueve, solo cambia la opacidad ---------- */
@media (prefers-reduced-motion: reduce) {
  html:active-view-transition-type(page-nav)::view-transition-new(root) { animation-name: fx-vt-in-fade; }
  html::after { display: none; }
  .btn.primary::after { display: none; }
  .fx-ready [data-stagger] > * { translate: none; transition: opacity .3s; }
  :is(h2, .page-title) > span::after { transition: none; }
  .fx-ready .spotlight { animation: none; transform: translateX(-50%); }
  .fx-ready .hero-title .ch { animation: none; }
  .fx-ready .hero .kicker, .fx-ready .hero .tagline, .fx-ready .hero .cta .btn, .fx-ready .mic, .fx-ready .hero .scroll-hint { animation: none; }
  .fx-ready .mic svg, .mic-glow { animation: none; }
  .fx-ready .hero-layer { animation: none; opacity: 1; }   /* capas quietas en su posición neutra (fx.js tampoco las mueve) */
  .tape-track { animation: none; }
  .fx-ready .bio-photo img { clip-path: none; scale: 1; transition: none; }
  .clip-card img, .clip-play, .clips-arrow { transition: none; }
  .clip-viewer[open] { scale: 1; transition: opacity .2s; }
  @starting-style { .clip-viewer[open] { scale: 1; } }
}
