/* ═══════════════════════════════════
   Tokens
   ═══════════════════════════════════ */
:root {
  --bg:      #1e1e1e;
  --bg-2:    #272727;
  --bg-3:    #2e2e2e;
  --border:  #444444;
  --text:    #f5f4f1;
  --sub:     #ccc9c2;
  --muted:   #b0aca5;
  --accent:  #d6b97b;
  --accent-bg: rgba(214, 185, 123, 0.1);
  --sans:    "Inter", -apple-system, system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;
  --ease:    cubic-bezier(0.16, 1, 0.3, 1);
  --radius:  10px;
}

/* ═══════════════════════════════════
   Reset
   ═══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;          /* no outer scroll; each page scrolls internally */
  height: 100svh;
}

img, svg { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.75; }
ul { list-style: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
::selection { background: var(--accent); color: #1a1200; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

/* ═══════════════════════════════════
   Shared typography helpers
   ═══════════════════════════════════ */
.section-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: 0.65rem;
}

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.18em 0.6em;
  white-space: nowrap;
}

.at {
  font-weight: 400;
  color: var(--sub);
  font-size: 0.92em;
}

/* ═══════════════════════════════════
   Buttons
   ═══════════════════════════════════ */
.btn {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.68rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a1200;
  transition: opacity 0.2s, transform 0.2s var(--ease);
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn--outline { background: transparent; color: var(--accent); }
.btn--outline:hover { background: var(--accent-bg); opacity: 1; }


/* ═══════════════════════════════════
   Top nav (sub-pages)
   ═══════════════════════════════════ */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topnav[hidden] { display: none; }

.topnav__back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sub);
  transition: color 0.2s;
}
.topnav__back:hover { color: var(--text); }

.topnav__title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════
   Page shells (section switching)
   ═══════════════════════════════════ */
.page {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  overflow-y: auto;
}
.page.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.page.is-exit {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

/* Inner wrapper for sub-pages */
.page__inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 5.5rem 2rem 3rem;   /* top pad clears the topnav */
}
.page__inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100svh;
  justify-content: center;
  padding-top: 4rem;
}
.page__inner h2 {
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 2rem;
}

/* ═══════════════════════════════════
   HOME
   ═══════════════════════════════════ */
.home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

.home__header {
  text-align: center;
  margin-bottom: 3.5rem;
  padding-top: 0.5rem;
}
.home__name {
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.home__role {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.home__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.home__intro h1 {
  font-weight: 600;
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  line-height: 1.18;
  margin-bottom: 1rem;
}
.home__desc {
  color: var(--sub);
  font-size: 0.88rem;
  max-width: 400px;
  margin-bottom: 2rem;
}
.home__social {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.home__social-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.1rem;
  background: var(--bg-2);
  border: 1px solid #5a5a5a;
  border-radius: var(--radius);
  color: var(--sub);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.home__social-link svg { flex-shrink: 0; }
.home__social-link:hover {
  border-color: #4a4a4a;
  background: var(--bg-3);
  color: var(--text);
  opacity: 1;
}

/* Nav card grid — 3 rows x 2 cols */
.home__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.card--nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid #5a5a5a;
  border-radius: var(--radius);
  color: var(--sub);
  text-decoration: none;
  transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.25s var(--ease);
}
.card--nav svg { color: var(--accent); }
.card--nav span { font-size: 0.8rem; font-weight: 500; }
.card--nav:hover {
  border-color: #888;
  background: var(--bg-3);
  color: var(--text);
  transform: translateY(-2px);
}

.card--links {
  grid-column: span 2;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card--links a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sub);
  transition: color 0.2s;
}
.card--links a:hover { color: var(--accent); opacity: 1; }

/* ═══════════════════════════════════
   ABOUT
   ═══════════════════════════════════ */
.about {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3.5rem;
  align-items: start;
}

.about__photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  position: relative;
}
.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about__photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--muted);
  background: var(--bg-2);
}

.about__awards { margin-top: 1.5rem; }

