/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */
:root {
  --color-primary: #1e4e79;
  --color-primary-light: #6EC1E4;
  --color-secondary: #54595F;
  --color-text: #595959;
  --color-text-light: #7A7A7A;
  --color-heading: #191919;
  --color-accent: #61CE70;
  --color-dark: #4054B2;
  --color-green: #23A455;
  --color-white: #FFF;
  --color-black: #000;
  --color-bg: #FFF;
  --color-bg-light: #F7F7F7;

  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-base: 20px;
  --font-size-nav: 16px;
  --font-size-subnav: 13px;
  --font-weight-body: 400;
  --font-weight-heading: 500;
  --font-weight-bold: 600;

  --max-width: 1140px;
  --header-height: 200px;
  --spacing-unit: 20px;
  --border-radius: 4px;
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/worksans/v19/QGYsz_wNahGAdqQ43Rh_fKDptfpA4Q.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/worksans/v19/QGYsz_wNahGAdqQ43Rh_fKDptfpA4Q.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/worksans/v19/QGYsz_wNahGAdqQ43Rh_fKDptfpA4Q.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  color: var(--color-heading);
  line-height: 1.3;
  margin-top: 0;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.25rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.375rem;
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-top: 0;
  margin-bottom: 1em;
}

strong {
  font-weight: var(--font-weight-bold);
}

header {
  background-color: var(--color-primary);
  padding: 0;
  position: relative;
}

header > div {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

header > div > a:first-child {
  color: var(--color-white);
  font-size: 2.25rem;
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  letter-spacing: -0.5px;
}

header > div > a:first-child:hover {
  color: var(--color-white);
  text-decoration: none;
  opacity: 0.9;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  color: var(--color-white);
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-heading);
  text-decoration: none;
  position: relative;
  padding: 0.25rem 0;
  transition: opacity 0.2s ease;
}

nav a:hover {
  color: var(--color-white);
  text-decoration: none;
  opacity: 0.85;
}

nav a.active {
  text-decoration: underline !important;
  text-underline-offset: 4px;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 180px;
  height: 0.5rem;
}

.nav-dropdown-toggle::after {
  content: " ▾";
  font-size: 0.65em;
  vertical-align: middle;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-primary);
  min-width: 180px;
  padding: 0.5rem 0;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-size: var(--font-size-subnav);
  font-weight: var(--font-weight-body);
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.nav-dropdown-menu a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-nav);
  color: var(--color-white);
}

.language-switcher a {
  color: rgba(255, 255, 255, 0.8);
}

.language-switcher a:hover {
  color: var(--color-white);
}

.language-switcher strong {
  color: var(--color-white);
}

main {
  min-height: 60vh;
}

main > div {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--spacing-unit);
}

article {
  max-width: var(--max-width);
  margin: 0 auto;
}

article header {
  background: none;
  padding: 0;
  margin-bottom: 2rem;
}

article header h1 {
  font-size: 2.25rem;
  color: var(--color-heading);
  margin-bottom: 0.5rem;
}

article header > p {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

article header img {
  width: 100%;
  border-radius: var(--border-radius);
  margin-top: 1rem;
}

article > div {
  line-height: 1.75;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
}

.logo {
    height: 180px;
    width: auto;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-primary);
}

.page-header h1 {
  margin-bottom: 0;
}

.listing-items {
  margin-top: 1.5rem;
}

.listing-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.listing-item,
.listing-item:link,
.listing-item:visited {
  color: inherit;
  text-decoration: none;
  display: block;
}

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

.listing-item h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.listing-item h2 {
  color: var(--color-heading);
}

.listing-item:hover h2 {
  color: var(--color-primary);
}

.listing-item .date {
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.publication-entry {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.publication-entry:last-child {
  border-bottom: none;
}

.publication-meta {
	color: var(--color-text-light);
	font-size: 0.9rem;
	margin-bottom: 0.5rem;
}

.publication-links {
	font-size: 0.85rem;
	margin-bottom: 0.25rem;
}

.publication-links a {
	color: var(--color-primary);
	word-break: break-all;
}

.publication-abstract {
	margin-top: 0.75rem;
}

/* Category badges sit outside .listing-content so they stay readable while the
   entry is collapsed. Each one is a button that jumps the filter to it. */
.publication-categories {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.5rem;
}

.publication-category {
	padding: 0.1rem 0.55rem;
	background: var(--color-bg-light);
	color: var(--color-text-light);
	border: 1px solid var(--pf-border);
	border-radius: 999px;
	font-family: var(--font-body);
	font-size: 0.7rem;
	font-weight: var(--font-weight-body);
	line-height: 1.6;
	white-space: nowrap;
	cursor: pointer;
}

.publication-category:hover {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: var(--color-white);
}

.publication-category:focus-visible {
	outline: none;
	border-color: var(--color-primary);
	box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.45);
}

@media (prefers-reduced-motion: no-preference) {
	.publication-category {
		transition: background-color 0.15s ease, border-color 0.15s ease,
			color 0.15s ease;
	}
}

/* ---------- Category filter (publications) ---------------------------------
   Custom listbox: a trigger button plus a styled option panel. The native
   <select> cannot style its open menu, hence the ARIA listbox pattern. */

.cat-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.cat-filter-label {
	font-size: 0.9rem;
	font-weight: var(--font-weight-bold);
	color: var(--color-heading);
}

.cat-filter-control {
	position: relative;
}

.cat-filter-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem;
	min-width: 19rem;
	max-width: 100%;
	padding: 0.55rem 0.95rem;
	background: var(--color-white);
	color: var(--color-heading);
	border: 1px solid var(--pf-border);
	border-radius: var(--border-radius);
	font-family: var(--font-body);
	font-size: 0.9rem;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
}

