/* ==========================================================================
   Swiss Minimal + Bold Typography
   Florian P. Mahner - Academic Website
   ========================================================================== */

/* Font — subsetted Times New Arial variable font (masters never committed)
   Axes: wght 0–100, srff 0–100 (0=Arial ↔ 100=Times), ital −100…100
   size-adjust scales the glyphs up to restore a readable apparent size. */
@font-face {
  font-family: 'TNA';
  src: url('/fonts/tna-vf.woff2') format('woff2-variations'),
       url('/fonts/tna-vf.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 125%;
}

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

/* Custom Properties */
:root {
  /* Colors */
  --black: #000;
  --white: #fff;
  --bg: #faf8f3;       /* warm off-white page background */
  --accent: #A855F7;
  --grey-dark: #555;
  --grey-mid: #999;
  --grey-rule: #d0d0d0;

  /* Typography — single family, different variation-settings for body vs heading.
     Serif axis: 0 = Arial, 100 = Times. Weight axis: 0 = regular, 100 = bold. */
  --font: 'TNA', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --vf-body:         'srff' 50, 'wght' 0;
  --vf-body-bold:    'srff' 50, 'wght' 100;
  --vf-heading:      'srff' 10, 'wght' 50;
  --vf-heading-bold: 'srff' 10, 'wght' 100;
  /* Strict 4-tier type scale. Every font-size in the stylesheet must use one of these. */
  --fs-title:   clamp(2.25rem, 8.5vw, 6rem);   /* hero name, mobile overlay numbers */
  --fs-heading: 1.125rem;                      /* item titles (pub/oss/edu) — 1px above body for bold-weight contrast */
  --fs-body:    1.0625rem;                     /* paragraphs, dates, default */
  --fs-desc:    0.875rem;                      /* meta, captions, nav labels, footer, view-all */

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;
  --fw-black: 900;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout — vertical grid lines at 33% and --grid-right (content bound) */
  --page-pad-x: clamp(1.5rem, 5vw, 6rem);
  --col-year: 8rem;  /* fits "2021–2025" at body font-size with breathing room */
  --grid-right: 76%;  /* right-side content/grid bound — bumped from 72% for wider text */
  --content-max: calc(var(--grid-right) + var(--page-pad-x) / 3 - var(--space-xl));
  --rail-w: 0px;  /* side rail removed — keeps the page centered. Restore to 160px if rail is re-enabled. */

  /* Rules */
  --rule: 1px solid var(--black);
  --rule-light: 1px solid var(--grey-rule);
}

/* Base */
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-weight: var(--fw-regular);
  color: var(--black);
  background: var(--bg);
  line-height: 1.55;
  font-variation-settings: var(--vf-body);
}

/* Headings & UI labels: Arial-leaning via the Serif axis */
.hero-name,
.section-name,
.side-rail-num,
.side-rail-label,
.nav-link,
.mobile-nav-num,
.mobile-nav-name { font-variation-settings: var(--vf-heading-bold); }

/* Bold body copy */
strong, b { font-variation-settings: var(--vf-body-bold); }
::selection { background: var(--accent); color: var(--white); }
a { color: inherit; text-decoration: none; }

/* Page Container & Grid Lines */
.page { max-width: 1200px; margin: 0 auto; margin-left: max(var(--rail-w), calc((100vw - 1200px) / 2)); padding: 0 var(--page-pad-x); border-left: none; border-right: var(--rule-light); min-height: 100vh; position: relative; overflow-x: clip; }
.page::before, .page::after { content: ''; position: absolute; top: 0; bottom: 0; width: 0; border-left: var(--rule-light); pointer-events: none; z-index: 0; }
.page::before { left: 33.333%; }
.page::after { left: var(--grid-right); }
section, header, footer { position: relative; z-index: 1; }

/* Side-Rail Navigation */
.side-rail {
  position: fixed;
  left: max(0px, calc((100vw - 1200px) / 2 - var(--rail-w)));
  top: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-xl);
  border-right: var(--rule);
}

.side-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0;
  position: relative;
  text-decoration: none;
  transition: color 0.2s;
  color: var(--grey-mid);
}

