/* ============================================================
   Web personal de Javier Albusac — estilo claro + azul eléctrico
   ============================================================ */
:root {
  --blue: #0057ff;
  --blue-dark: #0040bd;
  --blue-soft: #e8efff;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --text: #16213a;
  --text-soft: #5a6479;
  --muted: #5d6b85;
  --border: #e3e9f4;
  --shadow: 0 4px 24px rgba(22, 33, 58, .07);
  --radius: 14px;
  --maxw: 1120px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--blue-dark); }
img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { font-weight: 800; font-size: 1.1rem; color: var(--text); letter-spacing: -.02em; }
.brand span { color: var(--blue); }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 10px;
}
.nav-toggle:hover { background: var(--blue-soft); }
.nav-toggle .bar {
  display: block; width: 20px; height: 2px; background: var(--text);
  margin: 4px auto; border-radius: 2px; transition: .25s;
}

.head-logos { display: flex; align-items: center; gap: 14px; }
.head-logos img { height: 34px; width: auto; display: block; }

.nav-menu { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-menu > li { position: relative; }
.nav-menu a, .nav-menu .nav-label {
  display: block; padding: 8px 14px; border-radius: 8px;
  color: var(--text); font-weight: 500; font-size: .95rem; cursor: pointer;
}
.nav-menu > li > a:hover, .nav-menu .nav-label:hover { background: var(--blue-soft); color: var(--blue); }
.nav-menu > li > a.active { color: var(--blue); font-weight: 700; }

.dropdown .nav-label::after {
  content: ''; display: inline-block; margin-left: 7px;
  width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
}
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px; list-style: none;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: .2s;
}
.dropdown:hover .dropdown-menu, .dropdown.open .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown-menu a { padding: 9px 14px; border-radius: 8px; font-size: .92rem; }
.dropdown-menu a:hover { background: var(--blue-soft); color: var(--blue); }
.dropdown-menu a.active { color: var(--blue); font-weight: 600; }

/* ---------- Hero (portada) ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #eef3fd 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
#particles { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 72px 24px 64px;
  display: grid; grid-template-columns: 1.25fr .75fr; gap: 48px; align-items: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.1; margin-bottom: 10px;
}
.hero h1 em { font-style: normal; color: var(--blue); }
.hero .role { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.hero .org { color: var(--muted); margin-bottom: 22px; }
.hero p.lead { color: var(--muted); max-width: 56ch; margin-bottom: 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 10px;
  font-weight: 600; font-size: .95rem; transition: .2s;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(0,87,255,.30); }
.btn-primary:hover { background: var(--blue-dark); color: #fff; transform: translateY(-2px); }
.btn-ghost { border: 1.5px solid var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.hero-photo { position: relative; }
.photo-circle {
  border-radius: 50%; overflow: hidden; aspect-ratio: 1/1;
  border: 4px solid #fff; box-shadow: 0 16px 48px rgba(22,33,58,.16);
  background: #fff;
}
.photo-circle img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.14); }
.hero-photo::before {
  content: ''; position: absolute; inset: -14px -14px auto auto;
  width: 90px; height: 90px; border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), #6ea0ff);
  opacity: .18; z-index: -1;
}

/* ---------- Stats ---------- */
.stats {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: -34px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 18px; text-align: center;
}
.stat b { display: block; font-size: 1.9rem; color: var(--blue); font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: .85rem; color: var(--muted); }

/* ---------- Sections ---------- */
section.block { padding: 64px 0; }
.section-head { margin-bottom: 34px; }
.section-head .kicker {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--blue);
  background: var(--blue-soft); padding: 4px 12px; border-radius: 99px; margin-bottom: 10px;
}
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.section-head p { color: var(--muted); margin-top: 8px; max-width: 70ch; }