.cat-filter-trigger:hover {
	border-color: var(--color-primary-light);
	box-shadow: var(--pf-shadow-sm);
}

/* keep a clearly visible focus indicator -- never remove it outright */
.cat-filter-trigger:focus-visible {
	outline: none;
	border-color: var(--color-primary);
	box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.45);
}

.cat-filter.is-open .cat-filter-trigger {
	border-color: var(--color-primary);
	box-shadow: var(--pf-shadow-sm);
}

.cat-filter-value {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cat-filter-chevron {
	flex: none;
	font-size: 0.7em;
	color: var(--color-primary);
}

.cat-filter.is-open .cat-filter-chevron {
	transform: rotate(180deg);
}

.cat-filter-menu {
	position: absolute;
	top: calc(100% + 0.4rem);
	left: 0;
	z-index: 150; /* above the listing, below the header nav (200) */
	min-width: 100%;
	/* the option list outgrows short viewports -- scroll rather than overflow */
	max-height: min(60vh, 26rem);
	overflow-y: auto;
	margin: 0;
	padding: 0.35rem;
	list-style: none;
	background: var(--color-white);
	border: 1px solid var(--pf-border);
	border-radius: var(--border-radius);
	box-shadow: var(--pf-shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-0.4rem);
}

.cat-filter.is-open .cat-filter-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.cat-filter-menu:focus {
	outline: none;
}

.cat-filter-menu [role="option"] {
	display: grid;
	grid-template-columns: 1.1rem 1fr auto;
	align-items: center;
	gap: 0.6rem;
	padding: 0.5rem 0.6rem;
	border-radius: var(--border-radius);
	font-size: 0.875rem;
	color: var(--color-text);
	white-space: nowrap;
	cursor: pointer;
}

.cat-filter-menu [role="option"] .fa-check {
	visibility: hidden; /* reserve the space so labels never shift */
	font-size: 0.75em;
	color: var(--color-primary);
}

.cat-filter-menu [role="option"][aria-selected="true"] .fa-check {
	visibility: visible;
}

.cat-filter-menu [role="option"]:hover,
.cat-filter-menu [role="option"].is-active {
	background: var(--pf-hover);
	color: var(--color-heading);
}

.cat-filter-menu [role="option"][aria-selected="true"] {
	color: var(--color-primary);
	font-weight: var(--font-weight-bold);
}

.cat-filter-count {
	padding: 0.1rem 0.5rem;
	background: var(--color-bg-light);
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: var(--font-weight-body);
	font-variant-numeric: tabular-nums;
	color: var(--color-text-light);
}

.cat-filter-menu [role="option"]:hover .cat-filter-count,
.cat-filter-menu [role="option"].is-active .cat-filter-count,
.cat-filter-menu [role="option"][aria-selected="true"] .cat-filter-count {
	background: var(--color-primary);
	color: var(--color-white);
}

.cat-filter-results {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-text-light);
}

@media (prefers-reduced-motion: no-preference) {
	.cat-filter-trigger {
		transition: border-color 0.2s ease, box-shadow 0.2s ease;
	}

	.cat-filter-chevron {
		transition: transform 0.2s ease;
	}

	.cat-filter-menu {
		transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
	}

	.cat-filter-menu [role="option"] {
		transition: background-color 0.12s ease, color 0.12s ease;
	}
}

@media (max-width: 600px) {
	.cat-filter {
		align-items: stretch;
		flex-direction: column;
		gap: 0.5rem;
	}

	.cat-filter-trigger {
		min-width: 0;
		width: 100%;
	}
}

.thesis-entry {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.thesis-entry:last-child {
  border-bottom: none;
}

.doi-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--color-primary);
  word-break: break-all;
}

