/* Two-column layout: sticky profile sidebar + content. Uses al-folio theme variables,
   so it follows the light/dark toggle automatically. */

/* Accent colour: blue instead of al-folio's default purple (dark mode keeps al-folio's cyan). */
html:not([data-theme="dark"]) {
  --global-theme-color: #1565c0;
  --global-hover-color: #1565c0;
}
.profile-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
}

.profile-sidebar {
  position: sticky;
  top: 5.5rem;
  font-size: 0.95rem;
}

.profile-sidebar__photo {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1.1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.profile-sidebar__name {
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--global-text-color);
}

.profile-sidebar__role {
  margin-top: 0.3rem;
  color: var(--global-text-color-light);
}

.profile-sidebar__links {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
}

.profile-sidebar__links li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.22rem 0;
  color: var(--global-text-color);
}

.profile-sidebar__links i {
  width: 1.15rem;
  flex: none;
  text-align: center;
  color: var(--global-theme-color);
}

.profile-sidebar__links a {
  color: var(--global-text-color);
  text-decoration: none;
}

.profile-sidebar__socials a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.profile-sidebar__links a:hover {
  color: var(--global-theme-color);
}

.profile-sidebar__socials {
  padding-top: 1rem;
  border-top: 1px solid var(--global-divider-color);
}

.profile-main .post-header {
  margin-bottom: 1.5rem;
}

.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--global-theme-color);
  border-radius: 6px;
  color: var(--global-theme-color);
  text-decoration: none;
}

.cv-download:hover {
  background: var(--global-theme-color);
  color: var(--global-hover-text-color);
}

.cv-embed {
  width: 100%;
  height: 80vh;
  min-height: 600px;
  border: 1px solid var(--global-divider-color);
  border-radius: 6px;
}

/* ---------- Cards used by the projects, teaching and grants sections ---------- */
.item-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}

.item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--global-divider-color);
}

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

.item__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.item__title {
  font-weight: 600;
  color: var(--global-text-color);
}

.item__title a {
  color: inherit;
}

.item__title a:hover {
  color: var(--global-theme-color);
}

.item__when {
  color: var(--global-text-color-light);
  font-size: 0.9rem;
  white-space: nowrap;
}

.item__meta {
  color: var(--global-text-color-light);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.item__body {
  margin-top: 0.4rem;
}

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

.item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0;
  list-style: none;
}

.item__tags li {
  font-size: 0.78rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--global-divider-color);
  border-radius: 999px;
  color: var(--global-text-color-light);
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* ---------- Tablet & phone ---------- */
@media (max-width: 860px) {
  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }

  .profile-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--global-divider-color);
  }

  .profile-sidebar__photo {
    grid-row: span 2;
    width: 80px;
    height: 80px;
    margin: 0;
  }

  .profile-sidebar__name {
    font-size: 1.3rem;
    align-self: end;
  }

  .profile-sidebar__role {
    align-self: start;
    font-size: 0.9rem;
  }

  .profile-sidebar__links {
    grid-column: 1 / -1;
    margin-top: 0.9rem;
    font-size: 0.9rem;
  }

  .profile-sidebar__links li {
    padding: 0.12rem 0;
  }

  /* Profile links become a row of icon buttons */
  .profile-sidebar__socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0;
    border-top: none;
    margin-top: 0.75rem;
  }

  .profile-sidebar__socials li {
    padding: 0;
  }

  .profile-sidebar__socials a {
    width: 2.6rem;
    height: 2.6rem;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--global-divider-color);
    border-radius: 50%;
    font-size: 1.15rem;
  }

  .profile-sidebar__socials i {
    width: auto;
  }

  .profile-sidebar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .profile-main .post-title {
    font-size: 2rem;
  }
}

/* Phone navbar: the theme makes it 95% opaque, so the open menu let the page show through */
@media (max-width: 575.98px) {
  .navbar {
    opacity: 1;
  }

  .navbar-collapse-main.show {
    padding-bottom: 0.75rem;
  }
}

/* Browsers on phones and tablets can't show an embedded PDF (and draw a blank white box),
   so the CV page shows only the open/download buttons there. */
@media (max-width: 860px), (hover: none) and (pointer: coarse) {
  .cv-embed {
    display: none;
  }
}
