/* graffi.de — site styles. Local fonts only (system stacks), no CDNs. */

:root {
  --ink: #16212c;
  --ink-soft: #46586a;
  --paper: #f7f4ee;
  --panel: #fffdf9;
  --line: #d8d2c6;
  --line-strong: #b9b0a2;
  --accent: #0d7d6f;
  --accent-soft: #e2f0eb;
  --accent-ink: #06342d;
  --highlight: #f3e6c9;
  --shadow: 0 1px 2px rgba(22, 33, 44, .08);
  --radius: 10px;
  --nav-h: 3.25rem;
  --measure: 70rem;
  --measure-wide: 84rem;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #e6edf2;
  --ink-soft: #9fb0bf;
  --paper: #111820;
  --panel: #18222c;
  --line: #2b3947;
  --line-strong: #3f5262;
  --accent: #3fbc9f;
  --accent-soft: #14332c;
  --accent-ink: #d7f3e8;
  --highlight: #2b3a2b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

html[data-theme="dark"] body { --shadow: 0 1px 3px rgba(0, 0, 0, .55); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

main { display: block; }

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}
/* Explorer pages (publications, teaching, news) get room for images and filters. */
.wrap-wide { max-width: var(--measure-wide); }

/* ---------- typography ---------- */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.2;
  margin: 0;
}
h1 { font-size: clamp(1.75rem, 4.2vw, 2.9rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.1rem; }

.eyebrow {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 46rem; }
.small { font-size: .85rem; }
.muted { color: var(--ink-soft); }
code, .mono { font-family: var(--mono); font-size: .86em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration: underline; }

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--panel);
  padding: .6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.skip:focus { left: .75rem; top: .5rem; z-index: 60; }

/* ---------- header / nav ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-height: var(--nav-h);
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: .6rem;
  white-space: nowrap;
}
.brand:hover { color: var(--accent); }
.nav-links { display: flex; gap: .2rem; flex-wrap: wrap; }
.nav-links a {
  padding: .45rem .6rem;
  border-radius: 7px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
}
.nav-links a:hover { color: var(--ink); background: var(--accent-soft); }
.nav-links a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 600;
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }

.lang-switch { display: flex; gap: .15rem; }
.lang-switch a {
  font-size: .82rem;
  padding: .35rem .5rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-soft);
}
.lang-switch a[aria-current="true"] {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 600;
}

.theme-btn {
  font: inherit;
  font-size: .82rem;
  padding: .35rem .55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.theme-btn:hover { border-color: var(--line-strong); color: var(--ink); }

/* ---------- sections ---------- */

section {
  scroll-margin-top: calc(var(--nav-h) + 1.2rem);
  padding-block: clamp(2.2rem, 5vw, 3.6rem);
  border-bottom: 1px solid var(--line);
}
section:last-of-type { border-bottom: 0; }

.section-head { margin-bottom: 1.1rem; }
.section-head h2 { margin-bottom: .45rem; }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: start;
  padding-block: clamp(2.4rem, 6vw, 4.2rem);
}
.hero-copy h1 { margin: .5rem 0 .9rem; }
.hero-copy p { margin: 0 0 1.1rem; }

.portrait {
  width: 220px;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--panel);
  overflow: hidden;
}
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }

.cta-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.btn {
  display: inline-block;
  font: inherit;
  font-size: .95rem;
  padding: .55rem .9rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
html[data-theme="dark"] .btn { color: #071a16; }
.btn:hover { filter: brightness(.94); text-decoration: none; }
.btn.secondary {
  background: transparent;
  color: var(--accent-ink);
  border-color: var(--line-strong);
}
.btn.secondary:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.stat-row { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: 1.4rem; }
.stat { font-size: .9rem; color: var(--ink-soft); }
.stat b { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); display: block; }

/* ---------- research ---------- */

.themes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: .75rem;
}
.themes li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: .85rem 1rem;
  box-shadow: var(--shadow);
}
.themes li span { color: var(--ink-soft); font-size: .9rem; }

/* ---------- timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}
.timeline li:first-child { border-top: 0; }
.timeline .period {
  font-size: .85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .02em;
}
.timeline .role { font-weight: 600; }
.timeline .org { color: var(--ink-soft); font-size: .95rem; }
.timeline .focus { color: var(--ink-soft); font-size: .9rem; margin-top: .35rem; }
.review-flag {
  font-size: .75rem;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .15rem .45rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- selected publications ---------- */

.pubs-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.pubs-preview li {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: .8rem 1rem;
  box-shadow: var(--shadow);
}
.pubs-preview li:hover { border-color: var(--line-strong); }
.pubs-preview .thumb { width: 128px; }
.pub-title { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; }
.pub-meta { color: var(--ink-soft); font-size: .9rem; margin-top: .3rem; }
.pub-authors { font-size: .9rem; margin-top: .35rem; }
.auth-me { color: var(--accent-ink); background: var(--highlight); font-weight: 600; padding: .05rem .25rem; border-radius: 4px; }
.pub-links { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; font-size: .85rem; }

/* ---------- publications explorer ---------- */

.toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: .85rem;
}
.toolbar-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.field { display: grid; gap: .3rem; font-size: .8rem; color: var(--ink-soft); }
.field select, .field input[type="search"], .field input[type="text"] {
  font: inherit;
  font-size: .92rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  min-width: 12rem;
}
.field select:hover, .field input:hover { border-color: var(--accent); }
.search-field input { min-width: 16rem; flex: 1; }

.toolbar-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.count { font-size: .9rem; color: var(--ink-soft); }
.count[aria-live] { font-weight: 600; color: var(--ink); }