/* ---------- Cards genéricas ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
}

/* ---------- Libros ---------- */
.books-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px;
}
.book {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .25s, box-shadow .25s;
}
.book:hover { transform: translateY(-6px); box-shadow: 0 14px 38px rgba(22,33,58,.13); }
.book-cover { aspect-ratio: 4/3; overflow: hidden; background: var(--blue-soft); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.book-body h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.35; margin-bottom: 6px; }
.book-body .authors { font-size: .85rem; color: var(--muted); margin-bottom: 14px; flex: 1; }
.book-links { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-link {
  font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 8px;
  background: var(--blue-soft); color: var(--blue);
}
.tag-link:hover { background: var(--blue); color: #fff; }

/* ---------- Áreas de investigación (chips) ---------- */
.topics { display: flex; flex-wrap: wrap; gap: 10px; }
.topic {
  background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
  padding: 8px 18px; font-size: .9rem; font-weight: 600; color: var(--text);
}
.topic::before { content: '●'; color: var(--blue); margin-right: 8px; font-size: .7rem; vertical-align: 1px; }

/* ---------- Publicaciones ---------- */
.pub-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.pub-filters button {
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 16px; border-radius: 99px; font-family: var(--font); font-size: .85rem;
  font-weight: 600; cursor: pointer; transition: .2s;
}
.pub-filters button:hover { border-color: var(--blue); color: var(--blue); }
.pub-filters button.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.year-group { margin-bottom: 38px; }
.year-group h3 {
  font-size: 1.35rem; font-weight: 800; color: var(--text); margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px;
}
.year-group h3::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pub-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.pub {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  transition: border-color .2s;
}
.pub:hover { border-color: #bcd0ff; }
.pub .badge {
  flex-shrink: 0; font-size: .72rem; font-weight: 800; letter-spacing: .03em;
  padding: 4px 9px; border-radius: 7px; margin-top: 2px;
}
.badge-J  { background: #e8efff; color: #0047d6; }
.badge-CI { background: #e6f7ef; color: #0b7a48; }
.badge-CN { background: #fff3e2; color: #b25e00; }
.badge-B  { background: #f3e8ff; color: #7c3aed; }
.badge-LN { background: #e0f4fa; color: #0e7490; }
.pub p { font-size: .93rem; color: var(--text); }
.pub .award { display: inline-block; margin-top: 4px; font-size: .8rem; font-weight: 700; color: #b25e00; }
.pub .award::before { content: '🏆 '; }

/* ---------- Proyectos (timeline) ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--blue), #bcd0ff);
  border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before {
  content: ''; position: absolute; left: -27px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--blue-soft);
}
.tl-item .card { padding: 20px 22px; }
.tl-item h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 6px; }
.tl-item .meta { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.tl-item .meta b { color: var(--blue); font-weight: 700; }
.tl-item p { font-size: .92rem; color: var(--muted); }

/* ---------- Docencia / material ---------- */
.materia { margin-bottom: 30px; }
.materia h3 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 14px;
  padding-left: 14px; border-left: 4px solid var(--blue);
}
.materia .note { font-size: .87rem; color: var(--muted); font-style: italic; margin-bottom: 10px; }
.doc-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.doc-list li a {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: .9rem; font-weight: 500; color: var(--text);
  transition: .2s;
}
.doc-list li a:hover { border-color: var(--blue); color: var(--blue); transform: translateX(3px); }
.doc-list li a::before { content: '📄'; }
.doc-list li a.extra::before { content: '🖨️'; }

/* ---------- Estancias ---------- */
.stay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.stay h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.stay .where { color: var(--blue); font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.stay .when { color: var(--muted); font-size: .87rem; margin-bottom: 10px; }

/* ---------- Aviso pendiente ---------- */
.pending {
  background: #fffbe9; border: 1px dashed #e5c95a; border-radius: var(--radius);
  padding: 26px; color: #7a6410; font-size: .95rem;
}

/* ---------- Page hero (subpáginas) ---------- */
.page-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #eef3fd, var(--bg));
  border-bottom: 1px solid var(--border);
  padding: 54px 0 44px;
}
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
.page-hero .crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.page-hero .crumbs a { color: var(--muted); }
.page-hero .crumbs a:hover { color: var(--blue); }
.page-hero p.sub { color: var(--muted); margin-top: 8px; max-width: 70ch; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px; border-top: 1px solid var(--border);
  background: var(--surface); padding: 38px 0 30px;
}
.footer-grid {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  font-size: .88rem; color: var(--muted);
}
.footer-grid b { color: var(--text); }
.footer-grid .mail { color: var(--blue); font-weight: 600; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s, transform .6s; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding: 52px 24px 48px; }
  .hero-photo { max-width: 380px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .head-logos { display: none; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; gap: 0; padding: 10px 16px 16px;
    display: none;
  }
  .nav-menu.open { display: flex; }
  .dropdown-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none; padding: 0 0 0 16px; display: none;
  }
  .dropdown.open .dropdown-menu { display: block; }
}

/* items de lista sin enlace */
.doc-list li span {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: .9rem; font-weight: 500; color: var(--text);
}
.doc-list li span::before { content: '🎓'; }

/* ---------- Trabajos dirigidos (TFM/TFG) ---------- */
.work {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 12px; transition: border-color .2s;
}
.work:hover { border-color: #bcd0ff; }
.work h3 { font-size: .98rem; font-weight: 700; line-height: 1.45; margin-bottom: 6px; }
.work .meta { font-size: .87rem; color: var(--muted); }
.work .chips { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grade {
  display: inline-block; font-size: .78rem; font-weight: 700;
  color: var(--blue); background: var(--blue-soft);
  padding: 3px 12px; border-radius: 99px;
}
.grade-mh { color: #0b7a48; background: #e6f7ef; }
.prize {
  display: inline-block; font-size: .78rem; font-weight: 700;
  color: #b25e00; background: #fff3e2; padding: 3px 12px; border-radius: 99px;
}
.prize::before { content: '🏆 '; }

/* ---------- Proyectos destacados (IP) ---------- */
.featured-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 56px;
}
.featured {
  position: relative;
  background: linear-gradient(150deg, #f2f6ff 0%, #ffffff 55%);
  border: 1.5px solid #bcd0ff; border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,87,255,.10);
  padding: 24px 22px 20px;
}
.featured h3 { font-size: 1rem; font-weight: 700; line-height: 1.45; margin: 10px 0 8px; }
.featured .meta { font-size: .85rem; color: var(--muted); }
.featured .meta b { color: var(--blue); }
.ip-badge {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #fff; background: var(--blue);
  padding: 4px 12px; border-radius: 99px; box-shadow: 0 4px 12px rgba(0,87,255,.35);
}

/* ---------- Etiquetas IF y cuartil ---------- */
.if-tag, .q-tag {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 99px; margin-left: 6px; vertical-align: 1px;
  white-space: nowrap;
}
.if-tag { background: var(--blue-soft); color: #0047d6; border: 1px solid #c9d9ff; }
.q-tag.q1 { background: #e6f7ef; color: #0b7a48; border: 1px solid #b7e6cd; }
.q-tag.q2 { background: #eef9e0; color: #4d7c0f; border: 1px solid #d3ecae; }
.q-tag.q3 { background: #fff3e2; color: #b25e00; border: 1px solid #f5d9ad; }
.q-tag.q4 { background: #fdeaea; color: #b91c1c; border: 1px solid #f3c2c2; }
