:root {
  --accent: #d9480f;
  --accent-rgb: 217, 72, 15;
  --accent-ink: #ffffff;
  --ink: #14151a;
  --ink-2: #3a3d45;
  --muted: #6b7280;
  --line: #e8e8ef;
  --line-2: #f1f1f5;
  --soft: #f7f7fa;
  --white: #ffffff;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(20, 21, 26, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --bar-h: 0px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--soft);
  border-radius: 6px;
  padding: 2px 6px;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding-block: 10px;
}

/* Das Freiraum-Auto haengt an der Marke und nicht an der Navigation: dadurch
   bleiben die Aktionen auch dann rechts, wenn die Menuepunkte wegfallen
   (body.page-admin .mainnav). */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12.5px; }

.mainnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.mainnav a {
  color: var(--ink-2);
  font-size: 15px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.mainnav a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.mainnav a.is-active { background: rgba(var(--accent-rgb), .1); color: var(--accent); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .4); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--soft); }

.btn-line { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }

.btn-off { background: var(--soft); color: var(--muted); border-color: var(--line-2); cursor: default; }

.btn-danger { color: #b42318; }
.btn-danger:hover { border-color: #f0a9a2; background: #fef3f2; }

.btn-sm { padding: 9px 15px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* Bedienelemente im Topbar: alle Kontrollen gleich hoch, gleiche Typografie,
   gleicher Radius, sauber zentriert. Steht bewusst nach .btn-sm, damit die
   Werte hier gewinnen. Rein lokal, kein globales Button-Styling. */
.topbar-actions > * {
  height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-sm);
}

.topbar-icon { padding: 0 14px; }
.topbar-icon svg { display: block; width: 18px; height: 18px; flex: 0 0 auto; }

/* Der Zaehler steht als farbige Plakette auf dem Knopf, damit er auch dann
   auffaellt, wenn der Knopf selbst nur die leere Variante hat. Auf dem
   betonten Knopf wird er invertiert. */
.topbar-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
}
.btn-primary .topbar-badge { background: var(--accent-ink); color: var(--accent); }

/* Das Abmelde-Formular ist selbst ein Kind von .topbar-actions und darf weder
   Hoehe noch Rahmen beitraegen; der Button darin traegt dieselbe Box wie die
   Nachbarn. */
.topbar-logout {
  display: inline-flex;
  align-items: center;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
}
.topbar-logout > .topbar-icon {
  height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
  line-height: 1.2;
  border-radius: var(--radius-sm);
}

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

.notice {
  margin: 20px 0;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.notice-ok { background: #ecfdf3; border-color: #a6f4c5; color: #05603a; }
.notice-info { background: #eff8ff; border-color: #b2ddff; color: #0b4a8a; }
.notice-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 210px);
  gap: 40px;
  align-items: center;
  /* Standardhoehe: der Hero soll die Bildschirmmitte sicher erreichen, damit
     beim Seitenanfang "Ueber mich" in der Navigation ausgewaehlt ist. Ohne die
     Mindesthoehe faellt bei knappen Fenstern gar kein Punkt auf. */
  min-height: min(58vh, 560px);
  align-content: center;
  padding-block: 72px 64px;
}

.hero-nomedia { grid-template-columns: minmax(0, 1fr); }

.hero-media { position: relative; }

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.portrait-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 42px;
  color: rgba(var(--accent-rgb), .5);
  letter-spacing: .06em;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.display {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: 18px;
}

.prose { color: var(--ink-2); }
.prose p { margin: 0 0 .9em; }
.prose p:last-child { margin-bottom: 0; }
.prose h2 { font-size: 22px; margin: 1.2em 0 .4em; }
.prose h3 { font-size: 19px; margin: 1.1em 0 .3em; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.3em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.lead { font-size: 18.5px; }

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

.section { padding-block: 76px; }
.section-alt {
  background: var(--soft);
  border-block: 1px solid var(--line-2);
  max-width: none;
}
.section-alt > .wrap { max-width: 1080px; margin-inline: auto; }

.section-head { margin-bottom: 40px; max-width: 60ch; }
.section-title { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 38px); font-weight: 600; margin-bottom: .35em; }
.section-text { color: var(--muted); font-size: 17px; }
.section-text.is-empty, .field-hint.is-empty, .form-privacy.is-empty { display: none; }
.is-editing .section-text.is-empty,
.is-editing .field-hint.is-empty,
.is-editing .form-privacy.is-empty {
  display: block;
  opacity: .75;
  font-style: italic;
}
.is-editing .form-success[hidden] { display: block; opacity: .6; }

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

/* Der Download-Knopf nimmt die volle Breite der Karte ein und behaelt eine
   eigene, grosszuegige Hoehe - er ist die Hauptaktion der Karte. Das Label
   darin ist im Bearbeitungsmodus ein Feld und muss mittig stehen, damit es
   weiterhin als Knopf und nicht als Textblock wirkt. */
.pub-dl {
  width: 100%;
  justify-content: center;
  padding-block: 16px;
  text-align: center;
}
.pub-dl .ed-input { text-align: center; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 440px));
  gap: 26px;
  justify-content: start;
}

