/* === ROOT VARIABLES === */
:root {
  --bg: #0c0f14;
  --panel: #121721;
  --muted: #9aa3b2;
  --text: #e8edf5;
  --brand: #7bdcff;
  --brand-2: #a6e3a1;
  --line: #1f2633;
  --radius: 16px;
  --accent-color: #00b8d9;
  --card-bg: #111;
}

/* === BASE === */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover { opacity: 0.8; }
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === NAVIGATION === */
.site-header {
  background: rgba(12, 15, 20, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 0;
}
.menu {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.menu a {
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.2s ease;
}
.menu a[aria-current="page"],
.menu a:hover {
  background: #161c28;
}
.btn--ghost {
  border: 1px solid #2a2f39;
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
}
.btn--sm { padding: 8px 12px; font-size: .9rem; }

/* === HERO === */
.hero {
  padding: 56px 0;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  align-items: center;
}
.hero__copy h1 {
  font-size: 2.2rem;
  margin: 0 0 10px;
}
.lead {
  font-size: 1.15rem;
  color: #cfd6e5;
}
.cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.hero__photo img {
  border: 1px solid var(--line);
}

/* === SECTION === */
.section {
  padding: 36px 0;
}
.section--alt {
  background: #0e131b;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section__title {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

/* === SHARED CARDS (for Highlights, Impact, Publications) === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.card p {
  color: var(--muted);
  margin: 0.25rem 0 0.5rem;
  line-height: 1.5;
}
.tags {
  font-size: 0.9rem;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}
.card-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }

/* === IMPACT PAGE === */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.intro {
  text-align: center;
  margin-bottom: 2.5rem;
}
.intro h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}
.intro p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}
.stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3rem;
  margin: 3rem 0 4rem;
  text-align: center;
}
.stat h2 {
  font-size: 2.4rem;
  margin-bottom: 0.3rem;
  color: var(--accent-color);
}
.stat p {
  font-size: 1rem;
  color: var(--muted);
}

/* === LISTS & PUBLICATIONS === */
.list {
  display: grid;
  gap: 16px;
}
.list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.list-item__head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.tag {
  border: 1px solid #2a2f39;
  border-radius: 999px;
  padding: 4px 8px;
  color: #cbd3e6;
  font-size: .8rem;
}
.muted { color: var(--muted); margin: .15rem 0 .35rem; }
.abstract { color: #d9e1ef; margin: .25rem 0 .5rem; }
.links { display: flex; gap: 12px; flex-wrap: wrap; }

/* === MISC === */
.highlight-link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.highlight-link:hover { opacity: 0.6; }

/* === FOOTER === */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  margin-top: 24px;
  color: #aab3c6;
  text-align: center;
  font-size: 0.9rem;
}

/* === MEDIA QUERIES === */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .cards { grid-template-columns: 1fr; }
}

/* --- WHAT I DO / FOCUS AREAS (modern look) --- */
.section-profile {
  padding: 40px 0;
}

.section-profile .grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr; /* texto + chips */
  gap: 28px;
  align-items: start;
}

.section-profile h2 {
  font-size: 1.6rem;
  margin: 0 0 14px;
}

.bullets {
  margin: 0;
  padding: 0;
  list-style: none;
}
.bullets li {
  position: relative;
  padding-left: 28px;
  margin: 10px 0;
  color: #d9e1ef;
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 10px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 3px rgba(123, 220, 255, 0.12);
}

/* chips estilo “badge” para Focus areas */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 8px 12px;
  border-radius: 999px;
  background: #151b27;
  border: 1px solid #202739;
  color: #c7d0e0;
  font-weight: 500;
  letter-spacing: .2px;
}

/* Separadores suaves entre bloques */
.divider {
  height: 1px;
  background: var(--line);
  margin: 28px 0;
  opacity: .6;
}

/* Responsivo */
@media (max-width: 900px) {
  .section-profile .grid { grid-template-columns: 1fr; }
}

/* Head con CTA "All →" */
.section-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-bottom:12px;
}
.section-head h2{ margin:0; }
.see-all{
  color: var(--brand);
  font-weight:600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* Grilla 2 columnas para destacados */
.list-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:16px;
}

/* Responsive: 1 columna en mobile */
@media (max-width: 800px){
  .list-grid{ grid-template-columns:1fr; }
}

/* ===== Sub-navigation (sticky with transition) ===== */
.subnav {
  position: sticky;
  top: 60px;
  background: rgba(12,15,20,0.2);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 1rem;
  z-index: 9;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}
.subnav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.subnav a:hover { color: var(--text); background: #161c28; }
.subnav a.active { color: var(--brand); background: #161c28; }
.subnav.scrolled { background: rgba(12,15,20,0.9); backdrop-filter: blur(10px); }

section[id] { scroll-margin-top: 90px; }

/* iOS safe area para que no se coma el primer item (Home) */
.site-header {
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}

/* Nav móvil: scroll horizontal suave + no cortar texto */
@media (max-width: 480px){
  .nav { justify-content: flex-start; }            /* evita recorte del primer item */
  .menu {
    gap: .75rem;
    overflow-x: auto;                               /* se desplaza si no entra */
    -webkit-overflow-scrolling: touch;
    padding: 0 12px;
  }
  .menu::-webkit-scrollbar { display: none; }       /* oculta scrollbar en iOS */
  .menu a, .btn--ghost {
    white-space: nowrap;                            /* no partir palabras */
    padding: 10px 12px;
    font-size: .95rem;
    flex: 0 0 auto;                                 /* que no se compriman */
  }
}

/* Subnav sticky: mismo trato y sin cortes */
@media (max-width: 480px){
  .subnav {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-left: 12px; padding-right: 12px;
  }
  .subnav a { white-space: nowrap; }
}

/* Desktop: texto completo; móvil: corto */
.cv--short { display: none; }
@media (max-width: 480px){
  .cv--full { display: none; }
  .cv--short { display: inline; }
}

/* ===== Vertical layout for Library cards ===== */
.cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

/* ==== Layout differentiation for Library ==== */

/* Default (Home, etc.) → keep horizontal */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Vertical stacking only in Library page */
body.impact-page .cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items:stretch; 
}

body.impact-page .card {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}
