/* Blog jalogisch.de. Palette "Nordkapp" (Moto Guzzi V85 TT: weiß, blau, rot, silber),
   Werte und Kontraste aus marvin/planung/projekt-pixelpiste.md (2026-11-03).
   Systemschrift, keine externen Dateien (strenge CSP). Jede Änderung: neue Versionsnummer im Dateinamen. */

:root {
  color-scheme: light dark;
  /* Hell */
  --grund: #eeeeeb;      /* weißer Tank */
  --flaeche: #ffffff;
  --text: #1f2224;       /* Zylinderkopf, 13,8:1 */
  --gedaempft: #424444;  /* 8,4:1 */
  --blau: #1f3a63;       /* Tank, NORDKAPP-Schild; Links, Titel, 9,8:1 */
  --rot: #b53c35;        /* Schutzblech; nur Fläche, Linie, Fokus */
  --rot-text: #831a23;   /* Rahmen; Rot als Schrift, 8,5:1 */
  --linie: #b0b4b7;      /* Silber der Gabel; nie als Schrift */
  --kopf: #1f3a63;       /* Kopfleiste, auch theme-color (theme.v2.js); dunkel = Link-Blau mit dunkler Schrift (Nutzer, 2026-11-14) */
  --kopf-text: #ffffff;  /* 11,4:1 */
  --code-grund: #1d232a;
  --code-text: #eeeeeb;
  --fokus: #b53c35;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dunkel: gleicher Inhalt zweimal (Betriebssystem ohne Wahl / manuelle Wahl). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #14181d; --flaeche: #1d232a; --text: #eeeeeb; --gedaempft: #b0b4b7;
    --blau: #8fb0e6; --rot-text: #ee7a72; --linie: #5b6672; --kopf: #8fb0e6; --kopf-text: #14181d;
    --code-grund: #0f1216; --fokus: #8fb0e6;
  }
}
:root[data-theme="dark"] {
  --grund: #14181d; --flaeche: #1d232a; --text: #eeeeeb; --gedaempft: #b0b4b7;
  --blau: #8fb0e6; --rot-text: #ee7a72; --linie: #5b6672; --kopf: #8fb0e6; --kopf-text: #14181d;
  --code-grund: #0f1216; --fokus: #8fb0e6;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; } /* Sprungziele und Fokus nicht unter dem festen Kopf (WCAG 2.4.11) */
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
.wrap { width: 100%; max-width: 42rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 48rem) { body { font-size: 1.125rem; } }
main.wrap { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

a { color: var(--blau); text-underline-offset: .15em; }
a:hover { color: var(--rot-text); }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

.springen { position: absolute; left: -999px; top: 0; background: var(--flaeche); color: var(--blau); padding: .5rem 1rem; z-index: 20; }
.springen:focus { left: 1rem; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf: blaue Leiste mit rotem Streifen wie auf dem Tank */
.kopf { background: var(--kopf); color: var(--kopf-text); border-bottom: 4px solid var(--rot); position: sticky; top: 0; z-index: 10; } /* Kopf bleibt beim Scrollen oben (Nutzer, 2026-11-14) */
/* Sehr schmal (Kopf zweizeilig) oder sehr niedrig (Handy quer): Kopf scrollt mit, damit genug Platz für den Text bleibt */
@media (max-width: 359px), (max-height: 499px) { .kopf { position: relative; } html, html:has(.jahr) { scroll-padding-top: 0; } .jahr h2 { position: static; } }
.kopf .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1rem; padding-top: .25rem; padding-bottom: .25rem; }
.kopf a { color: var(--kopf-text); text-decoration: none; }
.kopf a:hover { text-decoration: underline; color: var(--kopf-text); }
.kopf :focus-visible { outline-color: var(--kopf-text); }
.marke { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; font-size: 1.35rem; letter-spacing: .02em; }
.kopf nav { display: flex; gap: .25rem; margin-right: -.6rem; }
.kopf nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .6rem; }
.kopf nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .3em; }

/* Startseite: Beiträge nach Jahr */
.jahr h2 { font-size: 1rem; color: var(--gedaempft); letter-spacing: .08em; margin: 2rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--linie);
  position: sticky; top: 3.5rem; z-index: 5; background: var(--grund); padding-top: .5rem; } /* Jahr bleibt unter dem Kopf stehen */
