:root{
  --bg:#ffffff;
  --text:#1a1c1f;
  --text-muted:#5f636a;
  --border:#e3e3e0;
  --accent:#14554a;
  --nav-h:60px;
  --maxw:760px;

  /* Top and bottom padding on each section. The anchor offset below
     is derived from this, so change it here and jump-to-section
     scrolling stays correct. */
  --section-pad:52px;
  /* Gap left between the nav bar and a section heading after a jump. */
  --anchor-gap:20px;
}
html[data-theme="dark"]{
  --bg:#101315;
  --text:#e8e8e4;
  --text-muted:#9aa0a0;
  --border:#252a2b;
  --accent:#5cc0ae;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  *{ transition-duration:0.001ms !important; }
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size:16px;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  transition:background 0.2s ease, color 0.2s ease;
  overflow-wrap:break-word;
}

a{ color:inherit; }

.skip-link{
  position:absolute; left:-9999px; top:0;
  background:var(--accent); color:#fff; padding:10px 16px;
  z-index:200;
}
.skip-link:focus{ left:0; }

:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px;
}

/* ---------- layout shell ----------
   Side padding only. This must NOT use the padding shorthand: .wrap
   is a class and section is an element, so a shorthand here would
   win on specificity and wipe out every section's vertical padding. */
.wrap{
  max-width:var(--maxw);
  margin:0 auto;
  padding-left:28px;
  padding-right:28px;
}

/* ---------- nav ----------
   Solid background on purpose. A translucent bar lets the previous
   section show through faintly as you jump between anchors. */
header.site-nav{
  position:sticky; top:0; z-index:100;
  height:var(--nav-h);
  display:flex; align-items:center;
  background:var(--bg);
  border-bottom:1px solid var(--border);
}
.nav-inner{
  max-width:980px;
  margin:0 auto;
  width:100%;
  padding:0 28px;
  display:flex; align-items:center; justify-content:space-between;
  gap:56px;
}
.nav-mark{
  font-family:'Newsreader', serif;
  font-weight:500;
  font-size:1rem;
  text-decoration:none;
  white-space:nowrap;
}
.nav-links{
  display:flex; align-items:center; gap:26px;
  list-style:none; margin:0; padding:0;
}
.nav-links a{
  position:relative;
  font-size:0.84rem;
  text-decoration:none;
  color:var(--text-muted);
  padding:4px 0;
  transition:color 0.15s ease;
}
.nav-links a:hover{ color:var(--text); }

/* the section you are currently reading */
.nav-links a.active{
  color:var(--accent);
  font-weight:600;
}
.nav-links a.active::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-2px;
  height:2px;
  background:var(--accent);
}

.theme-toggle{
  display:flex; align-items:center; justify-content:center;
  width:30px; height:30px;
  border-radius:4px;
  border:1px solid var(--border);
  background:transparent;
  cursor:pointer;
  color:var(--text-muted);
  flex-shrink:0;
}
.theme-toggle:hover{ color:var(--text); }
.theme-toggle svg{ width:14px; height:14px; }
.theme-toggle .icon-moon{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display:block; }

.nav-toggle-btn{
  display:none;
  width:30px; height:30px;
  border-radius:4px;
  border:1px solid var(--border);
  background:transparent;
  align-items:center; justify-content:center;
  cursor:pointer;
  color:var(--text-muted);
}

/* ---------- sections ----------
   scroll-margin-top = nav height + gap, minus the section's own top
   padding, so the section HEADING lands just below the nav bar
   instead of the section's empty padding. */
section{
  padding-top:var(--section-pad);
  padding-bottom:var(--section-pad);
  scroll-margin-top:calc(var(--nav-h) + var(--anchor-gap) - var(--section-pad));
}

/* kept so writing.html does not break; now plain, no accent bar */
.eyebrow{
  display:block;
  font-size:0.8rem;
  letter-spacing:0.04em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin-bottom:10px;
}

h2.section-title{
  font-family:'Newsreader', serif;
  font-weight:500;
  font-size:1.35rem;
  margin:0 0 24px 0;
  padding-bottom:8px;
  border-bottom:1px solid var(--border);
}

