/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 12px;
  --radius-sm: 7px;
  --radius-full: 999px;
  --ease: cubic-bezier(.16,.84,.44,1);
  --ease-spring: cubic-bezier(.34,1.4,.64,1);
  --nav-h: 64px;
  --maxw: 1080px;
  --accent: #6366f1;
  --accent-dim: rgba(99,102,241,.15);
  --accent-glow: rgba(99,102,241,.3);
}

/* DARK — slate-tinted, not pure black */
:root, [data-theme="dark"] {
  --bg: #0d0e14;
  --bg2: #11121a;
  --surface: #161720;
  --surface-hover: #1c1d28;
  --border: #252636;
  --border-sub: #1a1b28;
  --fg: #e8e9f0;
  --muted: #9091a8;
  --faint: #52536a;
  --primary: var(--accent);
  --primary-fg: #fff;
  --shadow: 0 20px 60px -20px rgba(0,0,0,.7);
  --live: #34d399;
  --live-bg: rgba(52,211,153,.12);
  --progress: #f59e0b;
  --progress-bg: rgba(245,158,11,.12);
  --photo-bg: #1a1b28;
  --photo-circle: #252636;
  --photo-text: #52536a;
  /* hero gradient blob */
  --blob1: rgba(99,102,241,.18);
  --blob2: rgba(139,92,246,.12);
}

/* LIGHT — warm off-white, not pure white */
[data-theme="light"] {
  --bg: #f5f4f0;
  --bg2: #eeede8;
  --surface: #ffffff;
  --surface-hover: #f9f8f5;
  --border: #dddbd4;
  --border-sub: #e8e6e0;
  --fg: #1a1917;
  --muted: #5f5d57;
  --faint: #a8a69f;
  --primary: var(--accent);
  --primary-fg: #fff;
  --shadow: 0 20px 60px -25px rgba(30,28,20,.2);
  --live: #059669;
  --live-bg: rgba(5,150,105,.1);
  --progress: #b45309;
  --progress-bg: rgba(180,83,9,.1);
  --photo-bg: #e8e6e0;
  --photo-circle: #d5d3cc;
  --photo-text: #a8a69f;
  --blob1: rgba(99,102,241,.1);
  --blob2: rgba(139,92,246,.07);
  --accent: #4f46e5;
  --accent-dim: rgba(79,70,229,.12);
  --accent-glow: rgba(79,70,229,.2);
}

/* ============================================================
   RESET
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 20px); }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .35s var(--ease), color .35s var(--ease);
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ============================================================
   SHARED
   ============================================================ */
.eyebrow {
  font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.75rem, 3vw, 2.4rem); font-weight: 700; letter-spacing: -.025em;
  margin-bottom: 14px; line-height: 1.15;
}
.section-subtitle { color: var(--muted); max-width: 560px; margin-bottom: 44px; font-size: 1.02rem; }

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* stagger children inside a reveal parent */
.reveal:nth-child(2) { transition-delay: .08s; }
.reveal:nth-child(3) { transition-delay: .16s; }
.reveal:nth-child(4) { transition-delay: .24s; }

