* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-family: sans-serif;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  /* Light mode */
  --global-bg-color: #ffffff;
  --global-text-color: #000000;
  --global-text-color-light: #828282;
  --global-theme-color: #B509AC;
  --global-divider-color: rgba(0,0,0,.1);
  /* teaser shadow — dark drop for the light background */
  --paper-shadow: 6px 8px 14px rgba(0, 0, 0, 0.30);
  --paper-shadow-hover: 7px 10px 18px rgba(0, 0, 0, 0.42);
}

/* Light mode icon visibility */
:root .fa-sun {
  display: none;
}
:root .fa-moon {
  display: block;
}

html[data-theme='dark'] {
  --global-bg-color: #1C1C1D;
  --global-text-color: #d0d0d0;
  --global-text-color-light: #d0d0d0;
  --global-theme-color: #2698BA;
  --global-divider-color: #424246;
  /* teaser shadow — white drop for the dark background */
  --paper-shadow: 4px 6px 10px rgba(255, 255, 255, 0.38);
  --paper-shadow-hover: 7px 10px 18px rgba(255, 255, 255, 0.52);
}

/* Dark mode icon visibility */
html[data-theme='dark'] .fa-sun {
  display: block;
}
html[data-theme='dark'] .fa-moon {
  display: none;
}

/* Smooth theme transition */
html.transition,
html.transition *,
html.transition *:before,
html.transition *:after {
  transition: all 750ms !important;
  transition-delay: 0 !important;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--global-bg-color);
  color: var(--global-text-color);
  line-height: 1.5;
  font-size: 1rem;
  font-weight: 350;
  min-height: 100vh;
  padding-top: 56px;
}

p, h1, h2, h3, h4, h5, h6, em, div, li, span, strong {
  color: var(--global-text-color);
}

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

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

/* Header & Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--global-bg-color);
  z-index: 100;
  border-bottom: 1px solid var(--global-divider-color);
  opacity: 0.95;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 15px;
}

.navbar-brand {
  font-size: 1.25rem;
  color: var(--global-text-color);
  font-weight: 300;
  text-decoration: none;
}

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

.font-weight-bold {
  font-weight: 700;
}

.font-weight-lighter {
  font-weight: 300;
}

.navbar-nav {
  display: flex;
  gap: 15px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: inline-block;
}

.nav-link {
  color: var(--global-text-color);
  font-weight: 400;
  text-decoration: none;
  padding: 8px 0;
}

.nav-link:hover {
  color: var(--global-theme-color);
  text-decoration: none;
}

.nav-item.active .nav-link {
  color: var(--global-theme-color);
  font-weight: bolder;
}

/* Theme toggle button */
#light-toggle {
  cursor: pointer;
  color: var(--global-text-color);
  background: none;
  border: none;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

#light-toggle:hover {
  color: var(--global-theme-color);
}

#light-toggle i {
  padding-left: 10px;
}

/* Main Content */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
}

main {
  padding: 30px 0 60px;
}

/* Profile - using float for text wrap */
.profile {
  width: 15%;
}

.profile.float-left {
  float: left;
  margin-right: 1rem;
}

.profile.float-right {
  float: right;
  margin-left: 1rem;
}

@media (min-width: 576px) {
  .profile .address p {
    display: block;
  }
}

.profile img {
  width: 100%;
  height: auto;
  display: block;
}

.profile .address {
  margin-top: 5px;
  margin-bottom: 5px;
  font-family: monospace;
  font-size: 11px;
}

.profile .address p {
  display: inline-block;
  margin: 0;
}

/* Clearfix for float containment */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* Divider */
hr {
  border: none;
  border-top: 1px solid var(--global-divider-color);
  margin: 30px 0 0 0;
  clear: both;
}

hr.divider-top {
  margin-bottom: 30px;
}

/* Publications Page */
.page-title {
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 20px;
  color: var(--global-text-color);
}

.publications-note {
  margin-bottom: 20px;
}

.year-section {
  margin-bottom: 25px;
}

.year-heading {
  color: var(--global-divider-color);
  border-top: 1px solid var(--global-divider-color);
  padding-top: 1rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  text-align: right;
  font-size: 1.3rem;
  font-weight: 400;
}