.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.pub { display: flex; flex-direction: column; gap: 20px; }

.pub-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  max-width: 190px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line-2);
}
.pub-cover img { width: 100%; height: 100%; object-fit: cover; }

.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 42px;
  color: rgba(var(--accent-rgb), .45);
}

.pub-body { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.pub-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), .1);
  color: var(--accent);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .03em;
}

.byline { font-weight: 600; color: var(--ink-2); }

.pub-blank {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
}
.card.pub[data-blank] .pub-cover,
.card.pub[data-blank] .pub-title { opacity: .55; }

.pub-title { font-family: var(--serif); font-size: 23px; margin: 0; }
.pub-desc { font-size: 16px; color: var(--ink-2); }
.pub-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: auto 0 0;
  padding-top: 6px;
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  grid-column: 1 / -1;
}

.hint-row { margin: 26px 0 0; }

/* ---------- feedback ---------- */

.feedback-head { max-width: 68ch; margin-inline: auto; text-align: center; }
.feedback-lead { font-size: 18px; color: var(--ink-2); }


.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 26px;
  align-content: start;
}
.form .field-wide { grid-column: 1 / -1; }

.field label {
  display: block;
  font-weight: 650;
  font-size: 15px;
  margin-bottom: 4px;
}

.req { color: var(--accent); margin-left: 3px; }

.field-hint {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field textarea { resize: vertical; min-height: 120px; }
/* Das Feedback-Feld waechst mit dem Text statt zu scrollen: site.js setzt die
   Hoehe nach, hier steht nur das Grundverhalten. Ohne JS greift rows="2". */
.field textarea[data-autogrow] {
  resize: none;
  overflow: hidden;
  min-height: 88px;
  display: block;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .14);
}

