/*
  Simple academic website styles.
  Edit colors, spacing, and typography here.
*/

:root {
  --accent: #d35400;
  --accent-dark: #9a3700;
  --accent-soft: #fff1e6;
  --link: #b5420b;
  --teal: #4f8584;
  --text: #242424;
  --muted: #666666;
  --border: #dddddd;
  --soft: #f6f8f8;
  --white: #ffffff;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--white);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-top: 5px solid var(--teal);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: min(100% - 32px, var(--max-width));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.site-name {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  font-size: 0.96rem;
}

.nav-links a {
  color: var(--text);
}

.nav-links a.active {
  color: var(--accent-dark);
  font-weight: 700;
}

.page {
  width: min(100% - 32px, var(--max-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 48px;
  padding: 58px 0 72px;
}

.sidebar {
  align-self: start;
}

.profile-photo {
  width: 210px;
  height: 210px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--soft);
}

.sidebar h1 {
  margin: 20px 0 4px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.sidebar p {
  margin: 0 0 14px;
}

.sidebar .small {
  color: var(--muted);
  font-size: 0.95rem;
}

.profile-meta {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  color: #444444;
  font-size: 0.94rem;
}

.profile-meta li {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 7px 0;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
}

.sidebar-links li {
  margin: 8px 0;
}

.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.link-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: 0 0 20px;
  object-fit: contain;
}

.content {
  max-width: 760px;
}

.content h2 {
  margin: 0 0 18px;
  font-size: 2.35rem;
  line-height: 1.15;
}

.content h3 {
  margin: 34px 0 10px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.content p {
  margin: 0 0 18px;
}

.lead {
  color: #3f3f3f;
  font-size: 1.2rem;
  line-height: 1.45;
}

.about-text {
  text-align: justify;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
}

.featured-image {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--soft);
}

.section {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.plain-list {
  padding-left: 22px;
}

.plain-list li {
  margin-bottom: 8px;
}

.item-list {
  display: grid;
  gap: 28px;
}

.publication-item,
.project-item,
.teaching-item,
.detail-box {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.publication-item:first-child,
.project-item:first-child,
.teaching-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.publication-item h3,
.project-item h3,
.teaching-item h3 {
  margin-top: 0;
}

.meta {
  color: var(--muted);
  font-size: 0.96rem;
}

.project-item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 24px;
}

.thumb,
.placeholder-thumb {
  width: 160px;
  height: 115px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.thumb {
  object-fit: cover;
}

.placeholder-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #d8c7b5;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.82rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button {
  display: inline-block;
  padding: 6px 11px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent-dark);
  background: var(--white);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.3;
}

.button:hover,
.button:focus {
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-decoration: none;
}

.publication-authors,
.publication-source,
.publication-meta {
  margin: 0 0 6px;
}

.publication-source,
.publication-meta {
  color: var(--muted);
}

.doi-text {
  color: var(--text);
}

.author-highlight {
  color: var(--accent-dark);
  font-weight: 700;
}

.pdf-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.citation,
.bibtex {
  padding: 16px;
  overflow-x: auto;
  background: var(--soft);
  border: 1px solid var(--border);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20, 20, 20, 0.35);
}

.modal-backdrop.is-open {
  display: flex;
}

.citation-modal {
  width: min(100%, 560px);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.citation-format {
  margin: 18px 0 0;
}

.citation-format h3 {
  display: inline;
  margin: 0;
  font-size: 1rem;
}

.copy-button {
  margin-left: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.copy-button:hover,
.copy-button:focus {
  color: var(--accent-dark);
  text-decoration: underline;
}

.citation-text {
  margin: 6px 0 0;
}

.citation-text pre {
  max-height: 190px;
  margin: 8px 0 0;
  padding: 14px;
  overflow: auto;
  background: var(--soft);
  border: 1px solid var(--border);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  white-space: pre;
}

.bibtex {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre;
}

.gallery-placeholder {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 22px;
}

.gallery-placeholder div {
  min-height: 95px;
  border: 1px dashed #b8caca;
  background: var(--soft);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 26px;
}

.project-gallery.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-gallery img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  background: var(--soft);
}

.gallery-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gallery-button:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.gallery-button img {
  display: block;
}

.project-gallery .wide {
  grid-column: 1 / -1;
}

.video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 12px 0 28px;
  border: 0;
  background: var(--soft);
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 64px 72px;
  background: rgba(20, 20, 20, 0.86);
}

.lightbox.is-open {
  display: flex;
}

.lightbox-image {
  max-width: min(100%, 1100px);
  max-height: 82vh;
  object-fit: contain;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--white);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.lightbox-close {
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.5rem;
}

.lightbox-nav {
  top: 50%;
  width: 48px;
  height: 64px;
  transform: translateY(-50%);
  border-radius: 6px;
  font-size: 2.4rem;
  line-height: 1;
}

.lightbox-prev {
  left: 18px;
}

.lightbox-next {
  right: 18px;
}

.lightbox-close:hover,
.lightbox-close:focus,
.lightbox-nav:hover,
.lightbox-nav:focus {
  background: rgba(211, 84, 0, 0.82);
}

.site-footer {
  width: min(100% - 32px, var(--max-width));
  margin: 0 auto;
  padding: 24px 0 36px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
  }

  .nav-links {
    justify-content: flex-start;
    gap: 10px 15px;
  }

  .page {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 32px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .profile-photo {
    width: 130px;
    height: 130px;
  }

  .sidebar h1 {
    margin-top: 0;
  }

  .sidebar-links {
    margin-top: 12px;
  }

  .content h2 {
    font-size: 2rem;
  }

  .two-column,
  .project-item {
    grid-template-columns: 1fr;
  }

  .thumb,
  .placeholder-thumb {
    width: 100%;
    max-width: 260px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .site-name {
    white-space: normal;
  }

  .sidebar {
    display: block;
  }

  .gallery-placeholder {
    grid-template-columns: 1fr;
  }

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

  .pdf-frame {
    min-height: 520px;
  }

  .lightbox {
    padding: 56px 18px;
  }

  .lightbox-nav {
    width: 40px;
    height: 52px;
  }
}
