/* ═══════════════════════════════════════════════════════════
   CV · Equipo — Neumorfismo (Soft UI)
   Fondo monocromático · relieves con sombras suaves dobles
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Color base — todo comparte el mismo tono para que el relieve funcione */
  --bg:          #e4e9f1;
  --light:       #ffffff;
  --shadow:      #b3bdd0;
  --text:        #45505f;
  --text-strong: #2b3340;
  --text-soft:   #858ea0;
  --accent:      #4a5fd6;
  --accent-soft: #6f7fe0;

  /* Sombras neumórficas */
  --nm-raised:    -6px -6px 14px var(--light), 6px 6px 14px var(--shadow);
  --nm-raised-lg: -9px -9px 22px var(--light), 11px 11px 26px var(--shadow);
  --nm-raised-sm: -3px -3px 7px var(--light), 3px 3px 7px var(--shadow);
  --nm-pressed:     inset -4px -4px 9px var(--light), inset 5px 5px 11px var(--shadow);
  --nm-pressed-sm:  inset -2px -2px 5px var(--light), inset 3px 3px 6px var(--shadow);

  /* Tipografía */
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Hanken Grotesk", -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", "Courier New", monospace;

  /* Métrica */
  --measure: 1180px;
  --gap: clamp(1.6rem, 3.5vw, 3rem);
  --tabbar-h: 60px;
  --radius: 26px;
  --radius-sm: 16px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

/* ═══════ BARRA DE PESTAÑAS ═══════ */
.tabbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  box-shadow: 0 6px 16px -8px var(--shadow);
}
.tabbar__inner {
  max-width: var(--measure);
  margin: 0 auto;
  height: var(--tabbar-h);
  padding: 0 clamp(1rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.tabbar__brand {
  display: flex;
  align-items: center;
}
.tabbar__logo {
  height: 32px;
  width: auto;
  display: block;
  /* El fondo blanco del logo se funde con el gris neumórfico */
  mix-blend-mode: multiply;
}
/* ── Lienzo del documento ── */
.cv { display: none; }
.cv.is-active { display: block; animation: fade-in 0.5s var(--ease); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Lienzo de página ── */
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.6rem, 3.5vw, 3rem) clamp(1rem, 4vw, 3rem) 3rem;
  position: relative;
}

/* ═══════ ÍNDICE DE NAVEGACIÓN ═══════ */
.index {
  position: fixed;
  left: clamp(0.5rem, 1.6vw, 1.4rem);
  top: calc(50% + var(--tabbar-h) / 2);
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.index__item {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-soft);
  position: relative;
  transition: color 0.25s var(--ease), box-shadow 0.3s var(--ease);
}
.index__item::after {
  content: attr(data-label);
  position: absolute;
  left: 132%;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  font-family: var(--font-body);
  font-size: 0.74rem;
  white-space: nowrap;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.index__item:hover { color: var(--accent); }
.index__item:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.index__item.is-active {
  color: var(--accent);
  box-shadow: var(--nm-pressed-sm);
}

/* ═══════ ENCABEZADO ═══════ */
.masthead {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--nm-raised);
  padding: clamp(1.6rem, 4vw, 3rem);
  margin-bottom: var(--gap);
}
.masthead__line {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(1rem, 3vw, 2rem);
}
.kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.masthead__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.7rem, 8vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  text-shadow: -1px -1px 1px var(--light), 1px 1px 2px var(--shadow);
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 144;
}
.display__word { display: block; }
.display__word--alt {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  text-shadow: -1px -1px 1px var(--light);
  margin-left: clamp(0.6rem, 4vw, 2.6rem);
}

.masthead__foot {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.role {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.9vw, 1.3rem);
  font-weight: 400;
  color: var(--text-strong);
}
.role__mark { color: var(--accent); font-style: italic; }
.role__sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-top: -0.2rem;
}

.status {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg);
  box-shadow: var(--nm-pressed-sm);
  border-radius: 100px;
  padding: 0.45rem 0.95rem;
  width: fit-content;
}
.status__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(74, 95, 214, 0.5);
  animation: pulse 2.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 95, 214, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(74, 95, 214, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 95, 214, 0); }
}

/* ── Avatar neumórfico ── */
.avatar {
  flex-shrink: 0;
  width: clamp(110px, 15vw, 160px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-raised-lg);
  display: grid;
  place-items: center;
}
.avatar__inner {
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-pressed);
  display: grid;
  place-items: center;
  /* Para usar foto: background-image: url('foto.jpg'); background-size: cover; */
  background-size: cover;
  background-position: center;
}
.avatar__initials {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--accent);
}

/* ═══════ REJILLA PRINCIPAL ═══════ */
.layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--gap);
  align-items: start;
}
.content { display: flex; flex-direction: column; gap: var(--gap); }

/* ═══════ SECCIONES (tarjetas en relieve) ═══════ */
.section {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--nm-raised);
  padding: clamp(1.4rem, 3vw, 2.4rem);
  scroll-margin-top: calc(var(--tabbar-h) + 1.2rem);
}
.section__head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.section__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--bg);
  box-shadow: var(--nm-pressed-sm);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 50;
}

