/* =========================================================
   Layout adapted from arthurdouillard.com (PaperMod-derived),
   styled with our Inter font, font sizes, and color palette.
   ========================================================= */

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

:root {
  /* Layout */
  --gap: 24px;
  --content-gap: 20px;
  --main-width: 720px;
  --footer-height: 70px;
  --radius: 8px;

  /* Palette (light) — keeping our teal accent */
  --bg-color: #ffffff;
  --theme: #ffffff;
  --entry: #ffffff;
  --text-color: #1e1e1e;
  --text-muted: #6c6c6c;
  --tertiary: #ececec;
  --border-color: #ececec;
  --link-color: #2BA298;
  --link-hover: #238a82;
  --button-hover-bg: rgba(43, 162, 152, 0.12);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0C1117;
    --theme: #0C1117;
    --entry: #141b22;
    --text-color: #e0e0e0;
    --text-muted: #b8b8b8;
    --tertiary: #1c242d;
    --border-color: #2e2e2e;
    --link-color: #E95378;
    --link-hover: #f06e90;
    --button-hover-bg: rgba(233, 83, 120, 0.18);
  }
}

/* ===== Base Styles ===== */
html {
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  overflow-y: scroll;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ===== Main container ===== */
.main {
  flex: 1;
  position: relative;
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin: 0 auto;
  width: 100%;
  padding: var(--gap);
}

/* ===== Profile Hero (Arthur Douillard layout) ===== */
.profile {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - var(--footer-height) - var(--gap) * 2);
  line-height: 1.5;
}

.profile_inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.profile-image {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin-bottom: 4px;
}

.profile-name {
  font-family: 'Inter', sans-serif;
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text-color);
  line-height: 1.2;
}

.profile-tagline {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-color);
  line-height: 1.55;
  max-width: 600px;
}

/* Social Icons */
.social-icons {
  display: flex;
  flex-wrap: wrap;
  margin: 4px -8px;
}

.social-icons a {
  display: inline-flex;
  padding: 8px;
  color: var(--text-color);
  transition: color 0.2s ease;
}

.social-icons a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.social-icons a svg {
  width: 24px;
  height: 24px;
}

/* Buttons (section reveals) */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 12px;
}

.button {
  background: var(--tertiary);
  border-radius: var(--radius);
  margin: 8px 16px 8px 0;
  padding: 6px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-color);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  background: var(--button-hover-bg);
  color: var(--link-color);
  text-decoration: none;
}

.button.active {
  background: var(--button-hover-bg);
  color: var(--link-color);
}

.button-inner {
  padding: 0 8px;
}

/* ===== Sections (revealed on demand) ===== */
.sections {
  margin-top: calc(var(--gap) * 2);
}

.section {
  display: none;
  scroll-margin-top: var(--gap);
}

.section.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1.75rem;
}

.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--text-color);
  line-height: 1.2;
}

.section-up {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.section-up:hover {
  color: var(--link-color);
  text-decoration: none;
}

/* ===== Publications ===== */
.paper-list {
  display: flex;
  flex-direction: column;
}

.year {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 1.35rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.02em;
}

.year:first-child {
  margin-top: 0;
}

.paper {
  line-height: 1.5;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.paper-authors,
.paper-title,
.paper-year {
  display: inline;
}

.paper-authors strong {
  font-weight: 500;
}

.paper-title a {
  color: var(--link-color);
  font-weight: 400;
}

.paper-title a:hover {
  text-decoration: underline;
}

.paper-venue {
  display: inline;
  font-style: italic;
}

/* ===== Tools + Teaching (Projects) ===== */
.teaching-list,
.tools-list {
  display: flex;
  flex-direction: column;
}

.teaching-item,
.tool-item {
  line-height: 1.5;
  margin-bottom: 15px;
}

.tool-item {
  margin-bottom: 20px;
}

.teaching-title,
.tool-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.3rem;
  font-weight: 400;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  color: var(--text-color);
}

.teaching-item:first-child .teaching-title,
.tool-item:first-child .tool-title {
  margin-top: 0;
}

.teaching-title a,
.tool-title a {
  color: var(--link-color);
}

.teaching-title a:hover,
.tool-title a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.notebooks-link {
  font-size: 1.05rem;
  font-weight: 400;
  margin-left: 0.35rem;
  color: var(--link-color);
}

.teaching-description,
.tool-description {
  color: var(--text-color);
  line-height: 1.5;
  font-size: 1.1rem;
}

.session-list {
  margin-top: 0.5rem;
}

.session-list li a {
  color: var(--link-color);
}

/* ===== Resume ===== */
.resume-download-inline {
  font-family: 'Inter', sans-serif;
  font-size: 0.7em;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.2em;
}

.resume-download-inline:hover {
  color: var(--link-color);
}

.resume-h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.02em;
}

.resume-h3:first-of-type {
  margin-top: 0;
}

.resume-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.resume-body {
  flex: 1;
  min-width: 0;
}

.resume-date {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.resume-role {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-color);
  margin-bottom: 0.15rem;
}

.resume-location {
  font-size: 0.9rem;
}

.resume-meta {
  margin-top: 0.2rem;
  font-size: 1.02rem;
  color: var(--text-muted);
}

.resume-bullets {
  margin: 0.4rem 0 0 1.15rem;
  padding: 0;
  list-style: disc;
}

.resume-bullets li {
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.resume-skills {
  margin-top: 0.25rem;
}

.resume-skills p {
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-size: 1.08rem;
}

.resume-skill-label {
  color: var(--text-color);
}

/* ===== Footer ===== */
.footer {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: calc((var(--footer-height) - var(--gap)) / 2) var(--gap);
  line-height: 20px;
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid var(--link-color);
}

/* ===== Back-to-top floating link ===== */
.top-link {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  background: var(--tertiary);
  color: var(--text-color);
  width: 42px;
  height: 42px;
  padding: 12px;
  border-radius: 50%;
  transition: visibility 0.3s, opacity 0.3s linear, background-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-link.is-visible {
  visibility: visible;
  opacity: 1;
}

.top-link:hover {
  background: var(--button-hover-bg);
  color: var(--link-color);
}

.top-link svg {
  width: 16px;
  height: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --gap: 16px;
  }

  .profile-image {
    width: 140px;
    height: 140px;
  }

  .profile-name {
    font-size: 1.85rem;
  }

  .profile-tagline {
    font-size: 1.05rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .resume-entry {
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
  }

  .resume-date {
    order: -1;
    margin-bottom: 0.1rem;
  }
}

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

  .profile-image {
    width: 120px;
    height: 120px;
  }

  .profile-name {
    font-size: 1.7rem;
  }

  .button {
    margin-right: 10px;
  }
}
