/* ===== Local Fonts ===== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter-700.ttf') format('truetype');
}

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

:root {
  --clr-bg:      #f8f9fa;
  --clr-surface: #ffffff;
  --clr-text:    #2d3436;
  --clr-muted:   #636e72;
  --clr-accent:  #0a6abf;
  --clr-accent2: #084a85;
  --clr-border:  #dfe6e9;
  --clr-tag:     #e8f0fe;
  --max-w:       960px;
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--clr-accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--clr-accent2); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ===== Header ===== */
.site-header {
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--clr-text);
  white-space: nowrap;
}
.site-title a { color: inherit; }
.site-title a:hover { text-decoration: none; }

/* Nav */
nav ul {
  list-style: none;
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}

nav a {
  display: block;
  padding: .4rem .75rem;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--clr-muted);
  transition: background .15s, color .15s;
}

nav a:hover, nav a.active {
  background: var(--clr-tag);
  color: var(--clr-accent);
  text-decoration: none;
}

/* Mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--clr-text); margin: 5px 0; transition: .2s; }

/* ===== Main ===== */
main {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  flex: 1;
}

/* ===== Page Header / Hero ===== */
.page-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

.page-hero .portrait {
  width: 160px;
  min-width: 160px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.page-hero h1 {
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: .5rem;
}

.page-hero .subtitle {
  color: var(--clr-muted);
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* Profile links row */
.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.profile-links + .profile-links {
  margin-top: .5rem;
}

/* Topic tags (non-clickable) */
.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}

.topic-tags span {
  display: inline-block;
  padding: .3rem .7rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border-radius: 6px;
  background: var(--clr-tag);
  color: var(--clr-accent);
  font-size: .8rem;
  font-weight: 500;
  transition: background .15s;
}
.profile-links a:hover { background: #d0e2f7; text-decoration: none; }
.profile-links svg { width: 14px; height: 14px; }

/* ===== Section ===== */
h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .75rem; color: var(--clr-text); }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }

p { margin-bottom: 1rem; }
ul, ol { margin: 0 0 1rem 1.25rem; }
li { margin-bottom: .35rem; }

/* ===== Cards ===== */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }

.card h3 { margin-top: 0; }

/* ===== Research Topics ===== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  clear: both;
}

.topic-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 1.25rem;
  border-left: 5px solid var(--clr-border);
  border-bottom: 5px solid var(--clr-border);
}

.topic-card h3 {
  font-size: .95rem;
  margin: 0 0 .4rem;
  color: var(--clr-text);
}

.topic-subtitle {
  font-size: .78rem;
  color: var(--clr-accent);
  opacity: .75;
  margin: -.2rem 0 .5rem !important;
  font-weight: 500;
}
.topic-card p:not(.topic-subtitle) {
  font-size: .88rem;
  color: var(--clr-muted);
  margin: 0;
  line-height: 1.55;
}

/* ===== Acronym highlight ===== */
.acro { color: var(--clr-accent); font-weight: 700; }

/* ===== Publications ===== */
.pub-controls {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.pub-controls input,
.pub-controls select {
  padding: .5rem .75rem;
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: var(--font-sans);
  background: var(--clr-surface);
}

.pub-controls input { flex: 1; min-width: 200px; }
.pub-controls select { min-width: 140px; }

.pub-year-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--clr-accent);
  margin: 1.75rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--clr-tag);
}

.pub-entry {
  padding: .75rem 0;
  border-bottom: 1px solid var(--clr-border);
  line-height: 1.6;
}

.pub-entry:last-child { border-bottom: none; }

.pub-title {
  font-weight: 600;
  color: var(--clr-text);
}

.pub-authors {
  font-size: .88rem;
  color: var(--clr-muted);
}

.pub-venue {
  font-size: .88rem;
  font-style: italic;
  color: var(--clr-muted);
}