.group-label{
  font-size:0.8rem;
  letter-spacing:0.05em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin:0 0 16px 0;
}
.group-label:not(:first-of-type){ margin-top:34px; }

/* ---------- hero / about ----------
   The hero has its own larger top padding, so it needs its own
   matching anchor offset. */
.hero{
  padding-top:64px;
  display:grid;
  grid-template-columns: 1fr auto;
  gap:36px;
  align-items:start;
}
#about{ scroll-margin-top:calc(var(--nav-h) + var(--anchor-gap) - 64px); }
.hero h1{
  font-family:'Newsreader', serif;
  font-weight:500;
  font-size:2.1rem;
  line-height:1.2;
  margin:0 0 8px 0;
}
.hero .role{
  font-size:0.97rem;
  color:var(--text-muted);
  line-height:1.5;
  margin:0 0 22px 0;
}
.hero .bio{ font-size:1rem; }
.hero .bio p{ margin:0 0 14px 0; }
.hero .bio p:last-child{ margin-bottom:0; }

.interest-line{
  font-size:0.95rem;
  color:var(--text-muted);
  margin:18px 0 0 0;
}
.interest-line .label{ color:var(--text); font-weight:500; }

/* profile photo */
.portrait{
  width:140px; height:140px;
  border-radius:2px;
  object-fit:cover;
  flex-shrink:0;
  margin-top:6px;
  border:1px solid var(--border);
  background:var(--bg);
}

.links-row{
  display:flex; flex-wrap:wrap; gap:8px 20px;
  margin-top:20px;
  font-size:0.9rem;
}
.links-row a{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:3px;
}
.links-row a:hover{ opacity:0.75; }

/* kept for compatibility if used elsewhere */
.interest-list{ font-size:1rem; max-width:66ch; }
.interest-list .sep{ color:var(--border); }

/* ---------- publications ---------- */
.pub-list{ display:flex; flex-direction:column; gap:22px; }
.pub-title{
  font-size:1rem;
  font-weight:600;
  line-height:1.45;
  margin:0 0 4px 0;
}
.pub-meta{
  font-size:0.88rem;
  color:var(--text-muted);
  margin:0 0 8px 0;
}
.pub-abstract{
  font-size:0.94rem;
  color:var(--text);
  margin:0 0 8px 0;
}
.pub-links{
  display:flex; flex-wrap:wrap; gap:16px;
  font-size:0.85rem;
  margin:0;
}
.pub-links a{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
}
.pub-links .disabled{ color:var(--text-muted); }
/* legacy classes, kept so old markup still renders sensibly */
.pub-status, .pub-venue{ color:inherit; }

/* ---------- writing (writing.html) ---------- */
.page-title{
  font-family:'Newsreader', serif;
  font-weight:500;
  font-size:2.1rem;
  line-height:1.2;
  margin:0 0 8px 0;
}
.page-intro{
  color:var(--text-muted);
  margin:0 0 32px 0;
}
.writeup-list{ display:flex; flex-direction:column; }
.writeup{
  display:block;
  padding:20px 0;
  border-top:1px solid var(--border);
  text-decoration:none;
  color:inherit;
}
.writeup:first-of-type{ border-top:none; padding-top:0; }
.writeup-head{
  display:flex; justify-content:space-between; align-items:baseline; gap:16px;
}
.writeup-title{
  font-size:1rem;
  font-weight:600;
  margin:0;
  transition:color 0.15s ease;
}
.writeup:hover .writeup-title{ color:var(--accent); }
.writeup-arrow{ flex-shrink:0; color:var(--text-muted); }
.writeup-meta{
  font-size:0.85rem;
  color:var(--text-muted);
  margin:4px 0 8px 0;
}
.writeup-excerpt{
  font-size:0.93rem;
  color:var(--text-muted);
  margin:0;
}
.writeup-tags{
  font-size:0.82rem;
  color:var(--text-muted);
  margin-top:8px;
}
.writeup-tags .sep{ color:var(--border); margin:0 8px; }

