/* =========================
   CSS VARIABLES
========================= */

:root {
  /* Sticky navigation height (desktop) */
  --nav-height: 80px;

  /* Color system */
  --accent: #1a5cff;
  --accent-soft: #ffd88a;

  --text-main: #111;
  --text-muted: #444;

  --bg-main: #ffffff;
  --bg-pill: #e6e6e6;
  --bg-pill-hover: #d4d4d4;

  --border-soft: #e5e5e5;

  /* Vertical rhythm */
  --section-gap: 28px;
}

/* =========================
   GLOBAL
========================= */

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;

  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px;

  line-height: 1.65;
  color: var(--text-main);
  background: var(--bg-main);
}

/* =========================
   ANCHOR OFFSET (MODERN)
========================= */

section {
  scroll-margin-top: var(--nav-height);
}

/* =========================
   SECTION LAYOUT (ONE SOURCE)
========================= */

section {
  margin-bottom: var(--section-gap);
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: var(--section-gap) 0;
}

/* =========================
   HEADINGS
========================= */

h1 {
  font-size: 32px;
  margin-bottom: 6px;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: 0.2px;
}

/* =========================
   LINKS
========================= */

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

a:hover {
  text-decoration: underline;
}

/* =========================
   HEADER / PROFILE
========================= */

#profile {
  margin-bottom: 18px;
}

.profile {
  display: flex;
  gap: 20px;
  align-items: center;
}

.profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.45;
}

/* =========================
   HEADER ICON LINKS (SVG)
========================= */

.profile-links {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.15s ease;
}

.profile-links a:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.profile-links svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

/* =========================
   NAVIGATION (PILLS)
========================= */

.nav-pills {
  position: sticky;
  top: 0;
  z-index: 10;

  background: var(--bg-main);
  padding: 10px 0 14px;

  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  border-bottom: 1px solid var(--border-soft);
}

.nav-pills .pill {
  padding: 8px 14px;
  border-radius: 12px;

  background: var(--bg-pill);
  color: var(--text-main);

  font-size: 14px;
  font-weight: 500;

  transition: background 0.2s ease, transform 0.1s ease;
}

.nav-pills .pill:hover {
  background: var(--bg-pill-hover);
  transform: translateY(-1px);
}

.nav-pills .pill.active {
  background: var(--accent-soft);
  font-weight: 600;
}

.nav-pills .pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =========================
   JS FADE-IN (PROGRESSIVE)
========================= */

.js section {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.js section.visible {
  opacity: 1;
}

.js .fallback-only {
  display: none;
}

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

.pub {
  margin-bottom: 20px;
}

.pub em {
  font-style: italic;
}

.first-author {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* Publication controls */

.pub-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin: 12px 0 22px;
  font-size: 14px;

  flex-wrap: wrap;
  gap: 10px;
}

.pub-controls > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pub-controls button {
  background: none;
  border: none;
  padding: 0;

  font-size: 14px;
  font-weight: 500;
  color: var(--accent);

  cursor: pointer;
}

.pub-controls button:hover {
  text-decoration: underline;
}

.pub-controls button.active {
  font-weight: 600;
  text-decoration: underline;
}

/* Publication details */

.pub-details {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
  display: none;
}

.pub-details p {
  margin: 0.5em 0;
}

.pub-toggle {
  background: none;
  border: none;
  color: var(--accent);

  padding: 0;
  font-size: 14px;
  cursor: pointer;
}

.pub-toggle:hover {
  text-decoration: underline;
}

/* =========================
   EXPERIENCE
========================= */

.experience-block {
  margin-bottom: 26px;
}

.experience-block p {
  margin-bottom: 8px;
  line-height: 1.5;
}

.experience-block em {
  color: var(--text-muted);
}

.experience-block ul {
  margin-top: 8px;
  padding-left: 20px;
}

.experience-block li {
  margin-bottom: 10px;
  line-height: 1.6;
}

/* Citation line */

.exp-citation {
  display: inline-block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

/* =========================
   LINKS SECTION
========================= */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* =========================
   BACK TO TOP
========================= */

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 20;

  padding: 8px 14px;
  border-radius: 12px;

  background: var(--bg-pill);
  color: var(--text-main);

  font-size: 14px;
  font-weight: 500;

  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);

  transition: opacity 0.25s ease, transform 0.25s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--bg-pill-hover);
}
/* =========================
   FOOTER
========================= */

.site-footer {
  margin-top: 40px;
  padding-top: 16px;

  font-size: 13px;
  color: var(--text-muted);
  text-align: center;

  border-top: 1px solid var(--border-soft);
}

/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

  :root {
    --nav-height: 112px;
    --section-gap: 32px;
  }

  body {
    padding-top: 28px;
  }

  .profile {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .profile-links {
    gap: 16px;
  }
}
