/* =========================================================
   José G. · Landing page
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #0e1726;
  --bg-2: #111c2e;
  --panel: #142238;
  --ink: #e6edf7;
  --title: #f3f6fb;
  --text: #a9b7cc;
  --muted: #7d8da6;
  --line: #22324d;
  --accent: #5eead4;
  --accent-d: #2dd4bf;
  --accent-soft: rgba(94, 234, 212, .10);
  --accent-line: rgba(94, 234, 212, .30);
  --card: rgba(20, 34, 56, .5);
  --card-hover: rgba(20, 34, 56, .55);

  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --radius: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 600px at 15% -10%, rgba(37, 99, 235, .16), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, rgba(45, 212, 191, .06), transparent 70%);
  background-attachment: fixed;
}

/* Halo que sigue al cursor (lo posiciona main.js) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(600px circle at var(--mx, -999px) var(--my, -999px), rgba(29, 78, 216, .12), transparent 80%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: var(--accent); color: #06261f; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #06261f;
  font-weight: 600;
  transition: top .2s;
}
.skip:focus { top: 16px; }

/* ---------- Layout ---------- */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 80px;
}

/* =========================================================
   Columna izquierda (fija)
   ========================================================= */
.left {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 72px 0 48px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
.left::-webkit-scrollbar { display: none; }

.id { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 26px; }

/* Foto de perfil: anillo degradado + separación del fondo */
.avatar {
  width: 104px;
  height: 104px;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #2563eb);
  box-shadow: 0 10px 30px -10px rgba(94, 234, 212, .35);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--bg);
  background: var(--panel);
}
.avatar:hover { transform: scale(1.04); box-shadow: 0 14px 36px -10px rgba(94, 234, 212, .5); }

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-line);
}

.avail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.avail i {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.avail i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: ping 1.8s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(2.8); opacity: 0; }
}

h1 {
  color: var(--title);
  font-size: clamp(32px, 5vw + 12px, 42px);
  line-height: 1.1;
  overflow-wrap: break-word;
  letter-spacing: -.025em;
  font-weight: 700;
}

.role { color: var(--ink); font-size: 19px; font-weight: 500; margin-top: 8px; }
.typed { color: var(--accent); }
.typed.caret::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -3px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.pitch { margin-top: 16px; max-width: 360px; }

.ctas { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  max-width: 100%;
  transition: border-color .2s, background-color .2s, transform .2s var(--ease);
}
.btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #06261f; }
.btn.pri:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.copied { border-color: var(--accent-line); color: var(--accent); }

/* ---------- Índice ---------- */
.toc { list-style: none; margin-top: 52px; }
.toc a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  transition: color .2s;
}
.toc a::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--muted);
  transition: width .25s var(--ease), background-color .25s;
}
.toc a:hover, .toc a.on { color: var(--title); }
.toc a:hover::before { width: 42px; background: var(--title); }
.toc a.on::before { width: 56px; background: var(--accent); }

