:root {
  --bg: #F5F6F4;
  --bg-alt: #ECEEE9;
  --panel: #FFFFFF;
  --ink: #14202B;
  --ink-soft: #46545E;
  --ink-faint: #7C8890;
  --accent: #2B6E86;
  --accent-ink: #1B4A5B;
  --accent-soft: #DEEAEC;
  --warm: #B9682A;
  --warm-soft: #F3E3D2;
  --line: #D7DAD3;
  --line-strong: #BCC1BA;

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1080px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--accent-ink); }

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

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.skip-link a {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip-link a:focus { left: 12px; top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------- Masthead ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245, 246, 244, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.header-right { display: flex; align-items: center; gap: 34px; width: 100%; justify-content: space-between; }

.site-nav { display: flex; align-items: center; gap: 26px; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; padding-bottom: 2px; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--accent-ink); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); border-color: var(--accent); }

.header-controls { display: flex; align-items: center; gap: 14px; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; background: none; border: none; cursor: pointer;
}
.nav-toggle span { display: block; width: 100%; height: 2px; background: var(--ink); }

/* ---------------- Language switch ---------------- */
.lang-switch {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 0.82rem;
  border: 1px solid var(--line-strong); border-radius: 3px; padding: 4px 8px;
}
.lang-switch a { color: var(--ink-faint); text-decoration: none; padding: 2px 4px; border-radius: 2px; }
.lang-switch a:hover { color: var(--accent-ink); }
.lang-switch a[aria-current="true"] { color: var(--ink); font-weight: 500; }
.lang-switch .lang-sep { color: var(--line-strong); }

/* ---------------- Page layout: sidebar + content ---------------- */
.page-layout {
  max-width: var(--maxw); margin: 0 auto; padding: 56px 28px 100px;
  display: grid; grid-template-columns: 250px 1fr; gap: 64px; align-items: start;
}

.sidebar { position: sticky; top: 96px; }

.sidebar-photo {
  width: 168px; height: 168px; object-fit: cover;
  border: 1px solid var(--line-strong); filter: grayscale(15%);
  margin-bottom: 20px; display: block;
}
.sidebar-name { font-size: 1.5rem; margin-bottom: 0.35em; }
.sidebar-tagline { font-size: 0.95rem; color: var(--ink-soft); margin-bottom: 20px; }

.sidebar-gantry { width: 100%; max-width: 130px; opacity: 0.7; margin: 0 0 20px; }
.sidebar-gantry .arc { fill: none; stroke: var(--accent); }
.sidebar-gantry .arc-1 { stroke-width: 1; opacity: 0.25; }
.sidebar-gantry .arc-2 { stroke-width: 1; opacity: 0.45; stroke-dasharray: 3 6; }
.sidebar-gantry .arc-3 { stroke-width: 1; opacity: 0.3; }
.sidebar-gantry .axis { stroke: var(--line-strong); stroke-width: 1; }
.sidebar-gantry .source { fill: var(--warm); }
.sidebar-gantry .detector { fill: var(--accent-ink); }
.sidebar-gantry .beam { stroke: var(--accent); stroke-width: 1.5; opacity: 0.55; }
.sidebar-sweep { transform-origin: 105px 105px; animation: sweep 9s ease-in-out infinite; }
@keyframes sweep { 0% { transform: rotate(0deg); } 50% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sidebar-sweep { animation: none; } }

.sidebar-divider { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.sidebar-meta { font-family: var(--font-mono); font-size: 0.83rem; color: var(--ink-faint); margin-bottom: 14px; }

.sidebar-links { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.sidebar-links a { font-family: var(--font-mono); font-size: 0.85rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid transparent; }
.sidebar-links a:hover { color: var(--accent-ink); border-color: var(--accent); }

.sidebar-cv {
  display: block; text-align: center; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  font-size: 0.88rem; font-weight: 500; color: var(--ink); text-decoration: none;
}
.sidebar-cv:hover { border-color: var(--ink); background: var(--panel); }

/* ---------------- Content ---------------- */
.content { min-width: 0; }

.page-heading { font-size: 1.9rem; margin-bottom: 0.7em; }
.page-intro { font-size: 1.08rem; max-width: 62ch; }

.content-section { padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--line); }
.content-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.section-heading { font-size: 1.4rem; margin-bottom: 0.9em; }

.lede { font-size: 1.08rem; max-width: 62ch; }

/* Bio */
.bio-text p:last-child { margin-bottom: 0; }

/* Timeline */
.tl-item { display: grid; grid-template-columns: 130px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: none; padding-top: 0; }
.tl-when { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-ink); white-space: nowrap; padding-top: 0.2em; }
.tl-body h3 { font-size: 1.15rem; margin-bottom: 0.2em; }
.tl-org { color: var(--ink-faint); font-size: 0.92rem; margin-bottom: 0.6em; }
.tl-body p:last-child { margin-bottom: 0; }