/* ---------- entries: experience, teaching, projects ---------- */
.entry{
  display:grid;
  grid-template-columns: 150px 1fr;
  gap:20px;
  margin-bottom:22px;
}
.entry:last-of-type{ margin-bottom:0; }
.entry-date{
  font-size:0.88rem;
  color:var(--text-muted);
  padding-top:1px;
}
.entry-title{
  font-size:0.98rem;
  font-weight:600;
  margin:0 0 2px 0;
}
.entry-org{
  font-size:0.9rem;
  color:var(--text-muted);
  margin:0 0 6px 0;
}
.entry-note{
  font-size:0.93rem;
  margin:0;
}
/* kept in case any old bullet markup remains */
.entry ul{ margin:6px 0 0 0; padding-left:18px; font-size:0.93rem; }
.entry li{ margin-bottom:5px; }
.entry-tools{ font-size:0.85rem; color:var(--text-muted); margin:8px 0 0 0; }

/* ---------- plain lists: honors, training ---------- */
.line-list{
  list-style:none;
  margin:0; padding:0;
  font-size:0.94rem;
}
.line-list li{
  position:relative;
  padding:0 0 10px 20px;
}
.line-list li:last-child{ padding-bottom:0; }
.line-list li::before{
  content:"\2022";
  position:absolute; left:2px;
  color:var(--text-muted);
}
.line-list .dot{ display:none; }
.line-list .cert-link{
  font-size:0.85rem;
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
  margin-left:6px;
  white-space:nowrap;
}
.line-list .cert-link:hover{ opacity:0.75; }

/* ---------- education ---------- */
.edu{ margin-bottom:22px; }
.edu-school{ font-size:1rem; font-weight:600; margin:0; }
.edu-degree{ font-size:0.9rem; color:var(--text-muted); margin:2px 0 6px 0; }
.edu-note{ font-size:0.93rem; margin:0; }
/* legacy */
.edu-meta{ font-size:0.88rem; color:var(--text-muted); margin-bottom:10px; }
.edu ul{ margin:0; padding-left:18px; font-size:0.93rem; }
.edu li{ margin-bottom:5px; }

/* ---------- contact / footer ---------- */
.contact-note{
  font-size:0.96rem;
  color:var(--text-muted);
  margin:0;
}
.contact-row{ display:flex; flex-wrap:wrap; gap:22px; margin-top:14px; }
.contact-row a{
  color:var(--accent);
  font-size:0.94rem;
  text-decoration:underline;
  text-underline-offset:3px;
}

footer{
  padding-top:28px;
  padding-bottom:44px;
  border-top:1px solid var(--border);
  margin-top:36px;
}
footer .foot-inner{
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px;
  font-size:0.85rem;
  color:var(--text-muted);
}

#contact{ padding-bottom:40px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px){
  .nav-links{
    position:fixed; top:var(--nav-h); left:0; right:0;
    flex-direction:column; align-items:flex-start;
    background:var(--bg); border-bottom:1px solid var(--border);
    padding:18px 22px; gap:14px;
    opacity:0; visibility:hidden;
    transition:opacity 0.15s ease, visibility 0.15s;
    max-height:calc(100vh - var(--nav-h));
    overflow-y:auto;
  }
  .nav-links.open{ opacity:1; visibility:visible; }
  .nav-toggle-btn{ display:flex; }
  /* underline reads badly in a stacked menu */
  .nav-links a.active::after{ display:none; }
}

@media (max-width: 640px){
  :root{ --section-pad:40px; }
  .wrap, .nav-inner{ padding-left:22px; padding-right:22px; }
  .hero{ grid-template-columns:1fr; padding-top:40px; gap:22px; }
  #about{ scroll-margin-top:calc(var(--nav-h) + var(--anchor-gap) - 40px); }
  .portrait{ width:100px; height:100px; order:-1; }
  .hero h1, .page-title{ font-size:1.75rem; }
  h2.section-title{ font-size:1.2rem; margin-bottom:20px; }
  .entry{ grid-template-columns:1fr; gap:2px; }
  .entry-date{ order:-1; }
}

@media (max-width: 380px){
  .wrap, .nav-inner{ padding-left:16px; padding-right:16px; }
  .hero h1, .page-title{ font-size:1.55rem; }
  .nav-mark{ font-size:0.92rem; }
}
