/* ==========================================================================
   Leo Benac — personal site
   Plain CSS, no build step. Colors live in the tokens below; the site opens in
   light mode, and the moon button switches to dark (remembered per visitor).
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f5f3;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-muted: #5b5e66;
  --border: #e6e3de;
  --accent: #a51c30;            /* Harvard crimson */
  --accent-hover: #82141f;
  --accent-soft: #f9ecee;
  --focus: #2563eb;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px rgba(20, 20, 30, .06);
  --radius: 12px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1040px;
  --nav-h: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #111113;
  --bg-soft: #1a1a1d;
  --surface: #17171a;
  --text: #ececf0;
  --text-muted: #a3a3ad;
  --border: #2b2b31;
  --accent: #f2788a;
  --accent-hover: #f8a0ad;
  --accent-soft: rgba(242, 120, 138, .12);
  --focus: #7aa2ff;
  --on-accent: #1a0b0e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 { color: var(--text); }

p { margin: 0 0 1em; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { left: 16px; color: var(--on-accent); text-decoration: none; }

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

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--nav-h);
}

.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--text); text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-links a.nav-cv {
  margin-left: 6px;
  border: 1px solid var(--border);
  color: var(--text);
}
.nav-links a.nav-cv:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.nav-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-soft); }
.icon-btn svg { width: 19px; height: 19px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }

@media (max-width: 980px) {
  .menu-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: calc(100vh - var(--nav-h));
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; font-size: 1rem; }
  .nav-links a.nav-cv { margin: 6px 0 0; text-align: center; }
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  align-items: center;
  padding: 72px 0 44px;
}

/* Photo with the spelled-out email underneath (no mailto link, so bots skip it) */
.avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
}

.avatar {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 14px 36px rgba(20, 20, 30, .14);
}

.email-note,
.email-inline {
  font-family: var(--font-mono);
  letter-spacing: .01em;
}
.email-note {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.email-inline { font-size: .92em; color: var(--text); }

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.7rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}

.role {
  margin: 0 0 18px;
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--accent);
}

.affil {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
}
.affil a { font-weight: 600; }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .94rem;
  font-weight: 600;
  transition: border-color .15s, color .15s, background-color .15s;
}
.social a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.social svg { width: 18px; height: 18px; flex: none; }
.social a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.social a.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 24px;
    padding: 40px 0 28px;
  }
  .avatar { width: 184px; height: 184px; }
  .affil { font-size: 1.02rem; }
  .social { justify-content: center; gap: 8px; }
  .social a { padding: 8px 14px; font-size: .92rem; }
}

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

.section {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 32px;
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  margin: 0;
}

.section-body { min-width: 0; }

.prose { max-width: 70ch; }
.prose p:last-child { margin-bottom: 0; }

.subhead {
  margin: 36px 0 14px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.subhead:first-child { margin-top: 0; }

@media (max-width: 820px) {
  .section { grid-template-columns: 1fr; gap: 18px; padding: 44px 0; }
}

/* Interest chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .84rem;
  color: var(--text-muted);
}

/* ---------- News ---------- */

.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.news li:first-child { padding-top: 0; }
.news li:last-child { border-bottom: 0; }
.news time {
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
@media (max-width: 480px) {
  .news li { grid-template-columns: 1fr; gap: 2px; }
}

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

.themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 1.04rem;
  line-height: 1.35;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.card-icon svg { width: 20px; height: 20px; }

.card .refs {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .92rem;
  line-height: 1.45;
}
.card .refs li {
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.card .refs li:last-child { padding-bottom: 0; }
.card .refs a { display: block; font-weight: 500; }
.card .refs .venue {
  display: block;
  margin-top: 2px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- Publications ---------- */

.pub-note {
  margin: 0 0 18px;
  font-size: .9rem;
  color: var(--text-muted);
}

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pub {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.pub:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow);
}

.pub-venue {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .02em;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.muted { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }

.pub-title {
  margin: 0 0 4px;
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.4;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-authors {
  margin: 0;
  font-size: .9rem;
  color: var(--text-muted);
}
.pub-authors .me { color: var(--text); font-weight: 600; }

.pub-tldr {
  margin: 8px 0 0;
  font-size: .92rem;
  line-height: 1.6;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 600 .78rem/1.6 var(--font-sans);
  cursor: pointer;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-sm[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.bib {
  position: relative;
  margin-top: 12px;
}
.bib pre {
  margin: 0;
  padding: 42px 16px 14px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font: .76rem/1.55 var(--font-mono);
  color: var(--text);
  white-space: pre;
}
.bib .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
}

/* ---------- Timeline (experience / education / teaching) ---------- */

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

.tl-item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 20px;
  padding: 0 0 26px;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-date {
  color: var(--text-muted);
  font-size: .86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  padding-top: 3px;
}

.tl-body :is(h3, h4) {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.4;
}
.tl-org { color: var(--accent); font-weight: 500; }
.tl-meta { margin: 2px 0 0; color: var(--text-muted); font-size: .88rem; }
.tl-body ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: .93rem;
}
.tl-body li + li { margin-top: 4px; }
.tl-body p { margin: 8px 0 0; color: var(--text-muted); font-size: .93rem; }

@media (max-width: 600px) {
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Simple lists ---------- */

.list {
  margin: 0;
  padding-left: 18px;
}
.list li + li { margin-top: 8px; }
.list .muted, .muted { color: var(--text-muted); }
.list .year {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-right: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 40px;
}
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */

.contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 44px;
  color: var(--text-muted);
  font-size: .86rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .pub { padding: 16px; }
}

/* ---------- Print ---------- */

@media print {
  .site-header, .nav-actions, .pub-links, .bib, .skip-link { display: none !important; }
  .section { break-inside: avoid; padding: 20px 0; }
  .pub, .card { box-shadow: none; }
  a { color: inherit; }
}

/* Publication venue line (added) */
.pub-meta {
  margin: 2px 0 0;
  font-size: .86rem;
  color: var(--text-muted);
}
