:root {
  --ua-red: #ab0520;
  --ua-red-dark: #8a0419;
  --ua-blue: #0c234b;
  --ua-blue-light: #1e3a6d;
  --ink: #1c1f24;
  --ink-soft: #4a4f57;
  --paper: #ffffff;
  --paper-alt: #f6f5f2;
  --border: #e3e1db;
  --max-width: 960px;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header / Nav ---------- */

.site-header {
  background: var(--ua-blue);
  border-bottom: 3px solid var(--ua-red);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 1rem;
}

.site-brand {
  display: flex;
  color: #fff;
  padding: 0.75rem 0;
  min-width: 0;
}

.site-brand a {
  color: #fff;
  text-decoration: none;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.logo-placeholder {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #c7d0e0;
  background: rgba(255, 255, 255, 0.06);
}

.logo-badge {
  flex-shrink: 0;
  width: 65px;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  overflow: hidden;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-brand .brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-brand .brand-tagline {
  font-size: 0.8rem;
  color: #c7d0e0;
  margin-top: 0.15rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.site-nav {
  min-width: 0;
  flex: 1 1 auto;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  color: #e9ecf3;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-block;
  }
  .site-nav {
    display: none;
    width: 100%;
  }
  .site-nav.open {
    display: block;
  }
  .site-nav ul {
    flex-direction: column;
    padding-bottom: 0.75rem;
  }
  .site-header .wrap {
    flex-wrap: wrap;
  }
}

/* ---------- Hero (home) ---------- */

.hero {
  background: linear-gradient(135deg, var(--ua-blue) 0%, var(--ua-blue-light) 100%);
  color: #fff;
  padding: 3.5rem 0;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.hero-logo-badge {
  flex-shrink: 0;
  width: 109px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  overflow: hidden;
}

.hero-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 600px) {
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 0.75rem;
  line-height: 1.25;
}

.hero p {
  color: #d9dfea;
  max-width: 46rem;
  font-size: 1.05rem;
  margin: 0;
}

/* ---------- Page header (non-home) ---------- */

.page-header {
  background: var(--paper-alt);
  border-bottom: 1px solid var(--border);
  padding: 2.25rem 0;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--ua-blue);
}

.page-header .subtitle {
  color: var(--ink-soft);
  margin-top: 0.4rem;
}

/* ---------- Main content ---------- */

main {
  min-height: 50vh;
  padding-bottom: 3rem;
}

.content h2 {
  color: var(--ua-blue);
  font-size: 1.4rem;
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border);
}

.content h3 {
  color: var(--ua-blue);
  font-size: 1.15rem;
  margin-top: 1.75rem;
}

.content h4 {
  color: var(--ink);
  font-size: 1.05rem;
  margin-top: 1.5rem;
}

.content ul,
.content ol {
  padding-left: 1.4rem;
}

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

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.content table td,
.content table th {
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
}

/* ---------- Cards / blocks ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

.card {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}

.card h3 {
  margin-top: 0;
}

.research-project {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin: 1rem 0 1.75rem;
  flex-wrap: wrap;
}

.research-project img {
  width: 220px;
  height: 160px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.research-project p {
  flex: 1;
  min-width: 240px;
  margin: 0;
}

/* ---------- News list ---------- */

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-list li {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.news-list .news-date {
  flex-shrink: 0;
  width: 6.5rem;
  font-weight: 700;
  color: var(--ua-red);
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

.news-list .news-body {
  flex: 1;
}

/* ---------- Home layout (main + sidebar) ---------- */

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  column-gap: 2.5rem;
  row-gap: 0;
  align-items: start;
}

/* Desktop: About, photos, and Our Address stack in the left column; news in the right. */
.home-main {
  grid-column: 1;
  grid-row: 1;
}

.home-photos {
  grid-column: 1;
  grid-row: 2;
}

.home-address {
  grid-column: 1;
  grid-row: 3;
}

.home-sidebar {
  grid-column: 2;
  grid-row: 1 / span 3;
  position: sticky;
  top: 1.5rem;
}

/* Homepage photo carousel: fixed box, images cycle in a loop, all the same size. */
.home-carousel-wrap {
  margin: 1rem 0 1.75rem;
}

.home-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--paper-alt);
  overflow: hidden;
}

.home-carousel img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
}

.home-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.home-carousel-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.home-carousel-dot:hover {
  background: var(--ua-blue-light);
}

.home-carousel-dot.active {
  background: var(--ua-red);
  transform: scale(1.15);
}

/* Mobile: single column, ordered About, Recent News, photos, Our Address. */
@media (max-width: 760px) {
  .home-layout {
    grid-template-columns: 1fr;
    row-gap: 2rem;
  }
  .home-main {
    grid-column: 1;
    grid-row: 1;
  }
  .home-sidebar {
    grid-column: 1;
    grid-row: 2;
    position: static;
  }
  .home-photos {
    grid-column: 1;
    grid-row: 3;
  }
  .home-address {
    grid-column: 1;
    grid-row: 4;
  }
}

.news-widget {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem 1.4rem;
}

.news-widget h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--ua-blue);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.news-widget .news-list li {
  display: block;
  padding: 0.7rem 0;
}

