/* Academic Pages inspired layout — independent of Fluid theme */
:root {
  --text: #494e52;
  --heading: #111;
  --muted: #7a8288;
  --link: #52adc8;
  --link-hover: #3d8ba3;
  --border: #e5e5e5;
  --bg: #fff;
  --page-bg: #f5f5f5;
  --serif: "Georgia", "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.academic {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page-bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* ---- Sidebar (author profile) ---- */
.author {
  position: sticky;
  top: 1.5rem;
}

.author__avatar {
  width: 150px;
  height: 150px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
}

.author__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author__content {
  text-align: center;
}

.author__name {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.2;
}

.author__bio {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.author__urls {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.author__urls li {
  margin: 0.3rem 0;
}

.author__urls a {
  word-break: break-all;
}

.author__urls .icon {
  display: inline-block;
  width: 1.1rem;
  margin-right: 0.25rem;
  text-align: center;
  opacity: 0.75;
}

.author__actions {
  margin-top: 1rem;
  display: grid;
  gap: 0.45rem;
}

.btn {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn:hover {
  background: #fafafa;
  text-decoration: none;
  color: var(--text);
}

.btn-primary {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}

.btn-primary:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: #fff;
}

.lang-switch {
  display: inline-flex;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-size: 0.8rem;
}

.lang-switch a {
  padding: 0.3rem 0.65rem;
  color: var(--muted);
  text-decoration: none;
}

.lang-switch a.active {
  background: var(--link);
  color: #fff;
}

.lang-switch a:hover:not(.active) {
  background: #f0f0f0;
  text-decoration: none;
}

/* ---- Main content ---- */
.page__content {
  background: var(--bg);
  padding: 2rem 2.25rem;
  border: 1px solid var(--border);
}

.page__lead {
  margin: 0 0 1.75rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--heading);
}

.page__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.page__nav a {
  color: var(--muted);
}

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

.page__section {
  margin: 0 0 2rem;
}

.page__section:last-of-type {
  margin-bottom: 0;
}

.page__section h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
}

.page__section p {
  margin: 0 0 0.75rem;
}

/* Education / project list items */
.archive__item {
  margin: 0 0 0.85rem;
  padding: 0 0 0.85rem;
  border-bottom: 1px solid #f0f0f0;
}

.archive__item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.archive__item-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
}

.archive__item-title a {
  color: inherit;
  text-decoration: none;
}

.archive__item-title a:hover {
  color: var(--link);
  text-decoration: underline;
}

.archive__item-excerpt {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.archive__item-meta {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.archive__item-tags {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.archive__item-tags span::after {
  content: " · ";
}

.archive__item-tags span:last-child::after {
  content: "";
}

.pub-empty {
  padding: 0.75rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
}

.page__footer {
  margin-top: 2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page__footer a {
  color: var(--muted);
}

/* ---- CV download modal ---- */
body.cv-modal-open {
  overflow: hidden;
}

.cv-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.45);
}

.cv-modal[hidden] {
  display: none;
}

.cv-modal__card {
  width: min(100%, 480px);
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  padding: 1.5rem 1.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.cv-modal__title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--heading);
}

.cv-modal__card p {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.cv-modal__hint {
  color: var(--muted);
  font-size: 0.85rem !important;
}

.cv-modal__mail-preview {
  margin: 0.75rem 0 1rem;
  font-size: 0.85rem;
}

.cv-modal__mail-preview summary {
  cursor: pointer;
  color: var(--link);
  user-select: none;
}

.cv-modal__mail-preview pre {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.cv-modal__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.cv-modal__actions .btn {
  display: inline-block;
  width: auto;
  min-width: 6.5rem;
  cursor: pointer;
  font-family: inherit;
}

#cv-download-btn {
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 768px) {
  .page {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1rem auto 2rem;
    width: min(100% - 1.25rem, 720px);
  }

  .author {
    position: static;
  }

  .page__content {
    padding: 1.25rem 1.1rem;
  }
}
