/* OSM brand font (mirrors osm-data.com's wordmark) */
@font-face {
  font-family: "PP Neue Gstaad Expanded";
  src: url("fonts/PPNeueGstaad-ExpandedBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.osm-word {
  font-family: "PP Neue Gstaad Expanded", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

/* Theme tokens ------------------------------------------------------------ */

:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --fg: #111111;
  --fg-muted: #555555;
  --fg-subtle: #888888;
  --fg-faint: #9ca3af;
  --border: #e5e5e5;
  --border-subtle: #eeeeee;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --current: #dc2626;
  --award: #b45309;
  --venue: #4f46e5;
  --highlight-bg: #eef2ff;

  --osm-bg: #1e293b;    --osm-fg: #fde68a;
  --msr-bg: #0078d4;    --msr-fg: #ffffff;
  --umass-bg: #881c1c;  --umass-fg: #ffffff;
  --ibm-bg: #006699;    --ibm-fg: #ffffff;
  --unibo-bg: #a93226;  --unibo-fg: #ffffff;
}

/* Dark tokens — applied when OS prefers dark (and user hasn't forced light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #161a22;
    --fg: #e5e7eb;
    --fg-muted: #b0b6c0;
    --fg-subtle: #8a93a0;
    --fg-faint: #6b7280;
    --border: #27303f;
    --border-subtle: #1b222d;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --current: #f87171;
    --award: #fbbf24;
    --venue: #a5b4fc;
    --highlight-bg: #1e2342;

    --osm-bg: #fde68a;    --osm-fg: #1e293b;
    --msr-bg: #38bdf8;    --msr-fg: #0b1726;
    --umass-bg: #ef4444;  --umass-fg: #1a0a0a;
    --ibm-bg: #0ea5e9;    --ibm-fg: #0b1726;
    --unibo-bg: #f87171;  --unibo-fg: #1a0a0a;
  }
}

/* Dark tokens — applied when user explicitly forces dark (any OS setting) */
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #161a22;
  --fg: #e5e7eb;
  --fg-muted: #b0b6c0;
  --fg-subtle: #8a93a0;
  --fg-faint: #6b7280;
  --border: #27303f;
  --border-subtle: #1b222d;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --current: #f87171;
  --award: #fbbf24;
  --venue: #a5b4fc;
  --highlight-bg: #1e2342;

  --osm-bg: #fde68a;    --osm-fg: #1e293b;
  --msr-bg: #38bdf8;    --msr-fg: #0b1726;
  --umass-bg: #ef4444;  --umass-fg: #1a0a0a;
  --ibm-bg: #0ea5e9;    --ibm-fg: #0b1726;
  --unibo-bg: #f87171;  --unibo-fg: #1a0a0a;
}

/* Reset & base ------------------------------------------------------------- */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: currentColor;
}

h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.2px;
}

/* Page layout -------------------------------------------------------------- */

.page {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px;
}

.sidebar {
  position: sticky;
  top: 40px;
  align-self: start;
  min-width: 0;
}

.main {
  max-width: 720px;
  min-width: 0;
}

@media (max-width: 820px) {
  .page {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 0 20px;
  }
  .sidebar { position: static; }
}

/* Sidebar ------------------------------------------------------------------ */

.sb-home-link {
  display: block;
  text-decoration: none;
  border: 0;
  color: inherit;
}

.sb-home-link:hover { border: 0; }

.sb-photo {
  display: block;
  width: 160px; height: 160px;
  border-radius: 0;
  overflow: hidden;
  margin: 0 auto 16px;
  background: transparent;
  border: 0;
}

.sb-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 43% 25%;
  transform: translate(2px, 5px) scale(1.2);
  transform-origin: center 30%;
  display: block;
}

.sb-name {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.3px;
  margin: 0 0 4px;
  text-align: center;
}

.sb-role {
  font-size: 13.5px;
  color: var(--fg-muted);
  line-height: 1.4;
  margin: 0 0 12px;
  text-align: center;
}

.sb-role .org { display: block; color: var(--fg-subtle); }
.sb-role .org a { color: var(--fg); border-bottom: 1px dashed var(--border); }
.sb-role .org a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.sb-contact {
  font-size: 12.5px;
  margin: 10px 0;
  word-break: break-all;
  text-align: center;
}

.sb-contact a {
  color: var(--fg);
  border-bottom: 1px dashed var(--border);
}

.sb-contact a:hover { border-bottom-color: var(--accent); color: var(--accent); }

.sb-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 14px;
}

.sb-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: color 120ms, border-color 120ms, background 120ms;
}

.sb-socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
}

.sb-socials a svg {
  width: 15px;
  height: 15px;
  display: block;
}

.sb-socials a.scholar svg {
  width: 17px;
  height: 17px;
}