.field-count { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); text-align: right; }
.field-error { margin: 6px 0 0; font-size: 13.5px; color: #b42318; }
.field.has-error input, .field.has-error textarea { border-color: #f4a29b; box-shadow: 0 0 0 4px rgba(180, 35, 24, .1); }

.form-privacy { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

.form-status { margin: 0; font-size: 15px; min-height: 1.2em; }
.form-status.is-error { color: #b42318; }

.form-success {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: #ecfdf3;
  border: 1px solid #a6f4c5;
  color: #05603a;
  font-weight: 600;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- modal ---------- */

body.has-modal { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 21, 26, .52);
  animation: modal-fade .18s ease;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 30px 28px 24px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 20px 52px rgba(20, 21, 26, .24);
  text-align: center;
  animation: modal-in .2s ease;
}
.modal-card:focus { outline: none; }

.modal-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #ecfdf3;
  color: #05603a;
}
.modal-mark svg { display: block; width: 27px; height: 27px; }
.modal.is-danger .modal-mark { background: #fef3f2; color: #b42318; }

.modal-title { margin: 0 0 8px; font-size: 21px; }
.modal-text { margin: 0; font-size: 15.5px; color: var(--ink-2); }
.modal-text:empty { display: none; }

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.modal-actions .btn { min-width: 128px; }

.btn-danger-solid { background: #b42318; color: #fff; }
.btn-danger-solid:hover { background: #912018; }

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- imprint ---------- */

.imprint {
  max-width: 72ch;
  padding-block: 10px;
}

.imprint-text {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.imprint-text p { margin: 0 0 .85em; }
.imprint-text p:last-child { margin-bottom: 0; }
.imprint-text strong { color: var(--ink); }

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

.footer {
  border-top: 1px solid var(--line-2);
  background: var(--soft);
  padding-block: 34px;
  margin-top: 20px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.footer-copy { margin: 0; font-weight: 700; }
.footer-meta { margin: 0; color: var(--muted); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.footer-meta a { color: var(--muted); }
.footer-meta a:hover { color: var(--accent); }
.footer-updated { justify-content: center; }

/* ---------- admin page ---------- */

/* Das Backend benutzt dieselbe Kopfzeile wie die oeffentliche Seite
   (inc/topbar.php). Nur die Navigation faellt weg: die Links zeigten auf
   Anker der oeffentlichen Seite, die es hier nicht gibt. Die Aktionen bleiben
   trotzdem rechts, weil .brand das margin-right:auto traegt. */
.page-admin .mainnav { display: none; }
.page-admin .topbar-inner { gap: 16px; }

.auth-card { max-width: 460px; margin-inline: auto; padding: 32px; }

/* Anmelde- und Einrichtungsformular: nur Icons. Die Beschriftung sitzt als
   Symbol vor dem Feld, der Name steckt fuer Screenreader im aria-label. */
.auth-view { display: grid; place-items: center; }
.auth-view .auth-card { width: 100%; }

/* Anmelde- und Einrichtungsformular. Das Symbol steht neben dem Feld statt
   darin: so kann es den Text nicht ueberdecken und es braucht kein
   Ecke-Padding, das von anderen Regeln ueberschrieben werden koennte. */
.field-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.field-row > .field-icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: var(--muted);
  pointer-events: none;
}
.field-row > .field-icon svg { display: block; width: 21px; height: 21px; }
.field-row input { flex: 1; min-width: 0; height: 56px; font-size: 16px; }
.field-row:has(input:focus) > .field-icon { color: var(--accent); }

/* Karten in den Einstellungen stehen linksbuendig unter der Ueberschrift und
   nicht mittig - sonst schweben sie mitten im Block. Die Anmeldekarten bleiben
   mittig (.auth-card), nur diese beiden nicht. */
.auth-card-left {
  margin-inline: 0;
  max-width: 620px;
}
/* Die Feldmeldung bricht auf eine eigene Zeile um, statt neben dem Input zu
   stehen - die Zeile ist sonst eine Flex-Reihe. */
.field-row > .field-error { flex: 1 0 100%; }

/* Augen-Knopf am rechten Rand eines Passwortfeldes. */
.field-row > .field-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.field-row > .field-toggle:hover { background: var(--soft); color: var(--accent); }
.field-row > .field-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Zwei Klassen, damit das sicher ueber .field input[type=...] gewinnt. */
.field.field-row.has-toggle input { padding-right: 56px; }

.btn-icon svg { display: block; width: 20px; height: 20px; }

/* ---------- link-dialog ---------- */

/* Breiter und linksbuendig: das ist ein Formular, kein Kurzhinweis. */
.modal-card-form { max-width: 600px; text-align: left; }
.modal-card-form .modal-title { margin-bottom: 4px; }
.modal-card-form .modal-text { text-align: left; }

.link-felder { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.link-felder .field label { font-size: 13.5px; }
.link-felder .field input { height: 46px; font-size: 15px; }

/* Adresse mit Knopf zum Nachsehen rechts daneben. */
.link-adresse { display: flex; align-items: center; gap: 8px; }
.link-adresse input { flex: 1; min-width: 0; }
.link-test {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
}
.link-test:hover { background: rgba(var(--accent-rgb), .08); color: var(--accent); }
.link-test svg { display: block; width: 19px; height: 19px; margin: 0 auto; }

.stack { display: flex; flex-direction: column; gap: 18px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-num { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: 13.5px; color: var(--muted); }
.stat-hot { background: rgba(var(--accent-rgb), .06); border-color: rgba(var(--accent-rgb), .3); }
.stat-hot .stat-num { color: var(--accent); }

/* ---------- statistik ---------- */

.stat-box {
  margin-top: 16px;
  padding: 20px 22px 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}
.stat-box-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 650;
}
.stat-box-hinweis { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat-box-leer { margin: 0; color: var(--muted); font-size: 14px; }
.stat-box-fuss { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Besucher je Tag: Balken mit Datum darunter. Die Hoehe kommt aus dem
   Seiten-Quelltext als Prozentwert, damit ohne JavaScript etwas zu sehen ist. */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.spark-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.spark-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  transition: height .2s ease;
}
.spark-bar.is-empty { background: var(--line-2); }
.spark-tag { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* Downloads je Publikation: Titel, Balken, Zahl. */
.dl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dl-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 220px) auto; align-items: center; gap: 14px; }
.dl-name {
  font-size: 14.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; border: 1px solid var(--line-2); }
.dl-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.dl-count { font-family: var(--serif); font-size: 17px; font-weight: 600; min-width: 2ch; text-align: right; }

@media (max-width: 620px) {
  .dl-item { grid-template-columns: minmax(0, 1fr) auto; }
  .dl-bar { display: none; }
  .spark { gap: 2px; height: 100px; }
  .spark-tag { display: none; }
}

/* Abstand zwischen Nachrichtenwerten und Liste: die msglist setzt ihre eigene
   Marge auf 0, sonst klebt die erste Nachricht direkt an den Kacheln. */
.stat-row + .empty { margin-top: 22px; }
.stat-row + .msglist { margin-top: 22px; }

.msglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.msg { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.msg-new { border-left: 4px solid var(--accent); background: rgba(var(--accent-rgb), .04); }
.msg-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.msg-from { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg-from a { font-size: 14px; }
.msg-date { font-size: 13px; color: var(--muted); }
.msg-text { margin: 0 0 14px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; align-items: center; }
/* Aktionen als reine Symbolknoepfe; der Name steht in aria-label und Titel. */
.msg-act { padding: 0; width: 38px; height: 38px; flex-shrink: 0; }
.msg-act svg { display: block; width: 18px; height: 18px; }

/* ---------- editor ---------- */

.is-editing { padding-bottom: 96px; }
.is-editing .wrap { position: relative; }

/* Ueber die volle Breite tippen: die Lesebreiten der Abschnitte begrenzen die
   Eingabefelder sonst auf60 Zeichen. Die Publikationskarten behalten bewusst
   ihre Spaltenbreite - sonst waere die Kartenansicht eine andere als in der
   Vorschau und die Karten passten nicht mehr nebeneinander. */
.is-editing .section-head { max-width: none; }
.is-editing .imprint { max-width: none; }

[data-block] { position: relative; }

[data-ed] {
  outline: 1px dashed transparent;
  outline-offset: 3px;
  border-radius: 4px;
  transition: background .14s ease, outline-color .14s ease;
  cursor: text;
}
.is-editing [data-ed]:hover {
  outline-color: rgba(var(--accent-rgb), .45);
  background: rgba(var(--accent-rgb), .07);
}
.is-editing [data-ed]:focus,
.is-editing [data-ed]:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(var(--accent-rgb), .1);
}

.is-editing [data-ed].is-blank { color: var(--accent); }
.is-editing [data-ed].is-blank::before {
  content: "leer – klicken zum Schreiben";
  font-size: .85em;
  font-style: italic;
  opacity: .6;
}

.is-editing [data-media] {
  position: relative;
  cursor: pointer;
  outline: 2px dashed rgba(var(--accent-rgb), .45);
  outline-offset: 3px;
}
.is-editing [data-media]:hover { outline-color: var(--accent); background: rgba(var(--accent-rgb), .07); }
.is-editing [data-media]::after {
  content: attr(data-media-label);
  position: absolute;
  inset: auto 0 0 0;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  background: rgba(var(--accent-rgb), .9);
  opacity: 0;
  transition: opacity .14s ease;
}
.is-editing [data-media]:hover::after { opacity: 1; }

.is-editing [data-media="file"] { outline: none; display: inline-flex; align-items: center; gap: 8px; }
.is-editing [data-media="file"]::after { content: none; }
.is-editing [data-file] { position: relative; }

.media-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-sm);
}

.ctl-group {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: wrap;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ctl {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.ctl:hover { background: rgba(var(--accent-rgb), .08); color: var(--accent); text-decoration: none; }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctl.btn-off { color: var(--muted); cursor: default; }
.ctl.btn-off:hover { background: transparent; color: var(--muted); }
.ctl.btn-primary { color: var(--accent); }

.pub-file { display: flex; flex-direction: column; align-items: stretch; }
.pub-file .ctl-label { align-self: flex-start; }
.pub-file .pub-dl { justify-content: center; width: 100%; }
.pub-file .ctl-group > .mini { height: auto; }

/* Notiz und Datei-Knoepfe als eine Zeile: die Notiz waechst mit und nimmt die
   freie Breite, die Knoepfe bleiben rechtsbuendig zusammen. Ohne Umbruch
   waere die Notiz sonst zweimal geteilt. */
.file-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
}
.file-bar > .ctl-note { flex: 1; min-width: 0; margin: 0; text-align: left; }
.file-bar > .ctl-group { flex: 0 0 auto; margin-left: auto; }

.ctl-note {
  display: block;
  min-width: 0;
  margin: 8px 0 10px;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}
/* Ohne Bearbeitungsmodus steht die Notiz allein unter dem Knopf und bleibt
   mittig - dort gibt es keine Knoepfe, die sie einruecken muessten. */
.pub-actions .ctl-note { margin: 9px 0 0; text-align: center; }

.ctl-label {
  display: block;
  margin: 0 0 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pub-file { margin: auto 0 0; padding-top: 10px; }

.ed-input {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  background: rgba(var(--accent-rgb), .06);
  border: 1px solid rgba(var(--accent-rgb), .3);
  border-radius: 6px;
  padding: 1px 6px;
  margin: -2px 0;
  max-width: 100%;
}
.ed-input:focus { outline: none; background: #fff; }

.ed-area {
  min-height: 0;
  padding: 8px 10px;
  line-height: 1.55;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
}

.is-editing [data-ed][data-input]:not(input):not(textarea):not(select) { display: block; width: 100%; }
.is-editing .pub-meta .tag { flex: 0 0 88px; }
.is-editing .tag .ed-input {
  width: calc(100% + 22px);
  max-width: none;
  margin-left: -11px;
  margin-right: -11px;
  text-align: center;
}

.ed-color input[type="color"] {
  width: 40px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.card-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
}
.is-editing .card:hover .card-tools { border-color: rgba(var(--accent-rgb), .5); }

.mini {
  font: inherit;
  font-size: 14px;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.mini:hover { background: rgba(var(--accent-rgb), .08); color: var(--accent); }
.mini-danger:hover { background: #fef3f2; color: #b42318; }

.ctl-group > * + * { border-left: 1px solid var(--line-2); }
.ctl-group > :first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.ctl-group > :last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.ed-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.ed-bar-inner {
  max-width: 1080px;
  margin-inline: auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ed-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}
.ed-led.is-dirty { background: #f59e0b; }
.ed-led.is-saved { background: #17c964; }
.ed-led.is-error { background: #ef4444; }
.ed-status { font-size: 14px; color: var(--ink-2); }
.ed-flex { flex: 1; }
.ed-color { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }

/* Die Leiste haengt am fokussierten Feld: left/top setzt admin.js aus dessen
   Bildschirmposition, .rt-bar bleibt position:fixed. Umgekehrtes Schema -
   Akzentflaeche mit daraus berechneter Schriftfarbe (--accent-ink), damit die
   Knöpfe auch bei einem hellen Akzent lesbar bleiben. */
.rt-bar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  display: flex;
  gap: 4px;
  padding: 7px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  border: 1px solid transparent;
  box-shadow: 0 8px 22px rgba(20, 21, 26, .22);
  max-width: calc(100vw - 16px);
}
.rt-bar[hidden] { display: none; }
.rt-bar button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--accent-ink);
  cursor: pointer;
  flex-shrink: 0;
}
.rt-bar button:hover {
  background: rgba(255, 255, 255, .2);
  background: color-mix(in srgb, var(--accent-ink) 20%, transparent);
  color: var(--accent-ink);
}
/* Markiert die Formatierung an der Cursor-Position. */
.rt-bar button.is-active {
  background: var(--accent-ink);
  color: var(--accent);
}
.rt-bar button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
/* Icon-Knoepfe: nur die Grafik, fester Kasten, damit die Leiste nicht springt. */
.rt-bar button.is-icon { padding: 0 7px; }
.rt-bar button.is-icon svg { display: block; width: 19px; height: 19px; }
/* Gruppen (z. B. Ausrichtung) lassen sich komplett ausblenden. */
.rt-group { display: contents; }
.rt-group[hidden] { display: none; }
.rt-sep { width: 1px; flex-shrink: 0; margin: 5px 3px; background: rgba(255, 255, 255, .34); background: color-mix(in srgb, var(--accent-ink) 34%, transparent); }

.is-editing a { cursor: default; }
.is-editing .card:hover { border-color: rgba(var(--accent-rgb), .35); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 80;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  box-shadow: var(--shadow-sm);
  max-width: 340px;
  animation: toast-in .2s ease;
}
.toast.is-error { background: #b42318; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- reveal ---------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .3, 1);
}

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

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 44px 40px; min-height: min(54vh, 460px); }
  .hero-media { max-width: 210px; }
  .mainnav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .section { padding-block: 52px; }
  html { scroll-padding-top: 130px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 18px; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .form { grid-template-columns: 1fr; }
  .feedback-head { text-align: left; }
  .ed-bar-inner { gap: 10px; padding: 10px 16px; }
  .rt-bar { max-width: calc(100vw - 16px); overflow-x: auto; }
  .toast { left: 16px; right: 16px; max-width: none; }
  .modal { padding: 16px; }
  .modal-card { padding: 24px 20px 20px; }
  .modal-actions .btn { flex: 1 1 130px; }
}

@media print {
  .topbar, .footer, .ed-bar, .rt-bar, .mainnav, .topbar-actions, .form, .card-tools, .modal { display: none !important; }
  body { font-size: 12pt; }
  .section { padding-block: 18px; }
  .card { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}