.year-section:first-of-type .year-heading {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.publication {
  margin-bottom: 1rem;
}

.publication-title {
  font-weight: bold;
  margin-bottom: 2px;
}

.publication-authors {
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.publication-venue {
  font-size: 0.85rem;
  color: var(--global-text-color-light);
}

/* News Section */
.news {
  margin-top: 1.5rem;
}

.news h2 {
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
  color: var(--global-text-color);
}

.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

/* accent bar that grows in on hover */
.news-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: var(--global-theme-color);
  transform: translateY(-50%);
  transition: height 0.2s ease;
}

.news-item:hover {
  background: var(--global-divider-color); /* fallback for no color-mix */
  background: color-mix(in srgb, var(--global-theme-color) 8%, transparent);
}

.news-item:hover::before {
  height: 62%;
}

.news-date {
  flex: 0 0 auto;
  min-width: 6.25rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--global-theme-color);
  background: var(--global-divider-color); /* fallbacks for no color-mix */
  border: 1px solid var(--global-divider-color);
  background: color-mix(in srgb, var(--global-theme-color) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--global-theme-color) 32%, transparent);
  font-variant-numeric: tabular-nums;
}

.news-body {
  flex: 1 1 auto;
  font-size: 0.95rem;
  line-height: 1.5;
}

.news-hl {
  color: var(--global-theme-color);
  font-weight: 500;
}

@media (max-width: 575px) {
  .news-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* Contact Page */
.contact-info {
  line-height: 1.8;
}

.contact-info p {
  margin-bottom: 3px;
}

/* Responsive */
@media (max-width: 575px) {
  .navbar-nav {
    gap: 10px;
  }
}

/* Intro paragraph: establish a block formatting context so it forms a clean
   column beside the profile image instead of wrapping its last line underneath.
   Only the first paragraph is affected; the rest flow normally below the image. */
.clearfix > p:first-of-type {
  display: flow-root;
}

/* nudge profile image down so its top aligns with the first line of text */
.profile.float-left {
  margin-top: 6px;
}

/* Recent papers — al-folio-style preview thumbnail beside each entry */
.recent-papers {
  margin-top: 1.5rem;
}
.recent-papers h2 {
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 0.75rem;
  color: var(--global-text-color);
}
.paper {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-bottom: 1rem;
}
.paper-preview {
  position: relative;
  flex: 0 0 18%;              /* teaser width — increase for bigger, decrease for smaller */
  line-height: 0;
}
.paper-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  /* bottom-right drop; colour follows the theme (white on dark, dark on light) */
  box-shadow: var(--paper-shadow);
  display: block;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.paper-preview:hover img {
  transform: scale(1.02);
  box-shadow: var(--paper-shadow-hover);
}
.paper-info {
  flex: 1 1 auto;
}
.paper-title {
  font-weight: 500;
  margin-bottom: 2px;
}
.paper-title a {
  color: var(--global-theme-color);
}
.paper-title a:hover {
  text-decoration: underline;
}
.paper-authors {
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.paper-venue {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--global-text-color-light);
}
/* venue badge overlaid on the thumbnail */
.paper-badge {
  position: absolute;
  top: 2px;
  left: -5px;
  z-index: 1;
  background-color: var(--global-theme-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
/* PDF / link buttons */
.paper-links {
  margin-top: 5px;
  line-height: 1.4;
}
.paper-btn {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 9px;
  margin-right: 6px;
  border: 1px solid var(--global-divider-color);
  border-radius: 4px;
  color: var(--global-text-color);
}
.paper-btn:hover {
  border-color: var(--global-theme-color);
  color: var(--global-theme-color);
  text-decoration: none;
}

/* Cite / BibTeX boxes (shared by the gallery and the publications list,
   toggled/copied by cite.js) */
button.paper-btn {
  background: none;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.5;
  cursor: pointer;
}
.cite-box {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--global-divider-color);
  border-radius: 6px;
  background: rgba(128, 128, 128, 0.07);
}
.cite-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.cite-row:last-child {
  margin-bottom: 0;
}
.cite-label {
  flex: 0 0 46px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--global-text-color-light);
  padding-top: 3px;
}
.cite-val {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.42;
  word-break: break-word;
}
.cite-bib {
  white-space: pre-wrap;
  font-size: 0.72rem;
  line-height: 1.35;
  margin: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--global-text-color-light);
}
.cite-copy {
  flex: 0 0 auto;
}
@media (max-width: 575px) {
  .paper-preview {
    flex-basis: 40%;
  }
}
