/* Lithium theme — academic personal site styles */
:root {
  --color-heading: #1a3d6d;
  --color-link: #1a3d6d;
  --color-accent: #1a3d6d;
  --text: #333;
  --text-muted: #898989;
  --text-sub: #908e8b;
  --link: #5b5957;
  --bg-page: #ffffff;
  --bg-footer: #eeeeee;
  --bg-highlight: #f5f2ec;
  --bg-input: #fafafa;
  --bg-mobile-menu: #efefef;
  --border: #d4d4d4;
  --ham-color: #333;
  --sidebar-sticky-top: 150px;
  --font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Cardo", Georgia, serif;
}

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

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.7;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.wrapper {
  padding-top: 0;
}

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

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

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.lab-vc-container {
  padding-top: 40px;
  padding-bottom: 60px;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 6px 10px;
  line-height: 1;
  color: var(--text);
  border-radius: 4px;
}

.theme-toggle:hover {
  opacity: 0.85;
}

/* Mobile: top bar + slide-out menu */
.mobile-header {
  display: none;
}

.menu-bar {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 44px;
  padding: 12px 0 8px;
}

.menu-bar .ham,
.menu-bar .ham::before,
.menu-bar .ham::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ham-color);
  position: relative;
}

.menu-bar .ham::before,
.menu-bar .ham::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-bar .ham::before {
  top: -7px;
}

.menu-bar .ham::after {
  top: 7px;
}

.mobile-menu-toolbar {
  display: none;
  margin-top: 20px;
}

.mobile-menu-wrapper {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-mobile-menu);
  z-index: 1000;
  transition: right 0.3s ease, background-color 0.25s ease;
  overflow-y: auto;
}

.mobile-menu-wrapper.open {
  right: 0;
}

.mobile-menu-container {
  padding: 24px;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.mobile-menu-overlay.visible {
  display: block;
}

.mobile-menu-container .menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-container .menu > li {
  margin-bottom: 8px;
}

.mobile-menu-container .menu a {
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
}

.mobile-menu-container .sub-menu {
  list-style: none;
  padding-left: 16px;
  margin-top: 4px;
}

.mobile-menu-container .sub-menu a {
  font-size: 0.85rem;
  color: var(--text-sub);
}

[data-theme="dark"] .mobile-menu-overlay {
  background: rgba(0, 0, 0, 0.55);
}

.theme-icon-moon {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: inline;
}

/* Page layout: content left, menu right */
.page-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  width: 100%;
  align-items: start;
}

@media (min-width: 768px) {
  .page-layout {
    grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr);
    gap: 48px;
  }
}

.page-main {
  min-width: 0;
}

/* Right sidebar navigation (page layout only; not hero overlay) */
@media (min-width: 768px) {
  .page-layout > .page-main {
    grid-column: 1;
    grid-row: 1;
  }

  .page-layout > .sidebar-nav {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: var(--sidebar-sticky-top);
  }
}

.sidebar-nav .sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: right;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.5;
}

.sidebar-nav .sidebar-menu > li {
  list-style: none;
}

.sidebar-nav .sidebar-menu a {
  color: var(--text);
  position: relative;
  display: inline-block;
}

.sidebar-nav .sidebar-menu > li > a::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--bg-highlight);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.5s ease-out;
}

.sidebar-nav .sidebar-menu > li > a:hover::before,
.sidebar-nav .sidebar-menu .current > a::before {
  transform: scaleX(1);
}

[data-theme="dark"] .sidebar-nav .sidebar-menu a:hover {
  color: var(--color-heading);
}

.sidebar-theme {
  margin-top: 20px;
  text-align: right;
}

.sidebar-theme .theme-toggle {
  font-size: 1.35rem;
  padding: 4px 0;
}

.sidebar-nav .sidebar-menu .current > a {
  font-weight: 700;
  color: var(--color-heading);
}

.sidebar-nav .sub-menu {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  font-size: 1.4rem;
  line-height: 1.45;
}

.sidebar-nav .sub-menu a {
  color: var(--text-sub);
  font-size: 1.7rem;
}

/* Hero (home) */
.hero-section {
  min-height: 50vh;
  display: flex;
  align-items: center;
}

.home .home-hero-banner {
  width: 100%;
  margin-bottom: 36px;
}

.home .hero-section.has-background,
.home .hero-section.home-hero-banner:not(.has-background) {
  position: relative;
  min-height: 50vh;
  padding: 48px 32px;
  border-radius: 8px;
  isolation: isolate;
  overflow: hidden;
}

.home .hero-section.has-background {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--bg-highlight);
}

.home .hero-section.has-background::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(255, 255, 255, var(--hero-overlay, 0.35));
  pointer-events: none;
}

