:root {
  --bg-color: #f8fafc;
  --text-color: #0f172a;
  --muted-color: #475569;
  --card-color: #ffffff;
  --border-color: #e2e8f0;
  --link-color: #1d4ed8;
  --link-hover: #1e40af;
  --accent-soft: #dbeafe;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
  --bg-color: #020617;
  --text-color: #e5e7eb;
  --muted-color: #94a3b8;
  --card-color: #0f172a;
  --border-color: #1e293b;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
  --accent-soft: #172554;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

p {
  margin-top: 0;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 22px 64px;
}

/* Floating navigation */

.floating-nav {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: color-mix(in srgb, var(--card-color) 82%, transparent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
  transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle:hover {
  border-color: var(--link-color);
  transform: translateY(-1px);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text-color);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(310px, calc(100vw - 36px));
  display: none;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card-color) 84%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.nav-panel.is-open {
  display: block;
}

.nav-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.nav-panel-title {
  color: var(--muted-color);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.nav-links a {
  padding: 9px 10px;
  border-radius: 12px;
  color: var(--text-color);
  font-size: 0.96rem;
}

.nav-links a:hover {
  background: var(--accent-soft);
  color: var(--link-color);
  text-decoration: none;
}

/* Theme button inside menu */

.theme-toggle {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-color) 75%, transparent);
  color: var(--muted-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--link-color);
  color: var(--link-color);
  transform: translateY(-1px);
}

.theme-toggle span {
  line-height: 1;
}

/* Header and hero */

.site-header {
  margin-bottom: 36px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 36px;
  align-items: center;
  padding: 50px 0 34px;
  border-bottom: 1px solid var(--border-color);
}

.hero-text {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--link-color);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.tagline {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted-color);
  font-size: 1.14rem;
}

.latest-line {
  margin: 14px 0 0;
  color: var(--muted-color);
  font-size: 0.96rem;
}

.latest-line strong {
  color: var(--link-color);
}

.hero-photo {
  width: 190px;
  height: 190px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid var(--card-color);
  box-shadow: var(--shadow);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--card-color);
  color: var(--text-color);
  font-size: 0.95rem;
}

.hero-links a:hover {
  border-color: var(--link-color);
  color: var(--link-color);
  text-decoration: none;
}

/* Sections */

section {
  margin: 52px 0;
  scroll-margin-top: 72px;
}

h2 {
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1.55rem;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.meta {
  color: var(--muted-color);
  font-size: 0.94rem;
}

.keywords {
  color: var(--muted-color);
  font-size: 0.95rem;
}

.section-note {
  color: var(--muted-color);
  font-size: 0.95rem;
  margin-top: -8px;
  margin-bottom: 18px;
}

/* Cards and grids */

.research-grid,
.card-grid,
.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card,
.project,
.person-card,
.service-item,
.pub-item {
  background: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.card:hover,
.project:hover,
.person-card:hover,
.service-item:hover,
.pub-item:hover {
  border-color: rgba(29, 78, 216, 0.35);
}

/* Publications */

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

.pub-list li {
  margin-bottom: 16px;
}

.authors {
  color: var(--muted-color);
}

/* People */

.period {
  display: inline-block;
  margin-left: 8px;
  color: var(--link-color);
  font-size: 0.82rem;
  font-weight: 650;
}

.affiliation {
  margin-bottom: 10px;
}

/* Lists */

.clean-list,
.news-list {
  padding-left: 1.2rem;
}

.clean-list li,
.news-list li {
  margin-bottom: 8px;
}

.service-item ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

/* Service section spacing */

#service .service-item + .service-item {
  margin-top: 16px;
}

/* Badges */

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--link-color);
  font-size: 0.78rem;
  font-weight: 650;
  vertical-align: middle;
  white-space: nowrap;
}

/* Gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.gallery-card {
  margin: 0;
  background: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-card figcaption {
  padding: 12px 14px;
  color: var(--muted-color);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* Blog */

.blog-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.blog-card {
  background: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
}

.blog-card h3 {
  margin-bottom: 8px;
}

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

/* Contact and footer */

.contact-links {
  line-height: 1.9;
}

.site-footer {
  margin-top: 58px;
  padding-top: 22px;
  border-top: 1px solid var(--border-color);
  color: var(--muted-color);
  font-size: 0.9rem;
}

/* Back-to-top button */

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--card-color) 78%, transparent);
  color: var(--link-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(8px);
  opacity: 0.72;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 900;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px);
  border-color: var(--link-color);
  color: var(--link-hover);
  text-decoration: none;
}

/* Responsive layout */

@media (max-width: 760px) {
  .container {
    padding: 24px 18px 56px;
  }

  .floating-nav {
    top: 14px;
    right: 14px;
  }

  .menu-toggle {
    width: 42px;
    height: 42px;
  }

  .nav-panel {
    top: 52px;
    width: min(300px, calc(100vw - 28px));
    border-radius: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    justify-items: center;
    text-align: center;
    padding-top: 44px;
  }

  .hero-photo {
    grid-row: 1;
    width: 108px;
    height: 108px;
    border-width: 4px;
  }

  .hero-text {
    grid-row: 2;
  }

  .eyebrow {
    font-size: 0.72rem;
    margin-bottom: 6px;
  }

  h1 {
    font-size: clamp(2rem, 9vw, 2.65rem);
  }

  .tagline {
    margin: 10px auto 0;
    font-size: 1rem;
    max-width: 520px;
  }

  .latest-line {
    font-size: 0.92rem;
  }

  .hero-links {
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
  }

  .hero-links a {
    padding: 7px 12px;
    font-size: 0.9rem;
  }

  .research-grid,
  .card-grid,
  .people-grid,
  .gallery-grid,
  .blog-list {
    grid-template-columns: 1fr;
  }

  .badge {
    margin-left: 4px;
    font-size: 0.72rem;
  }

  .period {
    display: block;
    margin-left: 0;
    margin-top: 2px;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    opacity: 0.62;
  }
}

@media (max-width: 420px) {
  .floating-nav {
    top: 12px;
    right: 12px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
  }

  .nav-panel {
    top: 50px;
    width: calc(100vw - 24px);
  }

  .hero-photo {
    width: 92px;
    height: 92px;
    border-width: 3px;
  }

  h1 {
    font-size: clamp(1.85rem, 10vw, 2.35rem);
  }

  .tagline {
    font-size: 0.95rem;
  }

  .hero-links a {
    padding: 7px 10px;
    font-size: 0.88rem;
  }
}
