/* === Design Tokens === */
:root {
  --color-text: #3a3a3a;
  --color-heading: #1a1a1a;
  --color-link: #4a6fa5;
  --color-link-hover: #2c4a7c;
  --color-light: #888888;
  --color-border: #eaeaea;
  --color-bg: #f8f7f5;
  --color-surface: #f3f2f0;
  --max-width: 860px;
  --font-main: 'EB Garamond', Georgia, serif;
}

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

body {
  font-family: var(--font-main);
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

h1, h2, h3 {
  color: var(--color-heading);
  font-family: var(--font-main);
  text-align: left;
}

h1 {
  font-size: 1.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  letter-spacing: 0.01em;
}

.content h1 {
  font-size: 1.5rem;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.2rem;
}

.content h1.home-name {
  font-variant: normal;
  text-transform: none;
  font-size: 1.8rem;
  letter-spacing: 0.01em;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

p {
  line-height: 1.7;
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
}

/* === Navigation === */
.nav {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  padding: 1.1rem 0;
}

.nav .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  text-align: left;
}

.nav-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-heading);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-name:hover {
  color: var(--color-heading);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
}

.nav-links a {
  font-weight: 400;
  font-size: 1rem;
  color: var(--color-light);
  text-decoration: none;
  padding-bottom: 3px;
  transition: color 0.2s ease;
  letter-spacing: 0.01em;
  font-family: var(--font-main);
}

.nav-links a:hover {
  color: var(--color-heading);
}

.nav-links a.active {
  color: var(--color-heading);
  font-weight: 600;
  border-bottom: 1.5px solid var(--color-heading);
}

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-heading);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === Layout === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.content {
  padding: 2.5rem 2rem 4rem;
}

/* === Home Page Grid === */
.home-grid {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.home-bio {
  flex: 3;
}

.home-bio p {
  text-align: justify;
  hyphens: auto;
}

.home-sidebar {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-sidebar img {
  width: 100%;
  max-width: 280px;
  border-radius: 4px;
  display: block;
  filter: grayscale(5%);
}

.contacts {
  margin-top: 1.2rem;
  text-align: center;
}

.contacts p {
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  color: var(--color-light);
  line-height: 1.5;
}

.contacts a {
  color: var(--color-link);
}

.social-icons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-top: 0.6rem;
}

.home-sidebar .social-icons {
  justify-content: center;
}

.news-box {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.news-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.news-box ul {
  list-style: none;
  padding: 0;
}

.news-box li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-light);
  transition: color 0.2s ease, background 0.2s ease;
}

.social-icons a:hover {
  color: var(--color-heading);
  background: var(--color-border);
}

/* === Research Page === */
.paper {
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #ffffff;
}

.paper-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.paper-meta {
  font-size: 0.95rem;
  color: var(--color-light);
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.paper-meta a {
  color: var(--color-link);
}

.paper-meta em {
  font-style: italic;
}

.paper-meta-with-toggle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.paper-links {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.paper-links a {
  margin-right: 0.8rem;
}

.paper-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
}

.btn {
  display: inline-block;
  font-size: 0.82rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid #004a93;
  border-radius: 3px;
  color: #ffffff;
  background: #004a93;
  transition: background 0.2s ease, border-color 0.2s ease;
  line-height: 1.4;
}

.btn:hover {
  background: #003670;
  border-color: #003670;
  color: #ffffff;
  text-decoration: none;
}

.showmore-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-light);
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.showmore-btn:hover {
  color: var(--color-text);
}

.paper-abstract {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-text);
  text-align: justify;
  hyphens: auto;
}

.paper-abstract p {
  margin-top: 0.5rem;
  font-size: 0.92rem;
}

.paper-abstract-toggle {
  display: none;
}

.paper-abstract-toggle.open {
  display: block;
  margin-top: 1rem;
}

.award {
  color: #b8860b;
  font-weight: 500;
  font-size: 0.92rem;
}

/* === Teaching Page === */

/* === Discussions Page === */
.discussion-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.discussion-text {
  flex: 1;
}

.discussion-text .paper-meta:last-child {
  margin-bottom: 0;
}

.discussion-card > .btn {
  flex-shrink: 0;
  align-self: center;
}

.placeholder-note {
  color: var(--color-light);
  font-style: italic;
  margin-top: 1rem;
}

/* === Mobile === */
@media (max-width: 640px) {
  .nav {
    padding: 0.8rem 1rem;
  }

  .nav .container {
    justify-content: space-between;
    align-items: center;
  }

  .hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding-top: 1rem;
  }

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

  .nav-links li {
    border-top: 1px solid var(--color-border);
  }

  .nav-links a {
    display: block;
    padding: 0.7rem 0;
    font-size: 1rem;
  }

  .nav .container {
    flex-wrap: wrap;
  }

  .home-grid {
    flex-direction: column;
    gap: 1.5rem;
  }

  .home-sidebar {
    order: -1;
  }

  .home-sidebar {
    align-self: center;
  }

  .home-sidebar img {
    max-width: 200px;
    margin: 0 auto;
  }

  .content {
    padding: 1.5rem 1rem 3rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  .content h1.home-name {
    text-align: center;
  }

  .social-icons {
    justify-content: center;
  }

  .paper-meta-with-toggle {
    flex-direction: column;
    align-items: flex-start;
  }

  .paper-dot {
    display: none;
  }

  .paper-journal {
    display: block;
  }

  .paper-meta-with-toggle .showmore-btn {
    margin-left: 0;
    margin-top: 0.3rem;
  }
}
