/* ─────────────────────────────────────────────
   PALETTE DEFINITIONS
   ───────────────────────────────────────────── */

/* Palette A — Ivory & Violet */
.palette-a {
  --bg-deep:         #ffffff;
  --bg-card:         #fdfbff;
  --bg-section:      #f3ecfa;
  --accent-1:        #5e2d96;
  --accent-2:        #8b5cc4;
  --text-main:       #e29ed3;
  --text-muted:      #5a4f74;
  --highlight:       #9a6010;
  --border:          rgba(94, 45, 150, 0.13);
  --glow:            rgba(94, 45, 150, 0.12);
  --shadow:          0 2px 20px rgba(94,45,150,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --page-gradient:   linear-gradient(155deg, #ffffff 0%, #f2ebff 55%, #fff8ef 100%);
  --hero-bg:         #0d0b14;
  --hero-text:       #e8e0f5;
  --hero-muted:      #9b92b8;
  --hero-gradient:   linear-gradient(135deg, #5e2d96 0%, #f7b5eb 100%);
  --heading-from:    #5e2d96;
  --heading-to:      #a06ad4;
  --dot-color:       rgba(94, 45, 150, 0.045);
}

/* Palette B — Parchment & Rose */
.palette-b {
  --bg-deep:         #ffffff;
  --bg-card:         #fdfafc;
  --bg-section:      #fdeaf0;
  --accent-1:        #a80f40;
  --accent-2:        #d03a62;
  --text-main:       #200510;
  --text-muted:      #6a3c50;
  --highlight:       #b05010;
  --border:          rgba(168, 15, 64, 0.13);
  --glow:            rgba(168, 15, 64, 0.12);
  --shadow:          0 2px 20px rgba(168,15,64,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --page-gradient:   linear-gradient(155deg, #ffffff 0%, #fde8f0 55%, #fff6ed 100%);
  --hero-bg:         #0e0508;
  --hero-text:       #f5e8ee;
  --hero-muted:      #b89aa4;
  --hero-gradient:   linear-gradient(135deg, #a80f40 0%, #c05010 100%);
  --heading-from:    #a80f40;
  --heading-to:      #d86090;
  --dot-color:       rgba(168, 15, 64, 0.04);
}

/* Palette C — Seafoam & Teal */
.palette-c {
  --bg-deep:         #ffffff;
  --bg-card:         #f8fcfd;
  --bg-section:      #e6f5f8;
  --accent-1:        #0e6e7c;
  --accent-2:        #1a9aaa;
  --text-main:       #06151a;
  --text-muted:      #305e6a;
  --highlight:       #846010;
  --border:          rgba(14, 110, 124, 0.14);
  --glow:            rgba(14, 110, 124, 0.12);
  --shadow:          0 2px 20px rgba(14,110,124,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --page-gradient:   linear-gradient(155deg, #ffffff 0%, #e8f8fa 55%, #f5ffe8 100%);
  --hero-bg:         #080e10;
  --hero-text:       #e8f5f5;
  --hero-muted:      #8ab0b5;
  --hero-gradient:   linear-gradient(135deg, #0e6e7c 0%, #7a8c10 100%);
  --heading-from:    #0e6e7c;
  --heading-to:      #30b8cc;
  --dot-color:       rgba(14, 110, 124, 0.04);
}

/* ─────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────── */

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle, var(--dot-color) 1px, transparent 1px),
    var(--page-gradient);
  background-size: 22px 22px, cover;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}

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

a { color: var(--accent-2); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-1); }

h1, h2, h3 { line-height: 1.2; }

.container {
  width: min(1100px, 90%);
  margin-inline: auto;
}

/* .section-header h2 .accent overrides this with gradient text */
.accent { color: var(--accent-1); }

.code-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(98, 52, 160, 0.07);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--accent-1);
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   SECTION HEADERS
   ───────────────────────────────────────────── */

section {
  padding: 72px 0;
  background: transparent;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 300;
  white-space: nowrap;
  letter-spacing: -0.04em;
}

.section-header h2 .accent {
  font-weight: 800;
  background: linear-gradient(130deg, var(--heading-from) 0%, var(--heading-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent-1), transparent);
}

.section-intro {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 36px;
  line-height: 1.75;
}

.section-intro--em {
  font-size: 0.97rem;
  border-left: 2px solid var(--accent-1);
  padding-left: 16px;
  opacity: 0.85;
}

/* ─────────────────────────────────────────────
   HERO
   ───────────────────────────────────────────── */

#hero {
  position: relative;
  min-height: 70vh; /* altura del hero: subir/bajar este valor */
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  padding: 64px 5% 72px 8%;
  overflow: hidden;
  /* Para cambiar la imagen, desde assets/:
     cwebp -q 82 -alpha_q 90 NUEVA.png -o hero-bg-1920.webp
     cwebp -q 80 -alpha_q 90 -resize 1280 0 NUEVA.png -o hero-bg-1280.webp */
  /* Imagen ajustada a la altura del hero y alineada a la derecha: se ve completa,
     y el espacio libre queda a la izquierda, detrás del nombre */
  background: #fff url('../assets/hero-bg-1920.webp') right center / auto 100% no-repeat;
}

/* Velo blanco desde la izquierda — mantiene legible el texto sobre el render */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* Blanco sólido hasta 50 %, luego se desvanece hasta 65 % */
  background: linear-gradient(90deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0) 65%);
}

/* Móvil: imagen más pequeña y anclada abajo, el texto queda sobre blanco */
@media (max-width: 700px) {
  #hero {
    background-image: url('../assets/hero-bg-1280.webp');
    background-size: 160% auto;
    background-position: 70% bottom;
  }
  #hero::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 45%);
  }
}