/* Hero animations */
.animate-hero-text {
  opacity: 0; transform: translateY(24px);
  animation: heroIn .8s var(--ease) .1s forwards;
}
.animate-hero-photo {
  opacity: 0; transform: translateY(18px) scale(.97);
  animation: heroIn .9s var(--ease) .3s forwards;
}
@keyframes heroIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-sub);
  transition: background .35s var(--ease);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.nav-mono {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.nav-name { font-size: .95rem; letter-spacing: -.01em; }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: .88rem; color: var(--muted); position: relative;
  transition: color .2s var(--ease);
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -3px;
  width: 0; height: 2px; background: var(--accent); border-radius: 2px;
  transition: width .25s var(--ease);
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

.nav-controls { display: flex; gap: 8px; align-items: center; }
.ctrl-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--fg); border-radius: var(--radius-sm);
  padding: 7px 11px; font-size: .8rem; font-weight: 500; font-family: inherit;
  cursor: pointer; min-width: 36px;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .15s var(--ease);
}
.ctrl-btn:hover { background: var(--surface-hover); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn { display: flex; align-items: center; justify-content: center; padding: 8px; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
.nav-burger { display: none; }
.nav-links-mobile { display: none; flex-direction: column; padding: 6px 24px 14px; border-top: 1px solid var(--border-sub); }
.nav-links-mobile a { padding: 12px 2px; color: var(--muted); font-size: .95rem; border-bottom: 1px solid var(--border-sub); transition: color .18s var(--ease); }
.nav-links-mobile a:last-child { border-bottom: none; }
.nav-links-mobile a:hover { color: var(--accent); }
.nav-links-mobile.open { display: flex; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: calc(92vh - var(--nav-h));
  display: flex; align-items: center;
  padding: 60px 24px 80px; position: relative; overflow: hidden;
}
/* ambient blobs */
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0;
}
.hero::before { width: 600px; height: 600px; top: -200px; left: -150px; background: var(--blob1); }
.hero::after  { width: 400px; height: 400px; bottom: -100px; right: -50px; background: var(--blob2); }

.hero-inner {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1fr 420px; gap: 60px; align-items: center;
  position: relative; z-index: 1;
}
.hero-eyebrow { margin-bottom: 18px; }
.hero-title {
  font-size: clamp(3rem, 7vw, 5.2rem);
  font-weight: 700; line-height: .98; letter-spacing: -.04em; margin-bottom: 22px;
}
.hero-title-accent { color: var(--accent); display: block; }
.hero-tagline { color: var(--muted); font-size: 1.1rem; max-width: 520px; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 44px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .92rem; font-weight: 500; font-family: inherit;
  padding: 12px 22px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease-spring), box-shadow .2s var(--ease), opacity .18s var(--ease), background .18s var(--ease);
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 18px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--accent-glow); }
.btn-outline { border-color: var(--border); color: var(--fg); }
.btn-outline:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero-socials { display: flex; gap: 10px; position: relative; z-index: 2; }
.hero-socials a {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted);
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease), transform .2s var(--ease-spring);
}
.hero-socials a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); transform: translateY(-3px); }
.hero-socials svg { width: 18px; height: 18px; }

/* Photo frame */
.hero-photo { display: flex; justify-content: center; }
.photo-frame {
  position: relative; width: 320px;
  border-radius: 24px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow), 0 0 0 1px var(--border-sub);
  transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease);
}
.photo-frame:hover { transform: translateY(-6px) rotate(.5deg); box-shadow: 0 32px 80px -20px rgba(0,0,0,.5), 0 0 0 1px var(--accent-dim); }
.photo-placeholder { width: 100%; height: auto; display: block; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-badge {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 7px 14px; font-size: .8rem; font-weight: 500; color: var(--muted);
  white-space: nowrap;
}
.photo-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 100px 24px; border-top: 1px solid var(--border-sub); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }

/* ABOUT */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: start; }
.about-copy p { color: var(--muted); margin-bottom: 18px; font-size: 1.04rem; }
.about-copy p:last-child { margin-bottom: 0; }

.skills-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.skill-group-label {
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 10px;
}

/* Hex honeycomb — iconos redondos estilo Apple Watch */
.hex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 10px;
  padding-top: 8px;
}
/* filas escalonadas: cada 3er item (col central de filas alternas) baja,
   y desplazamos la 2ª fila para crear el panal */
.hex-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
/* desplazamiento tipo colmena: items 4-6 (2ª fila) medio hueco a la derecha */
.hex-item:nth-child(4) { transform: translateX(50%); }
.hex-item:nth-child(5) { transform: translateX(50%); }
.hex-item:nth-child(6) { transform: translateX(50%); }
/* 3ª fila vuelve a la izquierda; 4ª fila desplazada de nuevo */
.hex-item:nth-child(10) { transform: translateX(50%); }

.hex-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  transition: transform .28s var(--ease-spring), border-color .2s var(--ease), box-shadow .28s var(--ease);
}
.hex-item svg {
  width: 40px;
  height: 40px;
  display: block;
}
.hex-item span {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .2s var(--ease);
}
.hex-item:hover .hex-circle {
  transform: translateY(-6px) scale(1.08);
  border-color: var(--accent);
  box-shadow: 0 12px 30px var(--accent-glow);
}
.hex-item:hover span { color: var(--fg); }
[data-theme="light"] .hex-circle {
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.10);
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: .8rem; font-weight: 500; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--bg); color: var(--muted);
  transition: border-color .18s var(--ease), color .18s var(--ease), transform .15s var(--ease-spring);
}
.tag:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.tags-sm .tag { font-size: .74rem; padding: 4px 10px; }