[data-theme="dark"] .home .hero-section.has-background::before {
  background: rgba(30, 33, 38, var(--hero-overlay-dark, 0.55));
}

.home .hero-section .hero-text {
  position: relative;
  z-index: 1;
  max-width: 100%;
  --hero-tagline: clamp(16px, 4vw, 42px);
  --hero-title-scale: 0.65;
  font-size: var(--hero-tagline);
}

/* Home: same sticky sidebar as other pages, menu overlays hero on the right */
@media (min-width: 768px) {
  .home .lab-vc-container {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    column-gap: 48px;
    align-items: start;
  }

  .home .home-hero-banner {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0;
  }

  .home .page-layout {
    display: contents;
  }

  .home .page-main {
    grid-column: 1;
    grid-row: 2;
    padding-top: 36px;
  }

  .home .page-layout > .sidebar-nav {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: start;
    position: sticky;
    top: var(--sidebar-sticky-top);
    z-index: 2;
  }

  .home .home-hero-banner.has-background ~ .page-layout > .sidebar-nav .sidebar-menu a {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
  }

  [data-theme="dark"] .home .home-hero-banner.has-background ~ .page-layout > .sidebar-nav .sidebar-menu a {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li {
    opacity: 0;
    transform: translateX(32px);
    animation: hero-menu-slide-in 0.55s ease-out forwards;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(1) {
    animation-delay: 0.38s;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(2) {
    animation-delay: 0.46s;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(3) {
    animation-delay: 0.54s;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(4) {
    animation-delay: 0.62s;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(5) {
    animation-delay: 0.7s;
  }

  .home .page-layout > .sidebar-nav .sidebar-menu > li:nth-child(n + 6) {
    animation-delay: 0.78s;
  }
}

@keyframes hero-menu-slide-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home .page-layout > .sidebar-nav .sidebar-menu > li {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Home hero: tagline/title/subtitle slide-in (same keyframes as menu) */
.home h2.main,
.home .hero-title,
.home .hero-subtitle {
  opacity: 0;
  transform: translateX(32px);
  animation: hero-menu-slide-in 0.55s ease-out forwards;
}

.home h2.main {
  animation-delay: 0.08s;
}

.home .hero-title {
  display: inline-block;
  animation-delay: 0.16s;
}

.home .hero-subtitle {
  display: inline-block;
  animation-delay: 0.24s;
}

@media (prefers-reduced-motion: reduce) {
  .home h2.main,
  .home .hero-title,
  .home .hero-subtitle {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Home hero: tagline size; title/subtitle = 65% of tagline (all viewports) */
.home h2.main {
  font-family: var(--font-serif);
  font-size: var(--hero-tagline);
  line-height: 1.12;
  font-weight: 400;
  margin: 0 0 24px;
  color: var(--color-heading);
}

.home h6.main {
  font-family: var(--font-serif);
  color: var(--text-muted);
  font-size: calc(var(--hero-tagline) * var(--hero-title-scale));
  line-height: 1.6;
  font-weight: 400;
  margin: 0;
}

@media (max-width: 767px) {
  .mobile-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: var(--bg-page);
  }

  .mobile-header .container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
  }

  .menu-bar {
    display: block;
    margin-left: auto;
  }

  .mobile-menu-toolbar {
    display: block;
  }

  .page-layout > .sidebar-nav {
    display: none;
  }

  .mobile-menu-container .sidebar-menu {
    text-align: left;
    font-size: 1.5rem;
    line-height: 1.5;
  }

  .lab-vc-container {
    padding-top: 16px;
  }

  /* Home hero: larger type, sit closer to the left edge */
  .home .hero-section.has-background,
  .home .hero-section.home-hero-banner:not(.has-background) {
    padding: 36px 20px 36px 8px;
    margin-left: -10px;
    width: calc(100% + 10px);
  }

  .home .hero-section .hero-text {
    --hero-tagline: clamp(24px, 6vw, 63px);
    --hero-title-scale: 0.65;
  }

  .home h6.main {
    font-size: calc(var(--hero-tagline) * var(--hero-title-scale));
  }
}

@media (min-width: 768px) {
  .mobile-menu-wrapper {
    display: none;
  }
}

/* Page sections */
.page-section,
.section-block {
  padding: 20px 0 40px;
}

h2.head2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--color-heading);
}

.page-subtitle,
.meta-line {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.page-subtitle.pub-intro {
  color: var(--text);
}

.pub-intro .pub-intro-link {
  color: #1a3d6d;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

.pub-intro .pub-intro-link:hover {
  color: #16335a;
}

[data-theme="dark"] .pub-intro .pub-intro-link {
  color: #8bb8e8;
}

[data-theme="dark"] .pub-intro .pub-intro-link:hover {
  color: #a3c9ef;
}

h4.section-heading,
h4.pub.years {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 25px 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--color-heading);
}

h4.search-format {
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0 0 4px;
}

h4.search-format a {
  font-weight: 500;
}

.post-list .post-item,
.pub-list .pub-item {
  margin-bottom: 28px;
}

.post-info,
.post-info a {
  font-size: 0.95rem;
  line-height: 1.45;
}

.post-info a {
  font-weight: 500;
  color: var(--text);
  position: relative;
  display: inline;
}

.post-info a:hover {
  color: var(--color-heading);
}

/* News article title (detail page) — same color as about .cv-role */
.news-article .page-heading h2.head2 {
  color: var(--text);
}

.post-info a::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--bg-highlight);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s ease-out;
}

.post-info a:hover::before {
  transform: scaleX(1);
}

.post-date {
  color: var(--color-accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.post-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.pub-entry {
  margin-bottom: 20px;
}

.pub-links a {
  font-weight: 500;
}

.more-link {
  margin-top: 16px;
}

.breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.content-body {
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 720px;
}

.content-body h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-heading);
}

.content-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-heading);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.content-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.5rem;
}

.content-body code {
  background: var(--bg-input);
  padding: 2px 6px;
  font-size: 0.9em;
}

.content-body pre {
  background: var(--bg-input);
  padding: 16px;
  overflow-x: auto;
}

.content-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
}

/* About page */
.about-layout {
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 820px;
}

.about-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 640px) {
  .about-header {
    grid-template-columns: 200px 1fr;
    gap: 40px;
  }
}