#heroCanvas {
  display: none; /* imagen de fondo es el elemento visual principal */
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: left;
  width: 100%;
  /* Columna: bloque del nombre arriba, enlaces abajo */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}

.hero-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-1);
  margin: 0;
}

/* Chakana a la izquierda del nombre */
.hero-name-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(14px, 2vw, 28px);
  margin: 0;
}

/* Chakana 3D — tamaño: width/height; posición: margin */
.hero-chakana {
  display: block;
  flex-shrink: 0;
  width: clamp(64px, 7vw, 110px);
  height: clamp(64px, 7vw, 110px);
  margin: 0;
  background: transparent;
  animation: chakanaFloat 4.5s ease-in-out infinite;
}

@keyframes chakanaFloat {
  /* Solo translateY — el objeto 3D dentro es estático, no hay ilusión de rotación */
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

/* Usuarios con "reducir movimiento" activado: sin flotación */
@media (prefers-reduced-motion: reduce) {
  .hero-chakana { animation: none; }
}

/* Nombre + tag apilados a la derecha de la chakana */
.hero-name-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0; /* permite que el nombre haga wrap en pantallas estrechas */
}

/* Nombre completo en negrita con el degradado */
.hero-content h1 {
  font-size: clamp(1.8rem, 4vw, 4.8rem); /* 4vw: "Ramos-Cisneros" cabe en la mitad */
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0;
  width: fit-content;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* En pantallas pequeñas vuelve a wrap normal */
@media (max-width: 680px) {
  .hero-content h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
}

/* El bloque chakana + nombre no pasa de la mitad de la pantalla
   (50vw menos el padding izquierdo del hero, 8 %) */
@media (min-width: 701px) {
  .hero-top { max-width: 42vw; }
}

/* "Ramos-Cisneros" nunca se corta en el guion */
.nowrap { white-space: nowrap; }

.hero-links {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.btn-outline {
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--accent-1);
  border-radius: 4px;
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
}
.btn-outline:hover { background: var(--accent-1); color: var(--bg-deep); }

.hero-scroll-hint {
  position: absolute;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.hero-scroll-hint span {
  display: block;
  width: 20px; height: 32px;
  border: 1px solid var(--accent-1);
  border-radius: 10px;
  position: relative;
  opacity: 0.45;
}
.hero-scroll-hint span::after {
  content: '';
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 8px;
  background: var(--accent-1);
  border-radius: 2px;
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot {
  0%, 100% { opacity: 1; top: 5px; }
  50%       { opacity: 0; top: 16px; }
}

/* ─────────────────────────────────────────────
   INKA DIVIDER
   ───────────────────────────────────────────── */

.inka-divider {
  width: 100%; height: 24px;
  overflow: hidden; line-height: 0;
}
.inka-divider svg { width: 100%; height: 24px; }
.home-divider { margin: 48px 0; opacity: 0.6; }

/* ─────────────────────────────────────────────
   TAB BAR
   ───────────────────────────────────────────── */

.tab-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.tab-nav-inner {
  width: min(1100px, 90%);
  margin-inline: auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tab-nav-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 16px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s;
  flex-shrink: 0;
}
.tab-btn:hover { color: var(--text-main); }

.tab-btn.active {
  color: var(--accent-1);
  font-weight: 600;
  border-bottom-color: transparent;
}

/* Gradient pill underline on active tab */
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10px; right: 10px;
  height: 2px;
  background: linear-gradient(to right, var(--heading-from), var(--heading-to));
  border-radius: 2px 2px 0 0;
}

/* ─────────────────────────────────────────────
   TAB PANES
   ───────────────────────────────────────────── */

.tab-content-area { min-height: 70vh; }

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: tabIn 0.28s ease;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
   HOME TAB
   ───────────────────────────────────────────── */

.home-wrapper {
  padding: 60px 0 72px;
  background: transparent;
}

.home-top-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 52px;
  align-items: start;
  margin-bottom: 0;
}

/* Sidebar — profile card */
.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: calc(49px + 20px); /* altura de la barra de pestañas + margen */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  align-self: flex-start;
}

