\
/* ======================================================================
   Minimalist academic site — v2 (closer to classic personal finance sites)
   - Serif typography, thin rules, generous whitespace
   - Single-column content (max ~72ch)
   - Understated link styling, no boxes or cards
   - Dark mode supported via color-scheme + toggle
   - Responsive: collapses nav to hamburger
   ====================================================================== */

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #5b5b5b;
  --rule: #e6e6e6;
  --link: #0a4bcc;
  --link-visited: #5a2ca0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0f;
    --text: #eaeaec;
    --muted: #b2b2b7;
    --rule: #2a2a32;
    --link: #8ab4ff;
    --link-visited: #c58af9;
  }
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Georgia", "Times New Roman", Times, serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { width: min(92vw, 72ch); margin: 0 auto; padding: 1.25rem 1rem; }

/* Header */
.site-header { position: sticky; top: 0; background: var(--bg); }
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; color: var(--text); text-decoration: none; }
.rule { border: none; border-top: 1px solid var(--rule); margin: 0; }

.site-nav { display: flex; align-items: center; gap: .75rem; }
.site-nav a {
  text-decoration: none;
  color: var(--text);
  padding: .25rem .35rem;
  border-radius: .25rem;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a.active, .site-nav a[aria-current="page"] {
  outline: 1px solid var(--rule);
}

.theme-toggle {
  margin-left: .5rem;
  font: inherit;
  padding: .25rem .45rem;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: .25rem;
  cursor: pointer;
}

/* Mobile nav */
.nav-toggle { display: none; background: none; border: none; padding: .25rem; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 4px 0; }
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; right: 1rem; top: 54px; display: none; flex-direction: column;
    background: var(--bg); border: 1px solid var(--rule); padding: .5rem; border-radius: .5rem;
  }
  .site-nav[data-expanded="true"] { display: flex; }
}

/* Typography */
h1, h2, h3 { line-height: 1.25; margin: 1.25rem 0 .25rem; }
.lead { color: var(--muted); margin-top: 0; }
.bio { margin-top: .5rem; }
.simple-list { padding-left: 1.1rem; }
.simple-list li { margin: .25rem 0; }
.links-inline { list-style: none; padding: 0; display: flex; gap: .75rem; flex-wrap: wrap; }
.links-inline li a { text-decoration: underline; }

/* Home split */
.home-split { display: grid; grid-template-columns: 1.6fr .8fr; gap: 2rem; align-items: start; }
.headshot img { width: 100%; border-radius: 6px; border: 1px solid var(--rule); }
@media (max-width: 880px) { .home-split { grid-template-columns: 1fr; } }

/* Papers */
.paper { margin: 1rem 0; padding-bottom: .75rem; border-bottom: 1px solid var(--rule); }
.paper-title { font-weight: 600; margin: 0; }
.paper-title .badge {
  display: inline-block; font-size: .72rem; margin-left: .5rem; border: 1px solid var(--rule); padding: .05rem .35rem; border-radius: .25rem;
}
.paper-meta { color: var(--muted); margin: .25rem 0 .5rem; }
.abstract-toggle {
  background: transparent; border: 1px solid var(--rule); border-radius: .25rem;
  padding: .25rem .45rem; cursor: pointer; font: inherit;
}
.abstract {
  margin-top: .5rem;
  padding-left: .75rem;
  border-left: 2px solid var(--rule);
}

/* Style the text inside abstracts */
.abstract,
.abstract p {
  text-align: justify;       /* aligns left & right edges */
  text-justify: inter-word;  /* spaces words more evenly */
  hyphens: auto;             /* allows word breaks if needed */
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

.abstract p {
  text-align-last: justify;
}

/* Courses */
.course { margin: 1rem 0; padding-bottom: .75rem; border-bottom: 1px solid var(--rule); }
.course-title { font-weight: 600; margin: 0; }
.term { color: var(--muted); font-weight: 400; }
.course-desc { margin: .35rem 0; }
.pdf::after { content: " (PDF)"; font-size: .85em; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block; text-decoration: none; border: 1px solid var(--rule); padding: .35rem .6rem; border-radius: .25rem; color: var(--text);
}

/* Links */
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus { position: static; width: auto; height: auto; padding: .35rem .6rem; background: var(--link); color: white; border-radius: .25rem; }

/* Footer */
.site-footer { margin-top: 3rem; }
.site-footer .small { color: var(--muted); font-size: .9rem; }

/* ===== Mobile nav (collapsed by default) ===== */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px;
  background: var(--bg, #fff);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  position: relative;
}
.nav-toggle span + span { margin-top: 4px; }

.site-nav {
  display: flex;                /* desktop default */
  gap: .75rem;
  align-items: center;
}

/* --- Phones / narrow screens --- */
@media (max-width: 720px) {
  .site-header .hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-toggle { display: inline-flex; }

  /* Start hidden */
  #site-nav {
    position: fixed;
    left: 0; right: 0;
    top: 56px;                  /* header height; adjust if your header is taller */
    max-height: 0;              /* collapsed */
    overflow: hidden;
    background: var(--bg, #fff);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    transition: max-height .25s ease;
    display: block;             /* switch from row layout to block stack */
    z-index: 999;
  }

  /* When open */
  #site-nav.open {
    max-height: 70vh;           /* reveals the menu */
  }

  #site-nav a,
  #site-nav .theme-toggle {
    display: block;
    padding: .9rem 1rem;
    border-top: 1px solid rgba(0,0,0,.06);
    min-height: 44px;           /* comfy touch target */
  }

  /* Prevent page from scrolling behind the menu */
  body.nav-open { overflow: hidden; }
}

