/* =========================================================================
   binary and analog — Stylesheet
   Konzept: Kontrast aus digital & analog.
   - Überschriften/Meta: Monospace (das "binäre")
   - Fließtext: Serife (das "analoge", warm & lesbar)
   - Farbe: Schwarz-Weiß + warmes Orange/Bernstein als einziger Akzent
   - Standard: helle Ansicht. Dark Mode per Umschalter (data-theme="dark").
   ========================================================================= */

/* --- Farb- & Design-Variablen: HELL (Standard) --- */
:root {
  --bg:        #f6f2ea;   /* warmes Papier */
  --surface:   #fffdf8;   /* Karten/Flächen */
  --text:      #1b1a17;   /* fast Schwarz, leicht warm */
  --muted:     #6d685d;   /* gedämpft für Meta */
  --accent:    #c0530f;   /* Bernstein/Orange – der eine Akzent */
  --accent-soft:#f0e4d4;  /* zarte Akzentfläche */
  --border:    #e4ddcd;
  --border-strong:#d3c9b4;
  --code-bg:   #fbf7ef;

  /* Nunito (selbst gehostet) für den Fließtext, Monospace für Überschriften. */
  --font-sans:  "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", "Roboto Mono", Consolas, monospace;

  --wrap: 46rem;
  --radius: 6px;
}

/* --- Farb-Variablen: DUNKEL --- */
[data-theme="dark"] {
  --bg:        #14130f;
  --surface:   #1c1a14;
  --text:      #ece7db;
  --muted:     #9c968a;
  --accent:    #f0873a;   /* helleres Bernstein für dunklen Grund */
  --accent-soft:#2a2318;
  --border:    #2e2a20;
  --border-strong:#3c3729;
  --code-bg:   #1a1810;
}

/* --- Grundlagen --- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.075rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* --- Kopfzeile --- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 1rem; padding-bottom: 1rem;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .55rem;
  font-family: var(--font-mono);
  font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark {
  font-family: var(--font-mono);
  background: var(--accent); color: #fff;
  padding: .05em .35em; border-radius: 4px; font-size: .8em;
  letter-spacing: .05em;
}
.brand-name .amp { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: .82rem; color: var(--muted); text-decoration: none;
  letter-spacing: .01em; text-transform: lowercase;
}
.site-nav a:hover { color: var(--accent); }

/* --- Dark-Mode-Umschalter --- */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-icon { font-size: .95rem; line-height: 1; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* Kopf-Umschalter (Sprache + Ansicht) nebeneinander */
.header-toggles { display: inline-flex; align-items: center; gap: .5rem; margin-left: .3rem; }

/* Sprach-Umschalter: Globus-Icon bzw. Kürzel DE/EN */
.lang-toggle .lang-current { display: inline-flex; }
.lang-toggle svg { display: block; }
.lang-toggle .lang-code {
  font-family: var(--font-mono); font-size: .74rem; font-weight: 700;
  line-height: 1; letter-spacing: .01em;
}
.theme-toggle.is-filtering { border-color: var(--accent); color: var(--accent); }

/* --- Hauptbereich --- */
main { padding-top: 2.5rem; padding-bottom: 4rem; min-height: 60vh; }

/* --- Beitragsliste --- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 1.6rem 0; border-bottom: 1px solid var(--border); }
.post-item:first-child { padding-top: 0; }

.post-meta {
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.dot { opacity: .5; }
.lang-badge {
  border: 1px solid var(--border-strong); border-radius: 3px;
  padding: 0 .35em; font-size: .72rem; letter-spacing: .04em;
}

.post-title { font-family: var(--font-mono); font-weight: 600; letter-spacing: -.02em;
  font-size: 1.35rem; line-height: 1.3; margin: .5rem 0 .4rem; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent); }

.post-summary { margin: .3rem 0 .7rem; color: var(--text); }

/* --- Tags --- */
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-family: var(--font-mono); font-size: .74rem; text-decoration: none;
  color: var(--muted); background: var(--accent-soft);
  padding: .12rem .5rem; border-radius: 999px;
}
.tag:hover { color: var(--accent); }

/* --- Einzelner Beitrag --- */
.post-header { margin-bottom: 2rem; }
.post-title-lg {
  font-family: var(--font-mono); font-weight: 700; letter-spacing: -.03em;
  font-size: clamp(1.7rem, 5vw, 2.5rem); line-height: 1.15; margin: .6rem 0 .8rem;
}
.post-hero { width: 100%; border-radius: var(--radius); margin: 0 0 2rem; border: 1px solid var(--border); }

.post-body { font-size: 1.1rem; }
.post-body > *:first-child { margin-top: 0; }
.post-body h2 { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: -.02em;
  margin: 2.4rem 0 .8rem; padding-top: .2rem; }
.post-body h3 { font-family: var(--font-mono); font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
.post-body p { margin: 1.1rem 0; }
.post-body a { text-decoration: underline; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li { margin: .35rem 0; }

.post-body blockquote {
  margin: 1.6rem 0; padding: .3rem 0 .3rem 1.2rem;
  border-left: 3px solid var(--accent); color: var(--muted); font-style: italic;
}
.post-body img { border-radius: var(--radius); border: 1px solid var(--border); }

/* Zitat-/Bild-Unterschriften über Markdown: *kursiv* direkt nach Bild */
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* --- Code --- */
.post-body code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--code-bg); border: 1px solid var(--border);
  padding: .1em .4em; border-radius: 4px;
}
.post-body pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; overflow-x: auto;
  font-size: .92rem; line-height: 1.55;
}
.post-body pre code { background: none; border: none; padding: 0; font-size: 1em; }
.highlight { background: transparent !important; }

/* --- Tabellen --- */
.post-body table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; font-size: .95rem; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: .5rem .7rem; text-align: left; }
.post-body th { background: var(--accent-soft); font-family: var(--font-mono); font-size: .85rem; }

/* --- Fuß-Navigation im Beitrag --- */
.post-footer-nav { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: .85rem; }
.post-footer-nav a { text-decoration: none; }

/* --- Seiten (Über mich, Impressum) --- */
.page-lead { color: var(--muted); font-family: var(--font-mono); font-size: .9rem; }

/* --- Tag-Cloud --- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; line-height: 2.2; }
.tag-cloud-item {
  font-family: var(--font-mono); text-decoration: none; color: var(--text);
  display: inline-flex; align-items: baseline; gap: .2rem;
}
.tag-cloud-item:hover { color: var(--accent); }
.tag-count { font-size: .6em; color: var(--muted); vertical-align: super; }

/* --- Tag-Cloud in der Fußzeile (auf jeder Seite) --- */
.footer-tags { border-top: 1px solid var(--border); padding: 2rem 0 .5rem; margin-top: 3rem; }
.footer-tags-title {
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
  text-transform: lowercase; letter-spacing: .06em; margin: 0 0 .9rem;
}
.footer-tags .tag-cloud { line-height: 1.9; }

/* --- Fußzeile --- */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  font-family: var(--font-mono); font-size: .8rem; color: var(--muted); flex-wrap: wrap;
}
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

.empty { color: var(--muted); font-family: var(--font-mono); font-size: .95rem; }

/* --- Barrierefreiheit: Fokus sichtbar --- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

@media (max-width: 34rem) {
  body { font-size: 1.05rem; }
  .site-nav { gap: .8rem; }
  .site-nav a { font-size: .78rem; }
  .header-inner { flex-wrap: wrap; }
}
