:root {
  color-scheme: light dark;
  --bg: #0b1014;
  --bg-accent: #111a22;
  --surface: #141c24;
  --surface-muted: #0f161d;
  --text: #e6edf3;
  --text-muted: #b3beca;
  --accent: #65d6a6;
  --accent-2: #7aa7ff;
  --button-bg-start: #65d6a6;
  --button-bg-end: #7aa7ff;
  --button-text: #0b1014;
  --border: #22303c;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --max-width: 1120px;
  --radius: 18px;
  --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2;
  --bg-accent: #ffffff;
  --surface: #ffffff;
  --surface-muted: #ece9e4;
  --text: #0f1720;
  --text-muted: #4b5a68;
  --accent: #1f8f6b;
  --accent-2: #3359c4;
  --button-bg-start: #1f8f6b;
  --button-bg-end: #3359c4;
  --button-text: #f6f5f2;
  --border: #d6d2ca;
  --shadow: 0 18px 36px rgba(15, 23, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(circle at 15% 10%, rgba(101, 214, 166, 0.18), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(122, 167, 255, 0.2), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 45%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  letter-spacing: 0.1px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--accent);
}

main {
  flex: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 18, 0.75);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="light"] .site-header {
  background: rgba(246, 245, 242, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.6px;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.hero {
  padding: 90px 0 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  align-items: center;
}

.hero-grid > * {
  animation: rise 0.8s ease both;
}

.hero-grid > *:nth-child(2) {
  animation-delay: 0.12s;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 3rem);
  margin: 0 0 16px;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hero-portrait {
  width: 50%;
  max-width: 180px;
  min-width: 120px;
  border-radius: 16px;
  margin: 0 auto 18px;
}

.section {
  padding: 40px 0;
}

.section-tight-top {
  padding-top: 0;
}

.section-tight-bottom {
  padding-bottom: 0;
}

.publication-intro {
  margin-bottom: 0;
}

.publication-list {
  margin-top: 30px;
}

.publication-list .year-divider {
  background: transparent;
  border: 0;
  padding: 6px 0 2px;
  margin: 6px 0 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.publication-list .year-divider::before,
.publication-list .year-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
  flex: 1;
}

.publication-list .year-divider span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 26px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.list {
  display: grid;
  gap: 16px;
  padding: 0;
  list-style: none;
}

.list li {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
}

.stagger > * {
  animation: fade-up 0.7s ease both;
}

.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.16s; }
.stagger > *:nth-child(4) { animation-delay: 0.24s; }
.stagger > *:nth-child(5) { animation-delay: 0.32s; }
.stagger > *:nth-child(6) { animation-delay: 0.4s; }

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

.author-me {
  color: var(--accent) !important;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 6px;
  padding: 0 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.button {
  background: linear-gradient(135deg, var(--button-bg-start), var(--button-bg-end));
  color: var(--button-text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 36px;
  background: var(--surface-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-grid strong {
  color: var(--text);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 3rem);
  margin-bottom: 10px;
}

.page-intro {
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.7;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 720px) {
  .site-header .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 70px;
  }
}

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

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