/* Active indicator — red underline */
.side-rail-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: transparent;
  transition: background 0.2s;
}

.side-rail-item:hover { color: var(--black); }
.side-rail-item:hover .side-rail-num { color: var(--accent); }

.side-rail-item.active { color: var(--black); }
.side-rail-item.active .side-rail-num { color: var(--accent); }
.side-rail-item.active::after { background: var(--accent); }

.side-rail-num {
  font-size: var(--fs-desc);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.2s;
}

.side-rail-label {
  font-size: var(--fs-desc);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
}

/* Hero */
.hero { padding: var(--space-4xl) 0 var(--space-3xl); border-bottom: var(--rule); }
.hero-name { font-size: var(--fs-title); font-weight: var(--fw-black); line-height: 1.05; letter-spacing: -0.035em; max-width: 90%; }
.hero-name .accent-dot {
  color: var(--accent);
  display: inline-block;
  /* Trajectory is animated by JS in base.njk — true physics simulation
     (gravity + restitution) integrated each rAF frame, since CSS
     keyframes can only lerp between samples and produce visible kinks
     at the apex/ground contacts. */
}

/* Section */
.section { padding: var(--space-2xl) 0 var(--space-xl); border-bottom: var(--rule); }

.section-label {
  position: relative;
  margin-bottom: var(--space-xl);
  overflow: visible;
}

.section-name {
  position: relative;
  font-size: var(--fs-body);
  font-weight: var(--fw-black);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
}

.section-rule {
  display: block;
  margin-top: var(--space-md);
  border: none;
  border-top: var(--rule-light);
}

/* About */
.about-content > p { max-width: var(--content-max); }
.about-content > p:first-child { font-size: var(--fs-heading); font-weight: var(--fw-light); line-height: 1.5; letter-spacing: -0.01em; }
.about-content > p:not(:first-child) { margin-top: var(--space-lg); font-size: var(--fs-body); font-weight: var(--fw-light); line-height: 1.65; color: var(--grey-dark); }
.about-content strong { font-weight: var(--fw-bold); }
.about-content em { font-style: normal; color: var(--accent); font-weight: var(--fw-medium); }
.about-content a { color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.15em; transition: text-decoration-color 0.15s; }
.about-content a:hover { text-decoration-color: var(--accent); }

/* Background */
.edu-item {
  display: grid;
  grid-template-columns: var(--col-year) 1fr;
  gap: 0 var(--space-xl);
  padding: 0.75rem 0;
  align-items: baseline;
  max-width: var(--content-max);
  transition: transform 0.25s ease;
}
.edu-item:first-child { padding-top: 0; }
.edu-item:hover { transform: translateX(4px); }

.edu-year {
  font-weight: var(--fw-light);
  font-size: var(--fs-body);
  color: var(--grey-mid);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.edu-item:hover .edu-year { color: var(--accent); }

.edu-content { display: flex; flex-direction: column; gap: 0.15rem; }
.edu-content strong { font-weight: var(--fw-regular); font-variation-settings: var(--vf-body); font-size: var(--fs-heading); }
.edu-place { font-size: var(--fs-desc); color: var(--grey-mid); }
.edu-place a { color: inherit; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.15em; transition: color 0.15s, text-decoration-color 0.15s; }
.edu-place a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.edu-detail { font-size: var(--fs-desc); color: var(--grey-mid); font-weight: var(--fw-light); }

/* Publications */
.pub-row {
  display: grid;
  grid-template-columns: var(--col-year) 1fr;
  gap: 0 var(--space-xl);
  padding: var(--space-lg) 0;
  border-top: var(--rule-light);
  align-items: start;
  max-width: var(--content-max);
  transition: transform 0.25s ease;
}
.section-content > .pub-row:first-child { border-top: none; }
.pub-row:hover { transform: translateX(4px); }

.pub-col-year {
  font-weight: var(--fw-light);
  font-size: var(--fs-body);
  color: var(--grey-mid);
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.pub-row:hover .pub-col-year { color: var(--accent); }

.pub-col-main { min-width: 0; }

.pub-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-heading);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.pub-title a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.15em; transition: color 0.15s, text-decoration-color 0.15s; }
.pub-title a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.pub-venue {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-desc);
  margin-top: 0.4rem;
}