.active-filters { display: flex; gap: .45rem; flex-wrap: wrap; font-size: .82rem; }
.chip {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: .25rem .6rem;
}

.bulkbar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: .8rem;
}
.bulkbar .count { margin-left: auto; }

/* Filtered rows and cards carry the hidden attribute; the layout rules below set
   display:grid/flex, which would beat the browser's [hidden] default and leave the
   non-matching entries on screen. Hide them explicitly. */
.pub-item[hidden], .course[hidden], .bulkbar[hidden], .news-post[hidden] { display: none !important; }
[hidden] { display: none !important; }

.pub-list { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: .75rem; }
.pub-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: .85rem 1rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1.15rem 148px minmax(0, 1fr);
  gap: .9rem;
}
.pub-item:hover { border-color: var(--line-strong); }
.pub-item:target, .pub-item.is-target { border-color: var(--accent); background: var(--accent-soft); }
.pub-item input[type="checkbox"] { margin-top: .5rem; width: 1rem; height: 1rem; accent-color: var(--accent); }
.pub-item .thumb { width: 148px; }
.thumb img {
  display: block;
  width: 148px;
  height: 185px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.thumb-fallback {
  width: 148px;
  height: 185px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: .78rem;
  text-align: center;
  padding: .5rem;
}
.pub-type {
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.pub-year { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }
details.pub-abstract { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .6rem; }
details.pub-abstract summary {
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
}
details.pub-abstract[open] summary { margin-bottom: .4rem; }
.pub-abstract-text {
  font-size: .92rem;
  line-height: 1.55;
  max-width: 62rem;
  margin: 0 0 .4rem;
}
details.pub-details { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .6rem; }
details.pub-details summary { cursor: pointer; font-size: .88rem; color: var(--ink-soft); }
details.pub-details dl { margin: .5rem 0 0; font-size: .88rem; }
details.pub-details dt { color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
details.pub-details dd { margin: .15rem 0 .6rem; }
details.pub-details pre {
  font-family: var(--mono);
  font-size: .8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .6rem;
  overflow: auto;
  white-space: pre-wrap;
}

/* ---------- teaching ---------- */

.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.course {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: .6rem;
}
.course:hover { border-color: var(--line-strong); }
.course h3 { font-size: 1.05rem; }
.course .tags { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .78rem; }
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .22rem .55rem;
  color: var(--ink-soft);
}
.tag.accent { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.course .topics { font-size: .92rem; color: var(--ink-soft); }
.playlists { display: grid; gap: .5rem; margin-top: .3rem; }
.plink { display: flex; gap: .5rem; align-items: baseline; font-size: .9rem; }
.plink .vids { color: var(--ink-soft); font-size: .82rem; }

.video-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.video-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
/* Teaching thumbnails are shown whole (never cropped) and framed so they read as media. */
.course-thumb {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.course-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: var(--paper); }
.course-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.thumb-play { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.thumb-play:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.course-thumb .video-frame { aspect-ratio: 16 / 9; }
.course .overview, .course .why { font-size: .95rem; color: var(--ink); }
.course .why { border-left: 3px solid var(--accent); padding-left: .7rem; background: var(--accent-soft); border-radius: 4px; }
.field-label {
  display: block;
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: .25rem;
}
.video-facade { position: relative; }
.video-facade button {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.video-facade button:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.play-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
html[data-theme="dark"] .play-icon { color: #071a16; }
.video-note { font-size: .8rem; color: var(--ink-soft); padding: .55rem .8rem; border-top: 1px solid var(--line); }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }

/* ---------- news ---------- */

.news-list { display: grid; gap: 1.4rem; margin-top: 1.6rem; }
.news-post {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: .65rem;
}
.news-post:hover { border-color: var(--line-strong); }
.news-post:target, .news-post.is-target { border-color: var(--accent); background: var(--accent-soft); }
.news-post .tags { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .78rem; }
.news-post h2 { font-size: 1.25rem; }
.news-date { font-size: .9rem; color: var(--ink-soft); }
.news-date time { color: var(--ink); }
.news-body { font-size: .98rem; line-height: 1.55; }
.news-thumb { max-width: 40rem; }
.news-source { font-size: .86rem; color: var(--ink-soft); word-break: break-all; }
.review-note {
  border-left: 3px solid var(--accent);
  padding-left: .7rem;
  color: var(--ink-soft);
}

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem 3rem;
  font-size: .9rem;
  color: var(--ink-soft);
}
.site-foot h2 { font-size: 1rem; margin-bottom: .5rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem; }
.updated { font-size: .85rem; }
.updated time { color: var(--ink); }

/* ---------- responsive ---------- */

@media (max-width: 62rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .portrait { width: 168px; }
  .pub-item { grid-template-columns: 1.15rem minmax(0, 1fr); }
  .pub-item .thumb { display: none; }
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
}

@media (max-width: 44rem) {
  /* Fallback for the wrapping header (site.js refines --nav-h from the real height). */
  :root { --nav-h: 6.5rem; }
  .nav { min-height: 2.9rem; }
  .nav-links a { padding: .35rem .5rem; font-size: .86rem; }
  .nav-right { margin-left: 0; }
  .toolbar { padding: .8rem; }
  .field select, .field input { min-width: 0; width: 100%; }
  .field { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  a, .btn, .theme-btn, .nav-links a, .pub-item, .course, .pubs-preview li { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}

@media print {
  .site-head, .toolbar, .bulkbar, .cta-row { display: none; }
  body { background: #fff; color: #000; }
}
