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

::selection {
  background: #e8d5c4;
}

body {
  font-family: 'Newsreader', Georgia, serif;
  background: #faf8f5;
  color: #2c2c2c;
  line-height: 1.7;
  font-size: 18px;
}

a {
  color: #1a5f7a;
  text-decoration: none;
  border-bottom: 1px solid #1a5f7a40;
  transition: border-color 0.2s;
}

a:hover {
  border-color: #1a5f7a;
}

main {
  max-width: 620px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
  margin-bottom: 3rem;
}

.photo {
  /* width: 150px;
  height: 150px; */
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: #e0e0e0;
  overflow: hidden;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1 {
  font-size: 2.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.tagline {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: #888;
  letter-spacing: 0.02em;
}

.email {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.email a {
  color: #666;
  border-bottom: none;
}

.email a:hover {
  color: #1a5f7a;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
}

.social-links a {
  color: #1a5f7a;
  border-bottom: 1px solid #1a5f7a40;
}

.social-links a:hover {
  border-bottom-color: #1a5f7a;
}

h2 {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ddd;
}

p {
  margin-bottom: 1rem;
  color: #444;
}

.intro {
  font-size: 1.15rem;
  margin-bottom: 2rem;
}

.intro p {
  color: #2c2c2c;
}

/* Publications */
.pub {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.pub:not(:has(.pub-figure)) {
  grid-template-columns: 1fr;
}

.pub-figure {
  width: 200px;
  flex-shrink: 0;
}

.pub-figure img {
  width: 100%;
  border-radius: 4px;
  object-fit: cover;
}

.pub-content {
  min-width: 0;
}

.pub-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.pub-title a {
  color: #2c2c2c;
  border-bottom-color: transparent;
}

.pub-title a:hover {
  color: #1a5f7a;
  border-bottom-color: #1a5f7a40;
}

.pub-meta {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
}

.pub-venue {
  font-style: italic;
  color: #1a5f7a;
}

.award {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  background: #e8d5c4;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}

/* Experience */
.experience {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.experience-list {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.now-section {
  padding-right: 2rem;
  border-right: 1px solid #ddd;
}

.now-stack,
.prev-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.experience-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.5rem;
  align-items: center;
}

.experience-item a {
  grid-row: span 2;
  border-bottom: none;
}

.experience-item img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: contain;
}

.experience-item .name {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: #2c2c2c;
  align-self: end;
  grid-row: auto;
  border-bottom: none;
}

.experience-item .name:hover {
  color: #1a5f7a;
}

.experience-item .desc {
  font-size: 0.7rem;
  color: #999;
  font-style: italic;
  align-self: start;
}


/* Personal */
.personal-text {
  font-style: italic;
  color: #666;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.gallery-item {
  aspect-ratio: 1;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(20%);
  transition: filter 0.3s, transform 0.3s;
}

.gallery-item:hover img {
  filter: grayscale(0%);
  transform: scale(1.02);
}

footer {
  margin-top: 5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: #bbb;
  display: flex;
  justify-content: space-between;
}

footer a {
  color: #999;
  border: none;
}

/* Publications Side Panel */
.pubs-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  transform: translateX(100%);
  z-index: 100;
  transition: transform 0.3s ease;
}

.pubs-panel.open {
  transform: translateX(0);
}

.pubs-tab {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateX(-100%) translateY(-50%);
  background: #1a5f7a;
  color: #fff;
  border: none;
  padding: 1rem 0.5rem;
  cursor: pointer;
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border-radius: 4px 0 0 4px;
  transition: background 0.2s;
}

.pubs-tab:hover {
  background: #145068;
}

.pubs-tab span {
  display: block;
}

.pubs-content {
  background: #faf8f5;
  border-left: 1px solid #ddd;
  padding: 2rem 1.5rem;
  height: 100%;
  overflow-y: auto;
  width: 320px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}

.pubs-content .pub {
  display: block;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #ddd;
}

.pubs-content .pub:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.pubs-content .pub-figure {
  width: 100%;
  margin-bottom: 0.75rem;
}

.pubs-content .pub-figure img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 4px;
}

.pubs-content .pub-title {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.pubs-content .pub-meta {
  font-size: 0.8rem;
  margin-bottom: 0;
}

.pubs-content .pub-authors {
  display: block;
  overflow: hidden;
  margin-bottom: 0.2rem;
}

.pubs-content .pub-authors-inner {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

/* Mobile publications button - hidden on desktop */
.pubs-mobile-btn {
  display: none;
}

/* Close button - hidden on desktop */
.pubs-close {
  display: none;
}

@media (max-width: 540px) {
  header {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .photo {
    order: -1;
    width: 100px;
    height: 100px;
  }

  h1 {
    font-size: 2rem;
  }

  .previously-list {
    gap: 1rem;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile publications button */
  .pubs-mobile-btn {
    display: block;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #1a5f7a;
    color: #fff;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 50px;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 99;
  }

  /* Hide desktop tab on mobile */
  .pubs-tab {
    display: none;
  }

  /* Mobile publications overlay */
  .pubs-panel {
    transform: translateY(100%);
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
  }

  .pubs-panel.open {
    transform: translateY(0);
  }

  /* Close button for mobile overlay */
  .pubs-close {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 102;
  }

  .pubs-content {
    width: 100%;
    border-left: none;
    padding-top: 3.5rem;
  }
}
