/* ============================================================
   ACADEMIC PERSONAL WEBSITE — Shared Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:         #faf9f7;
  --surface:    #ffffff;
  --border:     #e8e4de;
  --text:       #1a1917;
  --muted:      #6b6760;
  --accent:     #3a5a8c;
  --accent-lt:  #e8eef5;
  --sidebar-w:  260px;
  --nav-h:      62px;
  --radius:     6px;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: #ffffff;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.7; }
img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Top Nav ───────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #f0eeeb;
  border-bottom: 1px solid #dedad4;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding-left: calc((100% - 1180px) / 2 + 1.5rem);
  padding-right: calc((100% - 1180px) / 2 + 1.5rem);
  gap: 1rem;
}
@media (max-width: 1213px) {
  .site-nav {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  margin-right: auto;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-lt);
  color: var(--accent);
  opacity: 1;
}
/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: #f0eeeb;
  border-bottom: 1px solid #dedad4;
  padding: 1rem 2rem;
  z-index: 99;
  flex-direction: column;
  gap: 0.25rem;
}
.mobile-menu a {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  color: var(--muted);
  border-radius: var(--radius);
}
.mobile-menu a:hover,
.mobile-menu a.active {
  background: var(--accent-lt);
  color: var(--accent);
  opacity: 1;
}
.mobile-menu.open { display: flex; }

/* ── Layout: Sidebar + Main ────────────────────────────────── */
.page-body {
  display: flex;
  gap: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  align-items: flex-start;
  background: #ffffff;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 2rem 1.5rem 2rem 0;
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
}
.sidebar-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  background: var(--border);
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #c5cdd8, #8fa3be);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.2rem;
}
.sidebar-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.sidebar-title {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}
.sidebar-links a:hover { color: var(--accent); opacity: 1; }
.sidebar-links .icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 0 0 2.5rem;
  border-left: 1px solid var(--border);
}
/* Index page only: two-column layout */
.main-content--home {
  display: flex;
  flex-direction: column;
}

/* ── Page Title ────────────────────────────────────────────── */
.page-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.page-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 600px;
  line-height: 1.65;
}

