:root {
  /* Canales RGB sueltos para poder modular el alpha sin repetir el color */
  --accent-rgb: 205 150 245;
  --petal-rgb: 255 158 205;

  --bg-deep: #150a1f;
  --bg-mid: #241338;
  --accent: rgb(var(--accent-rgb));
  --accent-soft: #eec9ff;
  --petal: rgb(var(--petal-rgb));
  --text: #f7ecfb;
  --text-dim: #c5abd6;

  --card: rgba(255, 255, 255, 0.07);
  --card-hover: rgba(255, 255, 255, 0.13);
  --border: rgba(255, 255, 255, 0.14);
  --radius: 16px;
  --max-width: 620px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: clamp(1.5rem, 5vw, 4rem) 1.25rem 3rem;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 50% 0%, rgb(var(--accent-rgb) / 0.16), transparent 60%),
    linear-gradient(170deg, var(--bg-mid) 0%, var(--bg-deep) 60%, #0d0616 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- Fondo animado ---------- */
.aurora {
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(40% 35% at 20% 15%, rgb(var(--accent-rgb) / 0.3), transparent 70%),
    radial-gradient(35% 30% at 80% 25%, rgb(var(--petal-rgb) / 0.24), transparent 70%),
    radial-gradient(45% 40% at 50% 90%, rgb(var(--accent-rgb) / 0.18), transparent 70%);
  filter: blur(20px);
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 2%, 0) scale(1.08);
  }
}

.petals {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  /* Sin perspective el rotate3d de abajo se ve como un simple achatamiento.
     Con perspective el petalo parece darse vuelta en el aire. */
  perspective: 700px;
}

/* Solo declara formas reusables: no dibuja nada. */
.svg-defs {
  position: absolute;
}

/*
 * Flor de la bio. `em` en vez de `px` para que escale con el texto que la
 * rodea, y el descenso de 0.2em la baja hasta la altura de la x: alineada
 * con la linea base se ve flotando arriba de las minusculas.
 */
.bloom {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: var(--petal);
}

.petal {
  position: absolute;
  top: 0;
  display: block;
  /* Ancho por defecto a proposito. Un .petal sin regla nth-child queda sin
     tamano, el <svg> de adentro se estira al 100% de un contenedor absoluto
     sin ancho y termina tapando la pagina entera. Ya paso una vez, al mover
     los <defs> fuera de .petals y correrse todos los indices. */
  width: 12px;
  animation: petal-fall linear infinite;
}

.petal svg {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
  /* Valores por defecto: si un petalo se queda sin regla propia, gira igual
     en vez de quedarse quieto o romper el rotate3d con variables vacias. */
  --ax: 0.3;
  --ay: 1;
  --az: 0.25;
  --tilt: 0deg;
  animation: petal-flutter linear infinite;
}

/*
 * Cada petalo con su tamano, color, opacidad y ritmo. Los numeros no son
 * redondos ni multiplos entre si a proposito: si las duraciones comparten
 * divisores, los petalos se sincronizan cada tantos segundos y el ojo detecta
 * el patron al instante.
 */
