:root {
  --ink: #16212b;
  --muted: #5e6b76;
  --line: #dce3e8;
  --paper: #ffffff;
  --soft: #f4f7f8;
  --accent: #0c6d77;
  --accent-dark: #084e56;
  --accent-soft: #dceff1;
  --navy: #102f3a;
  --max: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

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

.container {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(220,227,232,.8);
  backdrop-filter: blur(14px);
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  text-decoration: none;
  overflow: hidden;
}

.brand span {
  display: block;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  transform: translateY(-0.5px);
}

.main-nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
}

.main-nav a,
.nav-cv {
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
}

.main-nav a { color: #3f4b54; }
.main-nav a:hover { color: var(--accent); }

.nav-cv {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: .95rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 88px 0 96px;
  background:
    radial-gradient(circle at 86% 12%, rgba(12,109,119,.12), transparent 28%),
    linear-gradient(180deg, #fbfdfd 0%, #ffffff 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
  align-items: center;
  gap: 44px;
}

.eyebrow,
.section-label {
  margin: 0 0 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .74rem;
  font-weight: 700;
}

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

h1, h2 {
  font-family: "Source Serif 4", Georgia, serif;
  letter-spacing: -.025em;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.55rem, 4vw, 4.15rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.hero-role {
  max-width: 680px;
  margin: 28px 0 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.hero-summary {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.primary:hover { background: var(--accent-dark); }

.button.secondary {
  border: 1px solid var(--line);
  background: white;
}

.button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 30px;
  color: var(--muted);
  font-size: .92rem;
}

.hero-meta a { text-decoration: none; }
.hero-meta a:hover { color: var(--accent); }

.social-links {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.social-links a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}

.social-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.social-links i {
  font-size: 16px;
  line-height: 1;
}

.portrait-wrap {
  position: relative;
  width: min(100%, 330px);
  justify-self: end;
}

.portrait-card {
  position: relative;
  z-index: 2;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(26, 52, 60, .16);
  background: #eef3f4;
}

.portrait-card img {
  width: 100%;
  aspect-ratio: 1 / 1.08;
  object-fit: cover;
  object-position: center 34%;
  transform: translateY(-5px);
}

.portrait-accent {
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 62%;
  height: 62%;
  border-radius: 28px;
  background: var(--accent-soft);
}

.section { padding: 104px 0; }
.section.alt { background: var(--soft); }

.two-col {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 88px;
  align-items: start;
}

h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
}

.prose {
  font-size: 1.08rem;
  color: #3e4b55;
}

.prose p { margin: 0 0 20px; }

.interest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 64px;
}

.interest-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.interest-card span {
  color: var(--accent);
  font-weight: 700;
  font-size: .82rem;
}

.interest-card h3 {
  margin: 46px 0 10px;
  font-size: 1.25rem;
}

.interest-card p {
  margin: 0;
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 60px;
  margin-bottom: 48px;
}

.section-heading > p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
}


/* =========================================================
   RESEARCH
   Compactado ligeramente para reducir altura de papers/WP
   ========================================================= */

.research-list {
  display: grid;
  gap: 12px;
}

.research-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 22px;
  padding: 20px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.research-item.featured {
  border-color: rgba(12,109,119,.45);
}

.research-year {
  color: var(--accent);
  font-weight: 700;
}

.tag {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.research-item h3 {
  margin: 0 0 5px;
  font-size: 1.28rem;
  line-height: 1.22;
}

.research-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.research-item a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}


/* =========================================================
   TEACHING
   ========================================================= */

.course-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}

.course-groups h3 {
  margin: 0 0 16px;
  font-size: 1.18rem;
}

.course-groups ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.course-groups li { margin: 7px 0; }


/* =========================================================
   EXPERIENCE
   ========================================================= */

.timeline {
  display: grid;
  gap: 0;
}

.timeline article {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 34px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.timeline article:last-child {
  border-bottom: 1px solid var(--line);
}

.timeline-date {
  color: var(--accent);
  font-weight: 700;
}

.timeline h3 {
  margin: 0 0 4px;
  font-size: 1.28rem;
}

.timeline p {
  margin: 8px 0 0;
  color: var(--muted);
}

.institution {
  color: var(--ink) !important;
  font-weight: 600;
}


/* =========================================================
   CONTACT
   ========================================================= */

.contact {
  padding: 88px 0;
  background: var(--navy);
  color: white;
}

.section-label.light { color: #82c7ce; }

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 70px;
  align-items: end;
}

.contact h2 { max-width: 760px; }

.contact-actions {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.contact-actions a {
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.35);
  padding-bottom: 5px;
}


/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
  padding: 24px 0;
  background: #0b222a;
  color: rgba(255,255,255,.68);
  font-size: .86rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-cv { margin-left: auto; }

  .hero { padding-top: 58px; }

  .hero-grid,
  .two-col,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid { gap: 46px; }

  h1 {
    white-space: normal;
    font-size: clamp(2.35rem, 8vw, 3.5rem);
  }

  .portrait-wrap {
    width: min(100%, 300px);
    max-width: 300px;
    justify-self: start;
  }

  .interest-grid { grid-template-columns: 1fr; }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 20px;
  }

  .course-groups { grid-template-columns: 1fr; }
}


