:root {
  --bg: #ffffff; --fg: #14171a; --muted: #5b6570;
  --line: #e3e6ea; --accent: #0b5fff; --card: #fafbfc;
  --feed-bg: #eef1f5; --feed-card: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --fg: #e6edf3; --muted: #9198a1;
    --line: #232a33; --accent: #6aa3ff; --card: #131920;
    --feed-bg: #05070a; --feed-card: #1c232c;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }

/* Icon assets are single-color: light-mode source images need inverting for a dark
   background and vice versa, so a white logo or black glyph stays visible in both themes. */
.invert-on-light { filter: invert(1); }
.invert-on-dark { filter: none; }
@media (prefers-color-scheme: dark) {
  .invert-on-light { filter: none; }
  .invert-on-dark { filter: invert(1); }
}

header.site { border-bottom: 1px solid var(--line); padding: 1.25rem 0; margin-bottom: 3rem; }
header.site .wrap { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline;
                    justify-content: space-between; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--fg);
         display: inline-flex; align-items: center; gap: .5rem; }
.brand-logo { height: 1.2rem; width: auto; }
header.site nav a { margin-left: 1.1rem; text-decoration: none; color: var(--muted); font-size: .95rem; }
header.site nav a:first-child { margin-left: 0; }
header.site nav a.here { color: var(--fg); font-weight: 600; }

main { min-height: 60vh; padding-bottom: 4rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.02em; margin: 0 0 1.5rem; }
h2 { font-size: 1.4rem; letter-spacing: -.01em; margin: 2.5rem 0 .75rem; }
h3 { font-size: .85rem; margin: 2.5rem 0 .9rem; text-transform: uppercase;
     letter-spacing: .08em; color: var(--muted); }

.lede { font-size: 1.2rem; color: var(--muted); max-width: 50ch; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.crash-note { margin: .75rem 0 0; font-size: .9rem; color: var(--muted); }
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem;
  background: var(--card); display: flex; flex-direction: column; gap: .4rem;
}
.card a.name { font-weight: 600; text-decoration: none; }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }
.card .meta { font-size: .8rem; color: var(--muted); display: flex; gap: .8rem;
              margin-top: auto; padding-top: .5rem; align-items: center; }
.card .meta .tag { border: 1px solid var(--line); border-radius: 20px; padding: 0 .5rem;
                   font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }

.gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 2.5rem; }
.gallery-item { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden;
                border: 1px solid var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

ul.people, ul.articles { list-style: none; padding: 0; }
ul.people { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            margin: 0 0 2.5rem; }
.person {
  border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem;
  background: var(--card); display: flex; flex-direction: column; gap: .2rem;
}
.person-photo {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  margin-bottom: .5rem; border: 1px solid var(--line);
}
.person-name { font-weight: 600; }
.person-role { color: var(--muted); font-size: .85rem; }
.person-link { font-size: .85rem; margin-top: .4rem; text-decoration: none;
               display: inline-flex; align-items: center; gap: .35rem; }
.linkedin-icon { width: 16px; height: 16px; display: inline-block; }
ul.articles li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
ul.articles a { font-weight: 600; text-decoration: none; font-size: 1.05rem; }
ul.articles p { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; }
time { color: var(--muted); font-size: .85rem; }

ul.thesis-proposals, ul.thesis-list { list-style: none; padding: 0; }
ul.thesis-proposals { display: flex; flex-direction: column; gap: 1rem; margin: 0 0 3rem; }
.proposal {
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem;
  background: var(--card);
}
.proposal-title { font-weight: 600; font-size: 1.05rem; display: block; }
.proposal-advisor { color: var(--muted); font-size: .85rem; display: block; margin-top: .2rem; }
.proposal p { margin: .6rem 0 0; color: var(--fg); font-size: .95rem; }

.thesis-entry {
  padding: .75rem 0; border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
}
.thesis-student { font-weight: 600; }
.thesis-title { color: var(--muted); }
.thesis-link { margin-left: auto; font-size: .9rem; white-space: nowrap; text-decoration: none; }

.pub-search { margin-bottom: 2rem; }
.pub-search input {
  width: 100%; font: inherit; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem;
}
.pub-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.pub-year { border-bottom: 1px solid var(--line); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.pub-year-summary {
  cursor: pointer; list-style: none; font-size: 1.4rem; font-weight: 700;
  letter-spacing: -.01em; margin-bottom: 1rem;
}
.pub-year-summary::-webkit-details-marker { display: none; }
.pub-year-summary::before { content: "▸ "; color: var(--muted); font-size: 1rem; }
.pub-year[open] > .pub-year-summary::before { content: "▾ "; }
.pub-count { color: var(--muted); font-weight: 400; font-size: 1rem; }

ul.publications { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.pub {
  display: flex; gap: 1.25rem; justify-content: space-between; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem;
  background: var(--card);
}
.pub-main { flex: 1; min-width: 0; }
.pub-main summary { cursor: pointer; list-style: none; }
.pub-main summary::-webkit-details-marker { display: none; }
.pub-main summary::before { content: "▸ "; color: var(--muted); }
.pub-main[open] summary::before { content: "▾ "; }
.pub-title { display: block; font-weight: 600; font-size: 1.05rem; }
.pub-authors { display: block; color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.pub-citation { display: block; color: var(--muted); font-size: .85rem; font-style: italic; margin-top: .1rem; }
.pub-abstract { margin: .85rem 0 0 1.1rem; color: var(--fg); font-size: .95rem; }
.pub-abstract > :first-child { margin-top: 0; }
.pub-abstract > :last-child { margin-bottom: 0; }
.pub-links { display: flex; flex-direction: row; gap: .6rem; flex-shrink: 0; align-items: flex-start; }
.pub-links a { display: block; opacity: .8; transition: opacity .15s; }
.pub-links a:hover { opacity: 1; }
.pub-icon { width: 26px; height: 26px; object-fit: contain; display: block; }

.post { max-width: 68ch; }
.post .byline { margin: -1rem 0 2rem; color: var(--muted); font-size: .9rem; }
.post pre { background: var(--card); border: 1px solid var(--line); border-radius: 8px;
            padding: 1rem; overflow-x: auto; }
.post code { font-size: .9em; }
.post blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--line);
                   color: var(--muted); }
.post table { width: 100%; border-collapse: collapse; }
.post td, .post th { border-bottom: 1px solid var(--line); padding: .5rem; text-align: left; }

.photo-strip { display: flex; flex-wrap: wrap; gap: .75rem; margin: 3rem 0 0; }
.photo-strip img {
  width: 150px; height: 150px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
}

#feed { background: var(--feed-bg); border-radius: 14px; padding: 1.25rem; }
ul.feed-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.feed-post {
  border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem;
  background: var(--feed-card); box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.feed-header { display: flex; align-items: center; gap: .55rem; margin-bottom: .75rem; }
.feed-avatar {
  width: 28px; height: 28px; min-width: 28px; border-radius: 50%; background: var(--accent);
  padding: 5px; box-sizing: border-box; object-fit: contain; flex-shrink: 0;
}
.feed-name { display: block; font-weight: 600; font-size: .9rem; }
.feed-header time { display: block; color: var(--muted); font-size: .78rem; }
.feed-body { font-size: .95rem; line-height: 1.6; }
.feed-body p { margin: 0 0 .75rem; }
.feed-body p:last-child { margin-bottom: 0; }
.feed-photos { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.feed-photos img {
  width: 90px; height: 90px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line);
}
.feed-link {
  display: inline-block; margin-top: 1rem; padding: .45rem .95rem;
  border: 1px solid var(--line); border-radius: 20px; font-size: .82rem;
  font-weight: 600; text-decoration: none;
}
.feed-link:hover { background: var(--line); }

footer { border-top: 1px solid var(--line); padding: 1.5rem 1.25rem 3rem;
         color: var(--muted); font-size: .9rem; }
