/* blog-md.css – Discord-Formatierung in Beiträgen + Editor im Admin */

/* ---------- Formatierter Inhalt ---------- */
.md { font-size: 16px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 14px; }
.md h2, .md h3, .md h4 { font-family: var(--font-display); text-transform: uppercase; line-height: 1.15; margin: 28px 0 12px; }
.md h2 { font-size: 26px; }
.md h3 { font-size: 20px; }
.md h4 { font-size: 16px; letter-spacing: .02em; }
.md .md-subtext { font-size: 12.5px; color: var(--text-faint); margin-top: -8px; }
.md strong { color: var(--text); font-weight: 700; }
.md u { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.md s { color: var(--text-soft); }
.md a { color: var(--accent-bright, var(--rust-bright)); text-decoration: underline; text-decoration-color: rgba(238,126,44,.4); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: currentColor; }
.md code { font-family: var(--font-mono); font-size: .88em; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.md .md-code { margin: 0 0 16px; padding: 14px 16px; border-radius: var(--r-md, 10px); background: #0d0a08; border: 1px solid var(--line); overflow-x: auto; }
.md .md-code code { padding: 0; border: 0; background: none; font-size: 13px; line-height: 1.55; white-space: pre; }
.md blockquote { margin: 0 0 16px; padding: 2px 0 2px 14px; border-left: 4px solid var(--line); color: var(--text-soft); }
.md blockquote p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 24px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 4px 0 0; }
.md li::marker { color: var(--accent-bright, var(--rust-bright)); }
.md-spoiler { background: #2b2521; color: transparent; border-radius: 4px; padding: 0 2px; cursor: pointer; transition: background .2s, color .2s; }
.md-spoiler * { color: transparent !important; }
.md-spoiler:hover { background: #3a322c; }
.md-spoiler.revealed { background: rgba(255,255,255,.08); color: inherit; cursor: auto; }
.md-spoiler.revealed * { color: inherit !important; }

/* Eingebettete Medien */
.md-yt, .md-video, .md-image { margin: 6px 0 20px; max-width: 760px; }
.md-yt { border-radius: var(--r-md, 10px); overflow: hidden; background: #000; border: 1px solid var(--line); border-left: 4px solid #ff0033; }
.md-yt-play { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer;
  background: #000 center / cover no-repeat; }
.md-yt-play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55)); transition: opacity .2s; }
.md-yt-icon { position: absolute; left: 50%; top: 50%; z-index: 1; width: 68px; height: 48px; margin: -24px 0 0 -34px; border-radius: 14px;
  background: rgba(20,20,20,.82); transition: background .2s, transform .2s; }
.md-yt-icon::before { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.md-yt-play:hover .md-yt-icon, .md-yt-play:focus-visible .md-yt-icon { background: #ff0033; transform: scale(1.06); }
.md-yt iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.md .md-yt-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-card); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.md .md-yt-bar:hover .md-yt-title { color: var(--accent-bright, var(--rust-bright)); }
.md-yt-bar small { color: var(--text-faint); font-weight: 400; }
.md-yt-logo { flex: none; width: 22px; height: 16px; border-radius: 4px; background: #ff0033; position: relative; }
.md-yt-logo::before { content: ""; position: absolute; left: 8px; top: 4px; border-style: solid; border-width: 4px 0 4px 7px; border-color: transparent transparent transparent #fff; }
.md-video video, .md-image img { display: block; width: 100%; border-radius: var(--r-md, 10px); border: 1px solid var(--line); background: #000; }
.md-video video { aspect-ratio: 16 / 9; }

/* ---------- Editor (Admin) ---------- */
.md-editor { border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--bg-card); overflow: hidden; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.md-toolbar button { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-soft);
  font: 600 13px var(--font-body); cursor: pointer; }
.md-toolbar button:hover { color: var(--text); background: rgba(255,255,255,.06); border-color: var(--line); }
.md-toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.md-toolbar .md-tb-media { color: var(--accent-bright, var(--rust-bright)); }
.md-toolbar .md-tb-right { margin-left: auto; display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: rgba(0,0,0,.25); }
.md-toolbar .md-tb-right button.active { color: var(--text); background: rgba(238,126,44,.18); }
.md-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 380px; }
.md-panes[data-mode="write"] { grid-template-columns: 1fr; }
.md-panes[data-mode="write"] .md-preview { display: none; }
.md-panes[data-mode="preview"] { grid-template-columns: 1fr; }
.md-panes[data-mode="preview"] textarea { display: none; }
.md-editor textarea { width: 100%; min-height: 380px; border: 0 !important; border-radius: 0 !important; resize: vertical; padding: 14px 16px !important;
  font: 14px/1.6 var(--font-mono) !important; background: transparent !important; color: var(--text); box-shadow: none !important; }
.md-editor textarea:focus { outline: none; }
.md-preview { padding: 14px 18px; border-left: 1px solid var(--line); overflow: auto; max-height: 720px; background: var(--bg-elev); }
.md-preview:empty::before { content: attr(data-empty); color: var(--text-faint); font-size: 13px; }
.md-help { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); line-height: 1.7; }
.md-help code { color: var(--text-soft); }

/* Medien-Auswahl */
.md-picker { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg, 14px);
  background: var(--bg-elev); color: var(--text); }
.md-picker::backdrop { background: rgba(5,4,3,.75); backdrop-filter: blur(3px); }
.md-picker header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.md-picker header h3 { margin: 0; font-family: var(--font-display); text-transform: uppercase; font-size: 18px; }
.md-picker header button { margin-left: auto; }
.md-picker-body { padding: 14px 16px 18px; display: grid; gap: 12px; max-height: calc(100dvh - 140px); overflow: auto; }
.md-picker-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.md-picker-row input { flex: 1 1 260px; }
.md-crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.md-crumbs button { background: none; border: 0; color: var(--accent-bright, var(--rust-bright)); cursor: pointer; font: inherit; padding: 2px 4px; }
.md-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.md-file { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-card);
  color: var(--text); cursor: pointer; text-align: left; font: 12px var(--font-body); }
.md-file:hover { border-color: var(--accent-bright, var(--rust-bright)); }
.md-file .thumb { aspect-ratio: 16 / 9; border-radius: 6px; background: #000 center / cover; display: grid; place-items: center; overflow: hidden; color: var(--text-faint); font-size: 24px; }
.md-file .thumb video, .md-file .thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.md-file .name { overflow-wrap: anywhere; line-height: 1.3; }
.md-file .size { color: var(--text-faint); font-family: var(--font-mono); font-size: 10.5px; }
.md-file.folder .thumb { background: rgba(238,126,44,.08); }

@media (max-width: 900px) {
  .md-panes { grid-template-columns: 1fr; }
  .md-preview { border-left: 0; border-top: 1px solid var(--line); }
}

/* Beitragsseite: formatierter Inhalt statt Rohtext */
.blog-post .content.md { white-space: normal; }
