/* ==========================================================================
   THEME TOKENS
   Light values live on :root; dark-mode overrides live on [data-theme="dark"].
   Toggling data-theme on <html> (see script.js) re-themes the whole page.
   ========================================================================== */

:root {
  --bg: #FFFFFF;
  --text: #141414;
  --text-secondary: #767676;
  --text-muted: #767676;
  --border: #E2E2E2;
  --divider: #F0F0F0;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --toggle-track: #D9DBF5;
  --nav-active-bg: #141414;
  --nav-active-color: #F5F5F5;
  --nav-inactive-color: #505050;
  --button-bg: #141414;
  --button-fg: #F5F5F5;
  --project-button-bg: #F0F0F0;
  --project-button-fg: #3C3C3C;
  --shadow-color: rgba(20, 20, 20, 0.14);
  --circle-shadow-color: rgba(0, 0, 0, 0.14);
  --card-shadow-color: rgba(20, 20, 20, 0.12);
  --ring-about: #535353;
  --ring-project: #BEBEBE;
  --accent: #B4572E;

  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --content-width: 960px;
}

html[data-theme="dark"] {
  --bg: #1C1C1C;
  --text: #F5F5F5;
  --text-secondary: #DEDEDE;
  --text-muted: #B5B5B5;
  --border: #363636;
  --divider: #3D3D3D;
  --nav-bg: rgba(28, 28, 28, 0.92);
  --toggle-track: #3A3757;
  --nav-active-bg: #F5F5F5;
  --nav-active-color: #141414;
  --nav-inactive-color: #B6B6B6;
  --button-bg: #F5F5F5;
  --button-fg: #141414;
  --project-button-bg: #3D3D3D;
  --project-button-fg: #E6E6E6;
  --shadow-color: rgba(255, 255, 255, 0.14);
  --circle-shadow-color: rgba(255, 255, 255, 0.2);
  --card-shadow-color: rgba(255, 255, 255, 0.12);
  --ring-about: #535353;
  --ring-project: #666666;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2 {
  font-family: var(--font-serif);
  margin: 0;
}

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

a:hover {
  color: #8f4523;
}

.page {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   SHARED BUTTON / CARD INTERACTIONS
   ========================================================================== */

.btn {
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn svg {
  pointer-events: none;
}

.btn-about:hover {
  background-color: var(--ring-about) !important;
  color: var(--button-fg) !important;
}

.btn-project:hover {
  background-color: var(--ring-project) !important;
  color: var(--project-button-fg) !important;
}

.project-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px var(--card-shadow-color);
}

/* ==========================================================================
   NAV
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.site-nav__row {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 10px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.site-nav__brand {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  justify-self: start;
  color: var(--text);
}

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

.site-nav__center {
  justify-self: center;
  display: flex;
  align-items: center;
}

.nav-pills {
  display: flex;
  gap: 4px;
  border-radius: 999px;
  padding: 4px;
}

.nav-pill {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--nav-inactive-color);
  transition: background 0.15s, color 0.15s;
}

.nav-pill.active {
  background: var(--button-bg);
  color: var(--button-fg);
}

.nav-hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  padding: 8px 16px 12px;
  flex-direction: column;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--nav-inactive-color);
}

.mobile-menu a.active {
  background: var(--button-bg);
  color: var(--button-fg);
}

@media (max-width: 700px) {
  .nav-pills { display: none; }
  .nav-hamburger { display: flex; }

  .project-card {
    flex-direction: column;
  }

  .project-card__thumb {
    width: 100%;
    align-self: stretch;
  }

  .project-card__thumb--gif {
    height: 166px;
  }
}

/* Theme toggle switch */

.theme-toggle {
  justify-self: end;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 1px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: var(--toggle-track);
  transition: background 0.2s;
}

.theme-toggle__knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

/* ==========================================================================
   SECTION LAYOUT
   ========================================================================== */

.section {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 64px 32px;
}

.section--about {
  padding: 88px 32px 64px;
}

.section--last {
  padding-bottom: 80px;
}

.section__title {
  text-align: center;
  font-weight: 600;
  font-size: 30px;
  margin: 0 0 12px;
  border-bottom: 2px solid var(--divider);
  padding-bottom: 8px;
}

/* ==========================================================================
   ABOUT
   ========================================================================== */

.about {
  display: flex;
  flex-direction: row-reverse; /* image on the right of the text */
  align-items: flex-start;     /* name and image aligned at top */
  justify-content: center;
  gap: 40px;
}

.avatar {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--accent);
  color: #F5F5F5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 50px;
  object-fit: cover;
  object-position: center top;
}

@media (max-width: 700px) {
  .about {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }
}

.about__body {
  flex: 1;
  min-width: 0;
  max-width: 640px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.about__name {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 6px;
}

.about__role {
  font-size: 14.5px;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.about__bio {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  text-align: justify;
  margin: 0 0 14px;
}

.about__bio:last-of-type {
  margin-bottom: 20px;
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.link-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--project-button-bg);
  box-shadow: 0 1px 2px var(--shadow-color);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--project-button-fg);
}

/* ==========================================================================
   PROJECTS
   ========================================================================== */

.project-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.project-card {
  display: flex;
  gap: 16px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.project-card__thumb {
  width: 280px;
  height: auto;
  align-self: center;
  border-radius: 10px;
  flex-shrink: 0;
  display: block;
  border: 1px solid var(--border);
}

.project-card__thumb--gif {
  /* Same footprint as the 1600x951 photo placeholder (280px wide -> ~166px tall) */
  height: 166px;
  object-fit: contain;
  background: var(--border);
}

.project-card__body {
  flex-grow: 1;
}

.project-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.project-card__title {
  font-size: 17px;
  font-weight: 600;
}

.project-card__period {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.project-card__desc {
  margin: 4px 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: justify;
}

.project-card__authors {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.project-card__authors b {
  color: var(--text-secondary);
  font-weight: 700;
}

.project-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--project-button-bg);
  color: var(--project-button-fg);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
  box-shadow: 0 1px 2px var(--shadow-color);
}

.project-btn .fa-youtube {
  font-size: 14px;
}

/* ==========================================================================
   PUBLICATIONS
   ========================================================================== */

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 20px;
}

.pub-list__title {
  font-size: 16px;
  font-weight: 600;
}

.pub-list__meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.pub-list__meta b {
  color: var(--text-secondary);
  font-weight: 700;
}

/* ==========================================================================
   SHARED ROW LIST (Teaching / Awards / Education)
   ========================================================================== */

.row-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.row-list__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.row-list__title {
  font-size: 16px;
  font-weight: 600;
}

.row-list__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.row-list__meta {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ==========================================================================
   FOOTER & SCROLL CONTROLS
   ========================================================================== */

.site-footer {
  background: var(--project-button-bg);
  border-top: 1px solid var(--project-button-bg);
  padding: 32px 32px;
  text-align: center;
  font-size: 15px;
  color: var(--project-button-fg);
}

.scroll-controls {
  position: fixed;
  right: 12px;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}

.scroll-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--button-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px var(--circle-shadow-color);
  color: var(--button-fg);
}
