/* ============================================================
   Header (name + intro + photo top-right)
   ============================================================ */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: clamp(1.25rem, 3vw, 2rem);
  row-gap: 1rem;
  align-items: start;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.site-header__title {
  grid-column: 1 / -1;        /* span full width */
  grid-row: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.7rem;
  font-size: clamp(1.7rem, 5.5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.site-header__intro {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.site-header__lede {
  font-size: clamp(0.98rem, 2.2vw, 1.05rem);
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 1rem;
}

.site-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.92rem;
  color: var(--text-faint);
  word-break: break-word; /* long email won't overflow */
}
.site-header__meta a { color: var(--text-muted); }
.site-header__meta a:hover { color: var(--link-hover); }

.site-header__photo {
  grid-column: 2;
  grid-row: 2;
  width: clamp(150px, 26vw, 230px);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.site-header__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

/* On phones: title → photo (avatar) → intro */
@media (max-width: 560px) {
  .site-header {
    grid-template-columns: 1fr;
    row-gap: 1.25rem;
  }
  .site-header__title { grid-column: 1; grid-row: 1; }
  .site-header__photo {
    grid-column: 1;
    grid-row: 2;
    width: 130px;
    border-radius: 50%;
  }
  .site-header__intro { grid-column: 1; grid-row: 3; }
}

/* ============================================================
   Theme toggle (top-right floating)
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  width: 44px;          /* iOS recommended touch target */
  height: 44px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* Show sun in dark mode, moon in light mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   Sections
   ============================================================ */
.section { margin-top: clamp(2rem, 5vw, 3rem); scroll-margin-top: 1rem; }

.section__title {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-size: clamp(1.2rem, 3.2vw, 1.35rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}
.section__title::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-4px);
}

.section__intro {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ============================================================
   Entry list (CV / Projects / Papers)
   ============================================================ */
.entries { display: grid; gap: clamp(1.1rem, 3vw, 1.5rem); }

.entry {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem 1.5rem;
}

.entry__meta {
  font-size: 0.9rem;
  color: var(--text-faint);
  padding-top: 0.15rem;
}

.entry__body { min-width: 0; }

.entry__title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  word-wrap: break-word;
}

/* Featured entry: atom on the left, content on the right.
   Used for entries whose subject has its own atom (PhD). */
.entry__body--featured {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  column-gap: 1.1rem;
  align-items: center;
}
.entry__atom-wrap {
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
}

@media (max-width: 560px) {
  .entry__body--featured {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }
  .entry__atom-wrap { justify-self: start; }
}

.entry__where {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  word-wrap: break-word;
}

.entry__desc {
  color: var(--text-muted);
  word-wrap: break-word;
  overflow-wrap: anywhere; /* keep long DOIs/URLs from overflowing */
}

.entry__bullets {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

/* ============================================================
   Thesis card — nested inside a degree entry.
   Indented + accent-bar so it visually belongs to its parent degree.
   ============================================================ */
/* Thesis card: atom column on the left, content column on the right. */
.thesis {
  margin-top: 0.95rem;
  padding: 0.85rem 1rem 0.95rem 1rem;
  background: var(--bg-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  column-gap: 1.1rem;
  align-items: center;
}

.thesis__atom-wrap {
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
}

.thesis__content { min-width: 0; }

.thesis__head {
  margin-bottom: 0.25rem;
}

.thesis__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

@media (max-width: 560px) {
  .thesis {
    grid-template-columns: 1fr;
    row-gap: 0.7rem;
  }
  .thesis__atom-wrap { justify-self: start; }
}

.thesis__meta {
  font-size: 0.82rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.thesis__where {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.thesis__pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.2rem 0.6rem 0.22rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.thesis__pdf:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}
:root[data-theme="dark"] .thesis__pdf:hover { color: var(--bg); }
.thesis__pdf svg { width: 13px; height: 13px; }

/* Narrower meta column in the tablet zone */
@media (max-width: 760px) {
  .entry { grid-template-columns: 7.5rem 1fr; gap: 0.75rem 1.1rem; }
}

@media (max-width: 560px) {
  .entry {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .entry__meta { padding-top: 0; }
}

/* ============================================================
   Atom bullets (custom list markers)
   Used in CV, Projects, etc. via class="atom-list"
   ============================================================ */
.atom-list { display: grid; gap: 0.4rem; }

.atom-list li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.atom-list li::before {
  /* nucleus (dot) */
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}

.atom-list li::after {
  /* orbital (ellipse outline) */
  content: "";
  position: absolute;
  left: -0.05rem;
  top: 0.65em;
  width: 16px;
  height: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  transform: translateY(-50%) rotate(-20deg);
  opacity: 0.55;
}

:root[data-theme="dark"] .atom-list li::before {
  box-shadow: 0 0 6px var(--atom-glow);
}
:root[data-theme="dark"] .atom-list li::after {
  box-shadow: 0 0 4px var(--atom-glow);
}

/* ============================================================
   Inline "tag" / category chip
   ============================================================ */
.chip {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  letter-spacing: 0.01em;
}
:root[data-theme="dark"] .chip { color: var(--accent); }

/* ============================================================
   CV download button
   ============================================================ */
.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  margin-bottom: 1.5rem;
}
.cv-download:hover {
  background: var(--accent);
  color: var(--bg);
}
.cv-download:active { transform: translateY(1px); }
.cv-download svg { width: 16px; height: 16px; }

:root[data-theme="dark"] .cv-download:hover {
  color: #0a0f15;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

@media (max-width: 480px) {
  .site-footer { justify-content: flex-start; flex-direction: column; }
}

/* ============================================================
   Take-on / essay-style paragraph block
   ============================================================ */
.essay p + p { margin-top: 1rem; }
.essay p {
  color: var(--text);
  max-width: var(--measure);
}
.essay em.callout {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}
