/* ===========================================================================
   Manuel Meier — personal website
   Elegant, single-page, light/dark aware.
   ======================================================================== */

:root {
  --maxw: 900px;
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1b1c1e;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e8e6e1;
  --accent: #2f4bd8;
  --accent-soft: #eef1fe;
  --award: #9a6b00;
  --award-bg: #fdf3d9;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 8px 24px rgba(20, 20, 30, 0.05);
  --radius: 14px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --surface: #1b1d22;
    --text: #e9e9ec;
    --muted: #a1a6b0;
    --faint: #767c88;
    --border: #2a2d34;
    --accent: #8aa2ff;
    --accent-soft: #1e2438;
    --award: #e8c66b;
    --award-bg: #33291180;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) clamp(20px, 5vw, 40px) 80px;
}

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

/* ------------------------------ Header --------------------------------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(20px, 4vw, 36px);
  align-items: start;
}

.avatar {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.7rem);
  letter-spacing: -0.01em;
  margin: 2px 0 4px;
}

.tagline {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 16px;
}

.intro { margin: 0 0 20px; color: var(--text); }
.intro p { margin: 0 0 10px; }

/* ------------------------------ Socials -------------------------------- */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.social:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.social svg { width: 18px; height: 18px; flex: none; }

/* ------------------------------ Sections ------------------------------- */
.section { margin-top: clamp(44px, 7vw, 72px); }

.section > h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 4px;
}
.section-hint { color: var(--muted); font-size: .95rem; margin: 0 0 26px; }

.rule {
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
  border: 0;
  margin: 10px 0 0;
}

.year-tag {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--faint);
  font-weight: 600;
  margin: 30px 0 14px;
  letter-spacing: .02em;
}
.year-tag:first-of-type { margin-top: 8px; }

/* --------------------------- Publications ------------------------------ */
.pub {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  align-items: start;
}
.pub:first-of-type { border-top: 0; }

.pub-banner {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--accent-soft);
}

.pub-title {
  font-size: 1.12rem;
  font-weight: 650;
  line-height: 1.35;
  margin: 2px 0 5px;
  color: var(--text);
}
.pub-authors { color: var(--muted); font-size: 0.95rem; margin: 0 0 3px; }
.pub-authors .me { color: var(--text); font-weight: 700; }
.pub-venue { color: var(--faint); font-size: 0.9rem; margin: 0 0 12px; }
.pub-venue em { color: var(--muted); font-style: italic; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: .02em;
  color: var(--award);
  background: var(--award-bg);
  border-radius: 999px;
  vertical-align: middle;
}

/* Link pills */
.links { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .14s ease;
  line-height: 1.4;
}
.pill:hover {
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.pill svg { width: 13px; height: 13px; }
@media (prefers-color-scheme: dark) {
  .pill:hover { color: #0b0d12; }
}

/* Expandable abstract / bibtex panels */
.panel {
  margin-top: 12px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
}
.panel[data-open="true"] { max-height: 1600px; }
.panel-inner {
  padding: 13px 15px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--text);
}
.panel-inner.abstract { line-height: 1.55; }
.panel-inner pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

/* --------------------------- Sports (details) -------------------------- */
.sports {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sports > summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
}
.sports > summary::-webkit-details-marker { display: none; }
.sports > summary .sub {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: auto;
}
.chevron {
  width: 20px; height: 20px; flex: none;
  transition: transform .25s ease;
  color: var(--muted);
}
.sports[open] .chevron { transform: rotate(180deg); }

.sports-body { padding: 4px 24px 24px; }
.sports-body p.lead { margin-top: 0; color: var(--text); }

.sport-list { list-style: none; padding: 0; margin: 14px 0 0; }
.sport-list li {
  padding: 13px 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.sport-list li:first-child { border-top: 0; }
.sport-list .st { font-weight: 600; color: var(--text); min-width: 0; }
.sport-list .sd { color: var(--muted); font-size: 0.95rem; }
.sport-year {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 42px;
  flex: none;
}

/* --------------------------- Video lightbox ---------------------------- */
.vmodal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 4vw, 48px);
}
.vmodal[aria-hidden="false"] { display: flex; }
.vmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.vmodal-box {
  position: relative;
  width: min(1040px, 100%);
  animation: vpop .18s ease;
}
@keyframes vpop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.vmodal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.vmodal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vmodal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #111;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform .15s ease;
}
.vmodal-close:hover { transform: scale(1.08); }
@media (max-width: 640px) {
  .vmodal-close { top: -46px; right: 0; }
}

/* ------------------------------ Footer --------------------------------- */
footer {
  margin-top: 70px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}

/* ------------------------------ Responsive ----------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; }
  .avatar { width: 96px; height: 96px; }
  .pub { grid-template-columns: 1fr; gap: 14px; }
  .pub-banner { max-width: 320px; }
  .sports > summary { padding: 18px; font-size: 1.2rem; }
  .sports-body { padding: 0 18px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto; }
}
