/* =====================================================================
   Alexander Veicht — personal site
   Locked design tokens at the top; everything else cascades from there.
   ===================================================================== */

/* ── Tokens (palette B · Forest, locked) ─────────────────────────────── */
:root {
  --bg:      #f9f8f4;
  --text:    #1e211c;
  --muted:   #76776c;
  --accent:  #3a7a45;

  --font-body:    "Quicksand", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Quicksand", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --max-w:        720px;
}

/* ── Reset / base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ── Page chrome (header / main / footer) ────────────────────────────── */
.site-header,
main,
.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header {
  padding-top: 1.5rem;
  padding-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.site-header__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.site-header__name:hover { text-decoration: none; color: var(--accent); }
.site-header__back {
  font-size: 0.88rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.site-header__back:hover { color: var(--accent); text-decoration: none; }
.site-header__back .icon { width: 14px; height: 14px; stroke-width: 2.25; }

main { padding-top: 2.5rem; padding-bottom: 4rem; }

.site-footer {
  padding-top: 2rem;
  padding-bottom: 3rem;
  font-size: 0.84rem;
  color: var(--muted);
  text-align: center;
}

/* ── Icon system (uses external sprite at /assets/sprite.svg) ────────── */
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
/* Filled variant for brand marks where outline-style doesn't read.
   Sized to keep the visible content roughly equal to line icons (which
   have stroke-width pushing their visual extent outward). */
.icon--filled {
  fill: currentColor;
  stroke: none;
  width: 17px;
  height: 17px;
}

/* ── Hero (homepage) ─────────────────────────────────────────────────── */
.hero {
  display: flex;
  gap: 1.75rem;
  align-items: stretch;
  margin-bottom: 4rem;
}
.hero__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.hero__photo {
  align-self: stretch;
  width: auto;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  max-height: 140px;
  max-width: 140px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  letter-spacing: -0.005em;
}
.hero__pitch {
  margin: 0 0 1rem;
  line-height: 1.55;
  font-size: 0.95rem;
  max-width: 56ch;
}
.hero__links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.hero__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* ── Section heading (accent underline, locked) ──────────────────────── */
.section { margin-bottom: 4rem; }
.section-h {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  position: relative;
  padding-bottom: 0.75rem;
  letter-spacing: -0.005em;
  color: var(--text);
}
.section-h::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 36px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ── News (What's new) ───────────────────────────────────────────────── */
.news {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  /* gap is handled per-item via margin-top so collapsed items can animate it away */
}
.news li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1.25rem;
  align-items: baseline;
  margin-top: 0.95rem;
  max-height: 200px;
  opacity: 1;
  overflow: hidden;
  transition:
    max-height 320ms ease,
    opacity 220ms ease 80ms,
    margin-top 320ms ease;
}
.news li:first-child { margin-top: 0; }
.news time {
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.news p { margin: 0; line-height: 1.55; font-size: 0.95rem; }

/* Collapsed state for items beyond the first 3 */
.news--limited > li:nth-child(n+4) {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
}

.news-more {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.1rem auto 0;
  width: fit-content;
  background: none;
  border: 1px solid color-mix(in srgb, var(--muted) 28%, transparent);
  color: var(--muted);
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.news-more:hover { color: var(--accent); border-color: var(--accent); }
.news-more .icon {
  width: 14px;
  height: 14px;
  transition: transform 220ms ease;
}
.news-more[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* ── My research (publications list) ─────────────────────────────────── */
.pubs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.pub {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.pub__body { min-width: 0; }
.pub__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  border-radius: 10px;
  overflow: hidden;
}
.pub__thumb img,
.pub__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* For paper-page renders, anchor to the top so title/authors stay visible */
.pub__thumb img { object-position: center top; }
a.pub__thumb { text-decoration: none; }
.pub__title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.pub__title a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: baseline;
  color: var(--text);
}
.pub__title a:hover { color: var(--accent); text-decoration: none; }
.pub__title .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.25;
  transform: translateY(2px);
}
.pub__authors {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  font-weight: 400;
}
.pub__authors strong { color: var(--text); font-weight: 600; }
.pub__venue {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.pub__stars { font-variant-numeric: tabular-nums; }
.pub__links {
  display: flex;
  gap: 1rem;
  font-size: 0.86rem;
  flex-wrap: wrap;
}
.pub__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.pub__links .icon { width: 15px; height: 15px; stroke-width: 2.25; }

/* BibTeX expander */
.pub__bib-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  color: var(--accent);
}
.pub__bib-toggle:hover { text-decoration: underline; }
.pub__bib-toggle .icon { width: 15px; height: 15px; stroke-width: 2.25; }

/* Outer wrapper: animates true content height via grid-template-rows */
.pub__bib {
  display: grid;
  grid-template-rows: 1fr;
  margin-top: 0.85rem;
  transition: grid-template-rows 300ms ease, margin-top 300ms ease;
}
.pub__bib.is-collapsed {
  grid-template-rows: 0fr;
  margin-top: 0;
}
/* Inner wrapper carries the visual chrome; clipped by the collapsing grid row */
.pub__bib-inner {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 4%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  transition:
    padding-top 300ms ease,
    padding-bottom 300ms ease,
    border-top-width 300ms ease,
    border-bottom-width 300ms ease;
}
.pub__bib.is-collapsed .pub__bib-inner {
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}
.pub__bib pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}
.pub__bib-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  cursor: pointer;
  color: var(--muted);
}
.pub__bib-copy:hover { color: var(--accent); border-color: var(--accent); }
.pub__bib-copy.copied { color: var(--accent); border-color: var(--accent); }
.pub__bib-copy .icon { width: 14px; height: 14px; stroke-width: 2.25; display: block; }

/* ── Project page ────────────────────────────────────────────────────── */
.project h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.project__authors { color: var(--muted); margin: 0 0 0.25rem; font-size: 0.95rem; }
.project__authors strong { color: var(--text); font-weight: 600; }
.project__venue { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.9rem; }
.project__links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  font-size: 0.92rem;
}
.project__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.project__links .icon { width: 16px; height: 16px; }
.project figure { margin: 1.5rem 0; }
.project figure img { border-radius: 8px; width: 100%; }
.project figcaption {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}
.project h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  font-weight: 600;
}
.project p { line-height: 1.65; }

/* ── Project index (list of projects) ────────────────────────────────── */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero__photo {
    width: 120px;
    height: 120px;
    max-height: 120px;
    max-width: 120px;
    align-self: center;
    margin: 0 auto 1rem;
  }
  .news li { grid-template-columns: 1fr; gap: 0.2rem; }
  .news time { text-align: left; }
  .pub { grid-template-columns: 1fr; }
  .pub__thumb {
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }
}
