/* ===== Design tokens =====
   Every gap/margin/padding uses --space-*; every corner uses --radius
   (chips use --radius-pill, round dots use 50%). */
:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 4rem;

  --radius: 8px;
  --radius-pill: 999px;
}

/* Theme buttons and form fields are square by default; match the radius */
input[type="submit"], input[type="reset"], input[type="button"], button, .button,
input[type="text"], input[type="password"], input[type="email"], input[type="search"],
select, textarea {
  border-radius: var(--radius);
}

/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ===== Header / Logo ===== */
#header a.logo,
#header a.logo:hover,
#header a.logo:focus {
  border: 0 !important;
  border-bottom: none !important;
  text-decoration: none !important;
  box-shadow: none !important;
  background-image: none !important;
}

#header .logo img {
  display: block;
  height: 9rem;
}


/* ===== Images & aspect ratios ===== */
.image.fit,
.image.main {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.image.fit img,
.image.main img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
}


/* ===== Home page cards ===== */

/* Softer, rounded image tiles that read as clickable */
.home-cards .image.fit {
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.home-cards .image.fit img {
  transition: transform 0.4s ease;
}

.home-cards .image.fit:hover,
.home-cards .image.fit:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

/* Gentle zoom on hover (clipped by the tile's overflow: hidden) */
.home-cards .image.fit:hover img,
.home-cards .image.fit:focus-visible img {
  transform: scale(1.04);
}


/* ===== Research page layout ===== */

/* Full-width articles inside the wide-grid posts section */
#main>.posts.wide-grid>* {
  flex-basis: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Divider between research blocks. The theme draws a top border on grid
   articles but hides it on the first two (a 2-column assumption), which
   leaves no break in this single-column layout. Restore a consistent rule. */
#main>.posts.wide-grid>article {
  border-top: 2px solid #eeeeee !important;
  border-left-width: 0 !important;
}

#main>.posts.wide-grid>article:first-child {
  border-top-width: 0 !important;
}

/* Side-by-side image + text, alternating left/right */
.pub-body {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.pub-block.left .pub-body {
  flex-direction: row;
}

.pub-block.right .pub-body {
  flex-direction: row-reverse;
}

.pub-image {
  flex: 0 0 28%;
  max-width: 360px;
  min-width: 220px;
}

.pub-image img {
  width: 100%;
  height: auto;
  display: block;
}

.pub-content {
  flex: 1;
  min-width: 0;
  line-height: 1.8;
  overflow: hidden;
}

/* strip the theme's outer paragraph margins so the text block truly centers
   against the image instead of sitting high above phantom bottom space */
.pub-content > :first-child {
  margin-top: 0;
}

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

.pub-block {
  text-align: left;
  padding: var(--space-6) var(--space-7) !important;
}

/* Headings not centered by parent .posts */
#main>.posts.wide-grid .major {
  text-align: left;
}

/* Responsive: image stacks on top, full width, on small screens */
@media (max-width: 900px) {
  .pub-body {
    flex-direction: column !important;
    align-items: center;
  }

  .pub-image {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0 0 var(--space-4) 0;
  }

  .pub-content {
    overflow: visible;
  }
}

/* Selected Publications */
.pub-selected {
  margin-top: var(--space-2);
}

.pub-selected,
.pub-selected * {
  text-align: left !important;
}

.pub-selected h3 {
  margin: var(--space-1) 0 var(--space-1);
}

.pub-list {
  margin: var(--space-1) 0 var(--space-2);
  padding-left: var(--space-4);
}

.pub-list li {
  line-height: 1.5;
  margin: var(--space-1) 0;
}

.pub-list li * {
  line-height: inherit;
}


/* ===== Members page ===== */

/* Two-column grid (one column on small screens) */
.members-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 736px) {
  .members-grid {
    grid-template-columns: 1fr;
  }
}

.members-grid>article {
  width: auto;
  margin: 0 0 var(--space-3);
}