/* ===== Mobile nav: safe-by-default behavior ===== */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px;
  background: var(--bg, #fff);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  position: relative;
}
.nav-toggle span + span { margin-top: 4px; }

.site-nav {
  display: flex;                /* desktop default */
  gap: .75rem;
  align-items: center;
}

/* --- Phones / narrow screens --- */
@media (max-width: 720px) {
  .site-header .hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-toggle { display: inline-flex; }

  /* DEFAULT on small screens (no-JS fallback): menu is visible */
  #site-nav {
    position: static;
    display: block !important;      /* stack links */
    max-height: none;
    overflow: visible;
    background: var(--bg, #fff);
    box-shadow: none;
    z-index: 999;
  }

  #site-nav a,
  #site-nav .theme-toggle {
    display: block;
    padding: .9rem 1rem;
    border-top: 1px solid rgba(0,0,0,.06);
    min-height: 44px;
  }

  /* IF JS is present, collapse by default and open on toggle */
  .js #site-nav {
    position: fixed;
    left: 0; right: 0;
    top: 56px;                      /* adjust if your header is taller */
    max-height: 0;                  /* collapsed */
    overflow: hidden;
    background: var(--bg, #fff);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    transition: max-height .25s ease;
  }

  .js #site-nav.open {
    max-height: 70vh;               /* reveals the menu */
  }

  /* Prevent page scroll when menu is open */
  body.nav-open { overflow: hidden; }
}

/* === MOBILE MENU: clean, left-aligned, full-width === */
@media (max-width: 720px){
  /* Header layout */
  .site-header .hdr{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding: 8px 14px;
  }

  /* Hamburger visible on phones */
  .nav-toggle{
    display:inline-flex;
    align-items:center; justify-content:center;
    width:40px;height:40px;
    border:1px solid rgba(0,0,0,.12);
    border-radius:10px;
    background:var(--bg,#fff);
    z-index:1001;
  }

  /* Base nav container (JS adds .open) */
  .js #site-nav{
    position:fixed;
    left:0; right:0;
    top:64px;                 /* adjust if your header is taller/shorter */
    max-height:0;
    overflow:hidden;
    background:var(--bg,#fff);
    box-shadow:0 6px 16px rgba(0,0,0,.08);
    transition:max-height .25s ease;
    z-index:1000;
    padding:0;                /* reset any inherited padding */
  }
  .js #site-nav.open{ max-height:70vh; }

  /* Link list: full width, left aligned, compact */
  #site-nav a,
  #site-nav .theme-toggle{
    display:block !important;
    text-align:left;
    font-size:17px;
    line-height:1.35;
    padding:12px 16px;
    margin:0 !important;                 /* kill desktop margins */
    border:0;
  }
  /* separators between items */
  #site-nav a + a,
  #site-nav a + .theme-toggle,
  #site-nav .theme-toggle + a{
    border-top:1px solid rgba(0,0,0,.08);
  }
/* =========================================================
   MOBILE HAMBURGER MENU
   ========================================================= */