/* ── About Section ─────────────────────────────────────────── */
.about-lead {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.about-body {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.85;
}
.about-body p { margin-bottom: 1.2rem; }
.about-body strong { font-weight: 500; color: var(--accent); }
.award-box {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #fffdf5;
  border: 1px solid #e8dfa0;
  border-radius: var(--radius);
  font-size: 0.95rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.award-box .medal { font-size: 1.5rem; flex-shrink: 0; }

/* ── Publication Cards ─────────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 1.25rem; }
.pub-card {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.pub-card:hover {
  box-shadow: var(--shadow);
  border-color: #d0c8be;
}
.pub-thumb {
  width: 68px;
  height: 86px;
  flex-shrink: 0;
  background: var(--accent-lt);
  border-radius: 3px;
  overflow: hidden;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pub-thumb-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--accent-lt), #c5d3e8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.3rem;
}
.pub-info { flex: 1; min-width: 0; }
.pub-title {
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.45;
}
.pub-authors {
  font-size: 0.87rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.pub-journal {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.65rem;
}
.pub-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pub-link {
  font-size: 0.78rem;
  padding: 0.22rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  background: var(--bg);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.pub-link:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

/* ── Project Cards ─────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover {
  box-shadow: var(--shadow);
  border-color: #d0c8be;
}
.project-img {
  height: 140px;
  background: var(--accent-lt);
  overflow: hidden;
}
.project-img img { width: 100%; height: 100%; object-fit: cover; }
.project-img-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.project-body { padding: 1.15rem; }
.project-tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}
.project-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.project-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

/* ── Teaching / Courses ────────────────────────────────────── */
.course-list { display: flex; flex-direction: column; gap: 1rem; }
.course-card {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow var(--transition);
}
.course-card:hover { box-shadow: var(--shadow); }
.course-year {
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.course-info .course-title {
  font-size: 0.97rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.course-info .course-institution {
  font-size: 0.87rem;
  color: var(--muted);
}

/* ── CV ────────────────────────────────────────────────────── */
.cv-section { margin-bottom: 2.5rem; }
.cv-section-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.cv-entry { display: flex; gap: 1rem; margin-bottom: 1.1rem; }
.cv-year {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  width: 90px;
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.cv-details .cv-role {
  font-weight: 500;
  font-size: 0.97rem;
  margin-bottom: 0.15rem;
}
.cv-details .cv-place {
  font-size: 0.88rem;
  color: var(--muted);
}
.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2rem;
  transition: opacity var(--transition);
}
.cv-download:hover { opacity: 0.85; }

/* ── Contact Form ──────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2.5rem;
  max-width: 820px;
}
.contact-info-block h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.contact-info-block p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}
.contact-detail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.contact-form { display: flex; flex-direction: column; gap: 0.85rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input,
.form-group textarea {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58,90,140,0.08);
}
.form-submit {
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity var(--transition);
}
.form-submit:hover { opacity: 0.85; }
.form-success {
  display: none;
  background: #edf7ed;
  border: 1px solid #aed9ae;
  color: #276227;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 1180px;
  margin: 0 auto;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); opacity: 1; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  .page-body { flex-direction: column; padding: 0 1rem 2rem; }
  .sidebar {
    width: 100%;
    position: static;
    padding: 1.5rem 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-avatar { width: 80px; height: 80px; margin-bottom: 0; }
  .sidebar-info { flex: 1; }
  .sidebar-links { flex-direction: row; flex-wrap: wrap; }
  .main-content {
    padding: 1.5rem 0 0;
    border-left: none;
  }
  .contact-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .project-grid { grid-template-columns: 1fr; }
  .pub-card { flex-direction: column; }
  .pub-thumb { width: 100%; height: 120px; }
}

@media (max-width: 480px) {
  .site-nav { padding: 0 1rem; }
  .nav-brand { font-size: 1.1rem; }
  .page-title { font-size: 1.8rem; }
  .cv-entry { flex-direction: column; gap: 0.25rem; }
  .cv-year { width: auto; }
}

/* ── Index page: two-column layout ────────────────────────────── */
.content-columns {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.col-about {
  flex: 1 1 55%;
  min-width: 0;
  padding-right: 2.5rem;
  border-right: 1px solid var(--border);
}
.col-news {
  flex: 1 1 45%;
  min-width: 0;
  padding-left: 2.5rem;
}

/* ── News section ──────────────────────────────────────────────── */
.news-section-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.year-group { margin-bottom: 0.6rem; }
.year-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0eeeb;
  border: 1px solid #dedad4;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  transition: background var(--transition), color var(--transition);
}
.year-toggle:hover { background: #e6e2dd; color: #2a4a7c; }
.year-toggle[aria-expanded="false"] { border-radius: var(--radius); }
.year-toggle .chevron {
  width: 16px; height: 16px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--muted);
}
.year-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.year-items {
  display: flex;
  flex-direction: column;
  border: 1px solid #dedad4;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.year-items:not(.open) { display: none; }
.year-items.open       { display: flex; }
.news-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #dedad4;
  background: #f7f5f2;
  transition: background var(--transition);
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: #eeebe6; }
.news-item-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.news-date {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  white-space: nowrap;
}
.news-badge {
  font-size: 0.69rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
}
.badge-paper  { background: #edf4ff; color: #2563a8; }
.badge-award  { background: #fffbe6; color: #a06b00; }
.badge-event  { background: #f0f9f0; color: #276227; }
.badge-member { background: #f5f0fa; color: #6a3d9a; }
.news-text { font-size: 0.88rem; color: var(--text); line-height: 1.55; }
.news-text strong { font-weight: 500; }

@media (max-width: 960px) {
  .content-columns { flex-direction: column; gap: 2.5rem; }
  .col-about {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 2.5rem;
  }
  .col-news { padding-left: 0; }
}