.pub-links {
  margin-top: .3rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.pub-links a {
  font-size: .78rem;
  padding: .2rem .55rem;
  border-radius: 4px;
  background: var(--clr-tag);
  font-weight: 500;
}
.pub-links a:hover { background: #d0e2f7; }

.pub-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: #ffeaa7;
  color: #856404;
  margin-left: .5rem;
}

.pub-badge-selected {
  background: #f5b7b1;
  color: #922b21;
}

.pub-badge-preprint {
  background: #e8daef;
  color: #6c3483;
}

.pub-badge-scicom {
  background: #d5f5e3;
  color: #1e8449;
}

.bib-raw {
  margin-top: .5rem;
  padding: .75rem 1rem;
  background: var(--clr-tag);
  border-radius: 6px;
  overflow-x: auto;
  font-size: .8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.bib-raw code { background: none; padding: 0; }

/* ===== Books ===== */
.book-card {
  display: flex;
  gap: 1.5rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.book-card .book-info { flex: 1; }
.book-card h3 { margin-top: 0; color: var(--clr-accent); }

.book-meta {
  font-size: .88rem;
  color: var(--clr-muted);
  margin-bottom: .75rem;
}

.book-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}

.book-links a {
  font-size: .82rem;
  padding: .35rem .7rem;
  border-radius: 6px;
  background: var(--clr-tag);
  font-weight: 500;
}

/* ===== Teaching ===== */
.course-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.course-card h3 { margin-top: 0; }

.course-semester {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: var(--clr-tag);
  color: var(--clr-accent);
  margin-bottom: .5rem;
}

.course-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.course-links a {
  font-size: .82rem;
  padding: .3rem .6rem;
  border-radius: 6px;
  background: var(--clr-tag);
  font-weight: 500;
}

/* ===== Affiliations ===== */
.affiliation-list {
  list-style: none;
  margin-left: 0;
}

.affiliation-list li {
  padding: .6rem 0;
  padding-left: 1.25rem;
  position: relative;
  border-bottom: 1px solid var(--clr-border);
}

.affiliation-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--clr-accent);
}

.affiliation-list li:last-child { border-bottom: none; }

/* ===== Page Images (float right, like WP original) ===== */
.page-img-right {
  float: right;
  max-width: 280px;
  margin: 0 0 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.page-img-right figcaption,
.page-caption {
  font-size: .78rem;
  color: var(--clr-muted);
  font-style: italic;
  text-align: center;
  margin-top: .35rem;
}

/* Book cover images */
.book-card .book-cover {
  width: 180px;
  min-width: 180px;
  align-self: flex-start;
}

.book-card .book-cover img {
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

@media (max-width: 700px) {
  .page-img-right {
    float: none;
    max-width: 100%;
    margin: 0 auto 1rem;
  }
  .book-card .book-cover {
    width: 120px;
    min-width: 120px;
  }
}

/* ===== Projects ===== */
.project-card {
  display: flex;
  gap: 1.25rem;
}

.project-img {
  flex-shrink: 0;
  width: 120px;
  height: 210px;
  border-radius: 8px;
  background: var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-muted);
  font-size: .75rem;
  overflow: hidden;
}

.project-img:has(img) {
  background: none;
}

.project-img img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.project-body {
  flex: 1;
  min-width: 0;
}

.project-meta {
  font-size: .85rem;
  color: var(--clr-muted);
  margin-bottom: .5rem;
}

.project-details {
  font-size: .85rem;
  color: var(--clr-muted);
  margin-bottom: .5rem;
}

/* SDG icons — stacked on the right, filling card height */
.sdg-icons {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.sdg-icons img {
  width: 65px;
  height: 65px;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .project-card {
    flex-direction: column;
  }
  .project-img {
    width: 100%;
    height: 140px;
  }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  text-align: center;
  padding: 1.5rem;
  font-size: .82rem;
  color: var(--clr-muted);
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .nav-toggle { display: block; }

  nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: .5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
  }

  nav ul.open { display: flex; }

  .header-inner { position: relative; }

  .page-hero { flex-direction: column; align-items: center; text-align: center; }
  .page-hero .portrait { width: 120px; min-width: 120px; }
  .profile-links { justify-content: center; }

  .book-card { flex-direction: column; }
  .topic-grid { grid-template-columns: 1fr; }
}