.about__tools { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.tools-list li {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--sub);
  padding: 0.25rem 0.6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.awards-compact { display: grid; gap: 0; }
.awards-compact li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.awards-compact li:last-child { border-bottom: none; }
.awards-compact__title {
  font-size: 0.78rem;
  color: var(--sub);
  line-height: 1.4;
}

.about__right h2 {
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 1rem;
}
.about__right p {
  color: var(--sub);
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}

.edu-block { margin-top: 1.8rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.edu-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.edu-row__school { font-weight: 600; font-size: 0.98rem; }
.edu-row__degree { color: var(--sub); font-size: 0.82rem; margin-top: 0.2rem; }

.clubs-block { margin-top: 1.6rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.clubs-list { display: grid; gap: 0; }
.clubs-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.clubs-list li:last-child { border-bottom: none; }
.clubs-list__info { display: flex; flex-direction: column; gap: 0.1rem; }
.clubs-list__org { font-weight: 500; color: var(--text); }
.clubs-list__role { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.clubs-list .chip { flex-shrink: 0; }

/* ═══════════════════════════════════
   EXPERIENCE TIMELINE
   ═══════════════════════════════════ */
.timeline { display: grid; }
.timeline__item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline__item:last-child { border-bottom: none; }
.timeline__meta { padding-top: 0.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.timeline__location { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); padding-left: 0.6em; }
.timeline__body h3 { font-weight: 600; font-size: 1rem; margin-bottom: 0.7rem; line-height: 1.4; }
.timeline__body ul { display: grid; gap: 0.4rem; }
.timeline__body li {
  color: var(--sub);
  font-size: 0.9rem;
  padding-left: 1rem;
  position: relative;
}
.timeline__body li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.6em;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ═══════════════════════════════════
   PROJECTS GRID
   ═══════════════════════════════════ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.project {
  padding: 1.4rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.project:hover { border-color: #4a4a4a; transform: translateY(-2px); }
.project__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.project__head h3 { font-weight: 600; font-size: 0.95rem; }
.project__head a { color: var(--muted); font-size: 0.9rem; }
.project__head a:hover { color: var(--accent); opacity: 1; }
.project p { color: var(--sub); font-size: 0.88rem; margin-bottom: 0.85rem; }

.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(214, 185, 123, 0.25);
  border-radius: 6px;
  padding: 0.22em 0.6em;
  margin-bottom: 0.7rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tags li {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 99px;
}

/* ═══════════════════════════════════
   PUBLICATIONS
   ═══════════════════════════════════ */
.pub-list { display: grid; gap: 0; }
.pub-item {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }
.pub-item__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.pub-item__badge {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(214, 185, 123, 0.25);
  border-radius: 6px;
  padding: 0.2em 0.55em;
}
.pub-item__title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.pub-item__title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.45;
  flex: 1;
}
.pub-item__link {
  color: var(--muted);
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
  transition: color 0.2s;
}
.pub-item__link:hover { color: var(--accent); opacity: 1; }
.pub-item__desc { color: var(--sub); font-size: 0.88rem; line-height: 1.6; }

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

/* ═══════════════════════════════════
   AWARDS
   ═══════════════════════════════════ */
.awards-list { display: grid; }
.award-item {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
}
.award-item:last-child { border-bottom: none; }
.award-item__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
.award-item h4 { font-weight: 600; font-size: 0.92rem; }
.award-item p { color: var(--sub); font-size: 0.88rem; }

/* ═══════════════════════════════════
   CONTACT
   ═══════════════════════════════════ */
.contact__text {
  color: var(--sub);
  max-width: 420px;
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}
.contact__links {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 380px;
}
.contact__link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.4rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--sub);
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.25s, color 0.25s, background 0.25s, transform 0.25s var(--ease);
}
.contact__link svg { color: var(--accent); flex-shrink: 0; }
.contact__link:hover {
  border-color: #4a4a4a;
  color: var(--text);
  background: var(--bg-3);
  transform: translateY(-2px);
  opacity: 1;
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */
@media (max-width: 760px) {
  /* Layout: switch from fixed full-screen pages to normal scroll */
  body { overflow: auto; height: auto; }
  .page {
    position: relative;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
    transform: none;
    transition: none;
    display: none;
  }
  .page.is-active {
    opacity: 1;
    pointer-events: auto;
    display: block;
  }
  .page.is-exit { display: none; }

  /* Top nav */
  .topnav { position: sticky; top: 0; }

  /* Home */
  .home {
    min-height: auto;
    padding: 3rem 1.25rem 2rem;
  }
  .home__header { margin-bottom: 2rem; }
  .home__body {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .home__intro h1 { font-size: 2rem; }
  .home__desc { max-width: 100%; }
  .home__grid { grid-template-columns: 1fr 1fr; }
  .home__social { flex-wrap: wrap; }
  .home__social-link { flex: 1; justify-content: center; }

  /* Sub-page inner */
  .page__inner { padding: 5rem 1.25rem 3rem; }
  .page__inner h2 { font-size: 1.5rem; }

  /* About */
  .about { grid-template-columns: 1fr; gap: 2rem; }
  .about__left {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.25rem;
    align-items: start;
  }
  .about__photo { width: 140px; flex-shrink: 0; }
  .about__awards { margin-top: 0; }
  .about__tools { margin-top: 1rem; grid-column: span 2; }

  /* Timeline */
  .timeline__item { grid-template-columns: 1fr; gap: 0.25rem; }
  .timeline__meta { display: flex; flex-direction: row; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

  /* Projects */
  .projects-grid--2x2 { grid-template-columns: 1fr; }

  /* Pub title row */
  .pub-item__title-row { gap: 0.75rem; }
}

@media (max-width: 480px) {
  html { font-size: 15px; }

  .home { padding: 2.5rem 1rem 2rem; }
  .home__grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .card--nav { padding: 1.25rem 0.75rem; }
  .card--nav span { font-size: 0.75rem; }

  .page__inner { padding: 4.5rem 1rem 2.5rem; }

  /* About: stack photo above content on very small screens */
  .about__left { grid-template-columns: 1fr; }
  .about__photo { width: 100%; max-width: 200px; }
  .about__tools { grid-column: 1; }

  .projects-grid { grid-template-columns: 1fr; }
  .home__social-link span { display: none; } /* icon-only on tiny screens */
}

@media (prefers-reduced-motion: reduce) {
  .page, .btn, .card--nav, .project, .contact__link {
    transition: none;
  }
}
