/* Academic Website */

:root {
  --primary-color: #8C1515; /* Cardinal red */
  --accent-color: #8C1515; /* Cardinal red */
  --text-primary: #000000; /* Pure black for main text */
  --text-secondary: #111111; /* Very dark gray, almost black */
  --text-tertiary: #222222; /* Dark gray for less emphasized text */
  --bg-color: #ffffff;
  --bg-secondary: #f4f4f4;
  --border-light: #e0e0e0;
  --link-color: #8C1515; /* Cardinal red for links */
  --link-hover: #A61B1B; /* Slightly lighter cardinal for hover */
  
  /* Typography */
  --font-sans: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-serif: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-mono: "Source Code Pro", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-main: var(--font-sans);
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 40px;
  --space-xl: 60px;
  --space-xxl: 80px;
  
  /* Layout */
  --container-width: 875px;
  
  --header-height: 60px;
  --transition-main: all 0.3s ease;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  margin: 20px auto;
  width: 92%;
  max-width: var(--container-width);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-color);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--font-sans);
  font-size: 19px;
  padding: 20px 0 40px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  line-height: 1.25;
  font-weight: 700;
  color: #000;
  margin: 0 0 var(--space-md) 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 28px;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  border-bottom: none; /* Remove border below h1 */
  padding-bottom: 8px;
  font-weight: 600; /* EB Garamond looks better with 600 weight for headings */
}

h2 {
  font-size: 22px;
  margin-top: 40px;
  margin-bottom: 20px;
  padding-bottom: var(--space-xs);
  border-bottom: none; /* Remove border below h2 */
  font-weight: 600;
}

h3 {
  font-size: 17px;
  margin-top: 30px;
  margin-bottom: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

h4, h5, h6 {
  font-size: 16px;
  margin-top: 30px;
  margin-bottom: 15px;
  color: var(--text-primary);
}

p {
  margin-bottom: 17px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--text-primary);
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
  border-bottom: none; /* No underline on links */
}

a:hover {
  text-decoration: none;
  color: var(--link-hover);
  border-bottom: 1px solid var(--link-hover);
}

a:focus {
  outline: none;
  text-decoration: none;
  border-bottom: none;
}

/* Header & Navigation */
header {
  margin-bottom: 35px;
  position: relative;
}

header h1 {
  border-bottom: none;
  margin-bottom: 10px;
  padding-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  font-family: var(--font-sans);
}

/* nickname style removed as name uses unified styling */

.header-title {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
  font-size: 19px;
  font-weight: normal;
}

.email {
  color: var(--link-color);
  border-bottom: 1px solid transparent;
}

.email:hover {
  border-bottom: 1px solid var(--primary-color);
}

.contact-header {
  position: absolute;
  top: 0;
  right: calc((100% - var(--container-width)) / 2 + 15px);
  text-align: right;
}

.contact-header a {
  margin-left: 15px;
  transition: all 0.2s;
  font-size: 19px;
  font-weight: 400;
  padding: 5px 0;
  display: inline-block;
  color: var(--text-primary);
  border-bottom: none;
}

.contact-header a:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
  border-bottom: none;
}

nav {
  margin-top: 15px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0;
}

nav ul {
  padding: 0;
  list-style: none;
  font-weight: 600; /* Better with EB Garamond */
  font-size: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 6px;
}

nav ul li {
  display: inline;
  margin-right: 30px;
  color: var(--text-primary);
}

nav a {
  color: var(--primary-color);
  position: relative;
  padding-bottom: 10px;
  font-weight: 700;
  border-bottom: none;
  background: none;
  transition: color 0.2s;
}

nav a:not(.active) {
  color: var(--primary-color);
  font-weight: 600;
}

nav a::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0px;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  opacity: 0;
  transform: translateX(-50%) scaleX(0.7);
  transition: opacity 0.25s, transform 0.25s;
}

nav a.active::after {
  opacity: 1;
}

nav a:hover::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

nav a.active {
  color: var(--primary-color);
  font-weight: 700;
}

/* Blurb Sections */
.blurb {
  margin-bottom: 40px;
}

.blurb h1 {
  margin-top: 0;
}