.thesis-meta {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.listing-item.collapsible {
  position: relative;
}

/* The whole title row is the control, so it has to look like one: a full-width
   button that tints on hover and carries a chevron flipping between shut and
   open. The chevron rotates off `.open` on the item, which the JS keeps in step
   with aria-expanded. */
.listing-item.collapsible .listing-title {
  margin-bottom: 0.25rem;
}

.listing-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* pulled out sideways so the label stays flush with the rest of the entry
     while the hover surface reaches past it */
  width: calc(100% + 1rem);
  margin: 0 -0.5rem;
  padding: 0.35rem 0.5rem;
  background: none;
  border: none;
  border-radius: var(--border-radius);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.listing-toggle:hover {
  background: var(--pf-hover);
  color: var(--color-primary);
}

/* keep a clearly visible focus indicator -- never remove it outright */
.listing-toggle:focus-visible {
  outline: none;
  background: var(--pf-hover);
  color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.45);
}

.listing-toggle-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--color-white);
  border: 1px solid var(--pf-border);
  border-radius: 50%;
  font-size: 0.7rem;
  color: var(--color-primary);
}

.listing-toggle:hover .listing-toggle-icon,
.listing-toggle:focus-visible .listing-toggle-icon {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

.listing-item.collapsible.open .listing-toggle-icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: no-preference) {
  .listing-toggle {
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .listing-toggle-icon {
    transition: background-color 0.15s ease, border-color 0.15s ease,
      color 0.15s ease, transform 0.25s ease;
  }
}

.js .listing-item.collapsible .listing-content.closed {
  display: none;
}

/* Without JS nothing collapses, so the control must not advertise itself as
   one: every entry is simply shown in full.
   Scoped to `html` on purpose -- a bare `:not(.js)` matches <body>, <main> and
   every wrapper <div> too (none of them carry the class), so it would apply
   even with JS on, and win on specificity. */
html:not(.js) .listing-item.collapsible .listing-content {
  display: block;
}

html:not(.js) .listing-toggle {
  width: 100%;
  margin: 0;
  padding: 0;
  cursor: default;
}

html:not(.js) .listing-toggle:hover {
  background: none;
  color: inherit;
}

html:not(.js) .listing-toggle-icon {
  display: none;
}

.btn {
  display: inline-block;
  padding: 0.667em 1.333em;
  font-size: 1.125em;
  font-weight: var(--font-weight-heading);
  color: var(--color-white);
  background-color: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: 9999px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  background-color: transparent;
  color: var(--color-primary);
  text-decoration: none;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
}

.pagination a {
  color: var(--color-primary);
  border: 1px solid rgba(30, 78, 121, 0.2);
}

.pagination a:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
  text-decoration: none;
}

.pagination .current,
.pagination span.current {
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
}

.text-center {
  text-align: center;
}

.mt-3 {
  margin-top: 1.5rem;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 3fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.news-grid .listing-item {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-bottom: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.news-grid .listing-item:hover,
.news-grid .listing-item:focus {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.news-grid .listing-item img {
  width: 100%;
  height: auto;
  border-radius: calc(var(--border-radius) * 0.75);
}

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

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

  .news-grid .listing-item {
    padding: 1.25rem;
  }

  .news-grid .listing-item img {
    height: auto;
  }
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-unit);
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-grid.complete {
  grid-template-columns: repeat(auto-fill, minmax(47px, 1fr));
}

.project-card {
  position: relative;
  background-size: cover;
  background-position: center;
  padding: 1.5em 1em;
  border-radius: var(--border-radius);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card .card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  z-index: 1;
}

.project-card .card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.project-card .card-content img {
  width: 300px;
  height: auto;
  margin-bottom: 0.75rem;
}

.project-card .card-content h3 {
  text-align: center;
  font-size: 1.125rem;
  margin-bottom: 0;
  color: var(--color-heading);
}

.project-card.inactive {
  min-height: 0;
  display: inline-flex;
  padding: 0;
}

.project-card.inactive img {
  width: 150px;
}

.project-card img {
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.2s ease;
}

.project-card:hover img {
  transform: scale(0.8);
}

.gallery {
  margin: 1.5rem 0;
}

.gallery img {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
}

.js .gallery {
  position: relative;
  margin: 1.5rem 0;
  max-height: 80vh;
}

.js .gallery img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin-bottom: 0;
  border-radius: var(--border-radius);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.js .gallery img.active {
  opacity: 1;
}

.js .gallery img.active:hover {
  opacity: 0.95;
}

.gallery-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--color-primary);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-nav:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-50%) scale(1.1);
}

.js .gallery-nav {
  display: flex;
}

.gallery-nav-prev {
  left: -25px;
}

.gallery-nav-next {
  right: -25px;
}