.pub-authors {
  font-weight: var(--fw-light);
  font-size: var(--fs-desc);
  color: var(--grey-mid);
  margin-top: var(--space-xs);
  line-height: 1.45;
}
.pub-authors .self { font-weight: var(--fw-semibold); color: var(--black); }

.pub-links {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.4rem;
}
.pub-links a {
  font-size: var(--fs-desc);
  font-weight: var(--fw-medium);
  color: var(--grey-mid);
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 0.15em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.pub-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Open Source */
.oss-row {
  display: grid;
  grid-template-columns: var(--col-year) 1fr;
  gap: 0 var(--space-xl);
  padding: var(--space-md) 0;
  align-items: baseline;
  max-width: var(--content-max);
  transition: transform 0.25s ease;
}
.oss-row:first-child { padding-top: 0; }
.oss-row:hover { transform: translateX(4px); }

.oss-lang {
  font-weight: var(--fw-light);
  font-size: var(--fs-body);
  color: var(--grey-mid);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.oss-row:hover .oss-lang { color: var(--accent); }

.oss-body { min-width: 0; }

.oss-name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-heading);
  letter-spacing: -0.01em;
}
.oss-name a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.15em; transition: color 0.15s, text-decoration-color 0.15s; }
.oss-name a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.oss-desc {
  font-size: var(--fs-desc);
  font-weight: var(--fw-light);
  color: var(--grey-mid);
  line-height: 1.5;
  margin-top: 0.15rem;
}

.oss-meta {
  font-size: var(--fs-desc);
  font-weight: var(--fw-regular);
  color: var(--grey-mid);
  margin-top: var(--space-xs);
}

/* Tools */
.tools-grid { display: flex; flex-wrap: wrap; gap: var(--space-md) var(--space-lg); max-width: var(--content-max); }
.tool-chip { display: inline-flex; align-items: baseline; gap: var(--space-sm); padding: 0.25rem 0; font-size: var(--fs-body); transition: color 0.2s, transform 0.2s; }
.tool-chip:hover { color: var(--accent); transform: translateY(-2px); }
.tool-name { font-weight: var(--fw-medium); }
.tool-desc { font-size: var(--fs-desc); font-weight: var(--fw-light); color: var(--grey-mid); }

/* Expand / Collapse Publications */
.view-all-toggle {
  background: none; border: none;
  font: inherit; font-size: var(--fs-desc); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--grey-mid); cursor: pointer;
  margin-top: var(--space-lg); margin-bottom: var(--space-xs); transition: color 0.15s;
}
.view-all-toggle:hover { color: var(--accent); }
.expanded-publications { margin-top: 0; }
.expanded-publications[hidden] { display: none; }

/* View All Link */
.view-all { margin-top: var(--space-lg); font-size: var(--fs-desc); }
.view-all a { color: var(--accent); }
.view-all a:hover { text-decoration: underline; }

/* Footer */
.footer { padding: var(--space-lg) 0; border-top: var(--rule); display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--space-md); max-width: var(--content-max); }
.footer-left,
.footer-right { font-size: var(--fs-desc); font-weight: var(--fw-light); color: var(--grey-mid); }
.footer-right a { margin-inline-start: var(--space-lg); }
.footer-right a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.15em; transition: color 0.15s, text-decoration-color 0.15s; }
.footer-right a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Floating Navigation (top-right number + hover TOC) */
.nav-floater {
  position: fixed;
  top: clamp(18rem, 28vw, 21rem);
  right: auto;
  left: min(
    calc(100vw - 56px - var(--space-md)),
    calc((100vw - 1200px) / 2 + 1200px + var(--space-xl))
  );
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.mobile-nav-toggle {
  background: none;
  border: none;
  padding: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-nav-toggle-num {
  font-size: var(--fs-heading);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  font-variation-settings: var(--vf-heading-bold);
  color: var(--accent);
  line-height: 1;
  pointer-events: none;
  transition: color 0.15s;
}

/* Desktop hover-revealed TOC dropdown */
.desktop-toc {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--white);
  border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--black);
  min-width: 12rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 180ms ease-out, transform 180ms ease-out, visibility 180ms;
  pointer-events: none;
}

