/* ===========================================================
   Brendan O'Donoghue — personal site
   Hand-authored modern CSS, no build step, no dependencies.
   =========================================================== */

:root {
  --max-width: 940px;
  --accent: #2f5fe0;
  --accent-soft: rgba(47, 95, 224, 0.1);
  --bg: #ffffff;
  --bg-elevated: #f7f8fa;
  --bg-card: #ffffff;
  --text: #1a1d24;
  --text-muted: #5b6471;
  --text-faint: #8a94a3;
  --border: #e7eaef;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, 0.14);
  --bg: #0e1116;
  --bg-elevated: #161b22;
  --bg-card: #161b22;
  --text: #e6e9ef;
  --text-muted: #9aa4b2;
  --text-faint: #6b7682;
  --border: #242b35;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}
a:hover { text-decoration: underline; }

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

/* ----------------------------- Nav ----------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-brand {
  font-weight: 700;
  color: var(--text);
  font-size: 16px;
  margin-right: auto;
  letter-spacing: -0.01em;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
}
.nav-links a:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ----------------------------- Hero ----------------------------- */
.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: center;
  padding: 64px 0 40px;
}
.hero-photo {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 4px solid var(--bg-card);
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero .role {
  font-size: 19px;
  color: var(--text);
  font-weight: 600;
  margin: 0 0 4px;
}
.hero .affil { color: var(--text-muted); margin: 0 0 18px; font-size: 16px; }
.hero .affil a { font-weight: 500; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
}
.socials a:hover {
  text-decoration: none;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.socials svg { width: 16px; height: 16px; }

/* ----------------------------- Sections ----------------------------- */
section { padding: 34px 0; border-top: 1px solid var(--border); }
section h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 22px;
}
.lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

/* Narrative bio */
.bio p {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 18px;
}
.bio p:last-child { margin-bottom: 0; }
#about { border-top: 0; padding-top: 12px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 9px; padding: 0; margin: 0; list-style: none; }
.chips li {
  padding: 7px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Timeline / experience */
.entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.entry:last-child { margin-bottom: 0; }
.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 16px;
  margin-bottom: 4px;
}
.entry-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.entry-head .meta { color: var(--text-faint); font-size: 14px; font-weight: 500; white-space: nowrap; }
.entry .org { color: var(--accent); font-weight: 600; font-size: 15px; margin: 0 0 12px; }
.entry ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
.entry ul li { margin-bottom: 6px; }
.entry ul li:last-child { margin-bottom: 0; }

/* Two-column grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Simple list cards (education, awards) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 2px; font-size: 17px; font-weight: 700; }
.card .meta { color: var(--text-faint); font-size: 13.5px; margin: 0 0 8px; }
.card p { margin: 4px 0; color: var(--text-muted); font-size: 15px; }
.card .deg { color: var(--text); font-weight: 500; }

.award-list { list-style: none; margin: 0; padding: 0; }
.award-list li {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15.5px;
}
.award-list li:last-child { border-bottom: 0; }
.award-list .year {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 78px;
}

/* Software */
.software-lead { margin: 0 0 16px; color: var(--text-muted); }
.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.repo-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.repo-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.repo-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent);
}
.repo-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
@media (max-width: 600px) {
  .repo-grid { grid-template-columns: 1fr; }
}

/* ----------------------------- Publications ----------------------------- */
.pub-group + .pub-group { margin-top: 30px; }
.pub-group h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pub-group h3 .count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
}
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  padding: 14px 16px;
  border-radius: 10px;
  margin: 0 -16px;
  transition: background 0.15s ease;
}
.pub:hover { background: var(--bg-elevated); }
.pub .title { font-weight: 600; color: var(--text); font-size: 16px; }
.pub a.title:hover { color: var(--accent); }
.pub .authors { color: var(--text-muted); font-size: 14.5px; margin-top: 2px; }
.pub .authors .me { color: var(--text); font-weight: 600; }
.pub .venue { color: var(--text-faint); font-size: 14px; font-style: italic; margin-top: 1px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.award { background: rgba(214, 158, 46, 0.16); color: #b7791f; }
html[data-theme="dark"] .badge.award { background: rgba(214, 158, 46, 0.2); color: #e3b341; }

/* ----------------------------- Footer ----------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
}
footer a { color: var(--text-muted); }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 22px;
    padding: 40px 0 30px;
  }
  .hero-photo { width: 160px; height: 160px; margin: 0 auto; }
  .hero h1 { font-size: 30px; }
  .socials { justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .entry-head .meta { white-space: normal; }
}
