:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #1e4d6b;
  --accent-hover: #163a52;
  --border: #e0e0e0;
  --tag-bg: #eef3f6;
  --max-width: 720px;
  --sidebar-width: 280px;
  --font-sans: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

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

.sidebar__photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 2px solid var(--border);
}

.sidebar__name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.sidebar__title {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.sidebar__affiliation {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.4;
}

.sidebar__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar__links a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

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

.icon {
  width: 22px;
  height: 22px;
}

.orcid-icon {
  width: 24px;
  height: 24px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* Anchor Navigation */
.anchor-nav {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.anchor-nav .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.anchor-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  justify-content: center;
  font-size: 0.85rem;
}

.anchor-nav__links a {
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.anchor-nav__links a:hover {
  color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}

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

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

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--wide {
  max-width: 960px;
}

/* Navigation */
.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0.75rem 0;
}

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

.site-nav__brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-nav__brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-nav__links a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.site-nav__links a:hover,
.site-nav__links a.active {
  color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero {
  padding: 2rem 0 1.5rem;
  text-align: center;
}

.hero__photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.hero__name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.hero__affiliation {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.hero__bio {
  margin: 0 0 1.25rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  justify-content: center;
}

.quick-links a {
  color: var(--accent);
}

/* Sections */
.section {
  padding: 2rem 0;
}

.section:first-child {
  padding-top: 0;
}

.section__title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  color: var(--text);
}

.section-wrapper {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 1rem;
}

/* Publications */
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub-item {
  margin-bottom: 1.5rem;
}

.pub-item:last-child {
  margin-bottom: 0;
}

.pub-item__title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.pub-item__authors {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.pub-item__meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.35rem;
}

.pub-item__desc {
  margin: 0;
  font-size: 0.95rem;
}

.pub-item__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}

/* Projects */
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.project-item {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.project-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.project-item--featured .project-item__image {
  max-width: 100%;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.project-item__title {
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.project-item__year {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9rem;
}

.project-item__desc {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.project-item__links {
  font-size: 0.9rem;
}

.project-item__thumb {
  max-width: 140px;
  border-radius: 4px;
  float: left;
  margin: 0 1rem 0.5rem 0;
}

/* Experience & Education */
.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry-item {
  margin-bottom: 1.25rem;
}

.entry-item:last-child {
  margin-bottom: 0;
}

.entry-item__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.25rem;
}

.entry-item__role {
  font-weight: 600;
  margin: 0;
}

.entry-item__years {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.entry-item__place {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
}

.entry-item__desc {
  margin: 0;
  font-size: 0.95rem;
}

/* Skills */
.skill-group {
  margin-bottom: 1.25rem;
}

.skill-group:last-child {
  margin-bottom: 0;
}

.skill-group__title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.skill-list {
  margin: 0;
  padding-left: 1.25rem;
}

.skill-list li {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow: hidden;
  min-width: 0;
}

.skill-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-grid li {
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  background: var(--tag-bg);
  border-radius: 4px;
  text-align: center;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* GitHub widgets */
.github-section p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.github-graph {
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.github-graph .js-calendar-graph-svg {
  max-width: 100%;
}

.ghfeed {
  height: 400px;
  overflow: auto;
}

/* CV page */
.cv-header {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cv-header__name {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin: 0 0 0.25rem;
}

.cv-header__affiliation {
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.cv-contact {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.cv-actions {
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

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

.btn--outline {
  background: transparent;
  color: var(--accent);
}

.btn--outline:hover {
  background: var(--tag-bg);
  color: var(--accent-hover);
}

.cv-section {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.cv-section:last-child {
  border-bottom: none;
}

.cv-section h2 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.interest-list {
  list-style: disc;
  margin: 0;
  padding-left: 1.25rem;
}

.interest-list li {
  margin-bottom: 0.25rem;
}

/* Blog posts */
.post-content {
  padding-bottom: 2rem;
}

.post-content h2,
.post-content h3 {
  font-family: var(--font-serif);
  margin: 1.5rem 0 0.75rem;
}

.post-content p,
.post-content ul,
.post-content ol {
  margin-bottom: 1rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
}

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

.site-footer__links {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* Course list & Thesis details */
.entry-item__thesis {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--tag-bg);
  border-radius: 4px;
  border-left: 3px solid var(--accent);
}

.entry-item__thesis .thesis-title {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  color: var(--text);
}

.entry-item__thesis .thesis-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.entry-item__thesis .thesis-desc {
  font-size: 0.9rem;
  margin: 0;
  color: var(--text-muted);
}

.cv-details {
  margin-top: 0.75rem;
}

.cv-summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  outline: none;
  user-select: none;
}

.cv-summary:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.cv-course-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0.5rem;
  border-left: 1px solid var(--border);
}

.cv-course-item {
  padding: 0.5rem 0 0.5rem 1rem;
  border-bottom: 1px dashed var(--border);
}

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

.cv-course-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.course-name {
  color: var(--text);
}

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

.course-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.achievement-group {
  margin-bottom: 1rem;
}

.achievement-group__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

/* Print styles for CV */
@media print {
  .site-nav,
  .cv-actions,
  .site-footer,
  .skip-link,
  .no-print,
  .sidebar,
  .anchor-nav {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
    line-height: 1.4;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .cv-header {
    padding-top: 0;
  }

  .cv-section {
    padding: 0.75rem 0;
    break-inside: avoid;
  }

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

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: var(--text-muted);
  }

  a[href^="mailto"]::after {
    content: none;
  }

  .cv-details {
    display: block !important;
  }

  .cv-details > summary {
    display: none;
  }

  .cv-course-list {
    display: block !important;
  }

  .cv-course-item {
    break-inside: avoid;
  }

  .page-wrapper {
    display: block;
  }

  .main-content {
    width: 100%;
  }

  .section-wrapper {
    padding: 0;
    box-shadow: none;
    background: transparent;
  }
}

/* Tablet and Mobile */
@media (max-width: 1024px) {
  .page-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
  }

  .sidebar__content {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    text-align: left;
  }

  .sidebar__photo {
    width: 60px;
    height: 60px;
  }

  .sidebar__name {
    font-size: 1rem;
  }

  .sidebar__title {
    font-size: 0.8rem;
  }

  .sidebar__affiliation {
    display: none;
  }

  .sidebar__links {
    flex-direction: row;
    gap: 0.5rem;
    margin-left: auto;
  }

  .sidebar__links a {
    padding: 0.25rem;
  }

  .icon {
    width: 18px;
    height: 18px;
  }

  .orcid-icon {
    width: 20px;
    height: 20px;
  }

  .anchor-nav {
    display: none;
  }

  .container {
    max-width: var(--max-width);
  }

  .hero {
    padding: 2rem 0 1.5rem;
    text-align: center;
  }

  .quick-links {
    justify-content: center;
  }

  .site-nav .container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .project-item__thumb {
    float: none;
    display: block;
    margin: 0 0 0.75rem;
  }

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

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

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

  .section-wrapper {
    padding: 0;
    box-shadow: none;
    background: transparent;
  }

  .section {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
  }

  .section:first-child {
    border-top: none;
    padding-top: 0;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 1.5rem 0 1rem;
  }

  .hero__bio {
    font-size: 0.95rem;
  }

  .section__title {
    font-size: 1.2rem;
  }

  .pub-item__title {
    font-size: 0.95rem;
  }

  .pub-item__meta {
    font-size: 0.85rem;
  }

  .entry-item__role {
    font-size: 0.95rem;
  }

  .entry-item__years {
    font-size: 0.8rem;
  }

  .sidebar__links {
    gap: 0.25rem;
  }

  .sidebar__links a {
    padding: 0.125rem;
  }

  .icon {
    width: 16px;
    height: 16px;
  }

  .orcid-icon {
    width: 18px;
    height: 18px;
  }
}
