/* Blogautomat – „Redaktionstisch“ */
/* Schrift: Public Sans, SIL Open Font License 1.1 – siehe /assets/fonts/OFL.txt */

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/assets/fonts/public-sans-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/assets/fonts/public-sans-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #F3F5F4;
  --sheet: #FFFFFF;
  --ink: #1E2A2F;
  --muted: #5E6B70;
  --rule: #D9DEDE;
  --unna: #A3192F;
  --holzwickede: #2F6B4F;
  --test: #B7791F;
  --auto: #1F6F78;
  --danger: #B42318;
  /* abgeleitet: Testphase-Pille (Text auf Tönung, AA) */
  --test-tint: #FBF0DD;
  --test-ink: #7A4D0E;
  --ok-tint: #E6F0EC;

  --fs-s: 13px;
  --fs-b: 15px;
  --fs-m: 19px;
  --fs-l: 24px;
  --fs-xl: 30px;

  --side: 220px;
  --tabbar: 60px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Blog-Identität über data-blog; weitere Blogs bleiben in Tinte */
[data-blog] { --blog: var(--ink); }
[data-blog="blog1"] { --blog: var(--unna); }
[data-blog="blog2"] { --blog: var(--holzwickede); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-b);
  line-height: 1.5;
  font-weight: 400;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; font-weight: 680; margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-m); }
h3 { font-size: var(--fs-b); font-weight: 650; }
p { margin: 0 0 12px; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.danger-text { color: var(--danger); }
.wrapword { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* ---------- Gerüst ---------- */
.brand { font-weight: 720; font-size: var(--fs-m); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }

.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.topbar .brand { font-size: 17px; }
.brand { display: inline-flex; align-items: center; }
.brand img, .login-brand img { display: block; height: auto; }
.topbar .brand img { width: 128px; }
.login-brand img { width: 220px; }
.topbar-cost { color: var(--muted); font-size: var(--fs-s); text-decoration: none; font-variant-numeric: tabular-nums; }

.content { padding: 20px 16px calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)); max-width: 760px; }
.content > h1:first-child, .content > .flash + h1 { margin-bottom: 20px; }
.content h1 + p { margin-top: -8px; }

/* Tab-Leiste (Handy) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--sheet); border-top: 1px solid var(--rule);
  box-shadow: 0 -1px 12px rgba(30, 42, 47, .06);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar > ul { display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; margin: 0; padding: 0; }
.tabbar > ul > li { min-width: 0; }
.tabbar a, .tabbar summary {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tabbar); padding: 6px 4px;
  color: var(--muted); text-decoration: none; font-size: 12px; line-height: 1.2; text-align: center;
  cursor: pointer; list-style: none;
}
.tabbar summary::-webkit-details-marker { display: none; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar svg circle { fill: currentColor; stroke: none; }
.tabbar a[aria-current="page"], .tabbar summary.is-current, .more[open] > summary { color: var(--ink); font-weight: 650; }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
.tabbar a:focus-visible, .tabbar summary:focus-visible { outline-offset: -4px; }
.more { position: relative; }
.more-list {
  position: absolute; right: 8px; bottom: calc(100% + 8px);
  width: min(260px, calc(100vw - 16px));
  list-style: none; margin: 0; padding: 6px 0;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px;
}
.tabbar .more-list a, .more-list .nav-logout {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  min-height: 44px; padding: 0 16px; width: 100%;
  font-size: var(--fs-b); color: var(--ink); text-align: left;
}
.more-list a[aria-current="page"] { font-weight: 650; box-shadow: inset 3px 0 0 var(--ink); }
.more-list li + li:last-child { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 6px; }
.more-list form { margin: 0; }
.nav-logout { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 0; }

/* ---------- Bausteine ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  font: inherit; font-weight: 620; line-height: 1.2;
  color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: 8px;
  text-decoration: none; cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2C3C43; }
.btn.danger { color: var(--danger); border-color: currentColor; background: transparent; }
.btn.danger:hover { background: #FBECEA; }
.btn.wide { width: 100%; }
.small-btn { min-height: 40px; padding: 0 14px; font-size: var(--fs-s); }

.flash { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; border-left: 3px solid; background: var(--sheet); }
.flash.ok { border-color: var(--holzwickede); }
.flash.error { border-color: var(--danger); color: var(--danger); }

.warn-note { color: var(--test-ink); background: var(--test-tint); padding: 8px 12px; border-radius: 8px; margin: -4px 0 16px; font-size: var(--fs-s); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-s); font-weight: 600; line-height: 1.45; white-space: nowrap; }
.pill.test { background: var(--test-tint); color: var(--test-ink); box-shadow: inset 0 0 0 1px var(--test); }
.pill.auto { background: var(--auto); color: #fff; }

.ortsmarke { color: var(--blog, var(--ink)); font-weight: 750; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.panel { margin-top: 40px; }
.panel > h2 { margin-bottom: 16px; }

/* ---------- Prüfliste ---------- */
.queue-head { display: flex; align-items: baseline; gap: 14px; margin: 4px 0 20px; }
.queue-head h1 { font-size: var(--fs-l); }
.queue-count { margin: 0; font-size: 47px; line-height: 1; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--ink); }

