:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --text: #17202b;
  --muted: #5b6877;
  --accent: #175da8;
  --accent-strong: #10477f;
  --accent-soft: #e8f1fb;
  --border: #dce3eb;
  --header-bg: rgba(246, 248, 251, 0.92);
  --shadow: rgba(21, 35, 52, 0.07);
  --max: 1120px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d131a;
  --surface: #151c24;
  --surface-soft: #1c2631;
  --text: #eef3f8;
  --muted: #a7b2c0;
  --accent: #79b7ff;
  --accent-strong: #a9d3ff;
  --accent-soft: #1b3149;
  --border: #2b3642;
  --header-bg: rgba(13, 19, 26, 0.92);
  --shadow: rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}
.skip-link:focus { top: 14px; }

.container { width: min(92%, var(--max)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav { min-height: 70px; display: flex; align-items: center; gap: 26px; }
.brand { font-weight: 850; letter-spacing: -0.025em; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { margin: 0 0 0 auto; padding: 0; display: flex; align-items: center; gap: 20px; list-style: none; }
.nav-links a { color: var(--muted); font-size: 0.94rem; font-weight: 650; padding: 8px 0; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); text-decoration: none; }
.nav-links a.active { box-shadow: inset 0 -2px 0 var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-button, .menu-button {
  width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.05rem;
}
.theme-button:hover, .menu-button:hover { background: var(--surface-soft); }
.menu-button { display: none; }

.hero { padding: 88px 0 68px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(220px, .55fr); gap: 62px; align-items: center; }
.hero-copy { max-width: 780px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .77rem; font-weight: 800; }
h1, h2, h3 { text-wrap: balance; }
h1 { margin: 0 0 18px; font-size: clamp(2.65rem, 7vw, 5rem); line-height: .98; letter-spacing: -.05em; }
h2 { margin: 0 0 12px; font-size: clamp(1.65rem, 3vw, 2.2rem); line-height: 1.15; letter-spacing: -.03em; }
h3 { margin: 0 0 8px; line-height: 1.3; letter-spacing: -.012em; }
p { margin-top: 0; }
.lead { max-width: 780px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.2rem); }

.profile-photo {
  width: 240px;
  height: 240px;
  margin: 0 auto;
  display: block;
  object-fit: cover;
  object-position: 50% 32%;
  border-radius: 50%;
  border: 1px solid var(--border);
  box-shadow: 0 18px 45px var(--shadow);
}
.actions { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 26px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border-radius: 10px; font-weight: 750; border: 1px solid var(--accent); transition: transform .18s ease, background .18s ease; }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--accent); }
html[data-theme="dark"] .button.primary { color: #09111a; }
.button.secondary { color: var(--accent); background: var(--surface); }
.button.ghost { color: var(--text); border-color: var(--border); background: transparent; }
.contact-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 24px; font-size: .95rem; }
.contact-row a { font-weight: 700; }

