/* ---------------------------------------------------------------
   Academic personal site — shared styles
   Experimental layout: centred hero (photo + name on the cover),
   horizontal tab bar, full-width content.
   --------------------------------------------------------------- */

:root {
  --page-width: 80%;
  --page-max: 3264px;

  /* never taller than a x-th of the screen */
  --cover-h: min(50vh, clamp(200px, 20vw, 320px));

  /* the photo sits in a single row beside the name, so it stays well
     inside the cover without having to scale with it */
  --photo: clamp(88px, 9vw, 118px);

  --ink: #1d1f21;
  --ink-soft: #4a4f55;
  --ink-faint: #7b8189;
  --rule: #e2e5e8;
  --bg: #ffffff;
  /* the very light ground the white sheet sits on */
  /* --page-bg: #fafafa35; */
  --page-bg: #fafafa35;
  /* gaps above and below the sheet, between it and the viewport edges */
  --sheet-margin: 1rem;
  /* inset of the content from the sheet's own left and right edges */
  --sheet-pad: 1.6rem;
  /* corner roundness of the sheet, top and bottom independently */
  --sheet-round-top: 10px;
  --sheet-round-bottom: 10px;
  --accent: #3c5a52;
  --accent-strong: #29403a;
  --social-color: #3c5a52d6; /* footer icon color */

  /* One font family throughout the site. */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* always reserve the scrollbar's width, so short pages (home,
     teaching) are laid out at the same width as long ones */
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.75;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(60, 90, 82, 0.3);
}

a:hover { border-bottom-color: var(--accent); }

/* --- page shell: centered 80% column ------------------------- */

.page {
  width: var(--page-width);
  max-width: var(--page-max);
  /* a white sheet floating on the page background */
  margin: var(--sheet-margin) auto;
  background: var(--bg);
  border-radius: var(--sheet-round-top) var(--sheet-round-top) var(--sheet-round-bottom) var(--sheet-round-bottom);
  box-shadow: 0 0 2px rgba(24, 32, 29, 0.05), 0 0 34px rgba(24, 32, 29, 0.07);
  padding-bottom: 1rem;
  /* fills the screen so the footer can sit at the bottom of short
     pages, and simply follows the content on long ones */
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--sheet-margin) - var(--sheet-margin));
  min-height: calc(100dvh - var(--sheet-margin) - var(--sheet-margin));
}

/* --- hero: photo + name centred on the cover ------------------ */

/* The image is taken out of flow and pinned to the hero's exact box, so
   its height is always definite. That is what lets object-fit actually
   engage: as a grid/flex child with a percentage height it fell back to
   its natural height and got clipped from the bottom instead. */
.hero {
  position: relative;
  /* follows the sheet's rounded top corners */
  border-radius: var(--sheet-round-top) var(--sheet-round-top) 0 0;
  min-height: var(--cover-h);
  flex-shrink: 0;
  flex-direction: column;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* equal trim off the top and bottom */
  object-position: center;
}

/* photo and name side by side, as one centred group — a short row
   leaves the middle of the cover visible around it */
.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 1rem;
  /* Reserve a separate row for navigation within the cover. */
  flex: 1;
  width: 100%;
}