.queue { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; }
.item { display: grid; gap: 14px; padding: 16px; }
.item + .item { border-top: 1px solid var(--rule); }
.item-thumb { display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--paper); }
.item-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.item-thumb.is-empty { display: none; }
.item-body { min-width: 0; }
.item-title { font-size: var(--fs-m); font-weight: 600; line-height: 1.3; margin-bottom: 6px; text-wrap: pretty; }
.item-title a { text-decoration: none; }
.item-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: var(--fs-s); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.item-alert { color: var(--danger); font-size: var(--fs-s); font-weight: 550; margin: 0 0 4px; }
.item-note { color: var(--muted); font-size: var(--fs-s); margin: 0 0 4px; }
.item-actions { display: flex; gap: 8px; margin-top: 12px; }
.item-actions form { margin: 0; flex: 1; display: flex; }
.item-actions .btn { flex: 1; }

.empty { padding: 28px 20px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; }
.empty p:first-child { font-size: var(--fs-m); line-height: 1.4; max-width: 34ch; }
.empty p:last-child { margin: 0; font-weight: 620; }

/* Blog-Status unter der Liste */
.blogs { display: grid; gap: 28px; margin-top: 40px; }
.blog { padding-left: 16px; border-left: 4px solid var(--blog); }
.blog-name { font-size: var(--fs-m); color: var(--blog); margin-bottom: 10px; }
.blog-host { color: var(--muted); font-size: var(--fs-s); font-weight: 400; margin-left: 6px; }
.blog > .muted { margin: 0; }
.modes { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.modes li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-s); }
.blog-sub { font-size: var(--fs-s); color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.upcoming { list-style: none; margin: 0; padding: 0; }
.upcoming li { padding: 8px 0; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; }
.upcoming li:first-child { border-top: 0; padding-top: 0; }
.upcoming a { font-weight: 550; text-decoration: none; }
.upcoming a:hover { text-decoration: underline; }
.upcoming .muted { font-size: var(--fs-s); font-variant-numeric: tabular-nums; }

/* ---------- Entwurf ---------- */
.draft-head { margin-bottom: 20px; max-width: 68ch; }
.draft-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; color: var(--muted); font-size: var(--fs-s); margin-bottom: 10px; }
.draft-meta .ortsmarke { font-size: var(--fs-b); }
.draft-head h1 { font-size: var(--fs-l); line-height: 1.25; text-wrap: pretty; }
.hero { margin: 0 0 24px; max-width: 68ch; }
.hero img { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--rule); }
.hero figcaption { color: var(--muted); font-size: var(--fs-s); margin-top: 6px; }

.article { max-width: 68ch; line-height: 1.6; font-size: 16px; overflow-wrap: break-word; }
.article > :first-child { margin-top: 0; }
.article p { margin: 0 0 1em; }
.article h2 { font-size: var(--fs-m); margin: 1.6em 0 .5em; }
.article h3 { font-size: 17px; margin: 1.4em 0 .4em; }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 1em; }
.article li { margin-bottom: .3em; }
.article a { color: var(--blog, var(--ink)); }
.article .anzeige { display: table; margin: 0 0 1.2em; padding: 2px 8px; border: 1px solid var(--ink); border-radius: 4px; font-size: var(--fs-s); line-height: 1.5; }
.article .anzeige strong { font-weight: 650; }
.article .quelle { margin-top: 1.6em; padding-top: 10px; border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--fs-s); }
.article .quelle a { color: inherit; }

