/* Asset-Bibliothek: dunkles Atelier, Vorschaubilder im Mittelpunkt.
   Formsystem: Flächen 10px (Kacheln) / 16px (Dialog), alles Bedienbare als Pille.
   Eine Akzentfarbe (Terrakotta) für Fokus, Auswahl und Hervorhebung. */

@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JBMono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --bg-raise: #15171a;
  --bg-high: #1d2024;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);
  --text: #ecebe8;
  --muted: #a0a3aa;
  --accent: #e8794f;
  --accent-soft: rgb(232 121 79 / 0.14);
  --on-accent: #1b0f0a;

  --sans: "Bricolage", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JBMono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 3.6vw, 56px);
  --max: 2480px;
  --r-tile: 10px;
  --r-panel: 16px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 160px; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Atelier-Licht: eine warme Lampe von oben links, darunter feines Korn. Fest, nicht scrollend. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
body::before {
  background:
    radial-gradient(60rem 36rem at 12% -8%, rgb(232 121 79 / 0.09), transparent 62%),
    radial-gradient(70rem 40rem at 88% -20%, rgb(150 170 190 / 0.06), transparent 60%);
}
body::after {
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: var(--on-accent); }
html { scrollbar-color: #3a3e45 var(--bg); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: 12px;
  z-index: 30;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus-visible { transform: none; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Kopf ---------- */
.masthead__inner {
  padding-top: clamp(40px, 7vw, 104px);
  padding-bottom: clamp(20px, 3vw, 36px);
}
.title {
  margin: 0;
  font-size: clamp(2.4rem, 1.5rem + 3.6vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.byline {
  margin: clamp(10px, 1.1vw, 16px) 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 0.95rem + 0.45vw, 1.4rem);
  letter-spacing: -0.01em;
}
.byline strong { color: var(--accent); font-weight: 600; }
.lede {
  margin: clamp(14px, 1.6vw, 22px) 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.2rem);
  line-height: 1.45;
  text-wrap: pretty;
}
.lede strong { color: var(--text); font-weight: 600; }
.lede__stamp {
  display: block;
  margin-top: 4px;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Werkzeugleiste ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.toolbar.is-stuck {
  background: rgb(14 15 17 / 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
@media (prefers-reduced-transparency: reduce) {
  .toolbar.is-stuck { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.toolbar__inner {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.toolbar__row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 640px;
}
.search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 46px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raise);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  text-overflow: ellipsis;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.search input::placeholder { color: #8d9097; opacity: 1; }
.search input:hover { border-color: rgb(255 255 255 / 0.24); }
.search input:focus-visible { outline: none; border-color: var(--accent); background: var(--bg-high); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search__key {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font: 400 0.8rem/1 var(--mono);
  pointer-events: none;
  transition: opacity 160ms ease;
}
.search input:focus ~ .search__key,
.search input:not(:placeholder-shown) ~ .search__key { opacity: 0; }

.sort { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sort__label { color: var(--muted); font-size: 0.9rem; }
.sort select {
  height: 48px;
  padding: 0 40px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raise) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%23a0a3aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 160ms ease;
}
.sort select:hover { border-color: rgb(255 255 255 / 0.24); }
.sort select option { background: var(--bg-high); color: var(--text); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding: 4px var(--gutter);
  scroll-padding-inline: var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
@media (max-width: 860px) {
  .chips { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .chips::after { content: ""; flex: 0 0 24px; }
}
.chips:empty { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}
.chip__n {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #9a9da4;
  font-variant-numeric: tabular-nums;
  transition: color 160ms ease;
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip[aria-pressed="true"] .chip__n { color: #4a4d53; }
.chip:active { transform: scale(0.97); }
.chip.is-zero:not([aria-pressed="true"]) { color: var(--muted); border-color: var(--line); }
@media (hover: hover) and (pointer: fine) {
  .chip:not([aria-pressed="true"]):hover { border-color: rgb(255 255 255 / 0.32); background: rgb(255 255 255 / 0.04); }
}

/* ---------- Bühne & Raster ---------- */
.stage {
  flex: 1 0 auto;
  padding-top: clamp(18px, 2vw, 28px);
  padding-bottom: clamp(48px, 6vw, 96px);
}
.stage:focus-visible { outline: none; }
.count {
  margin: 0 0 clamp(14px, 1.6vw, 22px);
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.count strong { color: var(--text); font-weight: 600; }

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(22px, 2.2vw, 40px) clamp(12px, 1.4vw, 28px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr));
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
@media (min-width: 1600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
@media (min-width: 2600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.grid[hidden] { display: none; }

.card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-tile);
}
.card:focus-visible { outline: none; }

/* Die Kachel ist ein kleiner Fotostudio-Sockel: Boden-Licht als Platzhalter, bis das Bild da ist. */
.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-tile);
  background:
    radial-gradient(70% 45% at 50% 82%, rgb(255 255 255 / 0.07), transparent 70%),
    linear-gradient(180deg, #1a1c20, #121316);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 0 0 1px var(--line) inset;
  transform: translateZ(0);
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06) inset;
  pointer-events: none;
  transition: box-shadow 200ms ease;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 360ms ease, transform 600ms var(--ease-out);
}
.tile img.is-loaded { opacity: 1; }
.tile.is-broken img { display: none; }
.tile.is-broken::before {
  content: "Noch keine Vorschau";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.card__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
}
.badge {
  flex: none;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font: 400 0.72rem/1.45 var(--mono);
  font-variant-numeric: tabular-nums;
  transition: color 160ms ease, border-color 160ms ease;
}
.badge.is-fresh, .card:hover .badge { color: var(--text); }
.card__name {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 560;
  line-height: 1.3;
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
  hyphens: auto;
  transition: color 160ms ease;
}
.card__meta {
  display: block;
  margin-top: 3px;
  color: #a6a9b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
  line-height: 1.35;
}

.card:focus-visible .tile::after { box-shadow: 0 0 0 2px var(--accent) inset; }
.card:focus-visible .card__name { color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .card:hover .tile img { transform: scale(1.035); }
  .card:hover .tile::after { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.22) inset; }
  .card:hover .card__name { color: #fff8f4; }
}
.card:active .tile { transform: scale(0.985); transition: transform 120ms var(--ease-out); }

/* Ladeplatzhalter */
.card--ghost { pointer-events: none; }
.card--ghost .tile { animation: breathe 1600ms ease-in-out infinite alternate; }
.ghost-line { display: block; height: 12px; margin-top: 14px; width: 62%; border-radius: 6px; background: var(--bg-high); }
.ghost-line--short { width: 36%; margin-top: 8px; height: 10px; }
@keyframes breathe { from { opacity: 0.55; } to { opacity: 1; } }

/* Erster Auftritt: kurze Kaskade für die ersten Reihen, danach nicht mehr. */
.grid.is-entering > li { animation: rise 520ms var(--ease-out) both; }
.grid.is-entering > li:nth-child(n+2) { animation-delay: 40ms; }
.grid.is-entering > li:nth-child(n+3) { animation-delay: 80ms; }
.grid.is-entering > li:nth-child(n+4) { animation-delay: 120ms; }
.grid.is-entering > li:nth-child(n+5) { animation-delay: 160ms; }
.grid.is-entering > li:nth-child(n+6) { animation-delay: 200ms; }
.grid.is-entering > li:nth-child(n+7) { animation-delay: 240ms; }
.grid.is-entering > li:nth-child(n+9) { animation-delay: 280ms; }
.grid.is-entering > li:nth-child(n+13) { animation-delay: 320ms; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Leer-, Kein-Treffer- und Fehlerzustand ---------- */
.state {
  display: grid;
  justify-items: start;
  max-width: 560px;
  padding: clamp(24px, 6vw, 72px) 0;
}
.state[hidden] { display: none; }
.state__mark {
  position: relative;
  width: 132px;
  height: 92px;
  margin-bottom: 28px;
}
/* drei leere Sockel, wie ein Regal, das noch bestückt wird */
.state__mark span {
  position: absolute;
  bottom: 0;
  width: 38px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #24272c, #17191c);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.state__mark span:nth-child(1) { left: 0; height: 46px; }
.state__mark span:nth-child(2) { left: 47px; height: 72px; }
.state__mark span:nth-child(3) { left: 94px; height: 30px; }
.state__mark span:nth-child(2)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -22px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--accent);
  transform: translateX(-50%) rotate(45deg);
}
.state__title {
  margin: 0;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.state__text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 48ch;
  text-wrap: pretty;
}
.state .btn { margin-top: 24px; }
.btn[hidden], .toolbar[hidden] { display: none; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raise);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--small { height: 36px; padding: 0 14px; font-size: 0.88rem; }
.btn.is-done { border-color: var(--accent); color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: rgb(255 255 255 / 0.32); background: var(--bg-high); }
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgb(21 23 26 / 0.9);
  color: var(--text);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, opacity 160ms ease, transform 120ms var(--ease-out);
}
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn:active { transform: scale(0.94); }
.iconbtn:disabled { opacity: 0.35; cursor: default; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .iconbtn:not(:disabled):hover { border-color: rgb(255 255 255 / 0.32); background: var(--bg-high); }
}

/* ---------- Detailansicht ---------- */
body:has(.detail[open]) { overflow: hidden; }

.detail {
  width: min(1240px, calc(100vw - 2 * var(--gutter)));
  max-width: none;
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-panel);
  background: var(--bg-raise);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.65), 0 12px 24px -12px rgb(0 0 0 / 0.5);
}
.detail::backdrop {
  background: rgb(8 9 10 / 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Öffnen: von leicht verkleinert und transparent, ease-out. Schließen schneller. */
.detail[open] {
  opacity: 1;
  transform: none;
  transition: opacity 240ms var(--ease-out), transform 320ms var(--ease-out), overlay 240ms allow-discrete, display 240ms allow-discrete;
}
.detail {
  opacity: 0;
  transform: translateY(10px) scale(0.975);
  transition: opacity 160ms ease, transform 160ms ease, overlay 160ms allow-discrete, display 160ms allow-discrete;
}
@starting-style {
  .detail[open] { opacity: 0; transform: translateY(10px) scale(0.975); }
}
.detail::backdrop { opacity: 0; transition: opacity 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
.detail[open]::backdrop { opacity: 1; }
@starting-style { .detail[open]::backdrop { opacity: 0; } }

.detail__frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
  max-height: calc(100dvh - 50px);
}
.detail__media {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 0;
  background:
    radial-gradient(70% 40% at 50% 86%, rgb(255 255 255 / 0.07), transparent 70%),
    linear-gradient(180deg, #1b1d21, #111214);
  border-right: 1px solid var(--line);
}
.detail__media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 50px);
  aspect-ratio: 1;
  object-fit: contain;
  transition: opacity 200ms ease;
}
.detail__media img.is-swapping { opacity: 0.3; }

.detail__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(28px, 3vw, 48px) clamp(22px, 2.6vw, 44px) clamp(20px, 2vw, 28px);
}
.detail__cat {
  margin: 0 56px 10px 0;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}
.detail__name {
  margin: 0 40px 0 0;
  font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.75rem);
  font-weight: 680;
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.idline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 20px;
}
.idline__code {
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line) inset;
  font: 400 0.88rem/1.3 var(--mono);
  color: var(--text);
  overflow-wrap: anywhere;
  user-select: all;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 24px;
  margin: 32px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.facts > div { min-width: 0; }
.facts .is-wide { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: 0.82rem; margin-bottom: 4px; }
.facts dd {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.facts dd small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; }
.fmt {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-high);
  font: 400 0.8rem/1.5 var(--mono);
}

.detail__tags { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail__tags[hidden] { display: none; }
.detail__sub { margin: 0 0 12px; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}
.tag::before { content: "#"; color: var(--muted); margin-right: 1px; }
.tag:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .tag:hover { border-color: var(--accent); background: var(--accent-soft); }
}

.detail__nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 32px;
}
.detail__pos {
  flex: 1;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.detail__close { position: absolute; top: 16px; right: 16px; z-index: 2; }

/* ---------- Fußzeile ---------- */
.foot { border-top: 1px solid var(--line); }
.foot__inner { padding-top: 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.foot__inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 28px; }
.foot p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.foot__links { display: flex; gap: 22px; font-size: 0.9rem; }
.foot a, .legal a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 0.3);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 160ms ease, color 160ms ease;
}
.foot a:hover, .legal a:hover { text-decoration-color: var(--accent); }

/* ---------- Rechtstexte (impressum.html, datenschutz.html) ---------- */
.legal .top, .legal .prose, .legal > footer {
  width: 100%;
  max-width: calc(720px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.legal .top { padding-top: clamp(32px, 6vw, 72px); padding-bottom: 8px; }
.legal .brand h1 { margin: 0; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.025em; }
.legal .brand h1 a { color: var(--text); text-decoration: none; }
.legal .brand h1 a:hover { color: #fff8f4; }
.legal .by { margin: 6px 0 0; color: var(--muted); font-size: 1rem; }
.legal .prose { flex: 1 0 auto; padding-top: clamp(24px, 4vw, 48px); padding-bottom: clamp(48px, 6vw, 88px); }
.prose h2 { margin: 0 0 20px; font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.8rem); font-weight: 680; line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance; }
.prose h3 { margin: 2.2em 0 0.55em; font-size: 1.15rem; font-weight: 620; line-height: 1.3; letter-spacing: -0.01em; }
.prose p { margin: 0 0 1em; color: #cfd0cd; font-size: 1.04rem; line-height: 1.68; hyphens: auto; overflow-wrap: break-word; text-wrap: pretty; }
.prose strong { color: var(--text); font-weight: 600; }
.legal > footer {
  padding-top: 26px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9rem;
  background: linear-gradient(var(--line), var(--line)) no-repeat var(--gutter) 0 / calc(100% - 2 * var(--gutter)) 1px;
}
.legal > footer a { color: var(--text); }

/* ---------- Mobil ---------- */
@media (max-width: 860px) {
  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .detail__frame {
    display: block;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .detail__media { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail__media img { width: min(100%, 560px); max-height: none; }
  .detail__body { overflow: visible; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .detail__nav {
    position: sticky;
    bottom: 0;
    margin-inline: calc(clamp(22px, 2.6vw, 44px) * -1);
    padding: 12px clamp(22px, 2.6vw, 44px);
    background: var(--bg-raise);
    border-top: 1px solid var(--line);
    z-index: 1;
    margin-top: 28px;
  }
  .detail__close { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; }
  .detail { transform: translateY(24px); }
  @starting-style { .detail[open] { transform: translateY(24px); } }
}

@media (max-width: 560px) {
  .sort__label { display: none; }
  .sort select { padding: 0 32px 0 14px; background-position: right 9px center; max-width: 118px; }
  .masthead__inner { padding-top: 32px; padding-bottom: 14px; }
  .lede { font-size: 0.98rem; }
  .search input { padding-right: 18px; }
  .search__key { display: none; }
  .card__row { margin-top: 10px; }
  .card__name { font-size: 0.95rem; }
  .card__meta { font-size: 0.8rem; }
  .facts { gap: 18px 16px; }
}

@media (min-width: 1800px) {
  body { font-size: 17px; }
}

/* ---------- Bewegung reduzieren: nur Deckkraft, keine Wege ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .detail, .detail[open] { transform: none !important; }
  @starting-style { .detail[open] { transform: none !important; } }
  .tile img, .card .tile, .chip, .btn, .iconbtn, .tag { transition-property: opacity, background-color, border-color, color, box-shadow !important; }
  .card:hover .tile img, .card:active .tile { transform: none !important; }
  .card--ghost .tile { animation: none; opacity: 0.7; }
}

@media (forced-colors: active) {
  .chip[aria-pressed="true"] { outline: 2px solid CanvasText; }
  .tile::after { box-shadow: none; border: 1px solid CanvasText; }
}