.gallery-counter {
  display: none;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.js .gallery-counter {
  display: block;
  position: absolute;
  bottom: -1.5rem;
  left: 0;
  right: 0;
}

.gallery-lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.gallery-lightbox.active {
  display: flex;
}

.gallery-lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: var(--border-radius);
  cursor: pointer;
}

.gallery-lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  line-height: 1;
}

.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  padding: 20px;
  user-select: none;
}

.gallery-lightbox-nav:hover {
  color: var(--color-primary-light);
}

.gallery-lightbox-prev {
  left: 20px;
}

.gallery-lightbox-next {
  right: 20px;
}

footer {
  background-color: var(--color-primary);
  color: var(--color-white);
  padding: 2rem 0;
  margin-top: 3rem;
}

footer > div {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 75px;
}

footer p {
  margin: 0;
}

footer a {
  color: rgba(255, 255, 255, 0.85);
}

footer a:hover {
  color: var(--color-white);
}

.footer-columns {
  display: flex;
  gap: 3rem;
}

.footer-col {
  flex: 1;
}

.footer-col img {
  height: 120px;
  width: auto;
  margin-bottom: 0.75rem;
}

.footer-col h3 {
  margin: 0.5rem 0;
  color: var(--color-white);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
}

.footer-col p {
  margin: 0.25rem 0;
  line-height: 1.5;
  font-size: 0.9rem;
}

.social-icons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.social-icons a {
  display: inline-flex;
}

.social-icons img {
  height: 32px;
  width: 32px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  transition: opacity 0.2s;
}

.social-icons a:hover img {
  opacity: 1;
}

.footer-search-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-white);
  padding: 0.4rem 0.75rem;
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  width: 100%;
  max-width: 280px;
  outline: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.footer-search-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.footer-search-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.6);
}

:root {
  --pf-font: var(--font-body);
  --pf-text: var(--color-heading);
  --pf-text-secondary: var(--color-text);
  --pf-text-muted: var(--color-text-light);
  --pf-background: var(--color-white);
  --pf-border: #dde3ea;
  --pf-border-focus: var(--color-primary);
  --pf-hover: #f0f4f8;
  --pf-mark: var(--color-primary);
  --pf-shadow-sm: 0 2px 8px rgba(30, 78, 121, 0.08);
  --pf-shadow-md: 0 4px 16px rgba(30, 78, 121, 0.12);
  --pf-shadow-lg: 0 16px 48px rgba(30, 78, 121, 0.2);
  --pf-outline-focus: var(--color-primary-light);
  --pf-border-radius: var(--border-radius);
  --pf-modal-backdrop: rgba(30, 78, 121, 0.4);
  --pf-modal-max-width: 600px;
}

.search-toggle {
  background: none;
  border: none;
  color: var(--color-white);
  font-size: var(--font-size-nav);
  cursor: pointer;
  padding: 0.25rem 0;
  transition: opacity 0.2s;
  line-height: 1;
}

.search-toggle:hover {
  opacity: 0.75;
}

.search-toggle:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Highlight an entry arrived at via an anchor link. Expanding it is the JS's
   job (see setListingExpanded) -- forcing it open from here would override a
   deliberate collapse afterwards. */
.listing-item:has(.listing-title:target) {
  border-left: 3px solid var(--color-primary);
  padding-left: 1rem;
  background: rgba(30, 78, 121, 0.04);
  border-radius: var(--border-radius);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --max-width: 100%;
  }

  header > div,
  footer > div {
    padding: 0 2rem;
  }

  main > div {
    padding: 1.5rem 2rem;
  }

  .footer-columns {
    flex-direction: column;
    gap: 2rem;
  }
}

/* Mobile */
@media (max-width: 840px) {
  :root {
    --font-size-base: 16px;
    --header-height: 60px;
    --spacing-unit: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.375rem;
  }

  h3 {
    font-size: 1.125rem;
  }

  header > div {
    padding: 0 1rem;
    flex-direction: column;
    height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
    gap: 0.75rem;
  }

  header > div > a:first-child {
    font-size: 1.5rem;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.875rem;
  }

  nav a {
    font-size: 0.875rem;
  }

  .nav-dropdown-menu {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-top: 0;
  }

  .nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown-menu a {
    padding: 0.35rem 1rem;
  }

  main > div {
    padding: 1rem;
  }

  article header h1 {
    font-size: 1.5rem;
  }

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

  footer > div {
    padding: 0 1rem;
  }
}

/* Mobile */
@media (max-width: 1199px) {

}

@media print {
  header,
  footer,
  .language-switcher,
  nav {
    display: none;
  }

  body {
    font-size: 12pt;
    color: #000;
  }

  a {
    color: #000;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .gallery-lightbox {
    display: none !important;
  }

  .gallery img {
    position: static;
    opacity: 1;
    width: 100%;
    height: auto;
    object-fit: fill;
    margin-bottom: 0.5rem;
  }
}