/* Key topics */
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.topic-list li {
  font-family: var(--font-mono); font-size: 0.83rem; color: var(--accent-ink);
  background: var(--accent-soft); padding: 7px 12px; border-radius: 3px; line-height: 1.3;
}

/* Research */
.thesis-panel { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 26px 28px; margin-bottom: 44px; }
.thesis-label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-ink); margin-bottom: 0.6em; }
.thesis-panel h3 { font-size: 1.3rem; max-width: 34ch; }
.thesis-meta { color: var(--ink-faint); font-size: 0.92rem; margin-bottom: 1em; }
.thesis-panel p:not(.thesis-label):not(.thesis-meta) { color: var(--ink-soft); }

.link-underline { text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; font-weight: 500; }
.link-underline:hover { border-color: var(--accent-ink); }

.pub-heading { font-size: 1.02rem; font-family: var(--font-body); font-weight: 600; color: var(--ink-faint); margin-top: 38px; margin-bottom: 16px; }

.pub-list { list-style: none; margin: 0 0 8px; padding: 0; }
.pub-list li { padding: 16px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.pub-list li:first-child { border-top: none; }
.pub-cite { margin: 0; color: var(--ink); flex: 1 1 480px; }
.pub-cite em { font-style: italic; color: var(--ink-soft); }
.doi-tag { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-ink); text-decoration: none; background: var(--accent-soft); padding: 4px 9px; border-radius: 2px; white-space: nowrap; }
.doi-tag:hover { background: var(--accent); color: #fff; }

/* Consulting */
.consult-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.consult-grid .consult-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.consult-card { background: var(--panel); padding: 24px 26px; border-left: 3px solid transparent; }
.consult-teal { border-left-color: var(--accent); }
.consult-amber { border-left-color: var(--warm); }
.consult-card h3 { font-size: 1.05rem; margin-bottom: 0.5em; }
.consult-card p { font-size: 0.95rem; margin-bottom: 0; }

.consult-cta { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.consult-cta p { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--ink); margin: 0; }

/* FAQ */
.faq-list { margin: 0; padding: 0; }
.faq-item { padding: 20px 0; border-top: 1px solid var(--line); }
.faq-item:first-child { border-top: none; padding-top: 0; }
.faq-item h3 { font-size: 1.05rem; margin-bottom: 0.4em; }
.faq-item p { font-size: 0.95rem; margin-bottom: 0; max-width: 68ch; }

/* Engagement models */
.engage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.engage-item { background: var(--panel); padding: 22px 26px; display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.engage-format {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-ink);
  background: var(--accent-soft); display: inline-block; padding: 4px 9px; border-radius: 2px;
  white-space: normal; line-height: 1.4;
}
.engage-body h3 { font-size: 1.05rem; margin-bottom: 0.4em; }
.engage-body p { font-size: 0.95rem; margin-bottom: 0; }
.engage-example { font-size: 0.88rem; color: var(--ink-faint); margin-top: 0.5em; margin-bottom: 0; font-style: italic; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 40px; }
.skill-group h4 { font-family: var(--font-body); font-size: 0.93rem; font-weight: 600; color: var(--ink-faint); margin-bottom: 0.4em; }
.skill-group p { margin-bottom: 0; }

/* Contact CTA */
.contact-cta p { font-size: 1.08rem; max-width: 52ch; }

/* Buttons */
.btn {
  display: inline-block; padding: 11px 20px; font-family: var(--font-body);
  font-size: 0.93rem; font-weight: 500; text-decoration: none; border-radius: 3px;
  border: 1px solid transparent; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: var(--panel); }

/* ---------------- Footer ---------------- */
.site-footer { padding: 32px 0; border-top: 1px solid var(--line); }
.site-footer p { margin: 0; font-size: 0.85rem; color: var(--ink-faint); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .page-layout { grid-template-columns: 1fr; gap: 40px; padding-top: 40px; }
  .sidebar { position: static; display: flex; flex-direction: column; align-items: flex-start; }
  .sidebar-gantry { display: none; }
  .tl-item { grid-template-columns: 1fr; gap: 6px; }
  .tl-when { padding-top: 0; }
  .consult-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .engage-item { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 720px) {
  .site-nav {
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: flex-start;
    padding: 16px 28px 24px; gap: 16px;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .site-nav.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-toggle { display: flex; }
}

@media (max-width: 520px) {
  .page-layout { padding: 32px 20px 64px; }
  .content-section { padding-bottom: 40px; margin-bottom: 40px; }
  body { font-size: 16px; }
}