/* EXPERIENCE */
.exp-list { display: flex; flex-direction: column; }
.exp-item {
  display: grid; grid-template-columns: 190px 1fr; gap: 28px;
  padding: 32px 0; border-top: 1px solid var(--border-sub);
}
.exp-item:first-child { border-top: none; padding-top: 0; }
.exp-date { font-size: .85rem; color: var(--accent); font-weight: 500; padding-top: 3px; }
.exp-role { font-size: 1.18rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 5px; }
.exp-org { color: var(--muted); font-size: .95rem; margin-bottom: 12px; }
.exp-desc { color: var(--muted); margin-bottom: 14px; max-width: 600px; }

/* PROJECTS */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .28s var(--ease-spring), border-color .22s var(--ease), box-shadow .28s var(--ease);
}
.project-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 1px var(--accent-dim); }
.project-card:hover .project-card-head h3 { color: var(--accent); }

.project-img { height: 160px; overflow: hidden; flex-shrink: 0; position: relative; }
.project-img svg { width: 100%; height: 100%; }
.project-img img { width: 100%; height: 100%; object-fit: cover; }
.project-img::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, var(--surface) 100%);
  pointer-events: none;
}

.project-card-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-card-head { display: flex; align-items: center; justify-content: space-between; }
.project-card-head h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em; transition: color .18s var(--ease); }
.project-card-body > p { color: var(--muted); font-size: .92rem; flex-grow: 1; }

.status-pill { font-size: .67rem; font-weight: 600; padding: 4px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.status-live { background: var(--live-bg); color: var(--live); }
.status-progress { background: var(--progress-bg); color: var(--progress); }

.project-card-links a { font-size: .83rem; font-weight: 500; color: var(--fg); transition: color .18s var(--ease); }
.project-card-links a:hover { color: var(--accent); }
.link-disabled { font-size: .83rem; color: var(--faint); }

/* CERTIFICATES */
.empty-state {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 56px 32px; text-align: center; max-width: 560px; margin: 0 auto;
}
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); background: var(--bg);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
.empty-desc { color: var(--muted); font-size: .94rem; max-width: 400px; margin: 0 auto; }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.contact-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 22px; display: flex; align-items: center; gap: 16px;
  position: relative; z-index: 1;
  transition: transform .22s var(--ease-spring), border-color .2s var(--ease), box-shadow .22s var(--ease);
}
.contact-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 30px var(--accent-glow); }
.contact-card svg { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; }
.contact-card-label { font-size: .74rem; font-weight: 600; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }
.contact-card-value { font-size: .9rem; word-break: break-word; }

/* FOOTER */
.footer { padding: 32px 24px 48px; text-align: center; font-size: .84rem; color: var(--faint); border-top: 1px solid var(--border-sub); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .hero-photo { order: -1; }
  .photo-frame { width: 260px; margin: 0 auto; }
  .hero-title { font-size: clamp(2.6rem, 8vw, 3.5rem); }
  .nav-links, .nav-name { display: none; }
  .nav-burger { display: flex; }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .tech-grid { columns: 3; }
  .project-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .exp-item { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 520px) {
  .section { padding: 72px 20px; }
  .hero { padding: 40px 20px 68px; }
}

/* ============================================================
   CONTACT — formulario + canales
   ============================================================ */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

/* Formulario */
.contact-form-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.form-field:last-of-type { margin-bottom: 20px; }
.form-field label {
  font-size: .82rem; font-weight: 600; color: var(--muted);
  letter-spacing: .01em;
}
.form-field input,
.form-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: inherit;
  font-size: .95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  resize: none;
  width: 100%;
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--faint); }
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-field input:invalid:not(:placeholder-shown),
.form-field textarea:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}

.btn-submit {
  width: 100%;
  justify-content: center;
  gap: 9px;
}
.btn-submit .btn-icon { width: 16px; height: 16px; }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

.form-success {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--live-bg);
  color: var(--live);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  text-align: center;
}
.form-error {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(239,68,68,.12);
  color: #f87171;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  text-align: center;
}
.form-success.show,
.form-error.show { display: block; }

/* Canales laterales */
.contact-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-side .contact-card { flex-direction: row; }

@media (max-width: 820px) {
  .contact-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .contact-side { flex-direction: column; }
}