/* ---------- Redes ---------- */
.socials { margin-top: auto; display: flex; gap: 10px; }
.socials a {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.socials a:hover { color: var(--accent); border-color: rgba(94, 234, 212, .4); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

/* =========================================================
   Columna derecha
   ========================================================= */
.right { padding: 72px 0 40px; min-width: 0; overflow-wrap: break-word; }

section { margin-bottom: 96px; scroll-margin-top: 60px; }

.sec-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
  color: var(--title);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.sec-title span { color: var(--accent); font-family: var(--mono); font-weight: 500; }
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.right p { margin-bottom: 16px; }
.right p b { color: var(--ink); font-weight: 600; }

/* ---------- Métricas ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 28px; }
.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color .2s;
}
.metric:hover { border-color: var(--accent-line); }
.metric b {
  display: block;
  color: var(--title);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.metric small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.4; }

/* ---------- Tarjetas (experiencia y proyectos) ---------- */
.job, .project {
  display: grid;
  gap: 24px;
  padding: 22px;
  margin: 0 -22px 8px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background-color .2s, border-color .2s;
}
.job { grid-template-columns: 130px 1fr; }
.project { grid-template-columns: 200px 1fr; margin-bottom: 10px; }
.job:hover, .project:hover { background: var(--card-hover); border-color: var(--line); }

/* Atenúa las tarjetas hermanas al pasar el mouse sobre una */
@media (hover: hover) {
  #experiencia:has(.job:hover) .job:not(:hover),
  #proyectos:has(.project:hover) .project:not(:hover) { opacity: .5; }
}

.when {
  padding-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.job h3, .project h3 { color: var(--title); font-size: 17px; font-weight: 600; }
.job h3 small { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; font-weight: 500; }
.job ul { margin: 10px 0 14px 18px; font-size: 15px; }
.job li { margin-bottom: 5px; }
.job li::marker { color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--title);
  font-weight: 600;
  transition: color .2s;
}
.link span { transition: transform .2s var(--ease); }
.link:hover { color: var(--accent); }
.link:hover span { transform: translate(2px, -2px); }

/* ---------- Proyectos ---------- */
.project h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.project h3 .tag {
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.project p { font-size: 15px; margin: 8px 0 10px; }

.result { display: flex; gap: 8px; margin-bottom: 12px; color: var(--ink); font-size: 14px; }
.result::before { content: "→"; color: var(--accent); font-weight: 700; }

.preview {
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #fbfaf5;
  display: flex;
  flex-direction: column;
  transition: transform .3s var(--ease), border-color .3s;
}
.project:hover .preview { transform: scale(1.03); border-color: var(--muted); }

.preview .pbar { height: 16px; background: #1d7f5b; }
.preview .pgrid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; }
.preview .pgrid div { border-radius: 4px; }
.pgrid .c-green  { background: #e9f6ef; }
.pgrid .c-blue   { background: #eaf2fd; }
.pgrid .c-yellow { background: #fff6dd; }
.pgrid .c-purple { background: #f1ecfd; }
.pgrid .c-card   { grid-column: span 2; background: #fff; border: 1px solid #eee; }

/* Vista previa: sitio turístico */
.preview-web { background: #f6f3ea; }
.preview-web .wbar { display: flex; gap: 3px; padding: 4px 6px; background: #e7e2d4; }
.preview-web .wbar i { width: 5px; height: 5px; border-radius: 50%; background: #c9c1ac; }
.preview-web .whero {
  flex: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  background:
    linear-gradient(180deg, transparent 55%, rgba(21, 83, 45, .55)),
    linear-gradient(160deg, #7cc4e4 0%, #a7dcc0 55%, #3f8f5a 100%);
}
.preview-web .wtitle { width: 58%; height: 7px; border-radius: 3px; background: #fff; }
.preview-web .wsub { width: 40%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .75); }
.preview-web .wbtn { width: 22%; height: 7px; margin-top: 2px; border-radius: 4px; background: #f59e0b; }
.preview-web .wcards { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 5px 6px 6px; }
.preview-web .wcards div { border-radius: 3px; background: #fff; border: 1px solid #e7e2d4; }
.preview-web .wcards div:first-child { background: linear-gradient(#cfe8d6 45%, #fff 45%); }
.preview-web .wcards div:nth-child(2) { background: linear-gradient(#d6e9f5 45%, #fff 45%); }
.preview-web .wcards div:nth-child(3) { background: linear-gradient(#f3e6c6 45%, #fff 45%); }

/* Vista previa: invitación de boda */
.preview-invite {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #fbeee6, #efe0d0 70%);
}
.preview-invite .icard {
  width: 56%;
  height: 84%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  background: #fffdf8;
  border: 1px solid #e6d3b3;
  box-shadow: 0 4px 12px rgba(120, 90, 50, .15), inset 0 0 0 3px #fffdf8, inset 0 0 0 4px #ecdcc0;
}
.preview-invite .iheart { color: #c9a26b; font-size: 11px; line-height: 1; }
.preview-invite .iname { width: 64%; height: 6px; border-radius: 3px; background: #8a6a4a; }
.preview-invite .iline { width: 42%; height: 3px; border-radius: 2px; background: #d8c3a2; }
.preview-invite .icount { display: flex; gap: 3px; margin-top: 2px; }
.preview-invite .icount i { width: 9px; height: 9px; border-radius: 2px; background: #f2e6d3; border: 1px solid #e0cba8; }
.preview-invite .ibtn { width: 38%; height: 6px; margin-top: 2px; border-radius: 4px; background: #c9a26b; }

/* ---------- Habilidades ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.skillbox {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color .2s;
}
.skillbox:hover { border-color: var(--accent-line); }
.skillbox h4 { margin-bottom: 10px; color: var(--title); font-size: 14px; font-weight: 600; }
.skillbox .chips span {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 500;
  transition: border-color .2s, color .2s;
}
.skillbox .chips span:hover { border-color: var(--accent-line); color: var(--accent); }

/* ---------- Formación ---------- */
.edu-list { margin-top: 26px; }
.edu {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.edu:last-child { border-bottom: none; }
.edu b { color: var(--title); font-weight: 600; }
.edu small { display: block; color: var(--muted); }
.edu > span { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Contacto ---------- */
.contact {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(20, 34, 56, .9), rgba(14, 23, 38, .9));
}
.contact .sec-title { margin-bottom: 18px; }
.contact h3 { margin-bottom: 8px; color: var(--title); font-size: 26px; letter-spacing: -.01em; line-height: 1.25; }
.contact .row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

footer { padding: 10px 0 30px; font-size: 13px; color: var(--muted); }

/* ---------- Volver arriba ---------- */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(20, 34, 56, .9);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s, transform .25s var(--ease), visibility .25s, border-color .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--accent-line); color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  background: #0b1a24;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  width: max-content;
  max-width: calc(100% - 32px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Animaciones de aparición ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Barra superior móvil ---------- */
.topbar { display: none; }

/* =========================================================
   Responsive
   ========================================================= */

/* Escritorio mediano / notebooks */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 340px 1fr; gap: 56px; padding: 0 32px; }
  .project { grid-template-columns: 170px 1fr; gap: 20px; }
  .job { grid-template-columns: 110px 1fr; gap: 20px; }
}

/* Escritorio con poca altura: compacta la columna fija */
@media (min-width: 961px) and (max-height: 860px) {
  .left { padding: 40px 0 28px; }
  .avatar { width: 84px; height: 84px; }
  .id { margin-bottom: 18px; }
  .pitch { margin-top: 12px; }
  .ctas { margin-top: 18px; }
  .toc { margin-top: 28px; }
  .toc a { padding: 6px 0; }
  .socials { padding-top: 20px; }
}
@media (min-width: 961px) and (max-height: 680px) {
  .toc { display: none; }
}
@media (max-width: 960px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(14, 23, 38, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
  }
  .topbar.scrolled { border-bottom-color: var(--line); }
  .topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--title); font-weight: 600; }
  .topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .avatar-sm { flex-shrink: 0; }

  .menu-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
  }
  .menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .25s var(--ease), opacity .2s;
  }
  .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 8px 24px 16px;
    background: rgba(14, 23, 38, .97);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  }
  .mobile-nav.open { opacity: 1; visibility: visible; transform: none; }
  .mobile-nav a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--muted);
  }
  .mobile-nav a:last-child { border-bottom: none; }
  .mobile-nav a.on, .mobile-nav a:hover { color: var(--accent); }

  .layout { grid-template-columns: 1fr; gap: 0; padding: 0 24px; }
  .left { position: static; height: auto; overflow: visible; padding: 40px 0 24px; }
  .pitch { max-width: 560px; }
  .toc { display: none; }
  .socials { margin-top: 28px; }
  .right { padding-top: 24px; }
  section { margin-bottom: 72px; scroll-margin-top: 80px; }
  .project { grid-template-columns: 200px 1fr; }
  .job { grid-template-columns: 130px 1fr; }
}

/* Celulares grandes / tablets en vertical angostas */
@media (max-width: 640px) {
  .job, .project { grid-template-columns: 1fr; gap: 10px; }
  .project .preview { max-width: 320px; }
  .avatar { width: 88px; height: 88px; }
}

/* Métricas: una por fila cuando no entran las tres */
@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
}

/* Celulares chicos: foto y badge en la misma fila; el rol reserva 2 líneas
   para que el efecto de tipeo no mueva el contenido de abajo */
@media (max-width: 420px) {
  .avatar { width: 72px; height: 72px; }
  .role { min-height: calc(2 * 1.4em); line-height: 1.4; }
}

@media (max-width: 480px) {
  .layout { padding: 0 16px; }
  .topbar { padding: 12px 16px; }
  .mobile-nav { padding: 8px 16px 16px; }
  .job, .project { margin: 0 -14px 8px; padding: 18px 14px; }
  .contact { padding: 24px 20px; }
  .contact h3 { font-size: 22px; }
  .contact .row .btn { flex: 1 1 100%; justify-content: center; }
  .edu { flex-direction: column; gap: 2px; }
  .to-top { right: 16px; bottom: 16px; }
}

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