.blurb p {
  font-size: 20px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Fix bullet styling for all pages */
.blurb ul, .interests ul, .news-list, ul {
  list-style-type: disc;
  padding-left: 2rem;
  margin-bottom: 25px;
}

.blurb ul li, .interests ul li, ul li {
  font-size: 18px;
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* News Section */
.news-list {
  list-style: disc;
  padding-left: 0.5rem;
  list-style-position: inside;
  margin-bottom: 40px;
  position: relative;
}

.news-list li {
  font-size: 19px;
  margin-bottom: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  position: relative;
  padding-left: 0;
}

.news-list li::before {
  content: none;
}

.news-list li strong {
  color: var(--text-primary);
  font-weight: normal;
}

/* Research Projects - Stanford-style */
.research-projects {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Improved Research page styling */
.interests ul {
  margin-top: 15px;
  margin-bottom: 40px;
}

.interests ul li {
  margin-bottom: 15px;
}

.interests ul li strong {
  font-weight: 700;
  color: var(--text-primary);
}

.publications-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 5px;
}

/* Reduce the space between research intro and publications */
.research-intro {
  margin-bottom: 0;
}

.publications {
  margin-top: 0;
}

/* Preserve spacing for news section */
.intro {
  margin-bottom: 40px;
}

.paper {
  margin-bottom: 0;
  padding: 16px 2px; /* Slightly more breathing room */
  position: relative;
  border-radius: 0;
  transition: all 0.2s ease;
  border: none;
  border-bottom: 1px solid #eee;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: start;
}

.paper-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
}

.paper-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  object-fit: contain;
  object-position: center center;
}

.paper-body {
  display: flex;
  flex-direction: column;
}

.paper:hover {
  background-color: transparent; /* No hover background */
  border-color: #eee;
  transform: none;
  box-shadow: none;
}

.paper-title {
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
  line-height: 1.3;
}