html:has(.jahr) { scroll-padding-top: 7rem; } /* Fokus nicht unter Kopf und Jahr */
.jahr:first-of-type h2 { margin-top: 0; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.liste a { flex: 1; padding: .65rem 0; text-decoration: none; line-height: 1.4; }
.liste a:hover { text-decoration: underline; }
.liste time { color: var(--gedaempft); font-family: var(--mono); font-size: .875rem; white-space: nowrap; }

/* Beitrag */
.beitrag h1 { color: var(--blau); font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; margin: 0 0 .4rem; overflow-wrap: anywhere; }
.meta { color: var(--gedaempft); font-size: .9rem; margin: 0 0 1.5rem; }
.tag { white-space: nowrap; }
a.tag { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .25rem; }
.tag::before { content: "#"; }
.titelbild { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; margin: 0 0 1.75rem; background: var(--flaeche); }
.portrait { display: block; width: 8rem; height: 8rem; object-fit: cover; border-radius: 50%; margin: 0 0 1.5rem; }

.text { overflow-wrap: break-word; }
.text h1, .text h2, .text h3, .text h4 { color: var(--blau); line-height: 1.25; margin: 2rem 0 .6rem; }
.text h1 { font-size: 1.5rem; } .text h2 { font-size: 1.35rem; } .text h3 { font-size: 1.15rem; } .text h4 { font-size: 1rem; }
.text img { max-width: 100%; height: auto; border-radius: 4px; }
.text figure { margin: 1.5rem 0; }
.text figcaption { color: var(--gedaempft); font-size: .875rem; margin-top: .4rem; }
.text hr { border: 0; border-top: 1px solid var(--linie); margin: 2rem 0; }
.text li { margin: .4rem 0; } /* Abstand zwischen Listenpunkten mit Links (Talks) */
.text table { border-collapse: collapse; display: block; overflow-x: auto; margin: 1.5rem 0; }
.text th, .text td { border: 1px solid var(--linie); padding: .4rem .6rem; text-align: left; }

/* Zitat und Hinweis auf alte Beiträge: roter Strich wie das Schutzblech */
.text blockquote { margin: 1.5rem 0; padding: .75rem 1rem; background: var(--flaeche); border-left: 4px solid var(--rot); border-radius: 0 4px 4px 0; }
.text blockquote > :first-child { margin-top: 0; }
.text blockquote > :last-child { margin-bottom: 0; }

/* Code: dunkler Block in beiden Modi */
code, pre, kbd { font-family: var(--mono); font-size: .875em; }
:not(pre) > code { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 3px; padding: .05em .3em; }
pre { background: var(--code-grund); color: var(--code-text); padding: 1rem; border-radius: 4px; overflow-x: auto; line-height: 1.5; tab-size: 4; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
/* Rouge (Jekyll): wenige Farben aus der Palette, alle auf --code-grund geprüft */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch, .highlight .cp { color: #b0b4b7; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .nb, .highlight .nt { color: #8fb0e6; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .dl { color: #ee7a72; }

/* Blättern */
.blaettern { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
.blaettern a { max-width: 48%; padding: .5rem 0; text-decoration: none; line-height: 1.4; }
.blaettern a:hover { text-decoration: underline; }
.blaettern a[rel="next"] { text-align: right; margin-left: auto; }
.blaettern span { display: block; color: var(--gedaempft); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }

/* Fuß und Schalter (theme.v2.js fügt .thema ein) */
.fuss { border-top: 1px solid var(--linie); color: var(--gedaempft); font-size: .9rem; }
.fuss .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-top: 1.25rem; padding-bottom: 1.5rem; }
.fuss nav { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-left: -.5rem; }
.fuss nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .5rem; }
.thema { display: flex; align-items: center; gap: .4rem; }
.thema button {
  min-height: 48px; min-width: 48px; padding: 0 .75rem; font: inherit; cursor: pointer;
  background: var(--flaeche); color: var(--text); border: 1px solid var(--gedaempft); border-radius: 4px; /* Rand 3:1 (WCAG 1.4.11), Silber reicht nicht */
}
.thema button[aria-pressed="true"] { background: var(--kopf); color: var(--kopf-text); border-color: var(--kopf); }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
/* --- Kleine Besonderheiten (Nutzer, 2026-11-14). Alles Zugabe: Browser ohne Unterstützung zeigen die Seite wie bisher. --- */

/* 3. Ruhigere Zeilenumbrüche */
h1, h2, h3 { text-wrap: balance; }
p, li, blockquote { text-wrap: pretty; }

/* 6. Markierter Text in den Farben des Kopfs */
::selection { background: var(--kopf); color: var(--kopf-text); }

/* 5. Sprungziel (zum Beispiel #english) mit rotem Strich links, Text bleibt an seinem Platz */
:target:not(main) { border-inline-start: 4px solid var(--rot); padding-inline-start: .5rem; margin-inline-start: -.75rem; }

@media (prefers-reduced-motion: no-preference) {
  /* 5. ... und kurz hinterlegt */
  :target:not(main) { animation: ziel 2.5s ease-out; }
  @keyframes ziel { from { background: color-mix(in srgb, var(--rot) 22%, transparent); } to { background: transparent; } }

  /* 2. Weiche Übergänge zwischen Seiten, der Kopf bleibt stehen */
  @view-transition { navigation: auto; }
  .kopf { view-transition-name: kopf; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }

  /* 1. Der rote Strich unter dem Kopf zeigt in Beiträgen den Lesefortschritt */
  @supports (animation-timeline: scroll()) {
    body:has(.blaettern) .kopf { border-bottom-color: color-mix(in srgb, var(--rot) 30%, var(--kopf)); }
    body:has(.blaettern) .kopf::after {
      content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
      background: var(--rot); transform-origin: 0 50%; transform: scaleX(0);
      animation: lesen linear both; animation-timeline: scroll(root);
    }
    @keyframes lesen { to { transform: scaleX(1); } }
  }
}

@media print { .kopf nav, .fuss, .blaettern, .springen { display: none; } body { background: #fff; color: #000; } }
