/* Projekt-Downloadportal – Grundstil (öffentlich + Backend) */
:root {
  --primary: #1f5fae;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2229;
  --muted: #5b6573;
  --border: #dde1e7;
  --ok: #1e7b3c;
  --warn: #9a6200;
  --err: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
a { color: var(--primary); }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
code { font-family: var(--mono); font-size: .88em; background: #eef1f5; padding: .1em .35em; border-radius: 4px; word-break: break-all; }
pre { overflow-x: auto; background: #eef1f5; padding: 1rem; border-radius: var(--radius); }
pre code { background: none; padding: 0; word-break: normal; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, white); outline-offset: 2px; }

/* Kopf und Fuß */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand svg { color: var(--primary); }
.tagline { color: var(--muted); font-size: .92rem; }
.site-footer { margin-top: 3rem; background: var(--surface); border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 1.2rem; }
.footer-inner a { color: var(--muted); }

/* Knöpfe und Formulare */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(1.08); }
.btn-sm { padding: .3rem .65rem; font-size: .88rem; }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #c6ccd5; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 8rem; resize: vertical; font-family: var(--mono); font-size: .92rem; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.form label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.form .check, .check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: 1rem 0; }
.check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; flex: none; }
.form .btn-primary { margin-top: .5rem; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; border: 1px solid; }
.alert p { margin: .2rem 0; }
.alert.error { background: #fdecea; border-color: #f3b8b3; color: #7a1a14; }
.alert.ok { background: #e8f5ec; border-color: #a8d5b5; color: #145228; }
.alert.warn { background: #fff5e0; border-color: #f0d08a; color: #6b4500; }
.alert.info { background: #eaf1fb; border-color: #b8cdea; color: #173f73; }

/* Übersicht */
.intro { padding: 2rem 0 .5rem; }
.intro .prose { color: var(--muted); max-width: 46rem; }
.filters { display: flex; gap: .6rem; margin: 1rem 0; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 260px; width: auto; }
.filters select { flex: 0 1 200px; width: auto; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.chip { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip.active, .chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: color-mix(in srgb, var(--primary) 10%, white); font-weight: 600; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #e9edf2; display: block; }
.card-img.placeholder { display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; color: color-mix(in srgb, var(--primary) 70%, white); background: color-mix(in srgb, var(--primary) 8%, white); }
.card-body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-body p { margin: 0; color: var(--muted); flex: 1; }
.card-head { display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; }
.card-head h2 { font-size: 1.12rem; margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; font-size: .85rem; color: var(--muted); }
.tag { background: #eef1f5; color: var(--muted); padding: .1rem .55rem; border-radius: 999px; text-decoration: none; font-size: .82rem; }
.badge { font-size: .76rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; border: 1px solid; }
.st-aktiv { color: var(--ok); border-color: #a8d5b5; background: #e8f5ec; }
.st-entwicklung { color: var(--warn); border-color: #f0d08a; background: #fff5e0; }
.st-archiviert { color: var(--muted); border-color: var(--border); background: #f1f3f6; }
.empty { padding: 3rem 0; text-align: center; color: var(--muted); }

/* Projektseite */
.crumbs { font-size: .9rem; color: var(--muted); margin: 1.4rem 0 1rem; }
.crumbs a { color: var(--muted); }
.project-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.project-head > div { flex: 1 1 420px; }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 .8rem; }
.note { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .2rem; font-size: .92rem; align-self: flex-start; max-width: 320px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 8px; border: 1px solid var(--border); aspect-ratio: 16 / 10; object-fit: cover; width: 100%; display: block; }
.gallery figcaption { font-size: .84rem; color: var(--muted); margin-top: .3rem; }
.project-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 2rem; align-items: start; }
.project-main section { margin-bottom: 1.8rem; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.version-line { margin-top: 0; }
.files { list-style: none; padding: 0; margin: .6rem 0; display: flex; flex-direction: column; gap: .6rem; }
.file { display: flex; justify-content: space-between; align-items: center; gap: .8rem; border: 1px solid var(--border); border-radius: 8px; padding: .7rem .8rem; background: #fbfcfd; }
.file-info { display: flex; flex-direction: column; min-width: 0; }
.file-meta { font-size: .84rem; color: var(--muted); }
.hash { font-size: .76rem; color: var(--muted); }
.hash code { font-size: .74rem; }
.older { margin-top: 2rem; }
.version { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .7rem 1rem; margin-bottom: .6rem; }
.version summary { cursor: pointer; font-weight: 600; display: flex; gap: .8rem; }
.version[open] summary { margin-bottom: .6rem; }
.prose { overflow-wrap: anywhere; }
.prose h2 { margin-top: 1.4em; }
.prose h3 { margin-top: 1.2em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose blockquote { margin: 1rem 0; padding: .4rem 1rem; border-left: 4px solid var(--border); color: var(--muted); }
.prose table { border-collapse: collapse; }
.narrow { max-width: 720px; margin: 2rem auto; }
.legal h2 { font-size: 1.2rem; }
.file-summary { display: flex; flex-direction: column; gap: .15rem; margin: 1rem 0; text-align: left; }
.message { padding-top: 2rem; }
.msg-icon { color: var(--primary); }
.msg-icon.ok { color: var(--ok); }
.license, .legal pre { white-space: pre-wrap; font-size: .82rem; }

/* Lightbox */
.lb { position: fixed; inset: 0; background: rgba(10, 14, 20, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.lb img { max-height: 85vh; max-width: 95vw; border-radius: 6px; }
.lb p { color: #fff; margin: .6rem 0 0; }
.lb button { position: absolute; top: 1rem; right: 1rem; background: #fff; border: none; border-radius: 50%; width: 2.4rem; height: 2.4rem; font-size: 1.4rem; cursor: pointer; }

@media (max-width: 860px) {
  .project-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  .note { max-width: none; }
  .file { flex-direction: column; align-items: stretch; }
}