.paper-authors {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.paper-venue {
  font-size: 16px;
  font-style: italic;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  line-height: 1.4;
  padding-bottom: 0;
  border-bottom: none;
}

.paper-links {
  font-size: 16px;
  margin: 2px 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.paper-links a:not(:last-child) {
  margin-right: 10px;
  padding-right: 10px;
  border-right: 1px solid var(--text-tertiary);
  display: flex;
  align-items: center;
}

.paper-links a {
  display: inline-flex;
  padding: 2px 4px;
  background-color: transparent;
  color: var(--link-color);
  border-radius: 0;
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 500;
  position: relative;
  border-bottom: none;
  align-items: center;
  justify-content: center;
}

/* Remove pseudo-element separator; using border-right for consistent behavior */

/* Emphasize the two toggles visually */
.paper-links a.tldr-toggle,
.paper-links a.citation-toggle {
  padding: 2px 6px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

/* Active states based on open section */
.paper.show-tldr .paper-links a.tldr-toggle,
.paper.show-citation .paper-links a.citation-toggle {
  background-color: rgba(140, 21, 21, 0.08);
  border-color: var(--primary-color);
  color: var(--primary-color);
  text-decoration: none;
}

/* Remove focus outline on toggles/links */
.paper-links a:focus {
  outline: none;
}

.paper-links a:hover {
  color: var(--link-hover);
  transform: none;
  text-decoration: underline;
}

/* Remove all the previous after pseudo-elements */
.paper-links a:after,
.paper-links a:hover:after {
  content: none;
}

.paper-tldr {
  background-color: transparent;
  padding: 12px 0;
  border-radius: 0;
  font-size: 16px;
  line-height: 1.5;
  margin-top: 10px;
  margin-bottom: 10px;
  border: none;
  display: none;
  animation: fadeIn 0.3s ease;
  border-left: 3px solid var(--primary-color);
  padding-left: 12px;
}

.paper-tldr strong {
  font-weight: 700;
  color: var(--primary-color);
}

.paper-citation {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  background-color: #f5f5f5;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  margin-top: 12px;
  margin-bottom: 5px;
  line-height: 1.45;
  display: none;
  animation: fadeIn 0.3s ease;
  overflow-x: auto;
  color: #24292e;
  max-height: 300px;
  max-width: 100%;
  word-break: normal;
  word-wrap: break-word;
}

.paper-citation pre {
  margin: 0;
  max-width: 100%;
}

.paper-citation code {
  display: block;
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Equal contribution note */
.equal-contrib {
  font-size: 16px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

.show-citation .paper-citation,
.show-tldr .paper-tldr {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.author {
  color: var(--primary-color);
  font-weight: 600;
}

.spotlight {
  color: #00629B;
  font-weight: 700;
}

/* Regular bullet lists for teaching page */
ul {
  list-style-type: disc;
  padding-left: 2rem;
  margin-bottom: 25px;
}

ul li {
  font-size: 19px;
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--text-primary);
}

ul li b {
  font-weight: 700;
}

ul li a {
  color: var(--link-color);
  text-decoration: none;
}

ul li a:hover {
  text-decoration: underline;
  color: var(--primary-color);
  border-bottom: none;
}

/* Teaching list styling */
.teaching-list {
  list-style-type: disc;
  padding-left: 2.5rem;
  margin-bottom: 25px;
}

.teaching-list li {
  margin-bottom: 8px;
  line-height: 1.4;
  position: relative;
}

.teaching-list li::marker {
  color: var(--text-primary);
}

.teaching-list li b {
  font-weight: 600;
  color: var(--text-primary);
}

.teaching-list li a {
  color: var(--link-color);
  text-decoration: none;
  margin-left: 4px;
}

.teaching-list li a:hover {
  text-decoration: underline;
  color: var(--primary-color);
}

.teaching h2 {
  margin-bottom: 15px;
  font-size: 24px;
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
  padding: var(--space-xl) 0;
  border-top: none;
  margin-top: var(--space-xxl);
}

footer p {
  color: var(--text-tertiary);
  font-size: 14px;
}

/* Content highlight effect */
::selection {
  background-color: rgba(140, 21, 21, 0.15);
  color: var(--text-primary);
}

/* We're moving contact links to the header so this is now being removed */
.contact-links {
  display: none;
}

/* Print Styles */
@media print {
  body {
    width: 100%;
    margin: 0;
    padding: 20px;
  }
  
  nav, footer, .contact-header {
    display: none;
  }
  
  a {
    text-decoration: none;
    color: var(--text-primary);
  }
  
  .pub-links {
    display: none;
  }
}

/* Responsive Styles */
@media (max-width: 1200px) {
  body {
    width: 95%;
    padding: 0 var(--space-md);
  }
  
  nav ul {
    flex-wrap: wrap;
  }
  
  .contact-header {
    position: static;
    text-align: left;
    margin-bottom: var(--space-md);
    margin-top: 10px;
  }
  
  .contact-header a {
    margin: 0 10px 0 0;
    padding: 3px 0;
  }
  
  .paper {
    padding: 14px 8px;
    grid-template-columns: 100px 1fr;
    gap: 12px;
  }
  
  .paper-links {
    gap: 6px;
  }
  
  .paper-links a {
    padding: 2px 0;
    font-size: 15px;
  }
  
  .paper-links a:not(:last-child) {
    margin-right: 6px;
    padding-right: 6px;
    display: flex;
    align-items: center;
  }
  
  /* Make sure section headings have proper styling on all screen sizes */
  .publications h2:after, .research-intro h2:after, .teaching h2:after, 
  .news h2:after, .intro h2:after, .blurb h2:after, section h2:after {
    width: 40px;
  }
}

@media (max-width: 576px) {
  body {
    width: 95%;
    margin: 30px auto;
    padding: 0 16px;
    font-size: 16px;
  }
  
  header h1 {
    font-size: 34px;
  }
  
  h1 {
    font-size: 28px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: 19px;
  }
  
  .header-title {
    font-size: 16px;
  }
  
  nav ul {
    gap: 16px;
    font-size: 18px;
  }
  
  nav ul li {
    margin-right: var(--space-md);
    font-size: 20px;
  }
  
  p, .blurb p, .paper-authors, .paper-venue, .paper-links, .paper-tldr {
    font-size: 16px;
  }
  
  .blurb ul li, .interests ul li, .news-list li, ul li {
    font-size: 16px;
  }
  
  .paper {
    padding: 12px 0;
    grid-template-columns: 80px 1fr;
    gap: 10px;
  }
  
  /* Adjust section heading styles for smaller screens */
  .publications h2, .research-intro h2, .teaching h2, .news h2, 
  .intro h2, .blurb h2, section h2 {
    margin-bottom: 20px;
    padding-bottom: 8px;
  }
  
  .publications h2:after, .research-intro h2:after, .teaching h2:after, 
  .news h2:after, .intro h2:after, .blurb h2:after, section h2:after {
    width: 30px;
    height: 2px;
  }
  
  .paper-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .paper-links a {
    padding: 2px 0;
    font-size: 14px;
    margin-bottom: 4px;
  }
  
  .paper-links a:not(:last-child) {
    margin-right: 5px;
    padding-right: 5px;
    display: flex;
    align-items: center;
  }
  
  .paper-tldr, .paper-citation {
    padding: 12px;
    font-size: 14px;
  }
  
  .paper-citation pre {
    margin: 0;
    max-width: 100%;
  }
  
  .paper-citation code {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  body {
    padding: 16px;
    font-size: 17px;
  }
  
  header h1 {
    font-size: 34px;
  }
  
  .contact-header {
    position: relative;
    top: 0;
    right: 0;
    text-align: left;
    margin-bottom: 16px;
  }
  
  .contact-header a {
    margin-left: 0;
    margin-right: 8px;
  }
  
  nav ul {
    gap: 16px;
    font-size: 20px;
  }
  
  h1 {
    font-size: 26px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: 18px;
  }
  
  .paper-title {
    font-size: 19px;
  }
  
  .profile-image {
    float: none;
    display: block;
    margin: 0 auto 20px;
    width: 160px;
  }
  
  .collection > li {
    grid-template-columns: 110px 1fr;
    gap: 12px;
  }
}

p, .paper-title, .blurb p {
  color: var(--text-primary);
}

.profile-image {
  width: 130px;
  height: 130px;
  border-radius: 0px;
  object-fit: cover;
  margin-right: 30px;
  margin-bottom: 0;
  border: none;
  box-shadow: none;
}

.header-content {
  display: flex;
  align-items: stretch;
  margin-bottom: 15px;
}

.header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 0;
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .header-text {
    width: 100%;
    text-align: center;
  }
  
  /* Ensure profile image centers on mobile */
  .profile-image {
    float: none;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
  }
  
  header h1 {
    margin-top: 15px;
  }
}

/* Add a new section for the publications container */
.publications {
  margin-top: 0;
}

.publications h2 {
  margin-bottom: 10px;
  position: relative;
  padding-bottom: 10px;
}

.publications h2:after {
  content: '';
  position: absolute;
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
  bottom: 0;
  left: 0;
}

/* Apply styled headings to all sections */
.publications h2, .research-intro h2, .teaching h2, .news h2, 
.intro h2, .blurb h2, section h2 {
  margin-bottom: 10px;
  position: relative;
  padding-bottom: 10px;
}

.publications h2:after, .research-intro h2:after, .teaching h2:after, 
.news h2:after, .intro h2:after, .blurb h2:after, section h2:after {
  content: '';
  position: absolute;
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
  bottom: 0;
  left: 0;
}

/* Ensure the last paragraph in research intro has no margin */
.research-intro p:last-child {
  margin-bottom: 0;
}

/* Strong emphasis in text should use the primary color */
strong, b {
  color: var(--text-primary);
  font-weight: 700;
}

.contact-link {
  position: relative;
  letter-spacing: 0.02em;
}

.contact-link:hover {
  text-decoration: none;
}

/* Teaching cards (collection) */
.collection {
  list-style: none;
  padding: 0;
  margin: 0;
}

.collection > li {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}

.thumb2 img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.text h3 {
  margin: 0 0 6px 0;
  font-size: 19px;
  font-family: var(--font-sans);
  font-weight: 600;
}

.venues {
  font-size: 16px;
  font-style: italic;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.authors {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.45;
}




