:root {
  --bg: #f7f6f2;
  --bg-raised: #ffffff;
  --text: #1f2326;
  --muted: #5b6168;
  --line: #e2dfd7;
  --accent: #1f5f5b;
  --accent-soft: #e4efed;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 760px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --bg-raised: #1d2024;
    --text: #e8e6e1;
    --muted: #a0a6ad;
    --line: #2d3137;
    --accent: #7fc4bd;
    --accent-soft: #1e302e;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a;
  --bg-raised: #1d2024;
  --text: #e8e6e1;
  --muted: #a0a6ad;
  --line: #2d3137;
  --accent: #7fc4bd;
  --accent-soft: #1e302e;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.55rem; margin-top: 3rem; }
h3 { font-size: 1.15rem; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
strong { font-weight: 600; }

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

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 6px;
}
.skip:focus { left: 8px; z-index: 10; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 60px;
}
.brand { font-family: var(--serif); font-weight: 600; color: var(--text); font-size: 1.05rem; white-space: nowrap; }
.nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; }
.nav li a { color: var(--muted); font-size: 0.95rem; font-weight: 500; white-space: nowrap; }
.nav li a[aria-current="page"], .nav li a:hover { color: var(--text); }

main { padding: 2.5rem 16px 4rem; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  margin-bottom: 1rem;
}
.hero-text .kicker { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.5rem; }
.hero-text h1 { margin-bottom: 0.75rem; }
.hero-text .lede { font-family: var(--serif); font-size: 1.25rem; line-height: 1.45; margin-bottom: 1.25rem; }
.hero img {
  width: 148px; height: 148px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--bg-raised); box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.button {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 500; font-size: 0.95rem;
}
.button:hover { text-decoration: none; filter: brightness(1.1); }
.icon-links { display: flex; flex-wrap: wrap; gap: 14px; }
.icon-links a { color: var(--muted); font-size: 0.95rem; display: inline-flex; align-items: center; gap: 6px; }
.icon-links a:hover { color: var(--accent); }
.icon-links svg { width: 18px; height: 18px; fill: currentColor; }

/* Sections */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-head .more { font-size: 0.95rem; white-space: nowrap; }

.now {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 1.25rem 0 0;
  font-size: 0.97rem;
}
.now strong { color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 1.25rem; }
.card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Publications */
.pubs { list-style: none; padding: 0; margin: 1rem 0 0; }
.pub { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: 0.93rem; color: var(--muted); }
.pub-venue { font-size: 0.93rem; }
.doi { color: var(--muted); font-size: 0.88rem; }
.pub-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 0.78rem; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.tag-accent { background: var(--accent); color: #fff; }
.pub-note { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

.highlights { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 14px; }
.highlight {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
}
.highlight .pub-title { display: block; margin-bottom: 4px; }
.highlight .meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.highlight p { margin: 0; font-size: 0.95rem; }

/* Side project */
.aside-card {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  margin-top: 1rem;
}
.aside-card .glyph {
  width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600;
}
.aside-card p { margin: 0 0 0.5rem; font-size: 0.97rem; }
.aside-card .links a { margin-right: 14px; font-size: 0.93rem; }

/* CV */
.cv-item { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.cv-item:last-child { border-bottom: 1px solid var(--line); }
.cv-dates { color: var(--muted); font-size: 0.9rem; padding-top: 3px; }
.cv-item h3 { margin: 0; font-size: 1.05rem; }
.cv-org { color: var(--muted); font-size: 0.95rem; margin: 2px 0 8px; }
.cv-item ul { margin: 0; padding-left: 1.1rem; font-size: 0.95rem; }
.cv-item li + li { margin-top: 4px; }
.skills { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 8px; font-size: 0.95rem; }
.skills li { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.skills .k { color: var(--muted); font-weight: 500; }
.plain { padding-left: 1.1rem; font-size: 0.97rem; }

/* Contact */
.contact { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; font-size: 0.9rem; color: var(--muted); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 6px; }
.site-footer .fine { margin: 0; font-size: 0.85rem; }

@media (max-width: 680px) {
  body { font-size: 16px; }
  h1 { font-size: 2rem; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero img { width: 108px; height: 108px; order: -1; }
  .cards { grid-template-columns: 1fr; }
  .cv-item { grid-template-columns: 1fr; gap: 4px; }
  .skills li { grid-template-columns: 1fr; gap: 0; }
  .nav ul { gap: 12px; }
  .nav li a { font-size: 0.88rem; }
  .brand { font-size: 0.95rem; }
  .nav-research { display: none; }
}

@media print {
  .site-header, .site-footer, .actions, .button, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { padding: 0; }
  a { color: inherit; }
  .cv-item, .pub { break-inside: avoid; }
}

/* Training Log page */
.lede-sm { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; }
.links-row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin: 0 0 0.5rem; }
.shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 1.5rem 0 0; }
.shots figure { margin: 0; }
.shots img {
  width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08); display: block;
}
.shots figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 6px; text-align: center; }
.arch { margin: 1.25rem 0 0; }
.arch svg { width: 100%; height: auto; display: block; color: var(--muted); }
.arch .box { fill: var(--bg-raised); stroke: var(--line); stroke-width: 1.5; }
.arch .box-main { fill: var(--accent-soft); stroke: var(--accent); }
.arch text { font-family: var(--sans); font-size: 13px; fill: var(--text); }
.arch .label-head { font-weight: 600; font-size: 14px; }
.arch .label-sub, .arch .edge-label { fill: var(--muted); font-size: 12px; }
.arch .label { fill: var(--muted); }
.arch .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.arch .row-strong text { fill: var(--text); font-weight: 500; }
.arch .edge { stroke: currentColor; stroke-width: 1.5; }
.arch figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 8px; }
.stack { border-collapse: collapse; width: 100%; font-size: 0.93rem; margin-top: 0.5rem; }
.stack th, .stack td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
.stack th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.stack td:first-child { white-space: nowrap; font-weight: 500; width: 110px; }

@media (max-width: 680px) {
  .shots { grid-template-columns: repeat(2, 1fr); }
  .arch { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .arch svg { min-width: 640px; }
}