.nav-floater:hover .desktop-toc,
.nav-floater:focus-within .desktop-toc {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.desktop-toc-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: 0.4rem 0;
  color: var(--grey-mid);
  font-size: var(--fs-desc);
  font-variation-settings: var(--vf-heading-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: var(--rule-light);
  transition: color 0.15s;
}
.desktop-toc-item:last-child { border-bottom: none; }
.desktop-toc-item:hover { color: var(--black); }
.desktop-toc-item:hover .dt-num { color: var(--accent); }
.desktop-toc-item.active { color: var(--black); }
.desktop-toc-item.active .dt-num { color: var(--accent); }

.dt-num {
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  color: var(--grey-mid);
  min-width: 1.25rem;
  transition: color 0.15s;
}
.dt-name { letter-spacing: 0.06em; }

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--white);
  flex-direction: column;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.mobile-nav-overlay.open { opacity: 1; visibility: visible; }

.mobile-nav-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  font: inherit;
  font-size: var(--fs-heading);
  cursor: pointer;
  color: var(--grey-mid);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
}
.mobile-nav-close:hover { color: var(--black); }

.mobile-nav-toc {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.mobile-nav-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-lg);
  text-decoration: none;
  color: var(--grey-mid);
  padding: var(--space-sm) 0;
  border-bottom: var(--rule-light);
  transition: color 0.15s;
}
.mobile-nav-item:last-child { border-bottom: none; }
.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--black); }
.mobile-nav-item.active .mobile-nav-num { color: var(--accent); }

.mobile-nav-num {
  font-size: var(--fs-title);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 2.5rem;
  transition: color 0.15s;
}

.mobile-nav-name {
  font-size: var(--fs-heading);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 500ms cubic-bezier(0.2, 0.7, 0.1, 1),
    transform 500ms cubic-bezier(0.2, 0.7, 0.1, 1);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Hover accent: red bar slides in from left along the bottom of cards */
.edu-item,
.pub-row,
.oss-row { position: relative; }

.edu-item::after,
.pub-row::after,
.oss-row::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease-out;
  pointer-events: none;
  z-index: 1;
}

.edu-item:hover::after,
.pub-row:hover::after,
.oss-row:hover::after { transform: scaleX(1); }

/* Stagger — children of .reveal.reveal-stagger animate in sequence */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 500ms cubic-bezier(0.2, 0.7, 0.1, 1),
    transform 500ms cubic-bezier(0.2, 0.7, 0.1, 1);
}
.reveal-stagger.visible > * {
  opacity: 1;
  transform: none;
}
.reveal-stagger.visible > *:nth-child(1)  { transition-delay: 0ms; }
.reveal-stagger.visible > *:nth-child(2)  { transition-delay: 80ms; }
.reveal-stagger.visible > *:nth-child(3)  { transition-delay: 160ms; }
.reveal-stagger.visible > *:nth-child(4)  { transition-delay: 240ms; }
.reveal-stagger.visible > *:nth-child(5)  { transition-delay: 320ms; }
.reveal-stagger.visible > *:nth-child(6)  { transition-delay: 400ms; }
.reveal-stagger.visible > *:nth-child(7)  { transition-delay: 480ms; }
.reveal-stagger.visible > *:nth-child(8)  { transition-delay: 560ms; }
.reveal-stagger.visible > *:nth-child(9)  { transition-delay: 640ms; }
.reveal-stagger.visible > *:nth-child(n+10) { transition-delay: 720ms; }

/* Scroll Targets */
section[id] { scroll-margin-top: var(--space-3xl); }

