/* =========================================================
   Base
   ========================================================= */

body {
  line-height: 1.6;
}

main.content {
  max-width: 980px;
}

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

h2 {
  margin-top: 2rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #e5e5e5;
}

h3 {
  margin-top: 1.2rem;
}

p {
  line-height: 1.65;
}

ul li {
  margin-bottom: 0.4rem;
}

.quarto-title-block .title {
  font-weight: 700;
}

/* =========================================================
   Cabecera de perfil
   ========================================================= */

.profile-header {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.profile-header td {
  padding: 0;
  border: none !important;
  vertical-align: top;
}

.profile-photo {
  width: 180px;
}

.profile-sep {
  width: 28px;
}

.profile-text {
  width: auto;
}

.profile-img {
  display: block;
  width: 150px;
  height: auto;
  border-radius: 10px;
}

.profile-text h1 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 2.2rem;
  line-height: 1.1;
}

.profile-text p {
  margin: 0.5rem 0 0.8rem 0;
  line-height: 1.45;
}

/* =========================================================
   Logos e iconos
   ========================================================= */

.inline-logo {
  width: 22px;
  height: auto;
  margin-right: 6px;
  vertical-align: -3px;
}

.navbar-logo {
  width: 21px;
  height: 21px;
  object-fit: contain;
  vertical-align: middle;
  opacity: 0.9;
}

.navbar-logo:hover {
  opacity: 1;
}

.icon-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  color: inherit;
  text-decoration: none;
}

.icon-link img {
  width: 20px;
  height: 20px;
  opacity: 0.85;
}

.icon-link:hover {
  text-decoration: underline;
}

.icon-link:hover img {
  opacity: 1;
}

/* =========================================================
   Tarjetas y bloques visuales
   ========================================================= */

.research-card,
.teaching-card,
.pub-card,
.link-card {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin: 0.8rem 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
}

.research-grid,
.teaching-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.4rem 0;
}

.research-card h3,
.teaching-card h3,
.pub-card h3,
.link-card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.research-card p,
.teaching-card p,
.pub-card p,
.link-card p {
  margin-bottom: 0;
}

/* =========================================================
   Publicaciones
   ========================================================= */

.pub-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 1.2rem;
  align-items: start;
}

.pub-card p {
  margin-top: 0;
}

.pub-card img {
  width: 140px;
  max-height: 85px;
  height: auto;
  object-fit: contain;
  object-position: left center;
  display: block;
  margin-top: 0.2rem;
}

.pub-card strong {
  font-weight: 700;
}

/* Compatibilidad con el formato antiguo de tablas */
.pub-table {
  width: 100%;
  margin-bottom: 1.2rem;
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  padding: 0.9rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
}

.pub-table td {
  padding: 0.4rem;
  border: none !important;
  vertical-align: top;
}

.pub-logo {
  width: 90px;
  padding-right: 12px;
}

.pub-logo img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 6px;
}

/* =========================================================
   Bloque ANECA / CV
   ========================================================= */

.cv-aneca,
.cv-aneca-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0.8rem 0 1.2rem 0;
}

.cv-aneca-box {
  align-items: center;
}

.aneca-logo {
  width: 110px;
  height: auto;
  margin-right: 14px;
}

.cv-aneca span {
  line-height: 1.45;
}

.cv-aneca strong {
  font-weight: 600;
}

.cv-position {
  margin: 0.8rem 0 0.6rem 0;
  color: #c40000;
  font-weight: 600;
  line-height: 1.35;
}

.cv-position-text {
  color: #c40000;
  font-weight: 700;
}

.cv-black {
  color: #222;
  font-weight: 500;
}

.cv-divider {
  margin: 1.2rem 0;
  border: none;
  border-top: 1px solid #d9d9d9;
}

.cv-section-title {
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.cv-education p {
  margin-bottom: 0.6rem;
}

.cv-education img {
  margin-right: 6px;
  vertical-align: middle;
}

/* =========================================================
   Métricas CV
   ========================================================= */

.cv-metrics {
  margin: 1rem 0 1.2rem 0;
  border-collapse: collapse;
}

.cv-metrics td {
  padding-right: 40px;
  text-align: center;
}

.cv-metrics-block {
  display: flex;
  gap: 55px;
  margin: 1rem 0 1.2rem 0;
}

.cv-metric {
  text-align: center;
}

.cv-metric-number {
  color: #7a8a9a;
  font-size: 2rem;
}

.cv-metric-label {
  color: #c40000;
  font-size: 0.9rem;
  font-weight: 700;
}

.cv-metric-year {
  font-weight: 600;
}

/* =========================================================
   Docencia
   ========================================================= */

.docencia-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.6rem 0;
}

.docencia-links a {
  display: block;
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
}

.docencia-links a:hover {
  border-color: #c4002f;
  text-decoration: none;
}

/* =========================================================
   Clases auxiliares
   ========================================================= */

.urjc {
  color: #C4002F;
  font-weight: 700;
}

.dept {
  font-weight: 700;
}

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

@media (max-width: 768px) {
  main.content {
    max-width: 100%;
  }

  .profile-header,
  .profile-header tbody,
  .profile-header tr,
  .profile-header td {
    display: block;
    width: 100% !important;
  }

  .profile-sep {
    display: none;
  }

  .profile-img {
    width: 160px;
    border-radius: 10px;
  }

  .profile-text h1 {
    font-size: 1.8rem;
  }

  .cv-aneca,
  .cv-aneca-box,
  .cv-metrics-block {
    flex-direction: column;
    gap: 0.8rem;
  }

  .research-grid,
  .teaching-grid,
  .link-grid,
  .docencia-links {
    grid-template-columns: 1fr;
  }

  .pub-card {
    display: block;
  }

  .pub-card img {
    width: 130px;
    max-height: none;
    margin-bottom: 0.8rem;
  }

  .pub-logo {
    width: 60px;
    padding-right: 10px;
  }

  .pub-logo img {
    width: 50px;
    height: 50px;
  }
}
/* =========================================================
   Footer
   ========================================================= */

footer {
  font-size: 0.85rem;
  color: #666;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e5e5;
}

footer a {
  color: inherit;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* =========================================================
   Material docente
   ========================================================= */

.material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.6rem 0;
}

.material-card {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
}

.material-card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.material-card p {
  margin-bottom: 0.6rem;
}

.material-card a {
  text-decoration: none;
  font-weight: 600;
}

.material-card a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .material-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   CV - publicaciones destacadas sin logo
   ========================================================= */

.cv-pub-card {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin: 0.8rem 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
}

.cv-pub-card p {
  margin-top: 0;
  margin-bottom: 0.4rem;
}