/* ── Textos ── */
.lede {
  font-family: var(--font-display);
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  font-weight: 300;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 0.9rem;
}
.lede strong {
  font-weight: 600;
  font-style: italic;
  color: var(--accent);
}
.body-text {
  color: var(--text-soft);
  max-width: 62ch;
  font-size: 0.94rem;
}

/* ── Entradas (experiencia / educación) — pozos hundidos ── */
.section__body { display: flex; flex-direction: column; gap: 1rem; }

.entry {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.4rem;
  padding: 1.3rem 1.4rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--nm-pressed-sm);
  transition: box-shadow 0.35s var(--ease);
}
.entry:hover { box-shadow: var(--nm-pressed); }
.entry:hover .entry__role { color: var(--accent); }

.entry__meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.3rem;
}
.entry__years {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-strong);
  font-weight: 500;
}
.entry__place {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-soft);
}
.entry__role {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 500;
  color: var(--text-strong);
  transition: color 0.3s var(--ease);
}
.entry__org {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 0.5rem;
}
.entry__list {
  list-style: none;
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.entry__list li {
  position: relative;
  padding-left: 1.3rem;
  color: var(--text-soft);
  font-size: 0.89rem;
}
.entry__list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── Proyectos — mini tarjetas en relieve ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem;
}
.project {
  border-radius: var(--radius-sm);
  padding: 1.3rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--nm-raised-sm);
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}
.project:hover {
  box-shadow: var(--nm-pressed-sm);
  transform: translateY(-2px);
}
.project:hover .project__name { color: var(--accent); }
.project__index {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-soft);
}
.project__name {
  font-family: var(--font-display);
  font-size: 1.13rem;
  font-weight: 500;
  color: var(--text-strong);
  transition: color 0.3s var(--ease);
}
.project__stack {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--accent);
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ── Habilidades ── */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem 2rem;
}
.skill-group__title {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: 0.8rem;
}
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.tags li {
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  box-shadow: var(--nm-raised-sm);
  transition: box-shadow 0.25s var(--ease), color 0.25s var(--ease);
}
.tags li:hover {
  box-shadow: var(--nm-pressed-sm);
  color: var(--accent);
}
/* Habilidad destacada — píldora en color de acento */
.tags li.is-key {
  background: var(--accent);
  color: #fff;
}
.tags li.is-key:hover {
  box-shadow: var(--nm-pressed-sm);
  color: #fff;
}

/* ═══════ BARRA LATERAL ═══════ */
.rail__sticky {
  position: sticky;
  top: calc(var(--tabbar-h) + 1.2rem);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.rail__block {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--nm-raised);
  padding: 1.5rem 1.5rem;
}
.rail__label {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin-bottom: 0.9rem;
}
.contact {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.contact a {
  text-decoration: none;
  transition: color 0.25s var(--ease);
}
.contact a:hover { color: var(--accent); }

.rail__note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-soft);
}
.rail__note--plain {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}
/* Lista con marca de flecha (bloque "El Equipo") */
.contact--mark li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--text);
}
.contact--mark li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.rail__print {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent);
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  box-shadow: var(--nm-raised);
  transition: box-shadow 0.3s var(--ease), color 0.25s var(--ease);
}
.rail__print:hover { color: var(--text); }
.rail__print:active { box-shadow: var(--nm-pressed); }

/* ═══════ PIE ═══════ */
.colophon {
  margin-top: var(--gap);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--nm-pressed-sm);
  padding: 1.1rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--text-soft);
}
.colophon__mark { color: var(--accent); }

/* ═══════ ANIMACIONES DE REVELADO ═══════ */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: translateY(0); }

/* ═══════ RESPONSIVO ═══════ */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .rail__sticky { position: static; }
  .index { display: none; }
  .entry { grid-template-columns: 1fr; gap: 0.5rem; }
  .entry__meta { flex-direction: row; gap: 0.8rem; }
  .display__word--alt { margin-left: 0; }
  .masthead__main { flex-direction: column-reverse; align-items: flex-start; }
  /* La barra de marca se ajusta en pantallas pequeñas */
  .tabbar__inner { flex-wrap: wrap; height: auto; min-height: var(--tabbar-h); padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .tabbar__logo { height: 28px; }
}

/* ═══════ IMPRESIÓN / PDF (se aplana el relieve) ═══════ */
@media print {
  :root { --bg: #fff; }
  body { font-size: 11pt; }
  .index, .tabbar, .rail__print, .status { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .cv { display: none !important; }
  .cv.is-active { display: block !important; }
  .page { max-width: 100%; padding: 0; }
  .masthead, .section, .rail__block, .colophon, .entry, .project,
  .tags li, .avatar, .avatar__inner, .section__num {
    box-shadow: none !important;
    border: 1px solid #d4d8e0 !important;
  }
  .entry, .project { break-inside: avoid; }
  .section { break-inside: avoid; }
  .display { font-size: 3.2rem; text-shadow: none; }
  a { text-decoration: none; }
}

/* Accesibilidad: respeta reduce-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