.sb-socials a.text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.sb-cv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 1px;
  margin-top: 4px;
}

.sb-cv svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.sb-cv:hover { color: var(--accent); border-bottom-color: var(--accent); }

.sb-theme {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 4px 6px;
  color: var(--fg-muted);
  border-radius: 6px;
  line-height: 0;
  transition: color 120ms, border-color 120ms, background 120ms;
  z-index: 1;
}

.sb-theme:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
}

.sb-theme svg { display: block; }

/* Show moon by default (light mode → click to go dark) */
.sb-theme .icon-sun { display: none; }
.sb-theme .icon-moon { display: block; }

/* When OS dark (and user hasn't forced light): show sun */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sb-theme .icon-sun { display: block; }
  :root:not([data-theme="light"]) .sb-theme .icon-moon { display: none; }
}

/* Explicit overrides win */
:root[data-theme="dark"] .sb-theme .icon-sun { display: block; }
:root[data-theme="dark"] .sb-theme .icon-moon { display: none; }
:root[data-theme="light"] .sb-theme .icon-sun { display: none; }
:root[data-theme="light"] .sb-theme .icon-moon { display: block; }

.sb-divider {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 20px 0 16px;
}

.sb-quotes {
  font-size: 11.5px;
  color: var(--fg-muted);
  line-height: 1.55;
}

.sb-quotes-h {
  font-size: 10px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sb-quote { font-style: italic; margin: 0 0 10px; }

.sb-quote .attr {
  display: block;
  font-style: normal;
  color: var(--fg-subtle);
  font-size: 10.5px;
  margin-top: 3px;
}

.sb-quote .attr::before { content: "— "; }

/* Intro -------------------------------------------------------------------- */

/* Tagline — Cormorant Garamond italic, locked-in style */
.tagline {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 28px;
  color: var(--fg);
  letter-spacing: -0.3px;
  margin: 0 0 8px;
  line-height: 1.3;
}


.intro {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  margin: 0 0 32px;
}

/* Sections ----------------------------------------------------------------- */

.section { margin: 36px 0 0; }

.section-h {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}

.section-h-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.section-h-row .section-h { margin: 0; }

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 6px 14px;
  letter-spacing: 0.1px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background 120ms, transform 120ms, box-shadow 120ms;
}

.section-link:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.25);
}

/* Timeline ----------------------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: 28px;
  margin: 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 14px; bottom: 14px;
  width: 2px;
  background: var(--border);
}

.tl-entry {
  position: relative;
  padding: 5px 0 5px 4px;
}

.tl-entry::before {
  content: "";
  position: absolute;
  left: -26px; top: 11px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-sizing: border-box;
}

.tl-entry.current::before {
  background: var(--current);
  border-color: var(--current);
}

.tl-line1 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tl-year {
  font-size: 11px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
  min-width: 40px;
}

.tl-logo {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #ffffff;
  padding: 3px;
  border: 1px solid var(--border);
  box-sizing: border-box;
  object-fit: contain;
  flex-shrink: 0;
}

.tl-logo.wordmark {
  width: auto;
  height: 26px;
  max-width: 90px;
  padding: 2px 6px;
}

.tl-logo.osm {
  background: #292524;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border);
  padding: 1px;
}

.tl-logo.umass {
  padding: 1px;
}

.tl-role { font-size: 14px; font-weight: 600; color: var(--fg); }
.tl-at { font-size: 13.5px; color: var(--fg-subtle); font-weight: 400; }
.tl-org {
  font-size: 13.5px;
  color: var(--fg);
  font-weight: 500;
  border-bottom: 0;
  text-decoration: underline dashed;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.tl-org.osm-word { font-weight: 700; }
.tl-org:hover { color: var(--accent); border-bottom: 0; text-decoration-color: var(--accent); }

.tl-where {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin: 1px 0 0 90px;
  line-height: 1.45;
}

.tl-where a { color: var(--fg-muted); border-bottom: 1px dashed var(--border); }
.tl-where a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.tl-detail {
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin: 3px 0 0 90px;
  font-style: italic;
  line-height: 1.5;
}

.tl-collabs {
  list-style: none;
  margin: 2px 0 0 90px;
  padding: 0;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.4;
}

.tl-collabs li {
  padding: 0;
}

.tl-collabs a {
  color: var(--fg-muted);
  border-bottom: 1px dashed var(--border);
}

.tl-collabs a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


.tl-collab-tag {
  font-size: 10.5px;
  color: var(--fg-subtle);
  font-style: italic;
  margin-left: 3px;
}

/* Research ----------------------------------------------------------------- */

.research-umbrella {
  font-size: 13.5px;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.6;
  margin: 0 0 24px;
  padding: 12px 16px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

.theme { margin-bottom: 26px; }

.theme-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.theme-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.1px;
}