.petal:nth-child(1)  { left:  6%; width: 15px; color: #ff9ecd; opacity: .50; animation-duration: 19s; animation-delay:  -2s; }
.petal:nth-child(2)  { left: 17%; width:  9px; color: #eec9ff; opacity: .30; animation-duration: 27s; animation-delay:  -9s; filter: blur(1.2px); }
.petal:nth-child(3)  { left: 29%; width: 12px; color: #ffc2de; opacity: .44; animation-duration: 23s; animation-delay: -15s; }
.petal:nth-child(4)  { left: 41%; width: 18px; color: #ff9ecd; opacity: .38; animation-duration: 31s; animation-delay:  -5s; }
.petal:nth-child(5)  { left: 55%; width: 10px; color: #cd96f5; opacity: .32; animation-duration: 21s; animation-delay: -18s; filter: blur(1.2px); }
.petal:nth-child(6)  { left: 67%; width: 14px; color: #ffc2de; opacity: .46; animation-duration: 29s; animation-delay: -11s; }
.petal:nth-child(7)  { left: 78%; width: 10px; color: #eec9ff; opacity: .29; animation-duration: 25s; animation-delay:  -1s; filter: blur(1.6px); }
.petal:nth-child(8)  { left: 88%; width: 16px; color: #ff9ecd; opacity: .42; animation-duration: 33s; animation-delay: -22s; }
.petal:nth-child(9) { left: 96%; width:  8px; color: #ffc2de; opacity: .27; animation-duration: 22s; animation-delay: -13s; filter: blur(1.6px); }

/*
 * El giro de cada petalo, uno por uno.
 *
 * Antes habia solo dos reglas (impares y pares), misma duracion, mismo eje y
 * sin delay: los cinco impares arrancaban juntos y quedaban en fase para
 * siempre, asi que cada 7.3s se ponian de canto los cinco a la vez y el fondo
 * se llenaba de rayitas.
 *
 * Cuatro cosas distintas por petalo:
 *   --ax/--ay/--az  eje de giro
 *   --tilt          inclinacion fija; ninguno cae perfectamente vertical
 *   duration        ninguna es multiplo ni divisor de otra
 *   delay negativo  arranca a mitad de ciclo, cada uno en otro punto
 *
 * El eje es lo que resuelve el problema de raiz, y no por azar. Con la normal
 * del petalo en (0,0,1) y un eje unitario, la formula de Rodrigues deja:
 *
 *     Rzz = z^2 + (1 - z^2) * cos(angulo)
 *
 * donde |Rzz| = 1 es "de frente" y 0 es "de canto". Es lineal en cos(angulo),
 * asi que Rzz recorre el rango [2z^2 - 1, 1]. Si 2z^2 - 1 se mantiene por
 * encima del umbral en que la silueta se lee como raya (~0.15), ese petalo
 * NUNCA puede colapsar. Eso pasa con z normalizado > 0.758.
 *
 * Cinco de los nueve estan de ese lado: giran en su propio plano, como una
 * hoja que rota mientras cae. Los otros cuatro vuelcan de verdad. El tope de
 * petalos de canto simultaneos pasa a ser 4 por construccion, no por suerte,
 * y con los delays desfasados se da en el 0.01% del tiempo.
 */
/* Vuelcan: eje casi horizontal, llegan a verse de canto. Son la minoria. */
.petal:nth-child(1) svg { --ax: .22; --ay: 1;   --az: .35;  --tilt:  12deg; animation-duration:  6.7s; animation-delay: -1.9s; }
.petal:nth-child(3) svg { --ax: .10; --ay: 1;   --az: .55;  --tilt:  34deg; animation-duration:  7.9s; animation-delay: -3.1s; }
.petal:nth-child(5) svg { --ax: .18; --ay: 1;   --az: .22;  --tilt:  21deg; animation-duration:  8.3s; animation-delay: -0.7s; }
.petal:nth-child(7) svg { --ax: .30; --ay: 1;   --az: .12;  --tilt:  41deg; animation-duration:  7.1s; animation-delay: -4.3s; animation-direction: reverse; }

/* Giran en su propio plano: z normalizado > 0.758, o sea 2z^2-1 > 0.15.
   Su |Rzz| minimo ronda 0.28, muy por encima del umbral: no pueden colapsar
   en una linea ni en el peor instante. */
.petal:nth-child(2) svg { --ax: .30; --ay: .90; --az: 1.27; --tilt: -25deg; animation-duration:  9.1s; animation-delay: -5.3s; animation-direction: reverse; }
.petal:nth-child(4) svg { --ax: .45; --ay: .75; --az: 1.17; --tilt:  -8deg; animation-duration: 11.3s; animation-delay: -7.7s; animation-direction: reverse; }
.petal:nth-child(6) svg { --ax: .62; --ay: .60; --az: 1.15; --tilt: -17deg; animation-duration: 12.7s; animation-delay: -9.1s; }
.petal:nth-child(8) svg { --ax: .15; --ay: .85; --az: 1.15; --tilt: -31deg; animation-duration: 10.1s; animation-delay: -2.3s; }
.petal:nth-child(9) svg { --ax: .50; --ay: .80; --az: 1.26; --tilt:   6deg; animation-duration:  9.7s; animation-delay: -6.1s; animation-direction: reverse; }

/*
 * La deriva horizontal va DENTRO de la caida en vez de ser una animacion
 * aparte: un solo transform compuesto evita apilar capas y el navegador lo
 * resuelve entero en el compositor, sin recalcular layout en ningun frame.
 */
@keyframes petal-fall {
  0%   { transform: translate3d(0, -15vh, 0); }
  25%  { transform: translate3d(24px, 15vh, 0); }
  50%  { transform: translate3d(-16px, 47vh, 0); }
  75%  { transform: translate3d(21px, 79vh, 0); }
  100% { transform: translate3d(-8px, 115vh, 0); }
}

/*
 * El eje llega por variables, asi cada petalo gira alrededor del suyo con un
 * solo bloque de keyframes en vez de nueve. Las custom properties dentro de
 * @keyframes se resuelven contra el elemento animado, no contra la regla.
 *
 * El componente Y domina (giro sobre si mismo, que es lo que da el aleteo) y
 * el Z nunca es cero: una rotacion pura en Y llega a colapsar el petalo en una
 * linea, y con algo de Z la silueta siempre conserva algo de ancho.
 */
@keyframes petal-flutter {
  from { transform: rotate(var(--tilt)) rotate3d(var(--ax), var(--ay), var(--az), 0deg); }
  to   { transform: rotate(var(--tilt)) rotate3d(var(--ax), var(--ay), var(--az), 360deg); }
}

/* ---------- Layout ---------- */
.page {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Perfil ---------- */
.profile {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(
    from 180deg,
    var(--accent),
    var(--petal),
    var(--accent-soft),
    var(--accent)
  );
  box-shadow: 0 0 34px rgb(var(--petal-rgb) / 0.38);
  animation: spin 9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* `display: contents` saca a <picture> del layout: el <img> queda como hijo
   directo de .avatar y el width/height de abajo resuelve contra el. */
.avatar picture {
  display: contents;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-mid);
  animation: spin 9s linear infinite reverse;
}

.name {
  margin: 0.4rem 0 0;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.handle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent-soft);
  font-weight: 600;
}

.bio {
  margin: 0.3rem 0 0;
  max-width: 46ch;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-dim);
  font-weight: 300;
  text-wrap: pretty;
}

.bio strong {
  color: var(--accent-soft);
  font-weight: 600;
}

/* ---------- Links ---------- */
.links {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.link:hover::before,
.link:focus-visible::before {
  transform: translateX(120%);
}

.link:hover,
.link:focus-visible {
  transform: translateY(-3px);
  background: var(--card-hover);
  border-color: rgb(var(--petal-rgb) / 0.5);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  outline: none;
}

.link:active {
  transform: translateY(-1px) scale(0.99);
}

.link__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.link__icon svg {
  width: 22px;
  height: 22px;
}

/* Colores de marca: NO se tocan con la paleta del sitio */
.link--youtube .link__icon {
  color: #ff3d3d;
  background: rgba(255, 61, 61, 0.14);
}

.link--tiktok .link__icon {
  color: #ffffff;
  background: rgba(37, 244, 238, 0.16);
}

.link--pinterest .link__icon {
  color: #ff4d6d;
  background: rgba(255, 77, 109, 0.14);
}

.link__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.link__text strong {
  font-size: 1.02rem;
  font-weight: 600;
}

.link__text small {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 300;
}

.link__arrow {
  margin-left: auto;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--text-dim);
  transition: transform 0.22s ease, color 0.22s ease;
}

.link:hover .link__arrow {
  transform: translate(3px, -3px);
  color: var(--petal);
}

/* ---------- Redes ---------- */
.socials {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  transition: transform 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.social svg {
  width: 20px;
  height: 20px;
}

.social:hover,
.social:focus-visible {
  transform: translateY(-3px) scale(1.06);
  color: var(--petal);
  border-color: rgb(var(--petal-rgb) / 0.5);
  outline: none;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  font-size: 0.8rem;
  color: rgb(var(--accent-rgb) / 0.55);
}

.footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  /* Neutralizar la animacion dejaria los nueve petalos congelados encima del
     contenido, que es peor que el movimiento. Se sacan y listo: son decoracion
     pura, no aportan informacion. */
  .petals,
  .aurora {
    display: none;
  }
}

/* ---------- Utilidades ---------- */

/*
 * Oculta a la vista pero NO al lector de pantalla ni al crawler.
 * `display: none` lo sacaria del arbol de accesibilidad y del contenido
 * indexable; esto lo deja presente y solo lo saca del render.
 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
