/* ==========================================================================
   CLAUDIO CASTILLO ORDENES — SITIO WEB PERSONAL (VERSIÓN 2)
   Estilo: Dark Premium (Inspirado en la sofisticación y fluidez de Apple)
   ========================================================================== */

:root {
  --bg-primary: #0B1220;
  --bg-surface: #16243A;
  --bg-surface-elevated: #1C2D47;
  --bg-surface-glass: rgba(22, 36, 58, 0.78);
  
  --accent-cyan: #35C6BC;
  --accent-cyan-glow: rgba(53, 198, 188, 0.18);
  --accent-cyan-border: rgba(53, 198, 188, 0.4);
  
  --text-primary: #F5F7FB;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.16);
  
  --whatsapp-color: #25D366;
  --whatsapp-glow: rgba(37, 211, 102, 0.45);
  
  --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.22s var(--ease-apple);
  --transition-smooth: 0.4s var(--ease-apple);
  --transition-slow: 0.65s var(--ease-apple);
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  overflow-x: hidden;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Tipografía de Encabezados */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.25;
}

.hero-title {
  font-size: clamp(2.15rem, 5.5vw, 3.85rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

p {
  color: var(--text-secondary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Fondo Tecnológico Global con Iluminación Radial Sutil */
.bg-ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(53, 198, 188, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 55%, rgba(22, 36, 58, 0.7) 0%, transparent 55%),
    radial-gradient(circle at 50% 90%, rgba(53, 198, 188, 0.04) 0%, transparent 50%);
}

.content-wrapper {
  position: relative;
  z-index: 1;
}

/* Utilidades de Glassmorphism estilo Apple */
.glass-panel {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  transition: border-color var(--transition-smooth), transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

/* Interacciones según capacidad del dispositivo (hover en cursor, active en táctil) */
@media (hover: hover) {
  .glass-panel:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.45);
  }

  .card-hover:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan-border);
    box-shadow: 0 16px 40px -10px rgba(53, 198, 188, 0.12);
  }

  .btn-primary:hover {
    background: #47DDD3;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(53, 198, 188, 0.4);
  }

  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-highlight);
    color: #FFFFFF;
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .card-hover:active,
  .btn-primary:active,
  .btn-secondary:active {
    transform: scale(0.985);
  }
}

/* Badge Tecnológico Sobrio */
.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(53, 198, 188, 0.08);
  border: 1px solid rgba(53, 198, 188, 0.25);
  color: var(--accent-cyan);
}

/* Botones Apple-Like */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.875rem 1.75rem;
  background: var(--accent-cyan);
  color: #07101B;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9375rem;
  border-radius: 9999px;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 20px rgba(53, 198, 188, 0.25);
  border: none;
  cursor: pointer;
  min-height: 48px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.875rem 1.75rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  cursor: pointer;
  backdrop-filter: blur(8px);
  min-height: 48px;
}

/* ==========================================================================
   FOTOGRAFÍA HERO: EN CELULAR, TABLET Y ESCRITORIO
   ========================================================================== */

/* Contenedor móvil y tablet (< 1024px) */
.hero-photo-mobile-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.25rem;
  margin-bottom: 2rem; /* Separación garantizada con el párrafo (al menos 24px) */
}

.hero-photo-mobile-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
}

.hero-photo-mobile-frame {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 5.2;
  border-radius: 1.35rem; /* 22px */
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-color: var(--bg-surface);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
}

/* Celular (< 768px): Altura máxima de 45vh */
@media (max-width: 767px) {
  .hero-photo-mobile-frame {
    max-height: 45vh;
    height: 45vh;
    width: auto;
  }
}

/* Tablet (768px - 1023px): Altura máxima de 55vh */
@media (min-width: 768px) and (max-width: 1023px) {
  .hero-photo-mobile-frame {
    max-height: 55vh;
    height: 55vh;
    width: auto;
  }
}

/* Imagen estrictamente contenida */
.hero-photo-img-contained {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Escritorio (>= 1024px) */
.hero-photo-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 380px;
}

/* Halo sutil fijo en #35C6BC (opacidad 18-22%, sin pulsos) */
.hero-photo-halo {
  position: absolute;
  inset: -22px;
  background: radial-gradient(circle at 50% 50%, rgba(53, 198, 188, 0.20) 0%, rgba(53, 198, 188, 0.08) 55%, transparent 75%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
  border-radius: 2rem;
}

/* Marco único rectangular vertical limpio */
.hero-photo-frame {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 5.2;
  border-radius: 1.35rem; /* 22px */
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-color: var(--bg-surface);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.6);
}

.hero-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  animation: fadeInPhoto 0.5s ease-out forwards;
}

@keyframes fadeInPhoto {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Versión circular pequeña para la sección de Contacto (96-120px) */
.contact-avatar-wrapper {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 1.5rem auto;
}

.contact-avatar-halo {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle at 50% 50%, rgba(53, 198, 188, 0.16) 0%, transparent 70%);
  filter: blur(14px);
  border-radius: 50%;
  pointer-events: none;
}

.contact-avatar-img {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid rgba(53, 198, 188, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   YOUTUBE LITE EMBED (SECCIÓN 5.2)
   ========================================================================== */
.youtube-lite-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 1rem;
  overflow: hidden;
  background-color: #07101B;
  border: 1px solid var(--border-subtle);
}

.youtube-play-btn {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  color: #07101B;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(53, 198, 188, 0.4);
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.youtube-lite-embed:hover .youtube-play-btn {
  transform: scale(1.1);
  background-color: #47DDD3;
}

/* Animaciones de Scroll Reveal */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Retrasos escalonados */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

/* Botón Flotante: WhatsApp */
.floating-whatsapp {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  right: 2rem;
  width: 3.875rem;
  height: 3.875rem;
  background: linear-gradient(135deg, #25D366 0%, #1EBE5D 100%);
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.45);
  z-index: 999;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
}

@media (hover: hover) {
  .floating-whatsapp:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 14px 34px rgba(37, 211, 102, 0.65);
  }
}

.floating-whatsapp svg {
  width: 2.125rem;
  height: 2.125rem;
  fill: #FFFFFF;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Botón Flotante: Volver Arriba */
.floating-back-to-top {
  position: fixed;
  bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  right: 2.25rem;
  width: 3.25rem;
  height: 3.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.floating-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (hover: hover) {
  .floating-back-to-top:hover {
    background: var(--accent-cyan);
    color: #07101B;
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
  }
}

.floating-back-to-top svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
}

/* Timeline Vertical Compacto */
.timeline-item {
  position: relative;
  padding-left: 2.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: -1.75rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-cyan), rgba(53, 198, 188, 0.15));
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

/* Header Fijo */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(11, 18, 32, 0.88);
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

/* Adaptabilidad a Preferencias de Movimiento Reducido */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Responsividad Móvil */
@media (max-width: 640px) {
  .reveal-on-scroll {
    transition-duration: 350ms;
  }

  .floating-whatsapp {
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    right: 1.25rem;
    width: 3.35rem;
    height: 3.35rem;
  }
  
  .floating-whatsapp svg {
    width: 1.85rem;
    height: 1.85rem;
  }
  
  .floating-back-to-top {
    bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    right: 1.35rem;
    width: 2.85rem;
    height: 2.85rem;
  }
}
