/* Ergänzungen zu Bootstrap (static/vendor/bootstrap). Bootstrap liefert Farben, Formulare, Tabellen, Karten,
   Buttons und Meldungen; hell/dunkel folgt dem System (color-scheme: light dark). Hier stehen nur Dinge, die
   Bootstrap nicht kennt: Sprachumschaltung, Cookie-Banner und -Dialoge, Einbettungen, Markdown-Inhalte, Editor. */
:root {
  /* Bootstrap-Alpha-Standard (Weiß auf blau-500/rot-500) erreicht nur ca. 3,6:1; dunklere Töne für AA (4,5:1) */
  --bs-primary-base: light-dark(var(--bs-blue-700), var(--bs-blue-400));
  --bs-primary-bg: light-dark(var(--bs-blue-700), var(--bs-blue-400));
  --bs-primary-contrast: light-dark(#ffffff, #0b1220);
  --bs-danger-bg: light-dark(var(--bs-red-700), var(--bs-red-400));
  --bs-danger-contrast: light-dark(#ffffff, #1f0606);
  --bs-success-fg: light-dark(var(--bs-green-800), var(--bs-green-400));
  --control-line: light-dark(#767676, #8f949c); /* Rahmen von Eingabefeldern ≥ 3:1 (WCAG 1.4.11) */
  --measure: 72ch;
  --muted: var(--bs-fg-3);
  --line: var(--bs-border-color);
  --focus: light-dark(#8a3b00, #ffd166); /* kräftiger als der Standard-Fokusring von Bootstrap */
}

[hidden] { display: none !important; }
html { scroll-padding-top: 1rem; }
body { min-height: 100vh; display: flex; flex-direction: column; overflow-wrap: break-word; }
main { flex: 1; }
main:focus { outline: none; }

/* Fokus immer deutlich sichtbar (WCAG 2.4.7, 1.4.11) */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Sprachumschaltung: beide Sprachen stehen im HTML, die inaktive wird ausgeblendet. */
html[lang="de"] [data-l="en"], html[lang="en"] [data-l="de"] { display: none !important; }

.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem; font-weight: 700; color: var(--bs-bg-body); background: var(--bs-fg-body); }
.skip:focus { top: 0.5rem; }

main h1 { margin-bottom: 1rem; }
main h2 { margin-top: 2rem; }
.card h2, .card h3, .section-head h2, dialog h2, .consent h2 { margin-top: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.3rem 0 0; }
.form-narrow { max-width: 26rem; }
.form-medium { max-width: 36rem; }

/* Kopfbereich */
.navbar .nav { --nav-link-color: var(--bs-fg-2); }
.nav-link[aria-current] { font-weight: 700; color: var(--bs-fg-body); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.3em; }
.lang-toggle [aria-pressed="true"] { color: var(--bs-bg-body); background: var(--bs-fg-body); border-color: var(--bs-fg-body); }
button.nav-link { background: none; border: 0; }

/* Überschriften, Karten, Tags */
.hero h1 { font-size: 2.1rem; margin: 0; }
.tagline { color: var(--muted); margin: 0.25rem 0 1.25rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; margin-top: 2rem; }
.section-head h1, .section-head h2 { margin: 0; }
.cards { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.cards > .card { margin: 0 !important; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.meta { color: var(--muted); font-size: 0.85rem; margin: 0; display: flex; flex-wrap: wrap; gap: 0 0.9rem; }
.kind { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; text-decoration: none; font-size: 0.8rem; }
.tags { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: 0.9rem; }
.tags a { text-decoration: none; padding-block: 0.3rem; display: inline-block; }
.tags a::before { content: "#"; content: "#" / ""; color: var(--muted); }
.tags a:hover { text-decoration: underline; }
.tags.big { font-size: 1.1rem; gap: 0.4rem 1.5rem; }
.tags small { color: var(--muted); }

/* Einträge und Markdown-Text */
.lead { font-size: 1.1rem; color: var(--muted); max-width: var(--measure); }
.cover { width: 100%; max-width: 56rem; height: auto; border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; }
.note { max-width: var(--measure); border: 1px dashed var(--bs-border-emphasized); border-radius: 6px; padding: 0.5rem 0.9rem; color: var(--muted); font-size: 0.9rem; }
.prose { overflow-wrap: anywhere; max-width: var(--measure); margin-inline: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose pre { border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.88rem; line-height: 1.55; }
.prose blockquote { margin: 1rem 0; padding: 0.1rem 1rem; border-left: 3px solid var(--bs-fg-body); color: var(--muted); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.35rem 0.7rem; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 46rem) { .grid { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); } }
form.inline { display: inline; margin: 0; }
.right { text-align: right !important; }

/* Cookie-Banner, Dialoge, Einbettungen */
.consent { position: fixed; inset-inline: 0; bottom: 0; z-index: 50; background: var(--bs-bg-1); border-top: 3px solid var(--bs-fg-body); max-height: 70vh; overflow-y: auto; padding-block: 1rem; }
.consent h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
body:has(.consent:not([hidden])) main { padding-bottom: min(70vh, 24rem); }
dialog { color: var(--bs-fg-body); background: var(--bs-bg-body); border: 2px solid var(--bs-fg-body); border-radius: 8px; padding: 1.25rem; width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
dialog::backdrop { background: rgb(0 0 0 / 0.7); }
dialog h2 { margin-top: 0; font-size: 1.3rem; }
.consent-item { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.consent-item:last-of-type { border-bottom: 0; }
.consent-item label .muted { display: block; font-weight: 400; }
.small-link { font-size: 0.85rem; }
.embed { margin: 1.25rem 0; }
.embed-gate { border: 2px dashed var(--bs-fg-body); border-radius: 8px; background: var(--bs-bg-1); padding: 1rem 1.1rem; }
.embed-gate p { margin: 0 0 0.7rem; }
.embed-gate .gate-links { margin: 0.7rem 0 0; font-size: 0.9rem; }
.embed-frame { border: 1px solid var(--line); background: var(--bs-bg-2); max-width: 56rem; }
.embed-frame iframe { display: block; width: 100%; border: 0; }
.embed[data-embed-service="youtube"] iframe, .embed[data-embed-service="vimeo"] iframe { aspect-ratio: 16 / 9; height: auto; }
.embed[data-embed-service="instagram"] .embed-frame { max-width: 34rem; }
.embed[data-embed-service="instagram"] iframe { height: 46rem; }
.embed[data-embed-service="mastodon"] .embed-frame { max-width: 36rem; }
.embed[data-embed-service="mastodon"] iframe { height: 26rem; } /* wird durch die vom Embed gemeldete Höhe ersetzt */

/* Community: Feed, Beitragskarten, Schreibfeld */
.feed { max-width: 40rem; margin-inline: auto; }
.post { margin: 0 0 1rem !important; padding: 1rem; }
.post-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.post-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.post-name { padding-block: 2px; font-weight: 700; color: var(--bs-fg-body); text-decoration: none; }
.post-name:hover { text-decoration: underline; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 0.75rem; }
.post-actions { margin-top: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--line); font-size: 0.9rem; }
.post-actions form { display: inline; }
.avatar { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; }
.avatar.big { width: 6rem; height: 6rem; font-size: 2.5rem; }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--bs-bg-body); background: var(--bs-fg-3); }
.post-imgs { display: grid; gap: 0.25rem; border-radius: 8px; overflow: hidden; }
.post-imgs a { display: block; background: var(--bs-bg-2); }
.post-imgs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-imgs.n1 img { height: auto; max-height: 34rem; object-fit: contain; }
.post-imgs.n2, .post-imgs.n3, .post-imgs.n4 { grid-template-columns: 1fr 1fr; }
.post-imgs.n2 a, .post-imgs.n3 a:not(:first-child), .post-imgs.n4 a { aspect-ratio: 1; }
.post-imgs.n3 a:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.profile-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.profile-head h1 { margin-bottom: 0.25rem; }
.previews { display: grid; gap: 0.75rem; margin-top: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.preview { display: flex; flex-direction: column; gap: 0.4rem; }
.preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.preview label { font-size: 0.85rem; font-weight: 400; }
.over { color: light-dark(#b00020, #ff8a9a); font-weight: 700; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr)); gap: 0.25rem; }
.emoji { min-height: 2.75rem; font-size: 1.5rem; line-height: 1; background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.emoji:hover { background: var(--bs-bg-2); border-color: var(--line); }
.lightbox { width: min(60rem, calc(100vw - 2rem)); }
.lightbox img { display: block; max-width: 100%; max-height: 75vh; margin-inline: auto; }

/* Dashboard (Inhalte) und Editor */
.filters { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tab[aria-pressed="true"] { color: var(--bs-bg-body); background: var(--bs-fg-body); border-color: var(--bs-fg-body); }
.md-editor { display: grid; gap: 1rem; }
@media (min-width: 62rem) { .md-editor { grid-template-columns: 1fr 1fr; } }
.md-toolbar { display: flex; gap: 0.75rem; align-items: center; min-height: 2.25rem; margin-bottom: 0.3rem; }
label.upload:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
form.vstack > button, form.vstack > .btn-solid { align-self: flex-start; }

/* Eingabefelder: kontrastreicher Rahmen, Ziel mindestens 24 × 24 px (WCAG 1.4.11, 2.5.8) */
.form-control, .check, .radio { --bs-control-border-color: var(--control-line); --bs-check-border-color: var(--control-line); }
.check, .radio { --bs-check-size: 1.5rem; }
.btn-outline.theme-secondary { --bs-btn-border-color: var(--control-line); }
.table-responsive { position: relative; }