.about-sections {
  width: 100%;
  min-width: 0;
}

.about-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-profile-photo-wrap {
  width: 100%;
  max-width: 200px;
  margin: 0 0 12px;
}

.about-profile-photo {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  border-radius: 14px;
  object-fit: contain;
}

/* Portrait taller than 1:1.618 → crop display to golden ratio (set via JS) */
.about-profile-photo-wrap--golden {
  aspect-ratio: 1 / 1.618;
  overflow: hidden;
  border-radius: 14px;
}

.about-profile-photo-wrap--golden .about-profile-photo {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
}

.about-affiliations {
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
  max-width: 200px;
  margin: 0 0 14px;
}

.about-affiliations p {
  margin: 0 0 6px;
}

.about-affiliations p:last-child {
  margin-bottom: 0;
}

.about-social {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 200px;
  margin-top: 4px;
}

.about-social a {
  display: block;
  line-height: 0;
  opacity: 0.92;
  transition: opacity 0.2s ease;
}

.about-social a:hover {
  opacity: 1;
}

.about-social img {
  width: 32px;
  height: 32px;
  display: block;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  max-width: none;
}

.about-intro {
  margin: 0;
}

.about-intro.content-body {
  max-width: none;
}

.about-section {
  margin-bottom: 28px;
}

.about-intro-block .about-section-title,
.content-body .about-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--color-heading);
}

/* CV list sections (Education, Awards, Talks, etc.) — cf. cv.html */
.about-section .cv-list {
  padding-left: 20px;
  margin: 0;
}

.about-section .cv-list > li {
  margin-bottom: 10px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

.about-section .cv-list--ordered > li {
  margin-bottom: 10px;
}

.about-section .cv-prose {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

.content-body .about-subsection-title {
  margin: 25px 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-heading);
}

[data-theme="dark"] .about-section .cv-list > li,
[data-theme="dark"] .about-section .cv-prose {
  color: #d4d8dc;
}

.about-extra {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* CV timeline (Positions, Education) — cf. cv.html */
.about-section .cv-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-section .cv-timeline > li {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 0;
  padding: 14px 0;
}

.about-section .cv-timeline > li:first-child {
  padding-top: 4px;
}

.about-section .cv-timeline > li:last-child {
  padding-bottom: 4px;
}

.about-section .cv-date {
  flex: 0 0 130px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1.45;
  white-space: nowrap;
}

.about-section .cv-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.about-section .cv-role {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.about-section .cv-org {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 768px) {
  .about-section .cv-timeline > li {
    flex-direction: column;
    gap: 6px;
  }

  .about-section .cv-date {
    flex: none;
    white-space: normal;
  }
}

/* Footer */
.main-footer {
  background-color: var(--bg-footer);
  margin-top: 40px;
}

.main-footer hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

.footer-bottom {
  padding: 40px 0;
}

.copyright p {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin: 0;
  line-height: 1.6;
}

.row {
  display: flex;
  flex-wrap: wrap;
}

.col {
  flex: 1 1 100%;
}

@media (max-width: 768px) {
  h2.head2 {
    font-size: 1.25rem;
  }

  h4.pub.years {
    font-size: 1.1rem;
    text-align: left;
  }

}

