/* Global variables */
:root {
  --bg: #f5f5f5;
  --text: #222;
  --accent: #001f4d;
  --muted: #555;
}

:root[data-theme="dark"] {
  --bg: #1b1b1b;
  --text: #f3f3f3;
  --accent: #5da0ff;
  --muted: #aaa;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Georgia, serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.site-header {
  text-align: center;
  padding: 50px 20px 30px;
}

.site-header h1 {
  font-size: 2.2rem;
  margin: 0;
  font-weight: normal;
}

.institution {
  color: var(--muted);
  font-style: italic;
  font-size: 1rem;
  margin: 8px 0 18px;
}

/* Nav */
.main-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.nav-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
  text-decoration: underline;
}

/* Layout */
.page-container {
  display: flex;
  justify-content: center;
  gap: 60px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

.sidebar {
  flex: 0 0 30%;
  text-align: center;
  position: sticky;
  top: 40px;
  align-self: flex-start;
}

.photo {
  width: 100%;
  max-width: 220px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.main-content {
  flex: 0 0 70%;
  max-width: 700px;
}

/* Sections */
.section {
  display: none;
}
.section.active {
  display: block;
}

/* Headers */
.section h2 {
  font-size: 1.4rem;
  font-weight: bold;
  margin-top: 2rem;
  margin-bottom: 1.2rem;
}

.section h3 {
  font-size: 1.15rem;
  font-weight: bold;
  margin-top: 2.8rem;
  margin-bottom: 1rem;
}

/* Chapters */
.chapter {
  margin-bottom: 1.2rem;
}

.chapter-title {
  font-weight: normal;
  margin-bottom: 0.25rem;
}

/* Abstract link */
.abstract-toggle {
  color: var(--accent);
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

.abstract-toggle:hover {
  text-decoration: underline;
}

.chapter-content {
  display: none;
  padding-left: 1rem;
  margin-top: 0.3rem;
  font-style: normal;
  color: var(--text);
  text-align: justify;
}

/* === ABSTRACT LAYOUT (float-left, right padding only) === */
.abstract-flex {
  display: flow-root;
  margin-top: 10px;
  width: 100%;
}

.chapter-image {
  float: left;
  width: 35%;
  max-width: 400px;
  height: auto;
  margin: 20px 20px 0px 0; /* added small top margin */
  border-radius: 8px;
  object-fit: cover;
}

@media (max-width: 1000px) {
  .chapter-image {
    float: none;
    display: block;
    width: 100%;
    margin: 0 auto 15px;
  }

  .abstract-flex p {
    text-align: left;
  }
}

/* Social icons */
.social-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  padding: 0;
}

.social-icons img {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
  display: block;
}

.social-icons img[src*="scholar"],
.social-icons a[title="Google Scholar"] img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  font-family: inherit;
}

a:visited {
  color: var(--accent);
}

a:hover {
  text-decoration: underline;
}

/* CV link */
.cv-link {
  font-size: 1rem;
  color: var(--accent);
  font-weight: bold;
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
}

.cv-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 60px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 900px) {
  .page-container {
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
  }

  .sidebar {
    position: static;
    width: 100%;
  }

  .photo {
    max-width: 160px;
  }

  .main-content {
    width: 100%;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .paper-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    padding: 0;
    margin: 0;
    display: inline;
  }

  .paper-link:hover {
    text-decoration: underline;
  }
}