/* Focus Visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  :root {
    /* Grid lines hidden on mobile — no 66% constraint */
    --content-max: none;
  }

  .page { margin-left: 0; border-left: var(--rule); }
  .page::before, .page::after { display: none; }
  .hero { padding: 3.5rem 0 var(--space-2xl); }
  .section { padding: var(--space-2xl) 0; }
  .section-label { margin-bottom: var(--space-xl); }

  .pub-row,
  .oss-row,
  .edu-item {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }

  /* Hide desktop side rail + hover TOC; show mobile hamburger overlay */
  .side-rail { display: none; }
  .nav-floater {
    top: var(--space-md);
    right: var(--page-pad-x);
    left: auto;
    align-items: flex-end;
  }
  .desktop-toc { display: none !important; }
  .mobile-nav-overlay { display: flex; }

  .footer { flex-direction: column; align-items: flex-start; }
  .footer-right a { margin-inline-start: 0; margin-inline-end: var(--space-lg); }
}

@media (max-width: 480px) {
  .hero-name { max-width: 100%; overflow-wrap: break-word; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  body { color: black; background: white; }
  a { text-decoration: underline; }
  .side-rail, .nav-floater, .mobile-nav-overlay, .footer-right { display: none !important; }
  .page { border: none; margin-left: auto; }
  .page::before, .page::after { display: none; }
  .pub-row, .oss-row, .edu-item { break-inside: avoid; }
}

/* ==========================================================================
   Project Pages — /projects/<slug>/
   Same tokens as the homepage. No new visual language.
   ========================================================================== */

.page-project { padding-top: var(--space-2xl); padding-bottom: var(--space-3xl); }

.project-back {
  display: inline-block;
  font-size: var(--fs-desc);
  color: var(--grey-mid);
  font-weight: var(--fw-light);
  margin-bottom: var(--space-2xl);
  transition: color 0.15s;
}
.project-back:hover { color: var(--accent); }

.project-header { max-width: var(--content-max); margin-bottom: var(--space-3xl); }

.project-venue {
  font-size: var(--fs-desc);
  color: var(--grey-mid);
  font-weight: var(--fw-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.project-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: var(--fw-black);
  font-variation-settings: var(--vf-heading-bold);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-lg);
}

.project-authors {
  font-size: var(--fs-body);
  font-weight: var(--fw-light);
  color: var(--grey-dark);
  line-height: 1.55;
  margin-bottom: var(--space-xs);
}
.project-authors .self { font-weight: var(--fw-bold); color: var(--black); font-variation-settings: var(--vf-body-bold); }

.project-equal {
  font-size: var(--fs-desc);
  color: var(--grey-mid);
  font-style: italic;
  margin-bottom: var(--space-lg);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.project-links a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--black);
  background: var(--bg);
  font-size: var(--fs-desc);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--black);
  transition: background 0.15s, color 0.15s;
}
.project-links a:hover { background: var(--black); color: var(--bg); }

.project-body { max-width: var(--content-max); }

.project-tldr {
  font-size: var(--fs-heading);
  font-weight: var(--fw-light);
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--black);
  margin: 0 0 var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: var(--rule-light);
}
.project-tldr em {
  font-style: normal;
  color: var(--accent);
  font-weight: var(--fw-medium);
}

.project-figure {
  margin: 0 0 var(--space-2xl);
}
.project-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--white);
  border: 1px solid var(--grey-rule);
}
.project-figure figcaption {
  margin-top: var(--space-md);
  font-size: var(--fs-desc);
  color: var(--grey-dark);
  line-height: 1.55;
  font-weight: var(--fw-light);
}
.project-figure-hero { margin-bottom: var(--space-3xl); }

.project-section {
  margin-bottom: var(--space-3xl);
}
.project-section .section-name {
  font-size: var(--fs-body);
  font-weight: var(--fw-black);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.project-lead {
  font-size: var(--fs-body);
  font-weight: var(--fw-light);
  line-height: 1.6;
  color: var(--grey-dark);
  max-width: 56ch;
  margin: 0 0 var(--space-xl);
}
.project-lead em {
  font-style: normal;
  color: var(--accent);
  font-weight: var(--fw-medium);
}

.project-bibtex {
  margin: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--white);
  border: 1px solid var(--grey-rule);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-desc);
  line-height: 1.55;
  color: var(--grey-dark);
  overflow-x: auto;
  white-space: pre;
}

@media (max-width: 768px) {
  .project-title { font-size: 1.4rem; }
  .project-tldr { font-size: var(--fs-body); }
  .project-links a { padding: 0.3rem 0.7rem; }
}
