/* ==========================================================================
   Dr. Jörg Christian Reiher — portfolio stylesheet
   ========================================================================== */

:root {
  --ink: #16202e;
  --ink-soft: #445066;
  --muted: #6b7587;
  --line: #e3e7ee;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --accent: #1f5fa8;
  --accent-ink: #174a84;
  --accent-soft: #e8f0fa;
  --side-bg: #0f1a2a;
  --side-ink: #c9d3e1;
  --side-muted: #7f8ca0;
  --side-hover: #1a2940;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 288px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: block;
  padding: 32px 28px 26px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand:hover { color: #fff; }
.brand-name {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
}

.nav { padding: 18px 16px 32px; }
.nav-label {
  margin: 20px 12px 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--side-muted);
}
.nav a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: 7px;
  color: var(--side-ink);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.4;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a[aria-current="page"] {
  background: rgba(47, 123, 208, .18);
  color: #fff;
  box-shadow: inset 3px 0 0 #4a93e6;
}
.nav .tech { color: var(--side-muted); font-size: 12.5px; }
.nav a[aria-current="page"] .tech { color: #9fb7d6; }

/* ---------- Mobile top bar ---------- */

.topbar { display: none; }
.scrim { display: none; }

/* ---------- Main ---------- */

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 48px 72px;
  flex: 1;
}

.page-footer {
  border-top: 1px solid var(--line);
  padding: 22px 48px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.005em;
}
h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.18; margin: 0 0 18px; }
h2 { font-size: 24px; line-height: 1.3; margin: 48px 0 14px; }
h3 { font-size: 19px; margin: 32px 0 10px; }

.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.eyebrow .sep { color: var(--muted); margin: 0 .5em; }

.prose { max-width: 72ch; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }

.lead { font-size: 18px; color: var(--ink-soft); }

.crumbs {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 28px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { margin: 0 .5em; opacity: .6; }

/* ---------- Page header ---------- */

.page-head { margin-bottom: 32px; }
.page-head h1 { max-width: 30ch; }

/* ---------- Resource links ---------- */

.resources {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 40px;
}
.res {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  max-width: 100%;
}
a.res:hover { border-color: #b9cde6; box-shadow: var(--shadow-lg); transform: translateY(-1px); color: var(--ink); }
.res-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.res-icon svg { width: 18px; height: 18px; }
.res-text { display: flex; flex-direction: column; min-width: 0; }
.res-label { font-size: 12.5px; color: var(--muted); }
.res-main { font-weight: 600; overflow-wrap: anywhere; }
.res-meta { font-weight: 400; color: var(--muted); }

/* ---------- Media ---------- */

.figure { margin: 36px 0; }
.figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.figure.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.figure.native img { width: auto; max-width: 100%; margin: 0 auto; }
.figure figcaption {
  margin: 12px auto 0;
  max-width: 72ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}
.hero-figure { margin-top: 0; }

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 36px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-facade { position: absolute; inset: 0; display: block; cursor: pointer; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .92; transition: opacity .2s; }
.yt-facade:hover img { opacity: 1; }
.yt-play {
  position: absolute; top: 50%; left: 50%;
  width: 68px; height: 48px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .4));
  transition: transform .15s;
}
.yt-play svg { width: 100%; height: 100%; display: block; }
.yt-facade:hover .yt-play { transform: translate(-50%, -50%) scale(1.08); }

/* ---------- Home ---------- */

.hero {
  padding: 8px 0 12px;
  margin-bottom: 20px;
}
.hero .eyebrow { margin-bottom: 14px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 52px); margin-bottom: 20px; }
.hero p { font-size: 18px; color: var(--ink-soft); max-width: 66ch; margin: 0; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 52px 0 20px;
  font-family: var(--serif);
  font-size: 24px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  transform: translateY(-6px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #cdd9e8; color: var(--ink); }
.card-media {
  aspect-ratio: 16 / 10;
  background: #eef1f5;
  overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.card:hover .card-media img { transform: scale(1.035); }
.card-media.contain { background: #fff; }
.card-media.contain img { object-fit: contain; padding: 10px; }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-tag {
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 5px;
}
.card-title { font-family: var(--serif); font-size: 18px; line-height: 1.35; font-weight: 600; }
.card-more { margin-top: auto; padding-top: 8px; font-size: 14px; color: var(--accent); font-weight: 500; }

/* ---------- Publications ---------- */

.pubs { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.pub {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.pub-authors { font-size: 14px; color: var(--muted); }
.pub-title { font-family: var(--serif); font-size: 17.5px; font-weight: 600; line-height: 1.4; margin: 3px 0 5px; }
.pub a { font-size: 14.5px; font-weight: 500; }

/* ---------- Prev / next ---------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.pager a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.pager a:hover { border-color: #b9cde6; box-shadow: var(--shadow); color: var(--ink); }
.pager small { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.pager strong { font-weight: 600; font-size: 15px; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- Report-style page (Medial Axis Transform) ---------- */

.report h2 { margin-top: 44px; scroll-margin-top: 80px; }
.report ol ol, .report ol ul, .report ul ol, .report ul ul { margin-top: .5em; }
.report .indent { margin-left: 1.4em; }
.report .center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 32px 0 0;
  max-width: none;
}
.report .center img {
  width: auto;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px;
  zoom: 1.5;
}
.report .caption {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
  max-width: 64ch;
  margin: 12px auto 32px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: min(86vw, 320px);
    box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { transform: none; }
  .brand { padding-top: 24px; }

  .scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10, 16, 26, .45);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
    z-index: 35;
  }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }

  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky; top: 0;
    z-index: 30;
    height: 58px;
    padding: 0 12px;
    background: var(--side-bg);
    color: #fff;
  }
  .topbar a { color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-btn {
    flex: none;
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border: 0; border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }
  .menu-btn:hover { background: var(--side-hover); }
  .menu-btn svg { width: 24px; height: 24px; }

  .main { margin-left: 0; }
  .wrap { padding: 36px 28px 56px; }
  .page-footer { padding: 20px 28px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; line-height: 1.65; }
  .wrap { padding: 28px 16px 48px; }
  .page-footer { padding: 18px 16px; }
  .hero p, .lead { font-size: 16.5px; }
  h2 { font-size: 21px; margin-top: 40px; }
  .section-title { font-size: 21px; margin-top: 40px; }
  .grid { grid-template-columns: 1fr; gap: 18px; }
  .resources { flex-direction: column; }
  .res { width: 100%; }
  .figure, .video { margin: 26px 0; }
  .figure img, .video { border-radius: 8px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .report .center img { zoom: 1; }
  .report .indent { margin-left: 0; }
  .prose ul, .prose ol { padding-left: 1.2em; }
}

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

@media print {
  .sidebar, .topbar, .scrim, .pager { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}

/* ---------- Status notice ---------- */

.notice {
  max-width: 72ch;
  margin: 0 0 28px;
  padding: 20px 22px;
  background: var(--accent-soft);
  border: 1px solid #c9dbf0;
  border-radius: var(--radius);
}
.notice p { margin: 0 0 .5em; }
.notice p:last-child { margin-bottom: 0; }
.notice-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff4dc;
  color: #8a5a00;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
