/* Plain CV-style stylesheet */

:root {
  --text: #222;
  --muted: #555;
  --bg: #fdfdfd;
  --accent: #7a1f2b;
  --rule: #ddd;
  --hover-bg: #e2e2e2;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --max-width: 800px;
  --topbar-height: 58px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e8e8e8;
    --muted: #aaa;
    --bg: #1a1a1a;
    --rule: #444;
    --hover-bg: #333;
    --shadow-color: rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html { font-size: 19px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Keep anchor targets from landing underneath the fixed top bar */
#top,
main section {
  scroll-margin-top: var(--topbar-height);
}

body {
  margin: 0;
  padding: var(--topbar-height) 0 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Crimson Text", "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.55;
}

/* Permanent top bar */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  z-index: 100;
  padding: 0 1rem;
}

.menu-btn {
  justify-self: start;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.menu-btn .bars,
.menu-btn .bars::before,
.menu-btn .bars::after {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  margin: 0 auto;
}

.menu-btn .bars::before { margin-top: -5px; }
.menu-btn .bars::after { margin-top: 5px; }

.topbar-name {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0rem;
  font-weight: bold;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-align: center;
}

.topbar-subtitle {
  font-size: 0.62rem;
  font-weight: normal;
  font-style: normal;
  color: var(--muted);
  margin-top: 0.05rem;
}

.github-btn {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0;
  transition: background-color 0.15s ease;
}

.github-btn:hover {
  background-color: var(--hover-bg);
}

.menu-panel {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  width: 260px;
  max-width: 80%;
  height: calc(100vh - var(--topbar-height));
  background: var(--bg);
  border-right: 1px solid var(--rule);
  box-shadow: 4px 0 12px var(--shadow-color);
  padding: 0.5rem 0;
  overflow-y: auto;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
  z-index: 100;
}

.menu-panel.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.25s ease;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}

.menu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.menu-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-panel a {
  display: block;
  padding: 0.5rem 1rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.menu-panel a:hover {
  background-color: var(--hover-bg);
}

header.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.25rem 1.5rem;
  text-align: center;
}

header.site-header img.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

header.site-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header.site-header .tagline {
  margin: 0.4rem 0 0.5rem;
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
}

nav.toc {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

nav.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.0rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.01em;
}

nav.toc a {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

nav.toc a:hover {
  background-color: var(--hover-bg);
}

ul.social {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0;
  margin: 0.75rem 0 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

section {
  padding-top: 0.5rem;
}

section h2 {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--text);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

section h3 {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-top: 1.75rem;
}

section p { margin: 0 0 1rem; }

ol.list, ul.list {
  padding-left: 1.25rem;
  margin: 0;
}

ol.list li, ul.list li {
  margin-bottom: 0.9rem;
}

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

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

.about-intro {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}

.carousel {
  position: relative;
  margin: 1rem 0;
  /* Image height scales with width (same ratio as the 260px desktop view) */
  container-type: inline-size;
  --carousel-img-h: min(260px, calc(100cqw * 13 / 38));
}

.carousel-track {
  position: relative;
  border: 1px solid var(--rule);
}

.carousel-slide {
  display: none;
  margin: 0;
}

.carousel-slide.active {
  display: block;
}

.carousel-slide img {
  width: 100%;
  height: var(--carousel-img-h);
  object-fit: cover;
  display: block;
}

.carousel-slide figcaption {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.65rem;
  color: var(--muted);
  padding: 0.4rem 0;
  text-align: center;
}

.carousel-arrow {
  position: absolute;
  top: 0;
  height: var(--carousel-img-h);
  width: 8%;
  min-width: 28px;
  display: flex;
  align-items: center;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0.6rem;
  background: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.carousel-prev {
  left: 0;
  justify-content: flex-start;
}

.carousel-prev:hover {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.carousel-next {
  right: 0;
  justify-content: flex-end;
}

.carousel-next:hover {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.carousel-dots {
  position: absolute;
  top: calc(var(--carousel-img-h) - 14px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}

.carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  padding: 0;
  cursor: pointer;
}

.carousel-dot.active {
  background: #fff;
}

/* Research areas: 2x2 grid on wide screens, single column on phones */

.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.research-item {
  margin: 0;
}

.research-item > a {
  display: block;
}

.research-item img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
}

.research-item figcaption {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
  padding-top: 0.5rem;
}

@media (max-width: 600px) {
  .research-grid { grid-template-columns: 1fr; }
}

/* Publications: thumbnail column + text column */

.pub-table {
  width: 100%;
  border-collapse: collapse;
  /* Fallback start value; script.js sets it from the row count */
  counter-reset: pub 12;
}

.pub-table tr {
  counter-increment: pub -1;
}

.pub-table td {
  vertical-align: top;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.pub-table tr:last-child td {
  border-bottom: none;
}

.pub-table .pub-thumb {
  width: 96px;
  padding-right: 1rem;
}

.pub-table .pub-thumb img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
}

.pub-table .pub-text {
  overflow-wrap: anywhere;
}

.pub-table .pub-text::before {
  content: counter(pub) ". ";
}

.pub-table.no-numbers .pub-text::before {
  content: none;
}

@media (max-width: 600px) {
  .pub-table .pub-thumb {
    width: 64px;
    padding-right: 0.75rem;
  }

  .pub-table .pub-thumb img {
    width: 64px;
    height: 64px;
  }
}

address {
  font-style: normal;
}

footer.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
}

@media (max-width: 480px) {
  nav.toc ul { gap: 0.4rem 0.6rem; }
}
