body {
  background-color: #eaeaea; /* light warm orange-beige */
  color: #111;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* ---------------- HEADER ---------------- */
header {
  border-bottom: 1px solid #c2c2c2;
  padding: 0.8rem 0;
  transition: background-color 0.35s ease, padding 0.35s ease;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.35s ease-in-out;
}

.header-name {
  font-size: 1.6rem;
  font-weight: 600;
  color: black;
  transition: all 0.35s ease-in-out;
}

/* Navigation menu */
header nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
  transition: gap 0.35s ease-in-out, opacity 0.35s ease-in-out;
}

header nav a {
  color: black;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

header nav a:hover {
  background-color: #b5cfe8;
  transform: scale(1.05);
}

header nav a.active {
  background-color: #003366;
  color: white;
  border-radius: 4px;
}


/* ----------- MOBILE HEADER FIX ----------- */
@media (max-width: 700px) {
  .header-container {
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 1rem;
    transform: translateY(3px);
    opacity: 0.97;
  }

  .header-name {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
    text-align: center;
  }

  header nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
  }

  header nav a {
    font-size: 1rem;
    padding: 0.3rem 0.6rem;
  }

  header nav a.active {
    background-color: #003366;
    color: white;
  }
}

/* ---------------- MAIN CONTENT ---------------- */
.intro-container {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.intro-text {
  flex: 1 1 60%;
  min-width: 280px;
}

.intro-photo img {
  width: 280px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  margin-top: 0.9rem;
}

/* -------- INTRO PHOTO LEFT ON WIDE SCREENS -------- */
.intro-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  flex-direction: row-reverse; /* move photo to the left */
}

/* -------- NORMAL STACK ON SMALL SCREENS -------- */
@media (max-width: 800px) {
  .intro-container {
    flex-direction: column; /* revert order */
  }

  .intro-photo {
    order: -1; /* show photo before text when stacked */
    align-self: center;
  }
}

/* Contact section */
.bordered {
  border-top: 1px solid #ddd;
  max-width: 400px;
  padding-top: 0.5em;
  padding-bottom: 0.em;
}

.contact {
  margin-top: 40px;
  padding: 10px 0;
  border-top: 1px solid #ddd;
  max-width: 600px;
}

.contact h2 {
  font-size: 1.3em;
  margin-bottom: 10px;
  color: #222;
  font-weight: 600;
}

.contact p {
  margin: 6px 0;
  line-height: 1.5;
  color: #333;
}

.contact strong {
  font-weight: 550;
  color: #444;
  letter-spacing: 0.2px;
}

/* General link styling */
a {
  color: #0066cc;
  text-decoration: none;
  transition: color 0.2s ease, border-bottom 0.2s ease;
}

a:hover {
  color: #003399;
  border-bottom: 1px solid #003399;
}

body.teaching main {
  margin-left: 60px;   /* or whatever spacing looks balanced */
  margin-right: 0;
  max-width: none;     /* removes centering constraint */
}


/* Journal info below title */
.journal {
  color: #333;
  font-style: normal;
  display: block;
  margin-left: 1.5em;
  margin-top: 1px;
  margin-bottom: 2px;
}

/* External links (e.g., CV, arXiv) */
a.external {
  color: #0077cc;
  font-weight: 500;
}

a.external::after {
  content: " ↗";
  font-size: 0.85em;
}

/* Legacy nav class (no longer used but kept for safety) */
.nav {
  list-style: none;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.nav li {
  margin: 0 20px;
}

.nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1em;
}

.nav a:hover,
.nav a.active {
  text-decoration: underline;
}

main::before {
  content: "This invisible alignment sentence is used only to maintain a consistent horizontal balance across all pages, matching the visual width of longer introductory paragraphs. This invisible alignment sentence is used only to maintain a consistent horizontal balance across all pages, matching the visual width of longer introductory paragraphs.";
  color: transparent;        /* make it invisible */
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}


main {
  background-color: #ffffff; /* light gray background */
  width: 100%;
  flex: 1;
  margin: 0;
  padding: 2rem 0; /* top and bottom spacing */
  box-sizing: border-box;
}

/* Keep text centered within gray area */
main > * {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

main h1 {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
  color: #111;
}

main h2 {
  font-size: 1.2rem;
  font-weight: 400;
  color: #444;
  margin-bottom: 1.5rem; /* nice breathing space before paragraph */
}

h1 {
  font-size: 1.5em;
  margin-bottom: 0.2em;
}

h2 {
  color: #444;
  font-size: 1.2em;
  font-weight: normal;
  margin-bottom: 1em;
}

.cv-link {
  color: #002855;
  font-weight: 600;
  text-decoration: none;
}


/* ------------FOOTER------------- */
footer {
  color: #333;
  text-align: center;
  padding: .3rem 0;
  font-size: 0.9em;
  border-top: 1px solid #c2c2c2;
}

html, body {
  height: 100%;
}

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

main {
  flex: 1;
}
