/* ============================================================
   Academic Personal Website — Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --accent:       #4a6fa5;
  --accent-light: #e8eef6;
  --sidebar-bg:   #f5f5f2;
  --border:       #e0dedd;
  --text-primary: #1c1c1c;
  --text-muted:   #6b6b6b;
  --sidebar-w:    270px;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: var(--text-primary);
  line-height: 1.65;
}

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

a:hover {
  text-decoration: underline;
}

/* ---- Layout ----------------------------------------------- */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 2.5rem 1.75rem 2.5rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Photo placeholder */
.sidebar-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #d5d5cf;
  margin: 0 auto 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 3px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 30%;
}

.sidebar-photo .photo-icon {
  font-size: 2.2rem;
  opacity: 0.4;
}

.sidebar-photo .photo-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Identity block */
.sidebar-identity {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.sidebar-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.sidebar-institution {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}

/* Nav */
nav {
  flex: 1;
}

nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  color: #444;
  transition: background 0.15s, color 0.15s;
}

nav a:hover {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.sidebar-footer a {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-footer a:hover {
  color: var(--accent);
}

/* ---- Main content ----------------------------------------- */
.main {
  margin-left: var(--sidebar-w);
  padding: 3.5rem 4rem 4rem;
  flex: 1;
  max-width: 860px;
}

/* Page title */
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* Section */
.section {
  margin-bottom: 3rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* Placeholder text blocks */
.placeholder-block {
  background: #fafaf8;
  border: 1.5px dashed #ccc;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  color: #aaa;
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.7;
}

/* Home hero (photo + intro side-by-side on home) */
.hero {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-bottom: 3rem;
}

.hero-photo {
  width: 180px;
  height: 220px;
  border-radius: 10px;
  background: #d5d5cf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 30%;
}

.hero-photo .photo-icon {
  font-size: 3rem;
  opacity: 0.35;
}

.hero-photo .photo-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.hero-text .hero-role {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.hero-text .hero-institution {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hero-text p {
  font-size: 0.95rem;
  color: #333;
}

/* News / Updates list */
.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.news-item {
  display: flex;
  gap: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  padding-top: 0.1rem;
  min-width: 80px;
}

.news-text {
  font-size: 0.92rem;
  color: #333;
}

/* Interest tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid #c8d8ed;
}

/* Publication entry */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pub-entry {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.pub-title {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.pub-venue {
  font-size: 0.85rem;
  color: #555;
  font-style: italic;
  margin-bottom: 0.4rem;
}

.pub-links {
  display: flex;
  gap: 0.75rem;
}

.pub-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.pub-link:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

/* Course entry */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.course-entry {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

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

.course-code {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.course-name {
  font-size: 0.97rem;
  font-weight: 600;
  margin: 0.15rem 0;
}

.course-meta {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* Contact block */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.contact-item {
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.contact-item-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.contact-item-value {
  font-size: 0.92rem;
  color: var(--text-primary);
}

/* ---- Course cards (Teaching page) ------------------------- */
.course-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.course-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(74, 111, 165, 0.1);
}

.course-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.course-card-title:hover {
  text-decoration: underline;
}

.course-card-title .arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.course-card-meta {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ---- Modal ------------------------------------------------- */
dialog.course-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(680px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

dialog.course-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.modal-inner {
  padding: 2rem 2.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.modal-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.modal-body p {
  font-size: 0.92rem;
  color: #333;
  line-height: 1.75;
  margin-bottom: 0.85rem;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .wrapper {
    flex-direction: column;
  }

  .main {
    margin-left: 0;
    padding: 2rem 1.5rem;
  }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}