.photo-frame {
  position: relative;
}

.home-sidebar .photo-frame {
  width: 160px;
  height: 160px;
  margin-inline: auto;
}

.home-sidebar .photo-frame img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-1);
  position: relative;
  z-index: 1;
}

.home-sidebar .photo-frame.photo-placeholder::before {
  content: 'A';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-1);
  font-size: 3.2rem;
  font-weight: 300;
  color: var(--accent-2);
  position: absolute;
  inset: 0;
  z-index: 1;
}

.home-sidebar .photo-frame.photo-placeholder img { opacity: 0; }

.photo-circles {
  position: absolute;
  inset: -18px;
  z-index: 0;
  animation: slowRotate 20s linear infinite;
}
@keyframes slowRotate { to { transform: rotate(360deg); } }

.home-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hc-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  transition: color 0.2s;
}
.hc-item:hover { color: var(--accent-2); }

.hc-icon {
  color: var(--accent-1);
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}

.hc-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  word-break: break-all;
}

.awards-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.award-badge {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 6px 10px;
  background: rgba(154, 96, 16, 0.06);
  border: 1px solid rgba(154, 96, 16, 0.3);
  border-radius: 4px;
  color: var(--highlight);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

/* Main content blocks */
.home-main {
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.home-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-1);
  margin-bottom: 20px;
}
.home-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent-1), transparent);
  opacity: 0.35;
}

.home-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.home-label-row .home-label {
  margin-bottom: 0;
  flex: 1;
}

.goto-btn {
  background: none;
  border: none;
  color: var(--accent-1);
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.goto-btn:hover { color: var(--accent-2); }

.about-lead {
  font-size: 1.1rem;
  color: var(--text-main);
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.65;
  padding-left: 14px;
  border-left: 3px solid var(--accent-1);
}

.home-block p {
  color: var(--text-muted);
  margin-bottom: 10px;
  font-size: 0.95rem;
  line-height: 1.75;
}
.home-block p:last-child { margin-bottom: 0; }

/* ─────────────────────────────────────────────
   EDUCATION TIMELINE
   ───────────────────────────────────────────── */

.edu-timeline {
  position: relative;
  padding-left: 28px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}

.edu-item {
  position: relative;
  margin-bottom: 28px;
}
.edu-item:last-child { margin-bottom: 0; }

.edu-item::before {
  content: '';
  position: absolute;
  left: -34px;
  top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-1);
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 7px var(--glow);
}

