/* ═══════════════════════════════════════════════════
   ESTILOS PRINCIPALES — Ricardo Hernández
   Diseño dark premium moderno v2
   ═══════════════════════════════════════════════════ */

/* ── RESET & VARIABLES ────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette */
  --bg:         #0a0a0f;
  --bg-alt:     #0f0f18;
  --bg-card:    #12121a;
  --bg-card-hover: #181825;
  --surface:    #1a1a2e;
  --border:     rgba(255, 255, 255, 0.06);
  --text:       #e4e4e7;
  --text-muted: #9ca3af;
  --accent:     #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.12);
  --accent-glow:rgba(110, 231, 183, 0.35);
  --gradient:   linear-gradient(135deg, #6ee7b7 0%, #3b82f6 100%);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Sizing */
  --max-w: 1200px;
  --section-py: clamp(60px, 10vw, 120px);

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── UTILITY ──────────────────────────────────────── */
.accent { color: var(--accent); }

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--section-py) 24px;
}

.section-alt {
  background: var(--bg-alt);
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.section-alt > *:not(.services-grid):not(.portfolio-grid) {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section-alt .services-grid,
.section-alt .portfolio-grid {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  border: none;
}

.btn-primary {
  background: var(--gradient);
  color: #0a0a0f;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
  transform: translateY(-2px);
}

.btn-sm { padding: 10px 22px; font-size: 0.85rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── NAVBAR ───────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  transition: all 0.35s var(--ease);
}

.navbar-scrolled {
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  padding: 12px 32px;
  box-shadow: 0 1px 0 var(--border);
}

.nav-logo {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 8px;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.25s, background 0.25s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-cta {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
}

.nav-cta:hover {
  background: rgba(110, 231, 183, 0.2) !important;
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 102;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
}

.hamburger { position: relative; }

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after  { top: 7px; }

.menu-toggle.active .hamburger {
  background: transparent;
}

.menu-toggle.active .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile panel */
.mobile-panel {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10, 10, 15, 0.97);
  backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.mobile-panel.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-link {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  padding: 14px 24px;
  border-radius: 12px;
  transition: color 0.25s, background 0.25s;
}

.mobile-link:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── HEADER / HERO ────────────────────────────────── */
header {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background-image: url(imagenes/header.png);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 15, 0.93) 0%,
    rgba(10, 10, 15, 0.72) 50%,
    rgba(10, 10, 15, 0.88) 100%
  );
  z-index: 1;
}

/* Particle canvas */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 120px 32px 80px;
}

.hero-greeting {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Animated gradient name */
.hero-name {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  background: linear-gradient(
    270deg,
    #ffffff 0%,
    #6ee7b7 25%,
    #3b82f6 50%,
    #6ee7b7 75%,
    #ffffff 100%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-role {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 36px;
  line-height: 1.8;
  min-height: 2em;
}

/* Typewriter cursor */
.typewriter-cursor {
  color: var(--accent);
  font-weight: 300;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Decorative orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -100px;
  right: -100px;
  animation: float 8s ease-in-out infinite;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
  bottom: -50px;
  left: -50px;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(30px, -20px); }
}

/* ── WAVE DIVIDERS ────────────────────────────────── */
.wave-divider {
  position: relative;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin-top: -2px;
}

.wave-divider svg {
  width: 100%;
  height: 80px;
  display: block;
}

.wave-1 { background: transparent; }
.wave-2 { background: var(--bg); }
.wave-3 { background: var(--bg-alt); }
.wave-4 { background: var(--bg); }
.wave-5 { background: var(--bg-alt); }

/* ── ABOUT ────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  margin-top: 48px;
}

.image-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
}

.image-frame img {
  width: 100%;
  border-radius: 20px;
  transition: transform 0.5s var(--ease);
}

.image-frame:hover img {
  transform: scale(1.03);
}

/* Animated glow border */
.image-glow {
  position: absolute;
  inset: -3px;
  border-radius: 24px;
  background: var(--gradient);
  z-index: -1;
  opacity: 0.5;
  filter: blur(8px);
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.3; filter: blur(8px); }
  50%      { opacity: 0.6; filter: blur(14px); }
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 1.02rem;
}

.about-stats {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── SERVICES ─────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  transition: all 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.35s;
  z-index: 0;
}

.service-card:hover {
  transform: translateY(-6px);
  border-color: rgba(110, 231, 183, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.service-card:hover::before {
  opacity: 0.04;
}

.service-card > * {
  position: relative;
  z-index: 1;
}

.service-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 1.6rem;
  margin-bottom: 20px;
}

.service-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── SKILLS ───────────────────────────────────────── */
.skills-container {
  max-width: 700px;
  margin: 48px auto 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: transform 0.3s var(--ease);
}

.skill-card:hover {
  transform: translateY(-6px);
}

.skill-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.skill-ring {
  position: relative;
  width: 110px;
  height: 110px;
  transition: filter 0.3s var(--ease);
}

/* Hover glow pulse on skill rings */
.skill-card:hover .skill-ring {
  filter: drop-shadow(0 0 12px var(--skill-color, var(--accent)));
}

.skill-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--skill-color, var(--accent));
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1.6s var(--ease);
}

.ring-fill.animate {
  stroke-dashoffset: calc(326.73 - (326.73 * var(--percent, 0) / 100));
}

.skill-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

/* ── PORTFOLIO ────────────────────────────────────── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.portfolio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.4s var(--ease);
  transform-style: preserve-3d;
  will-change: transform;
}

/* 3D tilt hover handled by JS — base reset */
.tilt-card {
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

.portfolio-card:hover {
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  border-color: rgba(110, 231, 183, 0.15);
}

.portfolio-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
}

.portfolio-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.portfolio-card:hover .portfolio-image img {
  transform: scale(1.08);
}

.portfolio-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.portfolio-card:hover .portfolio-overlay {
  opacity: 1;
}

.portfolio-info {
  padding: 20px 24px 24px;
}

.portfolio-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.portfolio-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Tech badges */
.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(110, 231, 183, 0.15);
  letter-spacing: 0.02em;
  transition: all 0.25s var(--ease);
}

.badge:hover {
  background: rgba(110, 231, 183, 0.2);
  transform: translateY(-1px);
}

/* ── CONTACT ──────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  margin-top: 48px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
}

.contact-form .btn {
  margin-top: 4px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.contact-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
}

.contact-info-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-detail {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 0.3s, transform 0.3s;
}

.contact-detail:hover {
  border-color: rgba(110, 231, 183, 0.2);
  transform: translateX(4px);
}

.contact-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.contact-value {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

/* ── FOOTER ───────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  background: var(--bg);
}

.footer-content {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  font-size: 1.4rem;
  font-weight: 900;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-socials {
  display: flex;
  gap: 12px;
}

.footer-socials a {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all 0.3s var(--ease);
}

.footer-socials a:hover {
  background: var(--accent-dim);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ── FLOATING ACTION BUTTONS ──────────────────────── */
.fab {
  position: fixed;
  z-index: 90;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 1.1rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: all 0.3s var(--ease);
}

.fab:hover {
  background: var(--accent-dim);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.fab-top {
  right: 24px;
  bottom: 24px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.fab-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-cv {
  right: 24px;
  bottom: 82px;
  gap: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  width: auto;
  padding: 0 16px;
}

/* ── SCROLL ANIMATIONS ────────────────────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.services-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.12s; }
.services-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.24s; }

.portfolio-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.12s; }
.portfolio-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.24s; }

.skills-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.skills-grid .animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }

/* ── SELECTION ────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2a2a3e;
}
