@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;400;500;700&display=swap");

:root {
  --accent-color: #007bff;
  --max-width: 1200px;
  --content-width: calc(100% - 200px);
  --toc-width: 180px;
  --toc-padding: 200px;
  --header-height: 140px; /* Adjust based on actual header height */
}

/* Add smooth scrolling to html */
html {
  scroll-behavior: smooth;
  padding: 20px 0;
  /*    scroll-padding-top: 50px; */
}

body {
  font-family: "Fira Sans", sans-serif;
  display: flex;
  justify-content: center;
  background-color: var(--background-color);
  color: var(--text-color);
}

.container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Header styles */
.header {
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 100;
  width: 100%;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: var(--max-width);
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header h1 {
  font-size: 3em;
  margin: 0;
  padding: 0;
  font-weight: 700;
}

h2 {
  border-bottom: 1px solid #ddd;
}

.profile-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #eee;
  margin-bottom: 10px;
}

.contact {
  color: #666;
  text-align: right;
}

/* Global link styles */
a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Content styles */
.content {
  width: var(--content-width);
  padding-right: var(--toc-padding);
}

/* TOC styles */
.toc {
  width: var(--toc-width);
  position: sticky;
  top: 144px;
  float: right;
  background: white;
  text-align: right;
}

.toc ul {
  list-style-type: none;
  padding: 0;
}

.toc li {
  margin-bottom: 10px;
}

.toc a {
  text-decoration: none;
  color: #000;
  padding-right: 10px; /* Add padding for indicator */
}

.toc a:hover {
  text-decoration: underline;
}

.toc a.active {
  color: var(--accent-color);
  font-weight: bold;
  border-right: 3px solid var(--accent-color); /* Move border to right */
  padding-right: 7px;
  border-left: none; /* Remove left border */
  padding-left: 0;
  margin-left: 0;
}

/* Section styles */
.section {
  width: 100%;
  padding-top: 20px;
  scroll-margin-top: 144;
  margin: 0 auto;
}

/* Table styles */
table {
  width: 95%;
  margin: 20px auto;
  border-collapse: collapse;
}

th,
td {
  vertical-align: top;
  padding: 8px;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: #f5f5f5;
}

td:first-child {
  text-align: right;
  white-space: nowrap;
}

/* Responsive styles */
@media screen and (max-width: 1000px) {
  .header-content,
  .content {
    width: 95%;
    padding-right: 0;
  }

  .toc {
    float: none;
    width: 100%;
    position: relative;
    top: auto;
    margin: 20px 0;
  }
}

@media screen and (max-width: 600px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact {
    text-align: left;
  }
}

.bio {
  width: calc(0.9 * var(--content-width));
  padding-left: calc(0.05 * var(--content-width));
  padding-top: 20px;
  font-size: 1.1em;
  line-height: 1.5;
  color: #444;
}

@media screen and (max-width: 1000px) {
  .bio {
    width: 95%;
    padding-right: 0;
  }
}

@media print {
  /* Page margins */
  @page {
    margin: 2cm 2.5cm;
  }

  /* Reset layout for print */
  :root {
    --content-width: 100%;
    --toc-padding: 0;
  }

  html {
    padding: 0;
  }

  body {
    background: white;
    color: black;
    font-size: 10pt;
  }

  /* Hide TOC and sticky header chrome */
  .toc {
    display: none;
  }

  .header {
    position: static;
    background: white;
  }

  .header h1 {
    font-size: 2em;
  }

  /* Fix ORCID overflow in contact block */
  .contact {
    word-break: break-all;
    max-width: 200px;
  }

  .content {
    width: 100%;
    padding-right: 0;
  }

  .bio {
    width: 100%;
    padding-left: 0;
    color: black;
  }

  /* Force black text, no colored links */
  a {
    color: black;
    text-decoration: none;
  }

  h2 {
    border-bottom: 1px solid #999;
  }

  th {
    background-color: #eee !important;
  }

  /* Avoid breaking rows across pages */
  tr {
    page-break-inside: avoid;
  }

  .section {
    page-break-inside: avoid;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-color: #1e90ff;
    --background-color: #121212;
    --text-color: #e0e0e0;
    --header-background: #1f1f1f;
    --toc-background: #1f1f1f;
    --table-header-background: #2c2c2c;
    --table-border-color: #333;
  }

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

  .header {
    background-color: var(--header-background);
  }

  .toc {
    background-color: var(--toc-background);
  }

  table {
    border-color: var(--table-border-color);
  }

  th {
    background-color: var(--table-header-background);
  }

  a {
    color: var(--accent-color);
  }

  .toc a.active {
    border-right-color: var(--accent-color);
  }
}
