:root {
  --bg: #1f1f1f;
  --fg: #e7e4e1;
  --fg-dark: #dfdad5;
  --accent: #d29034;
  --accent-dark: #8a5c20;
  --muted: #555;
  --muted-dark: #333;
  --max-width: 800px;
  --header-width: 900px;
  --pix: #46382a7e;
  --copied1: #39b54a;
  --copied2: #e6f9ed;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", sans-serif;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 2rem 0;
}

section + section {
  margin-top: 2rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

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

a:hover {
  text-decoration: underline;
}

.name {
  color: white;
}

.container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--muted);
  overflow: hidden;
}

/* .header-content {
  display: flex;
  align-items: center;
  width: 90%;
  max-width: var(--header-width);
  gap: 1.5rem;
  margin: 0 auto;
} */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between; /* This forces the CV button to the far right */
  gap: 1.5rem;
  width: 90%;
  max-width: var(--header-width);
  margin: 0 auto;
}

.profile-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
}
#thumbnail {
  opacity: 0;
  transition: opacity 2.0s ease-in;
}
#thumbnail.loaded {
  opacity: 1;
}

.photo-wrapper {
  position: relative;
}

.photo-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.35);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.photo-full {
  max-width: 90vw;
  max-height: 90vh;
  border: 5px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.intro {
  flex: 1;
  min-width: 0;
}

.intro h1 {
  color: var(--fg);
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.socials {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
}

.socials a {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  font-variant: small-caps;
  gap: 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.contact {
  margin-bottom: 1.0rem;
  display: flex;
  gap: 1rem;
}

.email {
  position: relative;
  display: inline-block;
  align-items: center;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: 0.5rem;
}


.email:hover {
  text-decoration: underline;
}

@keyframes text-anim {
  50% {
    transform: scale(1.03);
    color: var(--copied1);
  }
}
.email.copied {
  animation: text-anim 0.3s ease-in-out;
}

@keyframes slide-up-fade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  25%,
  70% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}
.email .copied-popup {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(8px);
  background: var(--copied1);
  color: var(--fg);
  padding: 4px 8px;
  font-size: 1em;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  animation: slide-up-fade 1.4s ease-out;
  z-index: 10;
}

.cv {
  /* margin-left: auto; */
  margin-left: 0;
  flex-shrink: 0;
  color: var(--fg);
  background-color: var(--accent-dark);
  white-space: nowrap;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-style: italic;
  text-decoration: none;
  align-self: center;
  border: 1px solid var(--bg);
  transition: background-color 0.25s ease-in, color 0.25s ease-in, border 0.25s ease-in;
}

.cv:hover {
  background-color: var(--bg);
  border: 1px solid var(--accent-dark);
  color: var(--accent);
  text-decoration: underline;
}

.about p {
  margin-top: 0.5rem;
  color: var(--fg-dark);
}

.interests p {
  margin-top: 0.5rem;
  color: var(--fg-dark);
}

.publications .under-review {
  color: #888;
  font-style: italic;
}

.publications .pub-title {
  color: var(--fg-dark);
  font-weight: 500;
  cursor: default;
}

.publications .arxiv-link {
  color: #3a9edb;
  font-weight: 600;
  font-variant: small-caps;
}

.publications .inspirehep-link {
  color: #db953a;
  font-weight: 600;
  font-variant: small-caps;
}

.abstract-wrapper {
  position: relative;
  display: inline-block;
}

.abstract {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #2a2a2a;
  border: 1px solid var(--accent);
  color: #f0f0f0;
  padding: 0.3rem 0.75rem 0.75rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  font-size: 0.85rem;
  z-index: 10;
  width: 80vw;
  max-width: var(--max-width);
  transition: opacity 0.2s ease-in-out 0.2s, visibility 0s linear 0.2s;
}

.abstract-wrapper:hover .abstract {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.2s ease-in-out 0s, visibility 0s linear 0s;
}

.abstract-title {
  font-size: 15pt;
  text-align: center;
  text-decoration: underline;
  font-variant: small-caps;
  margin-bottom: 0.5rem;
}

.footer {
  position: relative;
  text-align: center;
  padding: 1rem;
  border-top: 1px solid var(--muted);
  color: var(--muted);
}

.footer .footer-note {
  font-size: 0.8rem;
}

.footer .last-updated {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  color: var(--muted-dark);
}
.footer .last-updated:hover {
  color: var(--fg-dark);
}

#grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}

/* MOBILE OVERRIDE */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0 1rem;
    gap: 1rem;
  }

  .intro {
    text-align: center;
  }

  .intro h1 {
    font-size: 1.6rem;
  }

  .contact {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }

  .socials {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .socials a {
    margin-right: 0;
  }

  .cv {
    margin-left: 0;
    width: 100%;
    max-width: 260px;
    text-align: center;
    padding: 0.6rem 1rem;
  }

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

  .footer {
    padding: 1.5rem 1rem;
  }

  .footer .last-updated {
    position: static;
    transform: none;
    margin-top: 0.5rem;
  }
}
