/* Karussell-Planer: tokens mirror the slide design system (posts/skill/design-system.md) */
/* self-hosted: no visitor IPs to Google Fonts (GDPR) */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/archivo-latin-wght-normal.woff2") format("woff2");
}

:root {
  --tanne: #0c3a22;
  --tanne-hover: #14502f;
  --klee: #3c8c3a;
  --klee-dark: #2b6b2a; /* white text on it passes WCAG AA at small sizes */
  --sonne: #ffe200;
  --sand: #f4f0e4;
  --paper: #fbf9f3;
  --tinte: #082815;
  --muted: #5b6b60;
  --line: #ddd5c0;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --ok-bg: #e5f1e3;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(8, 40, 21, .06), 0 8px 24px rgba(8, 40, 21, .08);
  --space: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--tinte);
  font: 500 16px/1.5 var(--font);
}
a { color: var(--tanne); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 900; }
h2 { font-size: 1.1rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- layout ---------- */
.topbar { background: var(--tanne); color: var(--sand); }
.topbar__inner, .container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--sand); text-decoration: none; font-weight: 900; font-size: 1.1rem; }
.brand__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sonne); box-shadow: 0 0 0 4px rgba(255, 226, 0, .25); }
.topbar nav { display: flex; align-items: center; gap: .5rem; }
.topbar nav a { color: var(--sand); text-decoration: none; font-weight: 700; padding: .5rem .75rem; border-radius: 999px; }
.topbar nav a:hover { background: rgba(244, 240, 228, .1); }
.topbar form { margin: 0; }
main.container { padding-top: 2rem; padding-bottom: 7rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.section { margin-top: 2.25rem; }

/* ---------- buttons ---------- */
.btn, button {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.2rem; border-radius: 999px;
  font: 800 .95rem/1 var(--font); text-decoration: none;
  background: var(--tanne); color: var(--sand);
  transition: background .15s ease, transform .08s ease;
}
.btn:hover, button:hover { background: var(--tanne-hover); }
.btn:active, button:active { transform: translateY(1px); }
.btn--primary { background: var(--sonne); color: var(--tinte); }
.btn--primary:hover { background: #f2d600; }
.btn--ghost { background: transparent; color: var(--tanne); box-shadow: inset 0 0 0 2px var(--tanne); }
.btn--ghost:hover { background: rgba(12, 58, 34, .06); }
.btn--light { background: transparent; color: var(--sand); box-shadow: inset 0 0 0 2px rgba(244, 240, 228, .4); }
.btn--light:hover { background: rgba(244, 240, 228, .1); }
.btn--danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); }
.btn--danger:hover { background: var(--danger-bg); }
.btn--sm { min-height: 36px; padding: .4rem .9rem; font-size: .85rem; }
button:disabled, button[aria-busy="true"] { opacity: .6; cursor: progress; }
button[aria-busy="true"]::before {
  content: ""; width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 1rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: .35rem;
  font: 500 1rem/1.45 var(--font); color: var(--tinte);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: .65rem .8rem;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--tanne); box-shadow: 0 0 0 3px rgba(255, 226, 0, .6); }
.hint { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; }

/* ---------- surfaces ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.alert { border-radius: var(--radius-sm); padding: .85rem 1rem; margin: 0 0 1rem; font-weight: 600; background: var(--ok-bg); border-left: 5px solid var(--klee); }
.alert--error { background: var(--danger-bg); border-left-color: var(--danger); }
.alert--warn { background: #fff8c2; border-left-color: #c9a800; }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: #e6e2d6; color: var(--tinte); }
.badge--scheduled { background: var(--sonne); }
.badge--publishing { background: #cfe3f7; }
.badge--published { background: var(--klee-dark); color: #fff; }
.badge--failed { background: var(--danger); color: #fff; }
.badge--type { background: var(--tanne); color: var(--sand); }
.badge--type-sun { background: var(--sonne); color: var(--tinte); }

/* ---------- post list ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
.post-card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease; }
.post-card:hover { transform: translateY(-2px); }
.post-card__thumb { position: relative; display: block; aspect-ratio: 4 / 5; background: var(--tanne); }
.post-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card__empty { display: grid; place-items: center; height: 100%; color: rgba(244, 240, 228, .6); font-weight: 700; }
.post-card__body { padding: 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.post-card__title { font-weight: 800; color: var(--tinte); text-decoration: none; }
.post-card__meta { color: var(--muted); font-size: .85rem; }
.post-card__error { color: var(--danger); font-size: .85rem; }
.post-card__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }
.post-card__actions form { margin: 0; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- editor ---------- */
.editor { display: grid; gap: 1.5rem; }
@media (min-width: 960px) {
  .editor { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
  .editor__preview { position: sticky; top: 1rem; }
}
.preview { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.preview img { width: 100%; border-radius: var(--radius-sm); box-shadow: var(--shadow); display: block; background: var(--tanne); }
.preview-empty { padding: 2rem; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.slide-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; overflow: hidden; }
.slide-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; font-weight: 800; }
.slide-card summary::-webkit-details-marker { display: none; }
.slide-card summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--muted); }
.slide-card[open] summary::after { content: "\2212"; }
.slide-card__body { padding: 0 1.1rem .4rem; }
.slide-card__label { text-transform: capitalize; }

