/* adrianvalenzuela.com — sin frameworks ni plantillas. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0D0F12;
  --surface: #121519;
  --surface-hover: #171B21;
  --band: #101317;
  --line: #1D2127;
  --border: #23272F;
  --border-strong: #2C313A;
  --text: #E8EAED;
  --muted: #B4BAC4;
  --subtle: #9AA1AD;
  --faint: #8A919C;
  --accent: #C6F36B;
  --accent-soft: #E2FBA8;
  --on-accent: #0D0F12;
  --error: #FF9B8A;

  --sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* main.js los actualiza con el ratón. */
  --spot-x: -1000px;
  --spot-y: -1000px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Luz que sigue al ratón, por encima del fondo y por debajo del contenido. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--spot-x) var(--spot-y), rgba(198, 243, 107, .075), transparent 70%);
}

body > * { position: relative; z-index: 1; }

img { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 16px; color: var(--on-accent); }

.grid-bg {
  position: absolute;
  inset: 0 0 auto 0;
  height: 980px;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(#000 40%, transparent);
  mask-image: linear-gradient(#000 40%, transparent);
}

/* Cabecera */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.brand:hover { color: var(--text); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.site-nav { display: flex; flex-wrap: wrap; gap: 4px; font-family: var(--mono); font-size: 14px; }

.nav-link {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--subtle);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
.nav-link:hover, .nav-link[aria-current='true'] { color: var(--text); background: #1A1E24; }

.nav-cta { padding: 10px 14px; background: var(--accent); color: var(--on-accent); }
.nav-cta:hover, .nav-cta[aria-current='true'] { background: var(--accent-soft); color: var(--on-accent); }

/* Botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background-color .25s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); font-weight: 500; }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: progress; }

/* Portada */

.hero { padding-top: clamp(48px, 9vw, 120px); padding-bottom: 88px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s ease-in-out infinite; }

.hero-title {
  font-size: clamp(42px, 7.4vw, 108px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.04em;
}
.accent { color: var(--accent); }

/* La foto, dentro de una píldora a la altura del texto, con la cabeza asomando
   por arriba. Al pasar el ratón, cambia al memoji. */
.pill {
  position: relative;
  display: inline-block;
  width: 1.55em;
  height: .82em;
  vertical-align: -.06em;
  border-radius: 999px;
  background: var(--accent);
  transition: background-color .35s ease;
}
.pill-clip {
  position: absolute;
  inset: 0;
  clip-path: inset(-.7em 0 0 0 round 0 0 .41em .41em);
}
.pill-face, .pill-memoji {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  transition: opacity .35s ease, transform .45s var(--ease);
}
.pill-face { height: 1.32em; }
.pill-memoji { height: 1.3em; opacity: 0; transform: translate(-50%, 35%); }

.hero-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 40px 64px;
  margin-top: 56px;
}
.hero-intro { flex: 1 1 420px; min-width: 0; }
.lead { max-width: 560px; font-size: 20px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* Base de 460 px: la línea más larga (stack) cabe entera en escritorio. En
   pantallas estrechas pasa debajo y se encoge al ancho disponible. */
.code-card {
  flex: 0 1 460px;
  max-width: 460px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8);
  transform: perspective(1200px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform .5s var(--ease);
}
.code-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.code-dots { display: flex; gap: 8px; }
.code-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.code {
  margin: 0;
  padding: 14px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}
.code-line { display: block; padding: 0 20px; transition: background-color .2s ease; }
.code-indent { padding-left: 40px; }
.tok-kw { color: #C792EA; }
.tok-str { color: var(--accent); }
.tok-bool { color: #F78C6C; }

.caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -.15em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

/* Franja de tecnologías */

.marquee {
  overflow: hidden;
  padding: 18px 0;
  background: var(--band);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.marquee-track { display: flex; width: max-content; animation: marquee 34s linear infinite; }
.marquee-list {
  display: flex;
  gap: 12px;
  padding-right: 12px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.marquee-list li { padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; }
.marquee-list .is-accent { border-color: var(--accent); color: var(--accent); }

/* Secciones */

.section { padding-bottom: 112px; }
#capacidades { padding-top: 112px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}
.section-head p { max-width: 380px; color: var(--muted); }

.section h2, .contact h2 {
  font-size: clamp(36px, 4.4vw, 56px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.03em;
}
.split .section h2 { margin-bottom: 36px; }

.eyebrow {
  display: block;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--accent);
}

.cards { display: grid; gap: 16px; }
.cards-skills { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cards-projects { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }

.card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: transform .3s ease, border-color .3s ease, background-color .3s ease;
}
.card h3 { margin-bottom: 8px; font-size: 22px; font-weight: 600; }
.card p { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.chips li { padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 6px; transition: border-color .3s ease, color .3s ease; }

.project { display: flex; flex-direction: column; gap: 14px; padding: 32px; }
.project h3 { margin: 0; font-size: 34px; letter-spacing: -.02em; line-height: 1.15; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-num { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.tag {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.tag-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.project .stack { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.project-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: auto; padding-top: 8px; }
.project-links a { font-weight: 500; text-decoration: none; }
.arrow { display: inline-block; transition: transform .3s ease; }

.split { display: flex; flex-wrap: wrap; gap: 0 64px; }
.split > #trayectoria { flex: 999 1 520px; min-width: 0; }
.split > #blog { flex: 1 1 340px; min-width: 0; }

.timeline li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 32px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 1px solid var(--border); }
.timeline .when { flex: 0 0 140px; font-family: var(--mono); font-size: 14px; color: var(--subtle); }
.timeline .when.is-accent { color: var(--accent); }
.timeline div { flex: 1 1 260px; }
.timeline h3 { font-size: 20px; font-weight: 600; }
.timeline p { margin-top: 2px; color: var(--muted); }

.blog-empty {
  position: relative;
  overflow: hidden;
  padding: 36px 36px 156px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  font-family: var(--mono);
}
.blog-prompt { font-size: 15px; color: var(--faint); }
.blog-title { margin-top: 10px; font-family: var(--sans); font-size: 22px; font-weight: 500; }
.blog-status { margin-top: 6px; font-size: 14px; color: var(--subtle); }
.blog-memoji {
  position: absolute;
  right: 24px;
  bottom: -14px;
  width: 136px;
  height: auto;
  transition: transform .45s var(--ease);
}

/* Contacto */

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 48px 80px;
  padding: clamp(28px, 6vw, 72px);
  background: var(--surface) radial-gradient(520px circle at 100% 0%, rgba(198, 243, 107, .10), transparent 70%);
  border: 1px solid var(--border);
  border-radius: 24px;
}
.contact h2 { margin-bottom: 20px; font-size: clamp(38px, 5vw, 64px); letter-spacing: -.035em; }
.contact-intro { flex: 1 1 280px; }
.contact-intro > p { margin-bottom: 32px; color: var(--muted); }
.contact-links { display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 14px; }
.contact-links a { overflow-wrap: anywhere; }

.contact-form { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.field-row { display: flex; flex-wrap: wrap; gap: 20px; }
.field-row .field { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-family: var(--mono); font-size: 13px; color: var(--subtle); }

.field input[type='text'], .field input[type='email'], .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  transition: border-color .2s ease;
}
.field textarea { padding: 12px 14px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field [aria-invalid='true'] { border-color: var(--error); }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }

.field-error { min-height: 0; font-size: 13px; color: var(--error); }
.field-error:empty { display: none; }

.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.turnstile { min-height: 65px; max-width: 100%; }
.form-status { font-size: 15px; }
.form-status:empty { display: none; }
.form-status.is-ok { color: var(--accent); }
.form-status.is-error { color: var(--error); }

/* Pie */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 40px;
  padding-bottom: 56px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}
.site-footer a { color: var(--faint); }

/* Página de privacidad */

.legal { max-width: 760px; padding-top: 48px; padding-bottom: 96px; }
.legal h1 { margin-bottom: 12px; font-size: clamp(36px, 5vw, 56px); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; }
.legal h2 { margin: 40px 0 12px; font-size: 22px; font-weight: 600; }
.legal p, .legal li { color: var(--muted); }
.legal p + p { margin-top: 12px; }
.legal ul { margin-top: 8px; padding-left: 20px; list-style: disc; }
.legal li + li { margin-top: 6px; }
.legal .updated { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.back-link { display: inline-block; margin-bottom: 32px; font-family: var(--mono); font-size: 14px; text-decoration: none; }

/* Aparición al hacer scroll: solo con JS (main.js añade .js a <html>). */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Efectos al pasar el ratón: solo con ratón de verdad, no en pantallas táctiles. */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
  .btn-primary:hover { box-shadow: 0 12px 30px -14px rgba(198, 243, 107, .55); }

  .pill:hover { background: var(--accent-soft); }
  .pill:hover .pill-face { opacity: 0; transform: translate(-50%, 35%); }
  .pill:hover .pill-memoji { opacity: 1; transform: translateX(-50%); }

  .code-line:hover { background: #1D2229; }

  .card:hover { transform: translateY(-4px); border-color: var(--accent); background: var(--surface-hover); }
  .card:hover .chips li { border-color: #3E4652; color: var(--text); }
  .project:hover .arrow, .project-links a:hover .arrow { transform: translate(4px, -4px); }

  .marquee:hover .marquee-track { animation-play-state: paused; }
  .blog-empty:hover .blog-memoji { transform: translateY(-10px); }

  .field input:hover:not(:focus), .field textarea:hover:not(:focus) { border-color: #4A515C; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 243, 107, .6); }
  50% { box-shadow: 0 0 0 6px rgba(198, 243, 107, 0); }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header { flex-direction: column; align-items: flex-start; }
  .site-nav { margin-left: -12px; }
  .hero { padding-bottom: 64px; }
  .hero-body { margin-top: 40px; }
  .badge { font-size: 12px; }
  .lead { font-size: 18px; }
  .code { font-size: 12px; }
  .code-line { padding: 0 14px; }
  .code-indent { padding-left: 28px; }
  #capacidades { padding-top: 80px; }
  .section { padding-bottom: 80px; }
  .project { padding: 24px; }
  .project h3 { font-size: 28px; }
  .card { padding: 24px; }
  .form-foot .btn { width: 100%; }
}

/* Móviles de 360 px: la línea stack del código no cabe a 12 px. */
@media (max-width: 379px) {
  .code { font-size: 11px; }
  .code-line { padding: 0 10px; }
  .code-indent { padding-left: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .marquee-track { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
}
