/* Minimales Design mit Hell/Dunkel-Modus.
 *
 * Farben stehen als `light-dark(hell, dunkel)` in Variablen. Welche Hälfte gilt,
 * entscheidet `color-scheme`: standardmäßig die Systemeinstellung, nach einem
 * Klick auf den Umschalter (`data-theme` am <html>) die gewählte Seite. */

:root {
  color-scheme: light dark;

  --bg: light-dark(#ffffff, #0f1115);
  --fg: light-dark(#1b1b1f, #e6e7ea);
  --muted: light-dark(#5f6470, #9aa0ac);
  --border: light-dark(#e3e5e9, #2a2e36);
  --accent: light-dark(#1f5fd1, #7aa8ff);
  --code-bg: light-dark(#f5f6f8, #171a20);
  --inline-code-bg: light-dark(#eef0f3, #1e222a);

  --hl-k: light-dark(#cf222e, #ff7b72);
  --hl-s: light-dark(#0a3069, #a5d6ff);
  --hl-c: light-dark(#6e7781, #8b949e);
  --hl-n: light-dark(#0550ae, #79c0ff);
  --hl-t: light-dark(#953800, #ffa657);
  --hl-f: light-dark(#8250df, #d2a8ff);
  --hl-b: light-dark(#116329, #7ee787);
  --hl-a: light-dark(#8250df, #d2a8ff);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.7 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Rahmen */

.site-header,
main,
.site-footer {
  width: min(100% - 2.5rem, 43.5rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-block: 1.25rem;
}

.brand {
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-right: auto;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.35em; }

.lang-switch {
  display: flex;
  gap: 0.6rem;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--fg); }
.lang-switch a[aria-current="true"] { color: var(--fg); font-weight: 700; }

.theme-toggle {
  display: inline-flex;
  padding: 0.4rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--fg); background: var(--inline-code-bg); }

main { flex: 1; padding-block: 1.5rem 3rem; }

.site-footer {
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer p { margin: 0; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 0.75rem;
}
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--fg); }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.breadcrumbs a { color: var(--muted); }

/* Seitenkopf */

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.tag {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* Inhalt */

.content > :first-child { margin-top: 0; }

.content h1, .content h2, .content h3, .content h4 {
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
}
.content h2 { font-size: 1.5rem; }
.content h3 { font-size: 1.25rem; }
.content h4 { font-size: 1.0625rem; }

.anchor {
  margin-left: 0.4em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}
:is(h1, h2, h3, h4, h5, h6):hover > .anchor,
.anchor:focus-visible { opacity: 1; }

.content p, .content ul, .content ol { margin: 0 0 1rem; }
.content li > p { margin-bottom: 0.5rem; }
.content ul, .content ol { padding-left: 1.5rem; }
.content li { margin: 0.2rem 0; }
.content li.task { list-style: none; margin-left: -1.25rem; }

.content hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.content blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* Code */

code, pre { font-family: var(--mono); }

:not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: var(--inline-code-bg);
  font-size: 0.875em;
}

.code {
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-caption {
  padding: 0.35rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font: 0.8125rem var(--mono);
}

.code pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.55;
  tab-size: 4;
}

.hl-k { color: var(--hl-k); }
.hl-s { color: var(--hl-s); }
.hl-c { color: var(--hl-c); font-style: italic; }
.hl-n { color: var(--hl-n); }
.hl-t { color: var(--hl-t); }
.hl-f { color: var(--hl-f); }
.hl-b { color: var(--hl-b); }
.hl-a { color: var(--hl-a); }

/* Medien */

.content img,
.content video {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.content video { width: 100%; background: #000; }
.content audio { display: block; width: 100%; }

.content p > img { display: inline-block; vertical-align: middle; }

.content figure { margin: 1.5rem 0; }
.content figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Tabellen */

.content table {
  display: block;
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.content th, .content td {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.content thead th { border-bottom-width: 2px; }
.content .align-center { text-align: center; }
.content .align-right { text-align: right; }

/* Beitragsliste */

.post-list { margin-top: 2.5rem; }
.post-list h2 { margin: 0 0 0.75rem; font-size: 1.25rem; }
.post-list ul { margin: 0; padding: 0; list-style: none; }
.post-list li { padding: 0.9rem 0; border-top: 1px solid var(--border); }
.post-list li:last-child { border-bottom: 1px solid var(--border); }
.post-title { font-weight: 600; font-size: 1.125rem; text-decoration: none; }
.post-title:hover { text-decoration: underline; }
.post-list time { margin-left: 0.5rem; color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.post-list p { margin: 0.25rem 0 0; color: var(--muted); }

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .page-header h1 { font-size: 1.65rem; }
  .site-header { flex-wrap: wrap; }
}