/* Group photo carousel (one photo at a time, auto-rotating) */
.members-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  margin-bottom: var(--space-5);
}

.carousel-track {
  position: relative;
  aspect-ratio: 16 / 9;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease;
}

.carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Small control bar in normal flow under the photo */
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

/* Prev / next arrows — light grey squares */
.carousel-nav {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  color: #333;
  background: rgba(230, 230, 230, 0.85);
  border: 0;
  border-radius: var(--radius);
  box-shadow: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.carousel-nav:hover,
.carousel-nav:focus-visible {
  background: rgba(210, 210, 210, 0.95);
  box-shadow: none;
}

/* Dot indicators */
.carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.carousel-dot {
  width: 0.8rem;
  height: 0.8rem;
  padding: 0;
  border: 0;
  box-shadow: none;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dot.is-active {
  background: #2b6534;
  transform: scale(1.25);
}

@media (max-width: 736px) {
  .carousel-nav {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.4rem;
  }
}

.caption {
  opacity: 0.7;
  margin-top: calc(-1 * var(--space-3));
  margin-bottom: var(--space-6);
}

/* Person card */
.person-card {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  padding: var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, .15);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
}

.pc-media {
  flex: 0 0 225px;
  max-width: 225px;
  margin-bottom: var(--space-2);
}

@media (max-width: 980px) {
  .pc-media {
    flex-basis: 160px;
    max-width: 160px;
  }
}

@media (max-width: 736px) {
  .person-card {
    flex-direction: column;
  }

  .pc-media {
    flex-basis: auto;
    max-width: 100%;
  }
}

.pc-image {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
}

.pc-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-card .pc-body header.minor {
  margin: 0 0 var(--space-1);
}

.person-card .pc-body h4 {
  margin: 0 0 var(--space-1);
  line-height: 1.2;
}

.person-card .pc-section {
  margin: 0 0 var(--space-1);
  color: dimgrey;
}

.person-card .pc-info p {
  margin: 0;
}

.person-card .pc-info p:last-child {
  margin-bottom: 0;
}

.person-card .pc-info a.icon,
.person-card .pc-info .icon .fa {
  margin-right: var(--space-2);
}

.person-card ul.icons {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: var(--space-2);
}

.person-card ul.icons li {
  margin: 0;
}

/* Group-leader card variant */
.member-overlay--leader .member-overlay-panel {
  max-width: 950px;
}

.person-card--leader {
  border: 1px solid rgba(43, 101, 52, 0.35);
  border-left: 4px solid #2b6534;
  background: rgba(43, 101, 52, 0.05);
  border-radius: var(--radius);
}

.person-card--leader .pc-section {
  color: #2b6534;
}

.pc-subtitle {
  margin: 0 0 var(--space-1);
  color: dimgrey;
  font-size: 0.9em;
  line-height: 1.3;
}

.member-subtitle {
  margin: 0 0 var(--space-2);
  color: dimgrey;
  font-size: 0.9em;
}

#members header.major hr {
  margin: var(--space-2) 0;
}

/* Contact card (group leader block on members page) */
.contact-card {
  margin: var(--space-2) 0;
  padding: var(--space-4) var(--space-7) !important;
}

.contact-card p {
  margin: var(--space-1) 0;
}


/* ===== Publications list ===== */
ol.publications {
  text-align: left;
}

ol.publications li {
  text-align: left;
}

ol.publications a {
  text-align: left;
  display: block;
}


/* ===== Teaching page ===== */
.section-heading {
  text-align: center;
}

/* one grey rule above each heading only — not above the card grids too */
#main > section.teaching-boxes {
  border-top: 0 !important;
}

#main > .section-heading {
  padding-bottom: var(--space-4);
}

section.posts.teaching-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: 0 var(--space-7) var(--space-6) var(--space-7) !important;
}

section.posts.teaching-boxes > .teaching-card {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 250px;
  display: flex;
  padding: 0 !important;
  text-decoration: none;
  border-bottom: none;
}