.edu-year {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent-1);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.edu-degree {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}

.edu-inst {
  font-size: 0.85rem;
  color: var(--accent-2);
  margin-bottom: 3px;
}

.edu-inst.edu-placeholder {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.45;
}

.edu-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────
   HOME — PUBLICATIONS BLOCK
   ───────────────────────────────────────────── */

.home-pubs-block { margin-top: 8px; }

.home-pub-list {
  display: flex;
  flex-direction: column;
}

.home-pub-row {
  display: grid;
  grid-template-columns: 100px 1fr 24px;
  align-items: center;
  gap: 16px;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  text-decoration: none;
  position: relative;
  transition: background 0.18s, padding-left 0.18s;
  overflow: hidden;
}
.home-pub-row:last-child { border-bottom: none; }

/* Left accent bar appears on hover */
.home-pub-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--heading-from), var(--heading-to));
  border-radius: 3px;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}
.home-pub-row:hover { background: var(--bg-section); }
.home-pub-row:hover::before { transform: scaleY(1); }
.home-pub-row:hover .hpr-arrow { color: var(--accent-1); }

.hpr-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.hpr-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent-1);
  font-weight: 500;
}

.hpr-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
  line-height: 1.35;
}

.hpr-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hpr-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  transition: color 0.2s;
  text-align: right;
}

/* ─────────────────────────────────────────────
   HOME — RESEARCH AREAS
   ───────────────────────────────────────────── */

.home-areas-block { margin-top: 8px; }

.area-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.area-tag {
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.area-tag:hover {
  border-color: var(--accent-1);
  background: rgba(98,52,160,0.05);
  color: var(--accent-1);
  cursor: default;
}

/* ─────────────────────────────────────────────
   RESEARCH SECTION
   ───────────────────────────────────────────── */

.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.research-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}

.research-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--heading-from), var(--heading-to));
  opacity: 0.25;
  transition: opacity 0.25s;
}

.research-card:hover {
  border-color: var(--accent-1);
  box-shadow: 0 8px 32px var(--glow);
  transform: translateY(-2px);
}
.research-card:hover::before { opacity: 1; }

/* Large faint geometric background on research cards */
.research-card .research-icon {
  position: relative;
  z-index: 1;
}

.research-icon {
  width: 80px; height: 80px;
  margin-bottom: 20px;
}

.research-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--heading-from), var(--heading-to));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.research-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.research-card::after {
  content: '';
  position: absolute;
  bottom: 8px; right: 8px;
  width: 24px; height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M0,20 L4,20 L4,16 L8,16 L8,12 L12,12' stroke='%236b3fa0' stroke-width='1.5' fill='none' opacity='0.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  opacity: 0.35;
}
.palette-b .research-card::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M0,20 L4,20 L4,16 L8,16 L8,12 L12,12' stroke='%23c0184a' stroke-width='1.5' fill='none' opacity='0.4'/%3E%3C/svg%3E");
}
.palette-c .research-card::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M0,20 L4,20 L4,16 L8,16 L8,12 L12,12' stroke='%233ab8c5' stroke-width='1.5' fill='none' opacity='0.4'/%3E%3C/svg%3E");
}

.research-advisor {
  text-align: center;
  padding: 18px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  color: var(--text-muted);
}
.research-advisor strong { color: var(--accent-2); }

/* ─────────────────────────────────────────────
   PUBLICATIONS
   ───────────────────────────────────────────── */

.pub-list { display: flex; flex-direction: column; gap: 14px; }

