:root{
  --accent: #0b63c7;
  --text: #111;
  /*--muted: #666; */
  --muted: #999;
  --bg: #fff;
  --border: #e7e7e7;
  --sidebar: 320px;   /* desktop sidebar width */
  --gutter: 24px;     /* space between sidebar and content */
}

/* Base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px;}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  overflow-x: hidden; 
}
img { max-width: 100%; height: auto; } /* no overflow on mobile */

/* Top nav */
.topnav {
  position: fixed;
  top: 0;
  left: calc(var(--sidebar) + var(--gutter));
  right: 0;
  height: 64px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(130%) blur(6px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}
.topnav.scrolled { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.topnav-inner { max-width: 980px; margin: 0 auto; width: 100%; padding: 0 28px; display: flex; gap: 12px; align-items: center; }
#site-nav { display: flex; gap: 14px; align-items: center; }
#site-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 10px;            /* bigger tap target */
  border-radius: 8px;
  border: 1px solid transparent;
}
#site-nav a:hover { border-color: var(--border); }

/* hamburger hidden on desktop */
.nav-toggle { display: none; background: transparent; border: 0; padding: 8px; cursor: pointer; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar);
  padding: 84px 28px 28px;      /* clears topnav visually */
  /*border-right: 1px solid var(--border);*/
  border-right: none;
  /*background: #fafafa;*/
  background: #fff;
  overflow-y: auto;
}

/* Global image rules: bigger, not rounded, no border, never cropped */
.headshot{
  display:block;
  width:220px;           /* desktop size; change to taste */
  height:auto;           /* keep aspect ratio */
  object-fit:contain;    /* never crop */
  border:none;
  border-radius:0;
  margin:0 0 14px;
}
h1 { font-size: 26px; margin: 0 0 6px; }
.tagline { margin: 0 0 16px; color: var(--muted); }
.links { font-size: 14px; color: var(--muted); }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--text); text-decoration: underline; }

/* Content */
.content {
  margin-left: calc(var(--sidebar) + var(--gutter));
  padding: 96px 32px 40px;      /* top padding clears fixed nav */
  max-width: 980px;
}
.section {
  padding: 28px 0;
  /*border-bottom: 1px solid var(--border);*/
  border-bottom: 1px solid #f2f2f2;
  scroll-margin-top: 84px;      /* anchor offset under fixed header */
}
.section:last-of-type { border-bottom: 0; }
h2 {
  font-size: 24px; margin: 0 0 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block; padding-bottom: 2px;
}
a { color: var(--accent); }
a:hover { text-decoration: underline; }
.paper, .course { padding: 14px 0; }
.paper h3, .course h3 { margin: 0 0 4px; font-size: 19px; }
.meta { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.links a { margin-right: 10px; }
.cv-list { padding-left: 18px; }
.footer { color: var(--muted); font-size: 14px; padding: 28px 0; }


@media (min-width:1001px){
  .topnav-inner { justify-content: flex-start; }
}

/* =========================
   Mobile and tablet styles
   ========================= */
@media (max-width:1000px){
  /* Make the top bar span the full width */
  .topnav { left: 0; }

  /* Sidebar becomes a simple header card, not fixed */
  .sidebar{
    position: static;
    width: auto;
    margin-top: 64px;     /* equals topnav height */
    padding: 16px 20px 8px;
    border-right: 0;
    background: #fff;
    border-bottom: 1px solid #f2f2f2;
  }

  /* Content becomes full-width underneath */
  .content{
    margin: 0;                 /* <-- critical: remove desktop offset */
    padding: 96px 20px 40px;   /* top pad clears fixed nav */
    max-width: 760px;          /* optional: narrows line length on phones */
  }

  /* Mobile nav behavior (if not already added) */
  .nav-toggle{ display: inline-flex; background: transparent; border: 0; padding: 8px; cursor: pointer; }
  #site-nav{
    position: absolute; top: 64px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid #f2f2f2;
    padding: 8px 16px; display: none; flex-direction: column; gap: 4px;
    z-index: 1100; 
  }
  #site-nav.open{ display: flex; }

  /* Headshot: larger, rectangular, never cropped */
  .headshot{ width: 160px; height: auto; object-fit: contain; border: 0; border-radius: 0; }
}

/* Extra small phones */
@media (max-width: 400px) {
  .headshot { width: 120px; height: auto; }
  h1 { font-size: 22px; }
  .section { padding: 22px 0; }
}