.news-widget .news-list .news-date {
  display: block;
  width: auto;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.news-widget .news-list .news-body {
  font-size: 0.88rem;
  line-height: 1.5;
}

.news-widget-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- Single news post ---------- */

.news-post-date {
  color: var(--ua-red);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.news-post-back {
  display: inline-block;
  margin-top: 1.5rem;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- Publications ---------- */

.pub-list {
  padding-left: 1.6rem;
}

.pub-list li {
  margin-bottom: 1.1rem;
}

.pub-group[hidden],
.pub-list li[hidden] {
  display: none;
}

/* ---------- Publications: area toggle ---------- */

.pub-area-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.pub-pill {
  font: inherit;
  cursor: pointer;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.pub-pill:hover {
  border-color: var(--ua-red);
  color: var(--ua-red);
}

.pub-pill.active {
  background: var(--ua-blue);
  border-color: var(--ua-blue);
  color: #fff;
}

/* ---------- Research intro (collapsible) ---------- */

.research-intro {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background: var(--paper-alt);
}

.research-intro summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ua-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.research-intro summary::-webkit-details-marker {
  display: none;
}

.research-intro summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--ua-red);
  margin-left: 1rem;
}

.research-intro[open] summary::after {
  content: "\2212";
}

.research-intro[open] summary {
  border-bottom: 1px solid var(--border);
}

.research-intro-body {
  padding: 1rem 1.25rem 1.25rem;
}

.research-intro-body p {
  margin: 0 0 1rem;
}

.research-intro-body p:last-child {
  margin-bottom: 0;
}

/* ---------- Research theme cards ---------- */

.theme-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.75rem 0 2.25rem;
}

.theme-card {
  display: block;
  text-align: left;
  cursor: pointer;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem 1.1rem;
  font: inherit;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.theme-card:hover {
  border-color: var(--ua-red);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.theme-card.active {
  border-color: var(--ua-blue);
  background: #eef2f8;
  box-shadow: 0 4px 14px rgba(12, 35, 75, 0.15);
}

.theme-card h3 {
  margin: 0 0 0.6rem;
  color: var(--ua-blue);
  font-size: 1.1rem;
}

.theme-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.theme-card .theme-view {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ua-red);
}

/* ---------- Research area toggle (topics/grants) ---------- */

.research-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.research-group[hidden],
.research-topic[hidden],
.research-nav-reset[hidden] {
  display: none;
}

.research-nav-reset {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.research-topic {
  margin-bottom: 2rem;
}

.research-topic-title {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

/* ---------- Cite / BibTeX ---------- */

.pub-list details.cite {
  margin-top: 0.4rem;
}

.pub-list details.cite summary {
  display: inline-block;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ua-red);
  border: 1px solid var(--ua-red);
  border-radius: 5px;
  padding: 0.12rem 0.55rem;
  list-style: none;
  user-select: none;
}

.pub-list details.cite summary::-webkit-details-marker {
  display: none;
}

.pub-list details.cite summary:hover {
  background: var(--ua-red);
  color: #fff;
}

.pub-list details.cite[open] summary {
  background: var(--ua-red);
  color: #fff;
  margin-bottom: 0.5rem;
}

.pub-list details.cite pre {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--ua-blue);
  color: #dbe3f1;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

/* ---------- Callout ---------- */

.callout {
  background: #fdf1ee;
  border-left: 4px solid var(--ua-red);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ua-blue);
  color: #cfd6e4;
  padding: 2.25rem 0;
  margin-top: 3rem;
  font-size: 0.9rem;
}

.site-footer a {
  color: #fff;
}

.site-footer .footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.site-footer .footer-note {
  margin-top: 1.5rem;
  color: #8fa0bf;
  font-size: 0.8rem;
}

.funders {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  margin: 1.25rem 0;
}

.funders img {
  max-height: 70px;
  width: auto;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0 2.5rem;
}

.person-card {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.person-card-photo {
  width: 100%;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 5 / 6;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px dashed var(--border);
  background: repeating-linear-gradient(
    135deg,
    #ece9e2,
    #ece9e2 10px,
    #f3f1eb 10px,
    #f3f1eb 20px
  );
  color: var(--ink-soft);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.person-card-body {
  padding: 1rem 1.1rem 1.25rem;
}

.person-card-body h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  color: var(--ink);
}

.person-card-body h3 a {
  color: var(--ua-red);
}

.person-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

.person-bio {
  font-size: 0.9rem;
  margin: 0;
}

.person-bio.placeholder {
  color: var(--ink-soft);
  font-style: italic;
}

.person-photo {
  width: 170px;
  float: left;
  margin: 0 1.5rem 1rem 0;
  border-radius: var(--radius);
}

@media (max-width: 560px) {
  .person-photo {
    float: none;
    display: block;
    margin: 0 0 1rem;
  }
}

/* ---------- Teaching ---------- */

.teaching-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.teaching-card {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
}

.teaching-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--ua-blue);
}

.teaching-meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.teaching-card-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
}

.teaching-note {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin-top: 2rem;
}

/* ---------- Visitor counter ---------- */

.visitor-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.visitor-counter img {
  vertical-align: middle;
}

.site-updated {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}