.theme-meta {
  font-size: 10.5px;
  color: var(--fg-faint);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.theme-desc {
  font-size: 12.5px;
  color: var(--fg-subtle);
  font-style: italic;
  line-height: 1.55;
  margin: 4px 0 12px;
}

.sub-group {
  padding: 6px 0 4px 0;
  margin: 10px 0 14px;
}

.sub-hdr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.sub-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
}

.sub-meta {
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.sub-alias {
  font-size: 11px;
  color: var(--fg-faint);
  font-style: italic;
  margin-bottom: 4px;
}

.sub-desc {
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin-bottom: 6px;
  line-height: 1.5;
}

.paper {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 2px 0 2px 4px;
  font-size: 13px;
  line-height: 1.55;
}

.paper.highlight {
  background: var(--highlight-bg);
  border-radius: 4px;
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 8px;
  padding-right: 4px;
}

/* Adjacent highlighted papers merge into one card */
.paper.highlight + .paper.highlight {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.paper.highlight:has(+ .paper.highlight) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Same effect in the flat publications list, where papers are wrapped in <li> */
.pub-list > li.highlight + li.highlight {
  padding-top: 0;
}
.pub-list > li.highlight + li.highlight > .paper.highlight {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.pub-list > li.highlight:has(+ li.highlight) {
  padding-bottom: 0;
  border-bottom: none;
}
.pub-list > li.highlight:has(+ li.highlight) > .paper.highlight {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.paper .meta-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.paper .yr {
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}

.paper .title { color: var(--fg); }

.paper a.title-link {
  color: var(--fg);
  border-bottom: 1px dotted var(--border);
}

.paper a.title-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.paper .venue {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
}

.paper .venue a { color: var(--fg-muted); border-bottom: none; }
.paper .venue a:hover { color: var(--accent); border-bottom: 1px dashed var(--accent); }

.paper .venue .category {
  font-style: italic;
  font-weight: normal;
}

.paper .venue .workshop {
  font-weight: normal;
}

.paper .status {
  color: var(--fg-subtle);
  font-size: 10.5px;
  font-style: italic;
}

.paper .venue-full {
  display: block;
  font-size: 10.5px;
  color: var(--fg-subtle);
  margin-top: 2px;
}

.paper .award {
  position: relative;
  color: var(--award);
  font-size: 10.5px;
  font-weight: 600;
}

.paper .award::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 1px;
  width: 12px;
  height: 14px;
  margin-right: 3px;
  background-image: url('imgs/gold-award-small.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.paper .summary:not([hidden]) {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: var(--fg);
  margin: 6px 0 4px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.paper .authors {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.paper .links {
  display: block;
  font-size: 10.5px;
  margin-top: 3px;
}

.paper .links a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  margin-right: 10px;
  border-bottom: 1px solid transparent;
}

.paper .links a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.paper .links .link-icon {
  display: inline-flex;
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.paper .links .link-icon svg {
  width: 100%;
  height: 100%;
}

.paper .links button.abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0 10px 0 0;
  color: var(--accent);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  vertical-align: baseline;
}

.paper .links button.abstract-toggle:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.paper .abstract:not([hidden]) {
  margin: 6px 0 4px;
  padding: 6px 10px 6px 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--fg-muted);
  border-left: 2px solid var(--border);
  text-align: justify;
}

/* Flat publications list --------------------------------------------------- */

.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub-list > li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.pub-list > li > .paper { padding: 0 0 0 4px; }

.pub-list > li:last-child { border-bottom: none; }

/* Videos ------------------------------------------------------------------- */

.videos {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.video {
  flex: 1 1 240px;
  max-width: 280px;
}

.video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 4px;
  display: block;
}

.video-cap {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* Talks -------------------------------------------------------------------- */

.talks {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.4;
}

.talks li {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  padding: 2px 0;
}

.talks .yr {
  color: var(--fg-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.talks .title { color: var(--fg); font-weight: 500; }
.talks .where { color: var(--fg-subtle); font-size: 11.5px; }

.talks.talks-collapsed > li:nth-child(n+6) { display: none; }

.talks-toggle {
  font-family: inherit;
  font-size: 11.5px;
  background: none;
  border: 0;
  padding: 4px 0;
  margin-top: 4px;
  color: var(--accent);
  cursor: pointer;
}

.talks-toggle:hover {
  color: var(--accent-hover);
}

/* Service ------------------------------------------------------------------ */

.service {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  font-size: 12px;
  line-height: 1.6;
}

.service-block h4 {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-subtle);
  font-weight: 700;
}

.service-block .items { color: var(--fg-muted); }

/* Footer ------------------------------------------------------------------- */

.footer {
  margin: 48px 0 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--fg-faint);
}
