/* ==========================================================================
   RDG · Estilos base compartidos para todo el sitio
   Páginas SEO (home, sobre-mí, blog, estudio) — no afecta a /diagnostico/
   ========================================================================== */

:root {
  color-scheme: light dark;
  --ink: #000000;
  --paper: #ffffff;
  --line: #e5e5e5;
  --line-dark: #1f1f1f;
  --muted: #6e6e73;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11','ss01','ss03';
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ===== Tipografía utilitaria ===== */
.tightest { letter-spacing: -0.045em; }
.tabular { font-variant-numeric: tabular-nums; }
.eye { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; font-weight: 500; color: rgba(0,0,0,0.5); }
.dark .eye { color: rgba(255,255,255,0.5); }

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn-primary-light { background: #fff; color: #000; }
.btn-primary-light:hover { background: #f2f2f2; }
.btn-primary-dark { background: #000; color: #fff; }
.btn-primary-dark:hover { background: #1a1a1a; }
.btn-ghost-dark { background: transparent; color: #000; border: 1px solid rgba(0,0,0,0.18); }
.btn-ghost-dark:hover { border-color: rgba(0,0,0,0.5); }
.btn-ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.btn-ghost-light:hover { border-color: rgba(255,255,255,0.55); }

/* ===== Nav compartido (páginas SEO, NO landings de conversión) ===== */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255,255,255,0.72);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.site-nav--dark { background: rgba(0,0,0,0.55); border-bottom-color: rgba(255,255,255,0.06); color: #fff; }
.site-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-nav-logo img { height: 20px; width: auto; }
.site-nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.site-nav-links a { color: inherit; opacity: 0.75; transition: opacity 0.2s; }
.site-nav-links a:hover { opacity: 1; }
.site-nav-links a.is-cta {
  opacity: 1;
  background: #000;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
}
.site-nav--dark .site-nav-links a.is-cta { background: #fff; color: #000; }
.site-nav-links a.is-cta:hover { background: #1a1a1a; }
.site-nav--dark .site-nav-links a.is-cta:hover { background: #f2f2f2; }
.site-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: inherit;
  padding: 8px;
  cursor: pointer;
}
@media (max-width: 700px) {
  .site-nav-links { display: none; }
  .site-nav-toggle { display: block; }
  .site-nav-links.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .site-nav--dark .site-nav-links.is-open { background: rgba(0,0,0,0.95); border-bottom-color: rgba(255,255,255,0.08); }
}

/* ===== Footer compartido ===== */
.site-footer {
  background: #000;
  color: rgba(255,255,255,0.55);
  padding: 64px 24px 48px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.site-footer-inner { max-width: 1120px; margin: 0 auto; }
.site-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
@media (max-width: 780px) { .site-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .site-footer-grid { grid-template-columns: 1fr; gap: 32px; } }
.site-footer h4 { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255,255,255,0.4); margin: 0 0 18px; font-weight: 500; }
.site-footer a { color: rgba(255,255,255,0.75); font-size: 14px; line-height: 2; transition: color 0.2s; }
.site-footer a:hover { color: #fff; }
.site-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 16px;
}
.site-footer-logo { height: 18px; width: auto; opacity: 0.7; }

/* ===== Reveal on scroll ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 1s cubic-bezier(0.22,1,0.36,1), transform 1s cubic-bezier(0.22,1,0.36,1); will-change: opacity, transform; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ===== Prose (artículos de blog) ===== */
.prose {
  max-width: 700px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.75;
  color: rgba(0,0,0,0.8);
}
.prose p { margin: 0 0 26px; font-weight: 300; }
.prose h2 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #000;
  margin: 64px 0 24px;
}
.prose h3 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #000;
  margin: 48px 0 16px;
}
.prose strong { font-weight: 500; color: #000; }
.prose em { font-style: italic; }
.prose ul, .prose ol { margin: 0 0 26px; padding-left: 24px; }
.prose li { margin-bottom: 10px; font-weight: 300; }
.prose blockquote {
  border-left: 2px solid #000;
  padding: 8px 0 8px 24px;
  margin: 36px 0;
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  color: rgba(0,0,0,0.7);
  letter-spacing: -0.01em;
  line-height: 1.5;
}
.prose a { color: #000; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose .pullquote {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #000;
  margin: 56px 0;
  padding: 0;
  border: none;
  font-style: normal;
}
.prose .data-card {
  background: #000;
  color: #fff;
  padding: 36px;
  border-radius: 20px;
  margin: 40px 0;
}
.prose .data-card .big {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.prose .data-card .big em { font-style: normal; color: rgba(255,255,255,0.5); }
.prose .data-card p { color: rgba(255,255,255,0.75); font-size: 16px; line-height: 1.6; margin: 0; }
@media (max-width: 600px) {
  .prose { font-size: 17px; }
  .prose h2 { font-size: 28px; margin: 48px 0 18px; }
  .prose h3 { font-size: 20px; }
  .prose .pullquote { font-size: 24px; }
  .prose .data-card .big { font-size: 48px; }
}

/* ===== Spinner ===== */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}
.spinner-dark { border: 2px solid rgba(0,0,0,0.15); border-top-color: #000; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Accesibilidad ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ===== Spacers ===== */
.pad-nav { padding-top: 60px; }  /* Para compensar el nav fijo */


/* =========================================================
   ANIMACIONES — Sistema completo, CSS puro (sin JS)
   ========================================================= */

@keyframes fadeUp {
  0%   { opacity: 0; transform: translateY(32px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes scaleIn {
  0%   { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes kenBurns {
  0%   { transform: scale(1) translate(0,0); }
  100% { transform: scale(1.06) translate(-1%, -1%); }
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes shimmerText {
  0%   { background-position: -120% 0; }
  100% { background-position: 220% 0; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.5); }
  80%  { box-shadow: 0 0 0 14px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255,255,255,0)); }
  50%      { filter: drop-shadow(0 0 8px rgba(255,255,255,0.15)); }
}
@keyframes slideInLeft {
  0%   { opacity: 0; transform: translateX(-40px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  0%   { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ===== Reveal animado con cascada =====
   Los elementos aparecen con delay escalonado automático. */
.reveal {
  opacity: 0;
  animation: fadeUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.05s;
}
.reveal:nth-of-type(2)  { animation-delay: 0.15s; }
.reveal:nth-of-type(3)  { animation-delay: 0.28s; }
.reveal:nth-of-type(4)  { animation-delay: 0.42s; }
.reveal:nth-of-type(5)  { animation-delay: 0.55s; }
.reveal:nth-of-type(6)  { animation-delay: 0.68s; }
.reveal:nth-of-type(7)  { animation-delay: 0.80s; }
section .reveal:nth-child(n+8) { animation-delay: 0.9s; }

/* ===== Hero: gradiente vivo en fondos negros ===== */
section[style*="background: #000"],
section.dark {
  background: linear-gradient(135deg, #000 0%, #0a0a0a 35%, #050505 70%, #000 100%) !important;
  background-size: 250% 250% !important;
  animation: gradientShift 18s ease infinite;
}

/* ===== Imágenes protagonistas: efecto Ken Burns ===== */
section img[fetchpriority="high"],
section img[loading="eager"],
.portrait {
  animation: kenBurns 22s ease-in-out infinite alternate;
  will-change: transform;
}

/* ===== Titulares H1 con shimmer en color blanco (hero dark) ===== */
.dark h1, body.bg-black h1, section[style*="color: #fff"] h1 {
  background: linear-gradient(90deg, #ffffff 0%, #ffffff 40%, rgba(255,255,255,0.55) 50%, #ffffff 60%, #ffffff 100%);
  background-size: 220% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent !important;
  animation: shimmerText 6s ease-in-out infinite;
}

/* ===== Cards (borde redondeado + hover enriquecido) ===== */
a[style*="border-radius: 28px"],
a[style*="border-radius: 24px"],
article[style*="border-radius: 24px"],
.data-card {
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.55s ease,
              border-color 0.55s ease !important;
  will-change: transform;
}
a[style*="border-radius: 28px"]:hover,
a[style*="border-radius: 24px"]:hover,
article[style*="border-radius: 24px"]:hover,
.data-card:hover {
  transform: translateY(-8px) scale(1.01) !important;
  box-shadow: 0 30px 80px rgba(0,0,0,0.15);
}

/* ===== Botones con ripple ===== */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: currentColor;
  opacity: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1), height 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  z-index: -1;
}
.btn:hover::before {
  width: 420px;
  height: 420px;
  opacity: 0.08;
}
.btn-primary-light:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(255,255,255,0.15);
}
.btn-primary-dark:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* ===== CTA pulsante sutil ===== */
.site-nav-links a.is-cta {
  position: relative;
  animation: floatY 4s ease-in-out infinite;
}
.site-nav-links a.is-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  animation: pulseRing 2.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  pointer-events: none;
}

/* ===== Logo nav con glow sutil ===== */
.site-nav-logo img {
  animation: glowPulse 5s ease-in-out infinite;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.site-nav-logo:hover img {
  transform: scale(1.08);
}

/* ===== Números tabulares: zoom sutil al aparecer ===== */
.tabular {
  display: inline-block;
  animation: scaleIn 1.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.3s;
}

/* ===== Eyebrow (etiqueta pequeña) aparece desde la izquierda ===== */
.eye {
  animation: slideInLeft 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.1s;
}

/* ===== Hover en enlaces del prose ===== */
.prose a {
  position: relative;
  transition: color 0.3s ease;
}
.prose a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.prose a:hover::after {
  transform: scaleX(1);
}

/* ===== Ovos parallax scroll-driven (Chrome/Edge modernos) ===== */
@supports (animation-timeline: scroll()) {
  .portrait,
  section img[fetchpriority="high"] {
    animation: kenBurns linear;
    animation-timeline: view();
    animation-range: cover;
  }
}

/* ===== Micro-animación en data cards (big numbers crecen) ===== */
.data-card .big,
.card .num {
  animation: scaleIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.4s;
}

/* ===== Smooth scroll reforzado ===== */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

/* ===== Reducir animaciones si el usuario lo prefiere ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
