/* =========================================================
   Academic site: navy sidebar + off-white serif content
   ========================================================= */

:root {
  /* Content area */
  --bg: #f7f6f2;            /* soft off-white paper */
  --text: #26282b;
  --muted: #7a7a76;
  --rule: #2b2f36;          /* line under section labels */
  --accent: #9c3f24;        /* muted brick: section labels, "Abstract" */

  /* Sidebar */
  --navy-top: #172a45;
  --navy-bottom: #0c1727;
  --side-text: #f3f1ea;
  --side-muted: rgba(243, 241, 234, 0.72);
  --side-line: rgba(243, 241, 234, 0.18);
  --gold: #d6a84e;          /* active menu item and sidebar hovers */

  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --sidebar-width: 30%;     /* sidebar : content = 30 : 70 on laptops and PCs */
  --content-width: 54.6667rem;   /* max width of the text column */
}

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

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

html {
  font-size: 15px;          /* base size; everything on the page is measured from this */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0311rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p {
  margin: 0 0 0.8em;
}

strong {
  font-weight: 600;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Layout ---------- */

.page {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 4.2667rem 2.6667rem 2.6667rem;
  background: linear-gradient(170deg, var(--navy-top) 0%, var(--navy-bottom) 100%);
  color: var(--side-text);
}

.sidebar a:focus-visible {
  outline-color: var(--gold);
}

.profile-photo {
  display: block;
  width: 100%;
  max-width: 14rem;          /* photo width on laptops (PCs scale it up) */
  aspect-ratio: 5 / 6;
  object-fit: cover;
  border-radius: 0.9333rem;
  margin-bottom: 1.8667rem;
}

.profile-name {
  font-size: 1.8rem;          
  letter-spacing: -0.015em;
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.6667rem;
}

.profile-role {
  color: var(--side-muted);
  font-size: 0.9183rem;
  line-height: 1.45;
  margin: 0 0 1.4667rem;
}

/* CV and email icons */
.profile-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  list-style: none;
  padding: 0 0 1.8667rem;
  margin: 0 0 1.8667rem;
  border-bottom: 1px solid var(--side-line);
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--side-text);
  font-size: 0.87rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.profile-links a:hover {
  color: var(--gold);
  text-decoration: none;
}

.profile-links svg {
  width: 1.4667rem;
  height: 1.4667rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-links .cv-link svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Section menu */
.side-nav a {
  display: block;
  padding: 0.4rem 0;
  margin-bottom: 0.4rem;
  color: var(--side-text);
  font-size: 0.9667rem;
  font-weight: 500;
}

.side-nav a:hover {
  color: var(--gold);
  text-decoration: none;
}

.side-nav a.active {
  color: var(--gold);
}

/* University address, pinned to the bottom of the sidebar */
.sidebar-address {
  margin-top: auto;
  padding-top: 1.6rem;
  border-top: 1px solid var(--side-line);
  color: var(--side-muted);
  font-size: 0.9183rem;   /* same as "PhD Candidate in Economics" */
  font-style: normal;   /* browsers italicize addresses by default */
  line-height: 1.45;
}

.side-nav {
  margin-bottom: 2.6667rem;
}

/* ---------- Main content ---------- */

.content {
  width: 100%;
  max-width: calc(var(--content-width) + 12.8rem);
  margin: 0 auto;           /* centers the text column in the white area */
  padding: 5.8667rem 6.4rem 4.2667rem;
}

.intro {
  margin-bottom: 4.8rem;
}

.content section {
  margin-bottom: 4.8rem;
}

.section-label {
  font-size: 0.7733rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 0.8rem;
  margin: 0 0 2.1333rem;
  border-bottom: 2px solid var(--rule);
}

/* ---------- Papers ---------- */

.paper {
  margin-bottom: 2.9333rem;
}

.paper:last-child {
  margin-bottom: 0;
}

.paper-label {
  font-size: 0.696rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2667rem;
}

.paper-title {
  font-size: 1.0633rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.2667rem;
}

.jmp-paper {
  margin-bottom: 3.7333rem;
}


.paper-meta {
  color: var(--muted);
  font-size: 0.9183rem;
  margin: 0 0 0.9333rem;
}

/* Row of boxed links under each paper: Abstract, PDF, Slides, ... */
.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6667rem;
  margin-top: 0.6667rem;   /* space between the title and the PDF / Abstract buttons */
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9333rem;
  border: 0;
  border-radius: 0.2rem;
  background: #ebe7dd;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.754rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--accent);
  transition: background-color 0.15s ease;
}

.chip:hover,
.chip[aria-expanded="true"] {
  background: #dfd9cb;
  text-decoration: none;
}

.abstract {
  margin-top: 0.9333rem;
  padding-left: 1.2rem;
  border-left: 2px solid #e2ded3;
  font-size: 0.9377rem;
}

.abstract p {
  margin: 0;
}

/* Collapsible abstracts: hidden only when JS is running, so they never get lost */
.js .abstract.collapsible {
  display: none;
}

.js .abstract.collapsible.open {
  display: block;
}

/* ---------- Teaching ---------- */

.teaching-institution {
  font-size: 0.9667rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
}

.teaching-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2.1333rem;
}

.teaching-list:last-child {
  margin-bottom: 0;
}

.teaching-list li {
  margin-bottom: 0.8rem;
}

.course {
  display: block;
  font-weight: 500;
}

.course-detail {
  display: block;
  color: var(--muted);
  font-size: 0.8893rem;
}

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

.site-footer {
  color: var(--muted);
  font-size: 0.8217rem;
}

/* =========================================================
   Large desktop screens: scale the whole page up in proportion,
   so it looks like the laptop view, only bigger
   ========================================================= */
@media (min-width: 1441px) {
  html {
    font-size: min(1.0417vw, 21px);   /* 15px at 1440px wide, grows with the screen, capped */
  }
}

/* =========================================================
   Responsive
   ========================================================= */

/* Smaller laptops / iPad landscape */
@media (max-width: 1100px) {
  .sidebar {
    padding: 3.2rem 2rem 2.1333rem;
  }

  .content {
    padding: 4.8rem 3.7333rem 3.7333rem;
  }
}

/* iPad portrait and phones: navy block on top, content below */
@media (max-width: 860px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    padding: 2.9333rem 1.8667rem 2.1333rem;
  }

  .profile-photo {
    max-width: 9.3333rem;     /* photo width on phones and iPads in portrait */
  }

  .profile-links {
    padding-bottom: 1.6rem;
    margin-bottom: 1.3333rem;
  }

  /* Section menu becomes a wrapping row of links */
  .side-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2667rem 1.8667rem;
  }

  .side-nav a {
    padding: 0.2667rem 0;
    margin: 0;
    font-size: 1.015rem;
  }

  .side-nav {
    margin-bottom: 1.6rem;
  }

  .sidebar-address {
    margin-top: 0;
    padding-top: 1.3333rem;
  }

  .content {
    max-width: 48rem;
    margin: 0 auto;
    padding: 3.2rem 1.8667rem 3.2rem;
  }
}

/* iPhone */
@media (max-width: 480px) {
  body {
    font-size: 0.9667rem;
  }

  .sidebar {
    padding: 2.4rem 1.3333rem 1.8667rem;
  }

  .profile-name {
    font-size: 1.6rem;
  }

  .content {
    padding: 2.6667rem 1.3333rem 2.6667rem;
  }

  .content section,
  .intro {
    margin-bottom: 3.7333rem;
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  a,
  .chip {
    transition: none;
  }
}