section.posts.teaching-boxes article {
  position: relative;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: var(--space-6) !important;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-align: left;
}

a.teaching-card:hover article {
  border-color: #2B6534;
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

a.teaching-card:hover article header.major h3 {
  color: #2B6534;
}

section.posts.teaching-boxes article header.major {
  margin: 0;
  padding: 0;
  text-align: left;
}

section.posts.teaching-boxes article header.major h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: 1.25em;
  line-height: 1.3;
  color: #212931;
  transition: color 0.2s ease;
}

section.posts.teaching-boxes article > p {
  margin: 0;
  color: #555;
  line-height: 1.5;
  font-size: 0.85em;
}

/* ===== Chips (course term, research keywords, students) =====
   Height comes from line-height, so no off-scale vertical padding is needed */
.term-chip,
.research-chip,
.students-list li {
  display: inline-block;
  padding: 0 var(--space-2);
  line-height: 1.75;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: normal;
  color: #555;
  white-space: nowrap;
}

/* term chip next to a course title (e.g. "2 SWS"), sized relative to the heading */
.term-chip {
  vertical-align: middle;
  margin-left: var(--space-1);
  font-size: 0.55em;
}

@media screen and (max-width: 736px) {
  section.posts.teaching-boxes {
    padding-left: var(--space-6) !important;
    padding-right: var(--space-6) !important;
  }

  section.posts.teaching-boxes > .teaching-card {
    flex: 1 1 100%;
    min-width: 100%;
  }
}


/* ===== Funding / funders section ===== */
:root {
  --funder-h: 72px;
}

@media (min-width: 1200px) {
  :root {
    --funder-h: 160px;
  }
}

@media (max-width: 480px) {
  :root {
    --funder-h: 52px;
  }
}

.funders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  align-items: center;
  padding: 0;
}

.funders li {
  list-style: none;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--funder-h) + 0.5rem);
}

.funders a {
  display: block;
  line-height: 0;
}

.funders img {
  height: var(--funder-h);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}


/* ===== Footer logos ===== */
:root {
  --footer-logo-h: 80px;
}

@media (min-width: 1200px) {
  :root {
    --footer-logo-h: 96px;
  }
}

@media (max-width: 480px) {
  :root {
    --footer-logo-h: 40px;
  }
}

#footer .footer-logos {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 0 0 var(--space-4);
}

#footer .footer-logos img {
  height: var(--footer-logo-h);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* Forces a new row to start at this item (flex line break) */
#footer .footer-logos .footer-logos-break {
  flex-basis: 100%;
  height: 0;
  margin: 0;
}

#footer .footer-logos .footer-logo-item {
  line-height: 0;
  padding: var(--space-2);
}

#footer .footer-logos .text-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--footer-logo-h);
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.2;
  text-align: center;
  background: rgba(0, 0, 0, 0.03);
  color: inherit;
  text-decoration: none;
}

#footer .footer-logos .text-badge:hover {
  background: rgba(0, 0, 0, 0.06);
}


/* ===== Member profile overlay ===== */

.member-card {
  cursor: pointer;
  transition: opacity 0.15s;
}

.member-card:hover {
  opacity: 0.85;
}

.member-card:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: var(--radius);
}

.member-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.member-overlay[hidden] {
  display: none;
}

.member-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.member-overlay-panel {
  position: relative;
  background: #fff;
  color: #333;
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--space-6);
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.7);
}

/* Override Massively's global button styles (height, padding, box-shadow, color !important) */
.member-overlay-panel .member-overlay-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  height: auto;
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  font-size: 0.85rem;
  font-weight: normal;
  letter-spacing: normal;
  text-transform: none;
  background: none;
  border: none;
  box-shadow: none !important;
  color: #aaa !important;
  cursor: pointer;
  border-radius: var(--radius);
}

.member-overlay-panel .member-overlay-close:hover {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: none !important;
  color: #555 !important;
}

