/* ==========================================================================
   Theme colors (light is the default, dark is applied via html[data-theme])
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #000000;
  --text-light: #828282;
  --theme: #b509ac;
  --divider: rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --footer-bg: #1c1c1d;
  --footer-text: #cfcfcf;
  --footer-link: #ffffff;
  --back-to-top-bg: rgba(0, 0, 0, 0.4);
  --back-to-top-text: #ffffff;

  --max-width: 930px;
  --nav-height: 57px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1c1d;
  --text: #cfcfcf;
  --text-light: #828282;
  --theme: #2698ba;
  --divider: #424246;
  --card-bg: #212529;
  --footer-bg: #cfcfcf;
  --footer-text: #1c1c1d;
  --footer-link: #000000;
  --back-to-top-bg: rgba(255, 255, 255, 0.5);
  --back-to-top-text: #000000;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: var(--nav-height);
  padding-bottom: 70px;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 300;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  scroll-margin-top: calc(var(--nav-height) + 10px);
}

p {
  margin: 0 0 1rem;
}

b,
strong {
  font-weight: 700;
}

a {
  color: var(--theme);
  text-decoration: none;
}

a:hover {
  color: var(--theme);
  text-decoration: underline;
}

img {
  max-width: 100%;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 15px;
}

main.container {
  padding-top: 3.5rem;
  padding-bottom: 2rem;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--divider);
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: var(--nav-height);
}

.navbar-brand {
  font-size: 1.25rem;
  color: var(--text);
  padding: 0.75rem 0;
}

.navbar-brand:hover {
  color: var(--theme);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}

.nav-links a,
.nav-links button {
  display: block;
  padding: 0.5rem;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--theme);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--theme);
  font-weight: 400;
}

#theme-toggle {
  font-size: 1.1rem;
  width: 2.5rem;
}

#theme-toggle .icon {
  display: none;
}

html[data-theme-setting="system"] #theme-toggle .icon-system,
html[data-theme-setting="dark"] #theme-toggle .icon-dark,
html[data-theme-setting="light"] #theme-toggle .icon-light {
  display: inline-block;
}

.nav-toggler {
  display: none;
  margin-left: auto;
  padding: 0.5rem;
  font-size: 1.25rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
}

@media (max-width: 575px) {
  .nav-toggler {
    display: block;
  }

  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-end;
    padding-bottom: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }
}

/* Thin scroll progress bar under the navbar */
.scroll-progress {
  position: fixed;
  top: calc(var(--nav-height) - 1px);
  left: 0;
  z-index: 101;
  height: 1px;
  width: 0;
  background-color: var(--theme);
}

/* ==========================================================================
   Page header
   ========================================================================== */

