/* ---------------------------------------------------------
   Personal homepage — minimal academic style
   Light/dark themes + EN/ES language toggle
   --------------------------------------------------------- */

:root {
  --text: #404040;
  --heading: #1c1c1d;
  --muted: #828282;
  --link: #e74c3c;
  --link-hover: #b03a2e;
  --border: #e9e9e9;
  --bg: #ffffff;
  --accent-bg: #f7f7f8;
  --shadow: rgba(0, 0, 0, 0.12);
  --max-width: 1060px;
}

html[data-theme="dark"] {
  --text: #c9c9cc;
  --heading: #f0f0f2;
  --muted: #8e8e93;
  --link: #ff6b5e;
  --link-hover: #ff9085;
  --border: #2c2c2e;
  --bg: #1a1a1c;
  --accent-bg: #232325;
  --shadow: rgba(0, 0, 0, 0.5);
}

/* Theme toggle icon visibility */
html[data-theme="light"] .when-dark { display: none; }
html[data-theme="dark"] .when-light { display: none; }

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ----------------------- Masthead ----------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.masthead__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--heading);
}

.site-title:hover {
  text-decoration: none;
  color: var(--link);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.15rem;
}

.site-nav a {
  color: var(--text);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--link);
  text-decoration: none;
}

.toggle-btn {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  line-height: 1.4;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toggle-btn:hover {
  color: var(--link);
  border-color: var(--link);
}

/* ----------------------- Layout ------------------------- */

.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.layout--single {
  grid-template-columns: 1fr;
  max-width: 860px;
}

/* ----------------------- Sidebar ------------------------ */

.sidebar {
  position: sticky;
  top: 5rem;
  font-size: 0.92rem;
}

.sidebar__photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin-bottom: 1rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.sidebar__name {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  color: var(--heading);
  line-height: 1.25;
}

.sidebar__bio {
  margin: 0 0 0.3rem;
  color: var(--muted);
}

.sidebar__affiliation {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-weight: 600;
}

.sidebar__links {
  list-style: none;
  margin: 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--border);
}

.sidebar__links li {
  margin-bottom: 0.55rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.sidebar__links .icon {
  color: var(--muted);
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

/* ----------------------- Content ------------------------ */

.content section {
  margin-bottom: 1.5rem;
}

.content section:last-child {
  margin-bottom: 0;
}

.content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--heading);
  margin: 0 0 0.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: 1.12rem;
  color: var(--heading);
  margin: 1.2rem 0 0.6rem;
}

.content p {
  margin: 0 0 0.7rem;
}

.content p:last-child {
  margin-bottom: 0;
}

.content ul {
  padding-left: 1.3rem;
  margin: 0 0 1rem;
}

.content li {
  margin-bottom: 0.6rem;
}

.aside-note {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

.proposal-link {
  font-weight: 600;
}

.wip {
  color: var(--muted);
}

/* ----------------------- Skills ------------------------- */

.skills {
  margin: 0;
}

.skills__row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.skills__row:last-child {
  border-bottom: none;
}

.skills dt {
  font-weight: 700;
  color: var(--heading);
}

.skills dd {
  margin: 0;
}

/* ----------------------- CV ----------------------------- */

.cv-embed {
  width: 100%;
  height: 780px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--accent-bg);
}

/* ----------------------- Responsive --------------------- */

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .sidebar__photo {
    margin-left: auto;
    margin-right: auto;
  }

  .sidebar__links {
    width: 100%;
    max-width: 320px;
  }

  .sidebar__links li {
    justify-content: center;
  }

  .skills__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .cv-embed {
    height: 520px;
  }
}