/* Hamburger icon */
.nav-toggle{
  display:none;                      /* shown on phones below */
  align-items:center; justify-content:center;
  width:44px;height:44px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  background:var(--bg,#fff);
  cursor:pointer;
  z-index:1001;                      /* above the panel */
}
.nav-toggle span{
  display:block;
  width:22px; height:2.5px;
  background:currentColor;
  position:relative;
}
.nav-toggle span + span{ margin-top:5px; }

/* Desktop nav stays inline */
.site-nav{
  display:flex;
  gap:.8rem;
  align-items:center;
}

/* Phones */
@media (max-width: 720px){

  /* Header layout: brand on left, hamburger on right */
  .site-header .hdr{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:8px 14px;
  }

  .nav-toggle{ display:inline-flex; }

  /* Safe default: if JS hasn't run, show menu (no one gets stuck) */
  #site-nav{
    display:block !important;
  }

  /* When JS is present, collapse by default and open on toggle */
  .js #site-nav{
    position:fixed;
    left:0; right:0;
    top:64px;                         /* adjust if your header is taller/shorter */
    max-height:0;                     /* collapsed */
    overflow:hidden;
    background:var(--bg,#fff);
    box-shadow:0 10px 24px rgba(0,0,0,.08);
    transition:max-height .25s ease;
    z-index:1000;
    padding:0;
  }
  .js #site-nav.open{ max-height:70vh; }

  /* Vertical, left-aligned links inside the panel */
  #site-nav a,
  #site-nav .theme-toggle{
    display:block !important;
    text-align:left;
    font-size:16.5px;
    line-height:1.35;
    padding:12px 16px;
    margin:0 !important;
    border:0;
  }
  #site-nav a + a,
  #site-nav a + .theme-toggle,
  #site-nav .theme-toggle + a{
    border-top:1px solid rgba(0,0,0,.08);
  }

  /* Prevent background scroll when menu is open */
  body.nav-open{ overflow:hidden; }
}

  /* Prevent background scrolling when menu is open */
  body.nav-open{ overflow:hidden; }
}

/* ===== FINAL MOBILE HAMBURGER FIX ===== */
@media (max-width: 720px){

  /* Header: brand left, hamburger right */
  .site-header .hdr{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:8px 14px;
  }

  /* Show the hamburger */
  .nav-toggle{
    display:inline-flex !important;
    align-items:center; justify-content:center;
    width:44px;height:44px;
    border:1px solid rgba(0,0,0,.12);
    border-radius:10px;
    background:var(--bg,#fff);
    z-index:1002;
  }
  .nav-toggle span{display:block;width:22px;height:2.5px;background:currentColor}
  .nav-toggle span+span{margin-top:5px}

  /* KILL desktop layout that pushes nav to the right */
  .site-nav{
    margin:0 !important;
    padding:0 !important;
    gap:0 !important;
    display:block !important;      /* base; we'll control with .js below */
    text-align:left !important;
  }

  /* JS-enabled: hide the menu completely until opened */
  .js #site-nav{
    position:fixed !important;
    left:0 !important; right:0 !important;
    top:64px !important;           /* adjust to 56–72px if needed on your phone */
    display:none !important;       /* <-- hidden by default */
    max-height:none !important;
    overflow:auto !important;
    background:var(--bg,#fff) !important;
    box-shadow:0 10px 24px rgba(0,0,0,.08) !important;
    z-index:1001 !important;
  }
  .js #site-nav.open{
    display:block !important;      /* <-- shown when hamburger is tapped */
  }

  /* Vertical, left-aligned items, no giant margins */
  #site-nav a,
  #site-nav .theme-toggle{
    display:block !important;
    padding:12px 16px !important;
    margin:0 !important;
    border:0 !important;
    font-size:16.5px !important;
    line-height:1.35 !important;
    text-align:left !important;
  }
  #site-nav a + a,
  #site-nav a + .theme-toggle,
  #site-nav .theme-toggle + a{
    border-top:1px solid rgba(0,0,0,.08) !important;
  }

  /* Prevent background scroll when open */
  body.nav-open{ overflow:hidden !important; }
}

/* === Tidy hamburger icon on iOS/Android === */
.nav-toggle{
  display:inline-flex;
  align-items:center; justify-content:center;
  width:44px; height:44px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  background:#fff;
  color:#222;                         /* fixed color (not your link blue) */
  cursor:pointer;
  -webkit-appearance:none;
  -webkit-tap-highlight-color: transparent;
  outline:none;
  position:relative;
}

.nav-toggle span{
  position:absolute;                  /* position all three bars */
  left:50%;
  width:22px; height:2.5px;
  background:currentColor;
  transform:translateX(-50%);
  border-radius:2px;
}
/* top, middle, bottom bars */
.nav-toggle span:nth-child(1){ top:15px; }  /* top bar */
.nav-toggle span:nth-child(2){ top:21px; }  /* middle bar */
.nav-toggle span:nth-child(3){ top:27px; }  /* bottom bar */