.pub-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  color: var(--text-main);
  text-decoration: none;
}
.pub-card:hover {
  border-color: var(--accent-1);
  box-shadow: 0 6px 24px var(--glow);
  transform: translateY(-1px);
  color: var(--text-main);
}
.pub-card--muted { opacity: 0.62; }
.pub-card--muted:hover { opacity: 1; }

.pub-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  padding-top: 4px;
  border-right: 1px solid var(--border);
  text-align: center;
  background: linear-gradient(135deg, var(--heading-from), var(--heading-to));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pub-venue {
  display: inline-block;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: 3px;
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.pub-venue.tog   { background: rgba(107,63,160,0.18); color: var(--accent-2); border: 1px solid var(--accent-1); }
.pub-venue.arxiv { background: rgba(212,168,67,0.13); color: var(--highlight); border: 1px solid var(--highlight); }
.pub-venue.phys  { background: rgba(138,176,181,0.08); color: var(--text-muted); border: 1px solid var(--border); }

.pub-card h3 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.pub-authors, .pub-ref {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.pub-link {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-1);
}

/* Tarjeta con varios enlaces (revista + preprint) */
.pub-card--multi { cursor: default; }
.pub-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.pub-links .pub-link:hover { text-decoration: underline; }

.pub-section-label {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 0 4px;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   PROJECTS
   ───────────────────────────────────────────── */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}
.project-card:hover {
  border-color: var(--accent-1);
  box-shadow: 0 6px 24px var(--glow);
  transform: translateY(-2px);
}
.project-card--placeholder {
  opacity: 0.4;
  border-style: dashed;
}

.project-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent-1);
  letter-spacing: 0.06em;
}

.project-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: 3px;
  width: fit-content;
  letter-spacing: 0.04em;
}
.project-tag.research  { background: rgba(107,63,160,0.14); color: var(--accent-2); border: 1px solid var(--accent-1); }
.project-tag.course    { background: rgba(212,168,67,0.1);  color: var(--highlight); border: 1px solid var(--highlight); }
.project-tag.summer    { background: rgba(138,176,181,0.1); color: var(--text-muted); border: 1px solid var(--border); }
.project-tag.conference{ background: rgba(167,139,218,0.1); color: var(--accent-2); border: 1px solid var(--accent-2); }
.project-tag.phys      { background: rgba(138,176,181,0.07); color: var(--text-muted); border: 1px solid var(--border); }

.palette-b .project-tag.research { background: rgba(192,24,74,0.14); border-color: var(--accent-1); }
.palette-c .project-tag.research { background: rgba(58,184,197,0.11); border-color: var(--accent-1); }

.project-card h3 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
}
.project-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}
.project-tech {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.project-tech span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
}

/* Enlace al código del proyecto (o aviso si aún no es público) */
.project-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent-1);
  width: fit-content;
}
.project-link:hover { text-decoration: underline; }
.project-link--pending {
  color: var(--text-muted);
  font-style: italic;
}
.project-link--pending:hover { text-decoration: none; }

/* ─────────────────────────────────────────────
   GALLERY
   ───────────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.gallery-loading {
  color: var(--text-muted);
  font-size: 0.88rem;
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  position: relative;
}
.gallery-card::before {
  content: '';
  position: absolute;
  top: 8px; left: 8px;
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M0,16 L4,16 L4,12 L8,12 L8,8 L12,8 L12,4 L16,4 L16,0' stroke='%236b3fa0' stroke-width='1.2' fill='none' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  z-index: 2;
  pointer-events: none;
}
.gallery-card:hover {
  border-color: var(--accent-1);
  box-shadow: 0 8px 28px var(--glow);
  transform: translateY(-2px);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-thumb canvas { width: 100%; height: 100%; display: block; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.gallery-thumb-placeholder {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  padding: 20px;
  opacity: 0.45;
}

.gallery-info { padding: 14px 16px; }
.gallery-info h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}
.gallery-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.gallery-tag {
  font-size: 0.66rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 5px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
}

.btn-view3d {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--accent-1);
  border-radius: 4px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-view3d:hover { background: var(--accent-1); color: var(--bg-deep); }
.btn-view3d:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   3D VIEWER MODAL
   ───────────────────────────────────────────── */