.actionbar { position: sticky; bottom: 0; z-index: 10; background: var(--tanne); color: var(--sand); box-shadow: 0 -8px 24px rgba(8, 40, 21, .2); }
.actionbar__inner { max-width: 1200px; margin: 0 auto; padding: .75rem 1.25rem; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.actionbar form { display: flex; align-items: flex-end; gap: .5rem; margin: 0; flex-wrap: wrap; }
.actionbar label { margin: 0; color: var(--sand); font-size: .75rem; }
.actionbar input { margin-top: .2rem; min-height: 44px; width: auto; }

/* ---------- centered forms (new, login) ---------- */
.narrow { max-width: 720px; margin: 0 auto; }
.busy-note { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; padding: .85rem 1rem; border-radius: var(--radius-sm); background: #fff8c2; font-weight: 600; }
.auth { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth .card { width: 100%; max-width: 420px; }
.auth button { width: 100%; }
[x-cloak] { display: none !important; }
@media (min-width: 720px) {
  .actionbar { position: fixed; left: 0; right: 0; }
}
@media (max-width: 719px) {
  main.container { padding-bottom: 2rem; }
  .actionbar { position: static; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .post-card__body { padding: .75rem; }
  .post-card__title { font-size: .95rem; }
  .actionbar__inner > button { width: 100%; }
}
.h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 900; letter-spacing: -.01em; text-transform: none; color: var(--tinte); }

/* ---------- calendar ---------- */
.cal-nav { display: flex; gap: .5rem; }
.cal { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.cal th { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 .4rem; }
.cal-day { vertical-align: top; height: 7.5rem; padding: .4rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cal-day--out { opacity: .5; }
.cal-day--today { box-shadow: inset 0 0 0 3px var(--sonne); }
.cal-date { display: block; font-weight: 800; font-size: .85rem; margin-bottom: .3rem; }
.cal-today { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; background: var(--sonne); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.cal-weekday { display: none; }
.cal-chip { display: block; margin-bottom: .25rem; padding: .25rem .45rem; border-radius: 6px; font-size: .78rem; font-weight: 700; line-height: 1.25; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #e6e2d6; color: var(--tinte); }
.cal-chip:hover { filter: brightness(.95); }
.cal-chip--scheduled { background: var(--sonne); }
.cal-chip--publishing { background: #cfe3f7; }
.cal-chip--published { background: var(--klee-dark); color: #fff; }
.cal-chip--failed { background: var(--danger); color: #fff; }
.cal-time { font-variant-numeric: tabular-nums; }
@media (max-width: 719px) {
  /* agenda list: only days with posts */
  .cal, .cal tbody, .cal tr, .cal td { display: block; width: 100%; }
  .cal thead, .cal .cal-day--empty:not(.cal-day--today) { display: none; }
  .cal-day { height: auto; margin-bottom: .5rem; }
  .cal-weekday { display: inline; }
  .cal-chip { white-space: normal; font-size: .9rem; padding: .5rem .6rem; }
}
@media (max-width: 719px) {
  .topbar nav { flex-wrap: wrap; gap: .25rem; }
  .topbar nav a { padding: .4rem .5rem; }
}

/* ---------- statistics ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem .9rem; display: flex; flex-direction: column; }
.kpi__value { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.table-scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.stats { width: 100%; border-collapse: collapse; font-size: .9rem; }
.stats th, .stats td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.stats thead a { color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.stats thead a[aria-current] { color: var(--tinte); }
.stats .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats__post { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--tinte); font-weight: 700; white-space: normal; min-width: 14rem; }
.stats__post img { width: 40px; height: 50px; object-fit: cover; border-radius: 4px; }
.stats__post small { display: block; color: var(--muted); font-weight: 500; }
.chart { margin: 1.25rem 0 .5rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart__axis { stroke: var(--line); stroke-width: 1; }
.chart__tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart__line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--views { stroke: var(--tanne); }
.chart__line--reach { stroke: var(--klee); stroke-dasharray: 6 5; }
.chart__legend { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
.chart__key { font-weight: 800; color: var(--tinte); margin-right: .75rem; }
.chart__key::before { content: ""; display: inline-block; width: 18px; height: 0; margin-right: .35rem; vertical-align: middle; border-top: 3px solid var(--tanne); }
.chart__key--reach::before { border-top: 3px dashed var(--klee); }

.sources { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: .5rem; }
.sources a { word-break: break-all; font-size: .9rem; }