.actionbar {
  position: sticky; z-index: 10;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  display: flex; gap: 8px;
  margin: 28px -16px 0; padding: 10px 16px;
  background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.actionbar form { margin: 0; display: flex; flex: 1; }
.actionbar .btn { flex: 1; padding: 0 8px; white-space: nowrap; }
.actionbar > form:first-child { flex: 1.2; }
.discard { margin-top: 32px; }
.back { margin-top: 24px; font-size: var(--fs-s); }

/* ---------- Formulare ---------- */
label { display: block; margin: 0 0 18px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 10px 12px;
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  background: var(--sheet); border: 1px solid #B9C2C3; border-radius: 8px;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { min-height: 120px; line-height: 1.5; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235E6B70' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-color: var(--ink); }
::placeholder { color: #6F7B80; }
fieldset { border: 0; border-top: 1px solid var(--rule); margin: 8px 0 18px; padding: 16px 0 0; min-width: 0; }
fieldset[hidden] { display: none; }
legend { font-weight: 650; font-size: var(--fs-b); padding: 0 10px 0 0; }
.form > .btn { margin-top: 4px; }
.form.panel, .blog-settings, #bearbeiten .form, .panel > .form { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 16px; }
.form.panel { margin-top: 0; }

.blog-settings { border-left: 4px solid var(--blog); margin-bottom: 24px; }
.blog-settings > h2 { color: var(--blog); margin-bottom: 18px; }
.blog-settings > .muted { margin: 0; }

/* Anmeldung */
.public-main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 28px 22px 24px; }
.login-brand { font-size: var(--fs-l); margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }

/* Fehlerseiten des Routers */
.wrap { max-width: 760px; padding: 32px 16px; }
.wrap h1 { margin-bottom: 12px; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-b); }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.table thead th { font-size: var(--fs-s); font-weight: 600; color: var(--muted); padding-top: 0; }
.table tbody th { font-weight: 400; }
.table td:last-child, .table th:last-child { padding-right: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .num-left { font-variant-numeric: tabular-nums; }
.table tr.total th, .table tr.total td { font-weight: 650; }
.table td.wrapword { overflow-wrap: anywhere; }
.cost-month { margin-bottom: 32px; }
.cost-month h2 { margin-bottom: 8px; }
.topic-cell > * { display: block; margin-top: 2px; }
.topic-cell strong { font-weight: 600; }
.blog-tag { color: var(--blog); font-weight: 650; }

/* Auf schmalen Bildschirmen stapeln */
@media (max-width: 699px) {
  .stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack-sm, .stack-sm tbody, .stack-sm tr, .stack-sm td { display: block; width: 100%; }
  .stack-sm tr { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 2px 14px; }
  .stack-sm td { width: auto; border: 0; padding: 0; font-size: var(--fs-s); color: var(--muted); }
  .stack-sm td:first-child, .stack-sm td.wrapword { width: 100%; color: var(--ink); font-size: var(--fs-b); }
  .stack-sm td.topic-cell { order: -1; }
}

/* Quellen */
.rowlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.source { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.source p { margin: 0 0 2px; }
.source.is-off .source-name strong { color: var(--muted); }
.source-name { font-size: var(--fs-b); }

/* ---------- Desktop ---------- */
@media (min-width: 700px) {
  .item { grid-template-columns: 160px 1fr; gap: 20px; padding: 20px; }
  .item-thumb { width: 160px; align-self: start; }
  .item-thumb.is-empty { display: block; border: 1px dashed var(--rule); }
  .item-actions .btn, .item-actions form { flex: none; }
  .blogs { grid-template-columns: 1fr 1fr; gap: 32px; }
  .source { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 20px; }
  .form.panel, .blog-settings, #bearbeiten .form, .panel > .form { padding: 24px; }
}

@media (min-width: 900px) {
  body { font-size: 16px; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--side);
    background: var(--sheet); border-right: 1px solid var(--rule);
    padding: 24px 0 20px;
    overflow-y: auto;
  }
  .sidebar .brand { padding: 0 24px; margin-bottom: 28px; }
  .sidebar .brand img { width: 168px; }
  .side-nav { list-style: none; margin: 0; padding: 0; }
  .side-nav a {
    display: flex; align-items: center; min-height: 40px; padding: 0 24px 0 21px;
    border-left: 3px solid transparent;
    color: var(--muted); text-decoration: none; font-size: var(--fs-b);
  }
  .side-nav a:hover { color: var(--ink); }
  .side-nav a[aria-current="page"] { border-left-color: var(--ink); color: var(--ink); font-weight: 650; }
  .side-nav a:focus-visible { outline-offset: -2px; }
  .side-foot { margin-top: auto; padding: 16px 24px 0; border-top: 1px solid var(--rule); font-size: var(--fs-s); }
  .side-foot p { margin: 0 0 8px; }
  .side-cost { color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; font-weight: 550; }
  .side-cost:hover { text-decoration: underline; }
  .side-foot .nav-logout { min-height: 32px; font-size: var(--fs-s); }
  .side-foot .nav-logout:hover { color: var(--ink); text-decoration: underline; }
  .side-foot form { margin: 0; }

  .content { margin-left: var(--side); padding: 40px 40px 80px; }
  .content > h1:first-child { margin-bottom: 24px; }
  .queue-head { margin-bottom: 24px; }
  .queue-head h1 { font-size: var(--fs-xl); }
  .queue-count { font-size: 56px; }
  .draft-head h1 { font-size: var(--fs-xl); }
  .article { font-size: 17px; }
  .actionbar { position: static; margin: 32px 0 0; padding: 16px 0; background: none; border-bottom: 0; justify-content: flex-start; }
  .actionbar form, .actionbar .btn, .actionbar > form:first-child { flex: none; }
  .actionbar .btn { padding: 0 20px; }
  .wrap { margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