.section { padding: 42px 0 66px; }
.section-tight { padding-top: 18px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 24px; }
.section-heading > p { max-width: 540px; margin-bottom: 10px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.research-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: 0 8px 26px var(--shadow); }
.card p { color: var(--muted); }
.card-index { display: inline-block; margin-bottom: 20px; font-size: .78rem; font-weight: 800; color: var(--accent); }
.feature-list { display: grid; gap: 12px; }
.feature-item { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.feature-item p { margin-bottom: 0; color: var(--muted); }
.text-link { font-weight: 750; white-space: nowrap; }
.badge { display: inline-block; margin-bottom: 8px; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .76rem; font-weight: 800; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 28px; border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(130deg, var(--accent-soft), var(--surface)); }
.callout p:last-child { margin-bottom: 0; color: var(--muted); }

.page-title { padding: 66px 0 20px; max-width: 920px; }
.page-title h1 { font-size: clamp(2.5rem, 6vw, 4.2rem); }
.summary-strip { display: flex; flex-wrap: wrap; gap: 0; margin-top: 30px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.summary-strip > div { min-width: 180px; flex: 1; padding: 16px 18px; border-right: 1px solid var(--border); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip strong { display: block; color: var(--text); }
.summary-strip span { color: var(--muted); font-size: .88rem; }

.publications-section { padding-top: 22px; }
.publication-year { margin-bottom: 46px; }
.year-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.year-heading h2 { margin: 0; }
.year-heading span { color: var(--muted); font-size: .9rem; }
.pub { padding: 20px 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pub-title { margin: 2px 0 7px; font-size: 1.14rem; }
.pub-authors { margin-bottom: 4px; color: var(--text); }
.meta { color: var(--muted); font-size: .92rem; }

.two-column-section { display: grid; grid-template-columns: minmax(190px, .55fr) minmax(0, 1.45fr); gap: 52px; align-items: start; }
.section-label { position: sticky; top: 100px; }
.timeline { position: relative; display: grid; gap: 16px; padding-left: 24px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 20px 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.timeline-item::before { content: ""; position: absolute; left: -32px; top: 27px; width: 13px; height: 13px; border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); }
.timeline-date { margin-bottom: 6px; color: var(--accent); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.list-clean { margin: 10px 0 0; padding-left: 20px; }
.list-clean li + li { margin-top: 7px; }
.split-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list span { padding: 6px 9px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); font-size: .86rem; color: var(--text); }
.compact-list { color: var(--muted); }
.service-card h3:not(:first-of-type) { margin-top: 22px; }

.project-highlight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-card { display: flex; flex-direction: column; }
.project-card .text-link { margin-top: auto; padding-top: 8px; }
.project-list { border-top: 1px solid var(--border); }
.project-row { padding: 19px 0; border-bottom: 1px solid var(--border); }
.project-row h3 { max-width: 900px; }
.project-row .meta { margin-bottom: 0; }

.cv-section { padding-top: 18px; }
.cv-note { margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.cv-frame { width: 100%; height: 78vh; min-height: 620px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.error-page { padding: 110px 0; max-width: 760px; }

footer { margin-top: 40px; padding: 28px 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 22px; flex-wrap: wrap; }

@media (max-width: 980px) {
  .research-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-highlight-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .nav { gap: 12px; }
  .nav-links {
    display: none; position: absolute; left: 4%; right: 4%; top: 62px; margin: 0; padding: 12px;
    flex-direction: column; align-items: stretch; gap: 2px; border: 1px solid var(--border); border-radius: 13px;
    background: var(--surface); box-shadow: 0 16px 45px var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 10px 8px; }
  .nav-links a.active { box-shadow: none; background: var(--accent-soft); border-radius: 8px; padding-left: 10px; }
  .nav-actions { margin-left: auto; }
  .menu-button { display: grid; }
  .hero { grid-template-columns: 1fr; padding-top: 62px; gap: 38px; }
  .profile-photo { width: 180px; height: 180px; }
  .section-heading, .feature-item, .callout { align-items: flex-start; flex-direction: column; }
  .feature-item .text-link { white-space: normal; }
  .two-column-section { grid-template-columns: 1fr; gap: 18px; }
  .section-label { position: static; }
  .split-cards { grid-template-columns: 1fr; }
  .summary-strip > div { border-right: 0; border-bottom: 1px solid var(--border); flex-basis: 100%; }
  .summary-strip > div:last-child { border-bottom: 0; }
}

@media (max-width: 620px) {
  .container { width: min(91%, var(--max)); }
  .brand { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
  .hero { padding-top: 52px; }
  h1 { font-size: clamp(2.45rem, 14vw, 3.5rem); }
  .research-grid, .project-highlight-grid, .grid { grid-template-columns: 1fr; }
  .section { padding: 34px 0 54px; }
  .page-title { padding-top: 52px; }
  .cv-frame { height: 68vh; min-height: 500px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