.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.viewer-modal[hidden] { display: none; }

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(4px);
}

.viewer-panel {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  background: #ffffff;
  border: 1px solid var(--accent-1);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.viewer-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-2);
}
.viewer-controls { display: flex; gap: 7px; }

.viewer-btn {
  padding: 5px 12px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.viewer-btn:hover { border-color: var(--accent-1); color: var(--text-main); }
.viewer-btn--close:hover { border-color: #e55; color: #e55; }

#viewerCanvas {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  background: var(--bg-deep);
}

/* Flechas entre modelos + mensaje de carga */
.viewer-stage { position: relative; }

.viewer-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent-1);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: border-color 0.2s, background 0.2s;
}
.viewer-arrow:hover { border-color: var(--accent-1); background: #fff; }
.viewer-arrow--prev { left: 14px; }
.viewer-arrow--next { right: 14px; }

.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
}
.viewer-loading[hidden] { display: none; }

.viewer-caption {
  padding: 8px 18px 0;
  font-size: 0.82rem;
  color: var(--text-main);
  text-align: center;
}

.viewer-hint {
  padding: 7px 18px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   TALKS TIMELINE
   ───────────────────────────────────────────── */

.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent-1), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
  padding: 14px 16px 14px 0;
  border-radius: 8px;
  transition: background 0.2s;
}
.timeline-item:hover {
  background: var(--bg-section);
}
.timeline-dot {
  position: absolute;
  left: -25px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-1);
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 8px var(--glow);
}

.timeline-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--accent-1);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 5px;
}
.timeline-content h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}
.timeline-role {
  font-size: 0.84rem;
  color: var(--accent-2);
  margin-bottom: 8px;
  font-style: italic;
}
.timeline-content p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─────────────────────────────────────────────
   CONTACT
   ───────────────────────────────────────────── */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-1);
  border-radius: 10px;
  padding: 18px;
  color: var(--text-main);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.contact-card:hover {
  border-color: var(--accent-1);
  box-shadow: 0 6px 20px var(--glow);
  transform: translateY(-1px);
  color: var(--text-main);
}

.contact-icon {
  font-size: 1.3rem;
  color: var(--accent-1);
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.contact-label {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.contact-value {
  font-size: 0.88rem;
  color: var(--text-main);
}

.contact-location {
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────── */

footer {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-loc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */

@media (max-width: 860px) {
  .home-top-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .home-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
  }
  .home-sidebar .photo-frame { margin: 0; }
  .home-contact-list { flex: 1; min-width: 180px; }
  .awards-stack { flex-direction: row; flex-wrap: wrap; }
  .award-badge { flex: 1 1 auto; min-width: 160px; }

}


@media (max-width: 768px) {
  .home-pub-row {
    grid-template-columns: 80px 1fr 18px;
    gap: 10px;
  }

  .pub-card { grid-template-columns: 1fr; }
  .pub-year {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    text-align: left;
  }

  .footer-inner { flex-direction: column; text-align: center; }

  .tab-btn { padding: 13px 14px; font-size: 0.8rem; }
}


@media (max-width: 520px) {
  section { padding: 52px 0; }
  .research-grid { grid-template-columns: 1fr; }
  .home-pub-row {
    grid-template-columns: 1fr 18px;
    grid-template-areas:
      "left arrow"
      "body body";
    align-items: start;
    row-gap: 6px;
    padding: 12px 10px 12px 12px;
  }
  .hpr-left  { grid-area: left; flex-direction: row; align-items: center; gap: 8px; }
  .hpr-body  { grid-area: body; min-width: 0; }
  .hpr-arrow { grid-area: arrow; }
}
