/* ====== Base / Theme ====== */
:root {
  --bg: #0d1117;
  --bg-elev: #0f1520;
  --bg-header: #0b0f16;
  --text: #c9d1d9;
  --muted: #8b949e;
  --subtle: #b1bac4;
  --line: #21262d;
  --line-2: #30363d;
  --brand: #58a6ff;
  --brand-soft: #9ecbff;
  --tile: #0e1622;
  --focus: #1f6feb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ====== Layout ====== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ====== Header / Brand ====== */
.site-header {
  position: relative;
  background: linear-gradient(180deg, var(--bg-header), var(--bg-elev));
  border-bottom: 1px solid var(--line-2);
  padding: 24px 0 24px; /* compact so avatar feels 'right up' at the top */
  overflow: hidden;
}

/* subtle black band preserved */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 56px;
  background: #000;
  opacity: 0.2;
  pointer-events: none;
}

/* Title & subtitle */
.identity h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: 0.2px;
  color: var(--brand);
}
.identity p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Quick links (icons) */
.identity .icons {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.identity .icons a {
  color: var(--brand-soft);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 10px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.identity .icons a:hover {
  color: var(--brand);
  border-color: var(--line-2);
  background: rgba(88,166,255,0.06);
}

/* ===== Avatar (shared defaults) ===== */
.profile {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line-2);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  background: #000;
}

/* ===== Avatar placement modes =====
   Add ONE of these classes to .site-header:
   - avatar-inline : avatar sits to the RIGHT edge of the content column
   - avatar-left   : (optional) avatar pinned to top-left of content column
*/

/* --- INLINE (right of name, aligned to container's right edge) --- */
.site-header.avatar-inline .container.identity {
  display: flex;
  align-items: flex-start;           /* top-align with your name line */
  justify-content: space-between;    /* pushes avatar to the far right */
  gap: 18px;
}
.site-header.avatar-inline .profile-wrap {
  position: static;     /* no absolute pinning */
  flex: 0 0 auto;
  margin-left: 24px;    /* little breathing room if text grows long */
}

/* Responsive: stack on small screens */
@media (max-width: 560px) {
  .site-header.avatar-inline .container.identity {
    flex-wrap: wrap;
    gap: 12px;
  }
  .site-header.avatar-inline .profile-wrap {
    order: -1;          /* avatar above text on narrow screens */
    margin-left: 0;
  }
}

/* --- LEFT-EDGE (optional legacy mode) --- */
.site-header.avatar-left .profile-wrap {
  position: absolute;
  top: 16px;
  left: max(16px, calc(50% - 500px + 20px));
  width: 84px;
  height: 84px;
}
.site-header.avatar-left .profile-wrap::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #000;
  z-index: -1;
  filter: blur(8px);
  opacity: 0.45;
}

/* ====== Minimal Nav ====== */
.navbar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.navbar .nav {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 10px 0;
  overflow-x: auto;
}
.nav a {
  color: var(--brand-soft);
  text-decoration: none;
  font-size: 14.5px;
  padding: 6px 2px;
  position: relative;
  white-space: nowrap;
}
.nav a:hover { color: var(--brand); }
.nav a.active::after,
.nav a:focus-visible::after,
.nav a:hover::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}
.nav a:focus-visible {
  outline: 2px dashed var(--focus);
  outline-offset: 4px;
}

/* ====== Main ====== */
main { padding: 36px 0 96px; }  /* extra bottom room so it never feels cut off */
section + section { margin-top: 42px; }

h2 {
  color: var(--brand);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--brand);
}
h3 { margin: 10px 0 6px; font-size: 16.5px; color: var(--text); }
p  { color: var(--subtle); margin: 8px 0 0; }
a  { color: var(--brand-soft); }
a:hover { color: var(--brand); }

/* ====== Tiles (for links sections) ====== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .tile-grid { grid-template-columns: 1fr; } }

.tile {
  display: block;
  background: linear-gradient(180deg, var(--tile), rgba(14,22,34,0.6));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 16px;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  background: linear-gradient(180deg, var(--tile), rgba(14,22,34,0.8));
}
.tile h3 { margin: 2px 0 6px; color: var(--text); font-size: 16.5px; font-weight: 600; }
.tile p  { margin: 0; color: var(--muted); font-size: 14px; }

/* ====== Lists & Tables ====== */
ul { padding-left: 1.15rem; margin: 10px 0 0; }
ul.clean { list-style: none; padding-left: 0; }
li { margin: 6px 0; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 8px 10px; text-align: left; }
th { color: var(--brand-soft); font-weight: 600; border-bottom: 1px solid var(--line-2); }
td { border-bottom: 1px solid var(--line); }

/* ====== Publications (used on publications.html) ====== */
.pub-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--brand-soft);
  background: rgba(88,166,255,0.08); border: 1px solid var(--line);
  padding: 4px 8px; border-radius: 999px;
}
.pub-list { list-style: none; padding-left: 0; margin: 14px 0 0; }
.pub-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pub-item:last-child { border-bottom: none; }
.pub-title { margin: 0 0 4px; font-weight: 600; font-size: 16.5px; color: var(--text); }
.pub-authors { margin: 0; font-size: 14px; color: var(--subtle); }
.pub-meta { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.pub-links { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.pub-link {
  text-decoration: none; font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--brand-soft); background: rgba(88,166,255,0.04);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.pub-link:hover { color: var(--brand); border-color: var(--line-2); background: rgba(88,166,255,0.08); }
.year-divider {
  margin-top: 28px; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-top: 1px dashed var(--line); padding-top: 10px;
}

/* ====== Footer ====== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  color: var(--muted);
  font-size: 13px;
}
.site-footer .foot {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
.site-footer .foot a { text-decoration: none; color: var(--brand-soft); }
.site-footer .foot a:hover { color: var(--brand); }

/* ====== Utilities ====== */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}