:root {
  --text: #222;
  --text-soft: #444;
  --muted: #6c757d;
  --accent: #111;
  --link-line: #c3c7cc;
  --rule: #e2e4e7;
  --bg: #fff;
  --card: #fff;
  --shadow: rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

/* Light is the default theme; see the inline script in index.html */
:root[data-theme="dark"] {
  --text: #e6e8eb;
  --text-soft: #b9bec5;
  --muted: #8d949d;
  --accent: #f4f5f7;
  --link-line: #50565e;
  --rule: #2f3339;
  --bg: #16181b;
  --card: #1f2226;
  --shadow: rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

/* Top navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Bar sits on the baseline and matches the P's cap height */
.brand::before {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.66em;
  margin-right: 0.05em;
  background: var(--text);
}

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

.site-nav .nav {
  flex-wrap: nowrap;
  margin-left: auto;
  min-width: 0;
}

.site-nav .nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 0.75rem 0.9rem;
  white-space: nowrap;
}

/* Phones: links stay on one row and scroll sideways instead of wrapping */
@media (max-width: 575.98px) {
  .site-nav .nav {
    margin-left: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
    /* Fade the right edge to hint that the row scrolls */
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }

  .site-nav .nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav .nav-link {
    padding: 0.75rem 0.55rem;
  }
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  margin-left: 0.4rem;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
}

.theme-toggle:hover {
  color: var(--accent);
}

/* Show the icon for the theme a click switches to */
:root[data-theme="dark"] .icon-moon,
:root:not([data-theme="dark"]) .icon-sun {
  display: none;
}

.container {
  max-width: 1000px;
}

/* Below this width the g-5 row would poke past the screen edge,
   so widen the side padding to match its gutter */
@media (max-width: 1023.98px) {
  .container {
    --bs-gutter-x: 3rem;
  }
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease;
}

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

/* Sidebar */
@media (min-width: 768px) {
  .profile {
    position: sticky;
    top: 5rem;
  }
}

.avatar {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

.name {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.role,
.affiliation {
  color: var(--muted);
}

/* Maps cascade top to bottom, zig-zagging left and right */
.about-maps {
  flex-direction: column;
  width: 130px;
  flex-shrink: 0;
}

.about-maps img {
  height: 80px;
  width: auto;
}

.about-maps img + img {
  margin-top: -22px;
}

.about-maps img:nth-child(2) {
  transform: translate(8px, -14px);
}

.about-maps img:nth-child(odd) {
  align-self: flex-end;
}

#about .fi {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.links li {
  margin-bottom: 0.15rem;
}

/* Phones: email on its own line, the other links side by side below it */
@media (max-width: 767.98px) {
  .links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 1.25rem;
  }

  .links li:first-child {
    flex-basis: 100%;
  }
}

/* Content */
section {
  margin-bottom: 2.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.entry {
  margin-bottom: 1rem;
}

.org-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  margin-top: 0.2rem;
}

.entry-title {
  font-weight: 600;
}

.entry-org {
  font-style: italic;
  color: var(--text-soft);
}

.entry-date,
.entry-links {
  color: var(--muted);
  font-size: 0.95rem;
}

.entry-links {
  margin-left: 0.4rem;
}

.entry-desc {
  margin: 0.15rem 0 0;
  color: var(--text-soft);
}

/* Project cards: thumbnail on top, title and blurb below */
.project {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.project:hover {
  text-decoration: none;
  box-shadow: 0 6px 18px var(--shadow);
  transform: translateY(-2px);
}

.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--rule);
}

.project .entry-title {
  color: inherit;
  text-decoration: none;
  padding: 0.75rem 1rem 0;
}

.project .entry-desc {
  padding: 0 1rem 1rem;
  font-size: 0.95rem;
}

.project:hover .entry-title {
  color: var(--accent);
  text-decoration: none;
}

/* Sits above the card-wide stretched link so it stays clickable */
.project .credit {
  position: relative;
  z-index: 2;
}

.pubs,
.honors {
  padding-left: 1.2rem;
  color: var(--text-soft);
}

.pubs li,
.honors li {
  margin-bottom: 0.5rem;
}

.pubs strong {
  color: var(--text);
}

.skills dt {
  font-weight: 600;
}

.skills dd {
  margin-bottom: 0.4rem;
}

.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}