/* nice focus style for keyboard users */
.nav-toggle:focus-visible{
  outline:2px solid #2684ff;
  outline-offset:2px;
}



/* ===== Unified hamburger behavior up to 1024px ===== */

/* Desktop defaults ( > 1024px ) */
.nav-toggle{ display:none; }        /* no hamburger on desktop */
.site-nav{ display:flex; gap:.8rem; align-items:center; }

/* Phones + Tablets ( <= 1024px ) use hamburger */
@media (max-width: 1024px){

  /* Header layout */
  .site-header .hdr{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:8px 14px;
  }

  /* Show hamburger on tablet/phone */
  .nav-toggle{
    display:inline-flex !important;
    align-items:center; justify-content:center;
    width:44px; height:44px;
    border:1px solid rgba(0,0,0,.12);
    border-radius:10px;
    background:#fff; color:#222;
    z-index:1002;
  }
  .nav-toggle span{ position:absolute; left:50%; width:22px; height:2.5px; background:currentColor; transform:translateX(-50%); border-radius:2px; }
  .nav-toggle span:nth-child(1){ top:15px; }
  .nav-toggle span:nth-child(2){ top:21px; }
  .nav-toggle span:nth-child(3){ top:27px; }

  /* IMPORTANT: do NOT show the desktop inline menu on tablet/phone */
  .site-nav{
    margin:0 !important; padding:0 !important; gap:0 !important;
    display:block !important; /* base for stacking; JS will hide/show */
    text-align:left !important;
  }

  /* JS-enabled: fully hidden until hamburger opens it */
  .js #site-nav{
    position:fixed !important;
    left:0 !important; right:0 !important;
    top:64px !important;                /* tweak to 56–72px if header is taller */
    display:none !important;            /* HIDDEN by default */
    max-height:none !important;
    overflow:auto !important;
    background:var(--bg,#fff) !important;
    box-shadow:0 10px 24px rgba(0,0,0,.08) !important;
    z-index:1001 !important;
    padding:0 !important;
  }
  .js #site-nav.open{ display:block !important; }  /* shown only when toggled */

  /* Link styling inside panel */
  #site-nav a,
  #site-nav .theme-toggle{
    display:block !important;
    padding:12px 16px !important;
    margin:0 !important; border:0 !important;
    font-size:16.5px !important; line-height:1.35 !important;
    text-align:left !important;
  }
  #site-nav a + a,
  #site-nav a + .theme-toggle,
  #site-nav .theme-toggle + a{
    border-top:1px solid rgba(0,0,0,.08) !important;
  }

  body.nav-open{ overflow:hidden !important; }
}


/* === Desktop enforcement (>1024px): hide hamburger, show inline menu === */
@media (min-width: 1025px){
  .nav-toggle{
    display: none !important;          /* hide the button on laptops/desktops */
  }
  .site-nav{
    display: flex !important;          /* inline menu */
    gap: .8rem !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  /* ensure no mobile panel styles leak into desktop */
  .js #site-nav{
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
  }
  #site-nav a,
  #site-nav .theme-toggle{
    display: inline-block !important;
    padding: 0 !important;
    border: 0 !important;
    margin: 0 !important;
    text-align: left !important;
  }
}
/* === Dark mode styles === */
body.dark {
  --bg: #111;               /* background */
  --text: #f5f5f5;          /* text color */
  --rule: #333;             /* border color */
  --link: #4da6ff;          /* link color */
}

body.dark {
  background: var(--bg);
  color: var(--text);
}

body.dark a {
  color: var(--link);
}

body.dark .site-header,
body.dark .site-footer {
  background: #111;
  color: #f5f5f5;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}

body.dark .rule {
  border-top: 1px solid var(--rule);
}
/* === Theme toggle icon === */
.theme-toggle::before {
  content: "☀️";   /* light mode icon */
  font-size: 1.2rem;
  display: inline-block;
}

body.dark .theme-toggle::before {
  content: "🌙";   /* dark mode icon */
}
/* === Theme toggle button styling === */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 50%;
  background: var(--bg, #fff);
  cursor: pointer;
  margin-left: .5rem;
  font-size: 1.2rem;   /* size for the emoji */
  line-height: 1;
}

/* Default icon (light mode) */
.theme-toggle::before {
  content: "☀️";
}

/* Dark mode icon */
body.dark .theme-toggle::before {
  content: "🌙";
}

.pdf-button {
  display: inline-block;
  padding: 10px 18px;
  margin-top: 8px;
  background-color: #1a73e8; /* Button color */
  color: white;
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.pdf-button:hover {
  background-color: #0c52b5; /* Darker shade on hover */
}
