/* =====================================================================
   DIEGONEL EDITOR — Tema compartido (atmósfera + componentes base)
   Se carga en TODAS las páginas. Sistema de diseño Stitch "Diegonel Editor".
   Paleta: ink #09090b · accent #a855f7 · hover #6b21a8 · hairline #27272a
   ===================================================================== */

/* Tipografía de marca: Clash Display (titulares) + JetBrains Mono (labels técnicos).
   Inter (cuerpo/UI) se sigue cargando desde cada HTML. Si Fontshare falla, cae a Inter. */
@import url('https://api.fontshare.com/v2/css?f[]=clash-display@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #09090b;
  --accent: #a855f7;
  --accent-hover: #6b21a8;
  --accent-soft: #b76dff;
  --muted: #a1a1aa;
  --hairline: #27272a;
  --glass-bg: rgba(9, 9, 11, 0.72);
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--ink);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Identidad tipográfica ---------- */
/* Titulares grandes con carácter de agencia. Cae a Inter si Clash no carga. */
h1, h2, .font-display {
  font-family: "Clash Display", "Inter", sans-serif;
  letter-spacing: -0.02em;
}
/* Labels técnicos en mono (fechas, métricas, badges de sección) */
.mono-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.12em;
}

/* ---------- Fondo: mesh gradient de doble nodo (tinta viva) ---------- */
.mesh-bg {
  position: fixed;
  inset: -50%;
  z-index: -2;
  background:
    radial-gradient(circle at 50% 50%, rgba(73, 0, 128, 0.14) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 20%, rgba(107, 33, 168, 0.20) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.14) 0%, transparent 50%);
  filter: blur(80px);
  animation: mesh-drift 22s ease-in-out infinite alternate;
  pointer-events: none;
  mix-blend-mode: screen;
}
@keyframes mesh-drift {
  0%   { transform: scale(1) translate(0, 0) rotate(0deg); opacity: 0.85; }
  50%  { transform: scale(1.1) translate(-2%, 3%) rotate(5deg); opacity: 1; }
  100% { transform: scale(0.9) translate(3%, -2%) rotate(-5deg); opacity: 0.9; }
}

/* ---------- Grano sutil sobre el fondo (textura premium) ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Título con barrido de luz (shimmer) ---------- */
.shimmer {
  background: linear-gradient(100deg, #ffffff 30%, var(--accent-soft) 50%, #ffffff 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer-sweep 6s linear infinite;
  /* Evita que background-clip:text recorte los descendentes (g, p, y) */
  line-height: 1.15;
  padding-bottom: 0.12em;
}
@keyframes shimmer-sweep { to { background-position: -200% center; } }

/* ---------- Barra de progreso de scroll ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  z-index: 60; pointer-events: none;
}

/* ---------- Navbar reactiva al scroll (encoge + más blur/sombra) ---------- */
#site-nav nav > div { transition: height 0.3s ease; }
#site-nav nav.nav-scrolled {
  background: rgba(9, 9, 11, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
#site-nav nav.nav-scrolled > div { height: 3.25rem; }

/* ---------- Glassmorphism (navbar, overlays) ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.glass-card {
  background: rgba(20, 20, 25, 0.4);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(107, 33, 168, 0.1) inset;
  transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ---------- Glow reactivo que sigue al mouse (acabado premium) ---------- */
/* Añade la clase .glass-reactive a cualquier tarjeta. El brillo lo mueve
   components.js vía delegación, así funciona también en contenido dinámico. */
.glass-reactive { position: relative; overflow: hidden; }
.glass-reactive::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
              rgba(183, 109, 255, 0.14), transparent 40%);
  z-index: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s ease;
}
.glass-reactive:hover::before { opacity: 1; }
.glass-reactive > * { position: relative; z-index: 1; }

/* ---------- Divisores 1px ---------- */
.hairline { border-color: var(--hairline); }
.crude-border { border-color: var(--hairline); } /* alias de compatibilidad */

/* ---------- Botones ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 0.875rem;
  padding: 0.625rem 1.5rem; border-radius: 0.5rem; cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: transparent; color: #fff; font-weight: 600; font-size: 0.875rem;
  padding: 0.625rem 1.5rem; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer; transition: all 0.25s ease;
}
.btn-secondary:hover { border-color: var(--accent-soft); color: var(--accent-soft); }

/* ---------- Enlaces de navegación ---------- */
.nav-link {
  font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.02em; color: #fff;
  transition: color 0.25s ease; position: relative; text-transform: none;
}
.nav-link:hover { color: var(--accent-soft); }
.nav-link.is-active { color: var(--accent-soft); }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

/* ---------- Portafolio: tarjeta con giro 3D en hover ---------- */
.project-card { transform-origin: center center; will-change: transform; }
.project-card:hover {
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 40px 60px -15px rgba(0, 0, 0, 0.9),
              0 0 60px rgba(168, 85, 247, 0.15) inset,
              0 15px 30px rgba(168, 85, 247, 0.25);
  transform: perspective(1500px) rotateX(6deg) translateY(-10px);
}
.image-container::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(9, 9, 11, 0.8) 0%, transparent 100%);
  opacity: 0; transition: opacity 0.6s ease; pointer-events: none;
}
.md\:flex-row-reverse .image-container::after {
  background: linear-gradient(to left, rgba(9, 9, 11, 0.8) 0%, transparent 100%);
}
.project-card:hover .image-container::after { opacity: 1; }

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 56px; height: 56px;
  border-radius: 9999px;
  background: #25d366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.wa-fab:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(37, 211, 102, 0.55); }
.wa-fab svg { width: 30px; height: 30px; fill: #fff; }
.wa-fab::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: #25d366; z-index: -1;
  animation: wa-pulse 2.4s ease-out infinite;
}
/* Pulso con transform+opacity (compositor-friendly, sin repaint) */
@keyframes wa-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .wa-fab::before { animation: none; } }

/* ---------- Skeleton de carga para embeds ---------- */
.embed-frame {
  background: linear-gradient(100deg, #141418 25%, #24242e 50%, #141418 75%);
  background-size: 200% 100%;
  animation: embed-skeleton 1.4s linear infinite;
}
@keyframes embed-skeleton { to { background-position: -200% 0; } }
.embed-frame.loaded { animation: none; background: #000; }
@media (prefers-reduced-motion: reduce) { .embed-frame { animation: none; } }

/* ---------- Badge "Destacado" ---------- */
.badge-destacado {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 9px; border-radius: 9999px;
}

/* ---------- Estado vacío ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.75rem; padding: 3rem 1.5rem;
  border: 1px dashed var(--hairline); border-radius: 1rem; color: var(--muted);
}
.empty-state .material-symbols-outlined { font-size: 40px; opacity: 0.5; }

/* ---------- Reveal on scroll (usado por components.js) ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Portafolio en táctil: sin hover, mostrar a color ---------- */
/* En pantallas sin hover (móvil/tablet) las imágenes no deben quedarse en gris */
@media (hover: none) {
  #dynamic-portfolio-container img {
    filter: grayscale(0) !important;
    opacity: 1 !important;
    transform: scale(1) !important;
  }
}

/* ---------- Accesibilidad: respeta reduce-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .mesh-bg, .shimmer { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
}