.hero__photo {
  flex: none;
  width: var(--photo);
  height: var(--photo);
  object-fit: cover;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.hero__text { text-align: center; }

.hero__name {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #fff;
  margin: 0 0 0.4rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.hero__role {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* --- tab bar over the cover  ---------------------------------- */

.tabs {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100%;
  background: rgba(226, 235, 232, 0);
  border-top: 0px solid rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
}

.tabs a {
  padding: 0.85rem 1.5rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.025em;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  border: none;
  border-bottom: 0px solid transparent;
  margin-bottom: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.tabs a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.tabs a[aria-current="page"] {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.85);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}

.tabs a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

/* --- page content --------------------------------------------- */

.content {
  /* keeps text off the sheet edges */
  padding: 1.8rem var(--sheet-pad) 0;
  /* takes up the leftover height, pushing the footer down */
  flex: 1;
}

.content > :first-child { margin-top: 0; }

.content h2 {
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.4;
  letter-spacing: 0;
  margin: 2.2rem 0 0.8rem;
}

/* the intro line (Detailed CV / Google Scholar) sits closer to the
   first section heading than the sections sit to each other */
.content > p:first-child + h2 { margin-top: 1rem; }

.content p { margin: 0 0 1rem; color: var(--ink-soft); }

.content ul { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--ink-soft); }

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

.item {
  margin-bottom: 1.1rem;
  padding-inline-start: 1.1rem;
}

.item__title { position: relative; font-size: 1.0625rem; font-weight: 500; line-height: 1.5; color: var(--ink); }

.item__title::before,
.talks-list > li::before {
  content: "";
  position: absolute;
  inset-inline-start: -1.1rem;
  /* 4px is a whole number of screen pixels at 100/125/150/175/200%
     zoom, and with no transform every dot snaps to the pixel grid, so
     they all render the same size instead of some looking bigger */
  top: calc(0.75em - 2px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 1;
}

.content .talks-list {
  list-style: none;
  padding-inline-start: 1.1rem;
}

.content .talks-list > li {
  position: relative;
  margin-bottom: 1rem;
}

/* talk type: bullet colour */
.talks-list {
  --talk-seminar: var(--accent);
  --talk-poster: #b8741a;
}
.talks-list > li.talk--seminar::before { background: var(--talk-seminar); }
.talks-list > li.talk--poster::before  { background: var(--talk-poster); }

/* the PhD defence gets a celebratory graduation cap instead of a dot,
   centred where the dot would be */
.talks-list > li.talk--defence::before {
  inset-inline-start: calc(-1.1rem + 2px - 5px);
  top: calc(0.75em - 5px);
  width: 10px;
  height: 10px;
  border-radius: 0;
  background: #8b1a1a;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 1 9l11 6 9-4.91V17h2V9L12 3zM5.18 13.18v4L12 21l6.82-3.82v-4L12 17l-6.82-3.82z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 1 9l11 6 9-4.91V17h2V9L12 3zM5.18 13.18v4L12 21l6.82-3.82v-4L12 17l-6.82-3.82z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.talks-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
  /* same gap under the heading as .content h2 on the other tabs */
  margin-bottom: 0.8rem;
}
.talks-head h2 { margin: 0; }

.content .talks-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  /* tight enough that the legend doesn't make the heading row taller
     than a plain h2, so the first talk lines up with the other tabs */
  line-height: 1;
}
.content .talks-legend li { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; }
.content .talks-legend li::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c);
}
.talks-legend .talk--seminar { --c: var(--accent); }
.talks-legend .talk--poster  { --c: #b8741a; }

.talk__event {
  color: var(--ink);
  font-weight: 400;
  line-height: 1.5;
}

.talk__venue { font-weight: 500; }

.item__meta { color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.65; margin-top: 0.25rem; }

.item__desc { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.9375rem; }

.content .item__facts {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.item__facts li {
  position: relative;
  padding-inline-start: 1em;
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.item__facts li::before {
  content: "\2023";
  position: absolute;
  inset-inline-start: 0;
  top: 0.875em;
  line-height: 1;
  transform: translateY(-50%) scale(1.1);
  transform-origin: left center;
  color: var(--accent);
  opacity: 1;
  font-weight: 400;
}

.item__facts strong {
  font-weight: 500;
  color: var(--ink);
}

/* short facts that read better side by side, e.g. languages */
.item__facts--inline {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.6rem;
}

.item__facts--inline li::before {
  content: "";
  top: 0.875em;
  transform: translateY(-50%);
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 1;
}

.item__link {
  display: inline-block;
  transform: translateY(-1px);
  margin-inline-start: 0.65rem;
  font-size: 0.9375rem;
}

/* --- PhD manuscript: set apart from the regular item list ----- */

.manuscript {
  margin: 0 0 1.6rem;
  padding: 1.15rem 1.35rem;
  border-left: 3px solid var(--accent);
  background: rgba(60, 90, 82, 0.06);
  border-radius: 0px 0px 0px 0px;
}

.manuscript__title {
  font-family: var(--font);
  /*font-style: italic;*/
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
}

.manuscript__meta {
  line-height: 1.65;
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.manuscript__desc {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.manuscript__link {
  display: inline-block;
  transform: translateY(-1px);
  margin-inline-start: 0.65rem;
  font-size: 0.9375rem;
}

/* --- footer --------------------------------------------------- */

.footer {
  /* the rule spans the full sheet width; only the text is inset */
  margin: 3.5rem 0 0;
  padding: 1rem var(--sheet-pad) 0;
  border-top: 0px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.footer--home {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-inline-start: auto;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 4px;
  color: var(--social-color);
}

.social-links svg { display: block; width: auto; height: 1.25rem; }
.social-links a[aria-label="Email"] svg { height: 1.1rem; }

.social-links a:hover { opacity: 0.75; }
.social-links a:focus-visible { outline: 2px solid var(--social-color); outline-offset: 2px; }

/* --- small screens -------------------------------------------- */

@media (max-width: 720px) {
  :root {
    --page-width: 96%;
    --sheet-margin: 0.25rem;
    --sheet-pad: 1.1rem;
    /* --photo is left alone: it already scales off --cover-h, which
       keeps responding correctly to the 33vh cap on short screens */
  }

  .hero__inner { gap: 0.9rem; }

  .tabs a { padding: 0.7rem 0.85rem; font-size: 0.9375rem; }

  .content { padding-top: 1.4rem; }

}