.post-header {
  margin-bottom: 2rem;
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.post-description {
  font-size: 1rem;
  margin-bottom: 0;
}

.about-subtitle {
  font-size: 1rem;
  margin-bottom: 0;
}

/* ==========================================================================
   About page
   ========================================================================== */

.profile {
  float: right;
  width: 30%;
  margin: 0 0 1rem 1.5rem;
}

.profile img {
  width: 100%;
  display: block;
  border-radius: 0.25rem;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.profile .more-info {
  margin-top: 0.75rem;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.95rem;
}

.profile .more-info p {
  margin: 0;
}

@media (max-width: 575px) {
  .profile {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem;
  }
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.section-heading {
  font-size: 2rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.section-heading a {
  color: inherit;
}

.section-heading a:hover {
  color: var(--theme);
  text-decoration: none;
}

/* News */
.news table {
  width: 100%;
  border-collapse: collapse;
}

.news th,
.news td {
  vertical-align: top;
  padding: 0.75rem 0.75rem 0.75rem 0;
  text-align: left;
}

.news th {
  font-weight: 700;
  white-space: nowrap;
  width: 20%;
}

.news.scrollable {
  max-height: 17rem;
  overflow-y: auto;
}

/* Social icons */
.social {
  text-align: center;
  margin-top: 3rem;
}

.contact-icons {
  font-size: 4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
}

.contact-icons a {
  color: var(--text);
}

.contact-icons a:hover {
  color: var(--theme);
  text-decoration: none;
}

.contact-note {
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   Publications
   ========================================================================== */

.publications h2.year {
  font-size: 2.5rem;
  color: var(--divider);
  border-top: 1px solid var(--divider);
  padding-top: 1rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  text-align: right;
}

.publications ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pub {
  display: flex;
  gap: 30px;
  margin-bottom: 1.5rem;
}

.pub .abbr {
  flex: 0 0 calc(16.667% - 15px);
  min-width: 0;
}

.pub .badge {
  display: inline-block;
  min-width: 100%;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  color: #ffffff;
  background-color: var(--theme);
}

.pub a.badge:hover {
  color: #ffffff;
  text-decoration: none;
  filter: brightness(1.1);
}

.pub .content {
  flex: 0 1 calc(66.667% - 15px);
}

.pub .title {
  font-weight: 500;
}

.pub .author em {
  font-style: normal;
  border-bottom: 1px solid;
}

.pub .more-authors {
  color: var(--text-light);
  border-bottom: 1px dashed var(--text-light);
  cursor: pointer;
}

.pub .more-authors:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.pub .periodical em {
  font-style: italic;
}

.pub .links {
  margin-top: 0.5rem;
}

.pub .links a {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.25rem 1rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 0.125rem;
  text-transform: uppercase;
}

.pub .links a:hover {
  color: var(--theme);
  border-color: var(--theme);
  text-decoration: none;
}

@media (max-width: 575px) {
  .pub {
    flex-direction: column;
    gap: 0.5rem;
  }

  .pub .abbr {
    flex-basis: auto;
  }

  .pub .badge {
    min-width: 6.5rem;
  }
}

/* ==========================================================================
   CV
   ========================================================================== */

.cv-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.cv-toc {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
  flex: 0 0 9rem;
  font-size: 0.875rem;
  font-weight: 500;
}

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

.cv-toc a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.75rem;
  color: var(--text);
  border-left: 2px solid transparent;
}

.cv-toc a:hover,
.cv-toc a.active {
  color: var(--theme);
  border-left-color: var(--theme);
  text-decoration: none;
}

.cv-main {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 767px) {
  .cv-toc {
    display: none;
  }
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 0.25rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.cv-contact {
  border-collapse: collapse;
}

.cv-contact th,
.cv-contact td {
  text-align: left;
  vertical-align: top;
  padding: 0.3rem 2rem 0.3rem 0;
}

.cv-contact th {
  font-weight: 500;
  color: var(--text-light);
}

.cv-entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cv-entry {
  display: flex;
  gap: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--divider);
}

.cv-entry:first-child {
  border-top: none;
  padding-top: 0;
}

.cv-entry .when {
  flex: 0 0 8.5rem;
  text-align: center;
}

.cv-entry .date {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.125rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  background-color: var(--theme);
}

.cv-entry .location {
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.cv-entry .location i {
  color: var(--theme);
  margin-right: 0.25rem;
}

.cv-entry .what {
  flex: 1 1 auto;
  min-width: 0;
}

.cv-entry .role {
  font-weight: 700;
  color: var(--theme);
}

.cv-entry .org {
  font-weight: 400;
}

.cv-entry .summary {
  font-style: italic;
  margin-top: 0.25rem;
}

.cv-entry ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  list-style-type: circle;
}

.cv-list {
  margin: 0;
  padding-left: 1.25rem;
}

.cv-list li {
  margin-bottom: 0.5rem;
}

@media (max-width: 575px) {
  .cv-entry {
    flex-direction: column;
    gap: 0.25rem;
  }

  .cv-entry .when {
    flex-basis: auto;
    text-align: left;
  }
}

/* ==========================================================================
   Footer & back-to-top
   ========================================================================== */

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background-color: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.75rem;
  text-align: center;
  padding: 9px 15px 8px;
}

footer a {
  color: var(--footer-link);
}

footer a:hover {
  color: var(--theme);
  text-decoration: none;
}

#back-to-top {
  position: fixed;
  right: 30px;
  bottom: 50px;
  z-index: 95;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  color: var(--back-to-top-text);
  background: var(--back-to-top-bg);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