.member-overlay-header {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.member-overlay-photo {
  flex: 0 0 30%;
  max-width: 200px;
}

.member-overlay-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.member-overlay-name {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: 1.15rem;
  color: #111;
}

/* rule line filling the space right of the name, matching section dividers */
.member-overlay-name::after {
  content: "";
  flex: 1;
  border-top: 1px solid #e5e5e5;
}

.member-overlay-meta .member-role {
  margin: 0 0 var(--space-2);
  color: #777;
  font-size: 0.8rem;
}

.research-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-1) 0 var(--space-1);
}

.member-overlay-links {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: 1rem;
}

.member-overlay-links a {
  color: #555 !important;
  border-bottom: none !important;
}

.member-overlay-links a:hover {
  color: #111 !important;
}

.member-overlay-content {
  border-top: 1px solid #e5e5e5;
  padding-top: var(--space-4);
  margin-top: var(--space-1);
  color: #333;
}

.member-overlay-content p {
  font-size: 0.78rem;
  line-height: 1.5;
  margin: 0 0 var(--space-2);
}

/* publication list inside overlay */
.member-overlay-content h3 {
  color: #111;
  font-size: 0.85rem;
  margin: var(--space-2) 0 var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid #e5e5e5;
}

/* the wrapper already draws a divider — no second line under it */
.member-overlay-content > h3:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.member-overlay-content ol.publications {
  padding-left: var(--space-4);
  margin: 0;
}

.member-overlay-content ol.publications li {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #333;
}

.member-overlay-content ol.publications a {
  display: block;
  padding: var(--space-1) 0;
  color: #000000 !important;
}

.member-overlay-content ol.publications a:hover {
  color: #2B6534 !important;
}

/* CV and Students sections (below .member-overlay-content) */
.member-overlay-section {
  border-top: 1px solid #e5e5e5;
  margin-top: var(--space-5);
  padding-top: var(--space-3);
}

/* same breathing room before a content block (publications) that follows a section */
.member-overlay-section + .member-overlay-content {
  margin-top: var(--space-5);
}

.member-overlay-section h3 {
  color: #111;
  font-size: 0.85rem;
  margin: 0 0 var(--space-1);
}

.cv-list {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  margin: 0;
  position: relative;
  --cv-dot: 0.45rem;
  padding-left: var(--space-4);
}

/* vertical timeline line, dots per entry sit on top of it */
.cv-list::before {
  content: "";
  position: absolute;
  left: calc(var(--cv-dot) / 2 - 0.5px);  /* through the dot centres */
  top: var(--space-1);
  bottom: var(--space-1);
  width: 1px;
  background: #e5e5e5;
}

.cv-list dt {
  font-size: 0.78rem;
  font-weight: normal;
  color: #777;
  white-space: nowrap;
  position: relative;
}

.cv-list dt::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-4));
  top: 0.3em;
  width: var(--cv-dot);
  height: var(--cv-dot);
  border-radius: 50%;
  background: #2B6534;
}

.cv-list dd {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #333;
  margin: 0;
}

/* optional second line per CV entry (thesis title, group, …) */
.cv-detail {
  display: block;
  font-size: 0.72rem;
  color: #777;
}

/* students rendered as chips, matching the research keywords */
.students-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0;
  margin: 0;
}

/* muted supervision type (Forschi / BSc / MSc) inside the chip */
.students-list .student-type {
  color: #777;
  font-size: 0.7rem;
}

.students-list .student-type::before {
  content: "·";
  margin: 0 var(--space-1) 0 var(--space-1);
}

/* prevent body scroll while overlay is open */
body.overlay-open {
  overflow: hidden;
}

@media (max-width: 520px) {
  .member-overlay-header {
    flex-direction: column;
  }

  .member-overlay-photo {
    flex-basis: auto;
    max-width: 130px;
  }

  .member-overlay-panel {
    padding: var(--space-5);
  }

  .cv-list {
    grid-template-columns: 5rem 1fr;
  }
}


/* ===== Miscellaneous ===== */

/* Center action button rows */
ul.actions {
  justify-content: center;
  text-align: center;
}