@media (max-width: 620px) {
  .container {
    width: min(calc(100% - 28px), var(--max));
  }

  .section { padding: 76px 0; }
  .hero { padding: 48px 0 72px; }

  h1 { font-size: 3.2rem; }

  .research-item {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 18px 20px;
  }

  .timeline article {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-footer .container {
    flex-direction: column;
  }
}


@media (max-width: 1180px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(230px, .65fr);
    gap: 34px;
  }

  h1 {
    font-size: clamp(2.35rem, 3.7vw, 3.65rem);
  }

  .portrait-wrap {
    width: min(100%, 290px);
  }
}


@media (max-width: 560px) {
  .hero-grid {
    gap: 28px;
  }

  h1 {
    font-size: clamp(2.1rem, 11vw, 3rem);
    line-height: 1.05;
  }

  .portrait-wrap {
    width: min(78vw, 270px);
  }

  .social-links a {
    width: 32px;
    height: 32px;
  }

  .social-links i {
    font-size: 15px;
  }
}


/* =========================================================
   DARK MODE
   ========================================================= */

html[data-theme="dark"] {
  --ink: #edf4f5;
  --muted: #aab8bd;
  --line: #2d434b;
  --paper: #0f1d22;
  --soft: #14262d;
  --accent: #67c2cb;
  --accent-dark: #4aaab4;
  --accent-soft: #173b43;
  --navy: #0a171c;
}

html[data-theme="dark"] body {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .site-header {
  background: rgba(15, 29, 34, .9);
  border-bottom-color: rgba(45, 67, 75, .9);
}

html[data-theme="dark"] .main-nav a {
  color: #c2d0d4;
}

html[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 86% 12%, rgba(103,194,203,.10), transparent 28%),
    linear-gradient(180deg, #102127 0%, #0f1d22 100%);
}

html[data-theme="dark"] .button.secondary,
html[data-theme="dark"] .social-links a,
html[data-theme="dark"] .interest-card,
html[data-theme="dark"] .research-item,
html[data-theme="dark"] .theme-toggle {
  background: #13262d;
}

html[data-theme="dark"] .prose,
html[data-theme="dark"] .timeline p,
html[data-theme="dark"] .research-item p,
html[data-theme="dark"] .course-groups ul,
html[data-theme="dark"] .interest-card p,
html[data-theme="dark"] .section-heading > p {
  color: var(--muted);
}

html[data-theme="dark"] .institution {
  color: var(--ink) !important;
}

html[data-theme="dark"] .portrait-card {
  background: #183039;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

html[data-theme="dark"] .contact {
  background: #09161b;
}

html[data-theme="dark"] .site-footer {
  background: #071116;
}


/* =========================================================
   MOBILE LAYOUT REFINEMENTS
   ========================================================= */

@media (max-width: 620px) {
  .site-header .nav-wrap {
    min-height: 62px;
    gap: 14px;
  }

  .brand {
    width: 38px;
    height: 38px;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .hero {
    padding: 36px 0 58px;
  }

  .hero-grid {
    grid-template-columns: minmax(92px, 30vw) minmax(0, 1fr);
    gap: 10px 20px;
    align-items: start;
  }

  .hero-copy {
    display: contents;
  }

  .portrait-wrap {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 100%;
    max-width: 128px;
    justify-self: start;
    align-self: start;
    margin-top: 2px;
  }

  .portrait-card {
    border-radius: 18px;
    box-shadow: 0 14px 38px rgba(26, 52, 60, .15);
  }

  .portrait-card img {
    aspect-ratio: 1 / 1.14;
    object-position: center 30%;
    transform: none;
  }

  .portrait-accent {
    right: -8px;
    bottom: -8px;
    border-radius: 16px;
  }

  .eyebrow,
  .hero-copy h1,
  .hero-role {
    grid-column: 2;
    min-width: 0;
  }

  .eyebrow {
    margin: 0 0 2px;
    font-size: .65rem;
    line-height: 1.45;
    letter-spacing: .12em;
  }

  .hero-copy h1 {
    margin: 0;
    font-size: clamp(1.9rem, 9.5vw, 2.55rem);
    line-height: 1.02;
    overflow-wrap: anywhere;
  }

  .hero-role {
    margin: 5px 0 0;
    font-size: .9rem;
    line-height: 1.45;
  }

  .hero-summary,
  .hero-actions,
  .hero-meta,
  .social-links {
    grid-column: 1 / -1;
  }

  .hero-summary {
    margin: 18px 0 0;
    font-size: .98rem;
    line-height: 1.6;
  }

  .hero-actions {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .button {
    min-height: 46px;
    padding: 0 14px;
  }

  .hero-meta {
    margin-top: 20px;
  }

  .social-links {
    margin-top: 12px;
  }

  .two-col {
    gap: 28px;
  }

  .section-heading {
    margin-bottom: 34px;
  }

  h2 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .interest-grid {
    margin-top: 38px;
  }

  .interest-card {
    padding: 24px;
  }

  .interest-card h3 {
    margin-top: 28px;
  }

  .contact {
    padding: 70px 0;
  }
}


@media (max-width: 380px) {
  .hero-grid {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px 16px;
  }

  .hero-copy h1 {
    font-size: clamp(1.72rem, 9vw, 2.1rem);
  }

  .hero-role {
    font-size: .84rem;
  }
}
