/* dm2tim.de — Dark/technisches Theme (Schwesterseite zu clrsrc.de). Keine externen Abhängigkeiten. */

:root {
  /* Sagt dem Browser, dass die Seite dunkel ist: native Scrollbalken, Formularfelder,
     Auswahllisten und das Standard-Canvas rendern dann im dunklen System-Look statt hell. */
  color-scheme: dark;

  --bg:        #0d1117;
  --bg-grad:   #0a0d12;
  --surface:   #161b22;
  --surface-2: #1c232c;
  --border:    #30363d;
  --text:      #c9d1d9;
  /* War #8b949e = 6,15:1 auf --bg / 5,62 auf --surface / 5,15 auf --surface-2:
     durchweg WCAG AA, aber nirgends AAA (7:1). Da diese Farbe auch inhaltlich
     wichtige Kartentexte und 0,82-rem-Fusszeilen traegt, jetzt 8,32 / 7,60 / 6,96. */
  --text-dim:  #a3adb8;
  --accent:    #4dabf7;   /* Funk-Blau */
  --accent-2:  #56d4dd;   /* Cyan / Signal */
  --danger:    #f85149;
  --radius:    10px;
  --maxw:      1080px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(77,171,247,0.09), transparent 60%),
    radial-gradient(900px 500px at 10% 0%, rgba(86,212,221,0.06), transparent 55%),
    var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Dezentes Frequenzskala-/Waterfall-Muster im Hintergrund */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.014) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.010) 0 1px, transparent 1px 42px);
  pointer-events: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Barrierefreiheit ---------- */

/* Sichtbarer Fokus-Indikator. Ohne diese Regel bleibt nur der Browser-Standard,
   der auf dunklem Grund kaum zu erkennen ist. :focus-visible blendet ihn nur bei
   Tastaturbedienung ein, nicht beim Mausklick. */
:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 3px;
}
/* Fallback für Browser ohne :focus-visible — Default-Ring nur bei Maus unterdrücken */
:focus:not(:focus-visible) { outline: none; }

/* Skip-Link: liegt vor der Navigation und wird erst bei Tastatur-Fokus sichtbar */
.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  padding: 10px 16px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--radius);
  font-weight: 600;
  transition: top .12s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* Sprungziel nicht unter dem sticky Header verstecken */
#inhalt { scroll-margin-top: 76px; }

/* Bewegung reduzieren, wenn das Betriebssystem es verlangt (u. a. der pulsierende
   Live-Punkt und das weiche Scrollen). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header / Nav ---------- */
header.site {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(13,17,23,0.78);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg, .brand img { width: 28px; height: 28px; }
.brand b { color: var(--accent); }
.nav .spacer { flex: 1; }
.nav a.link { color: var(--text-dim); font-size: 0.95rem; }
.nav a.link:hover, .nav a.link.active { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* Basis: horizontale Nav (Desktop). MUSS VOR dem @media stehen, sonst überschreibt
   diese Regel das display:none im @media und das Mobil-Menü bliebe dauerhaft offen. */
.nav .links { display: flex; align-items: center; gap: 18px; }

@media (max-width: 860px) {
  /* min-* statt nur Padding: die Tippflaeche haengt sonst an der Schriftgroesse
     des Glyphs und lag gemessen bei 38x39 px. So sind 44x44 px garantiert. */
  .nav-toggle { display: block; padding: 10px 12px; min-width: 44px; min-height: 44px; }
  .nav .links { display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 4px 20px; gap: 0;
    /* stretch statt des geerbten center: sonst schrumpfen die Links auf ihre
       Textbreite - gemessen 30,9 px fuer "Start" in einem 500 px breiten Menue.
       Die Hoehe allein macht das Menue nicht treffsicher, die Breite fehlte. */
    align-items: stretch; }
  .nav .links.open { display: flex; }
  .nav .spacer { display: none; }
  /* Touch-Ziele: die Links sind reiner Text, als Inline-Element nur ~25 px hoch.
     display:block + Padding bringt die Tippflaeche auf ~49 px (WCAG-Minimum 24 px,
     komfortabel ab 44 px). Padding STATT gap - sonst addieren sich beide und das
     Menue wird unnoetig lang. text-align haelt die gewohnte zentrierte Optik,
     waehrend die ganze Zeilenbreite tippbar wird. */
  .nav .links a.link { display: block; padding: 12px 0; text-align: center; }
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 48px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; margin: 0 0 16px; }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.2rem; color: var(--text-dim); max-width: 680px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.badge {
  font-family: var(--mono); font-size: 0.8rem; color: var(--accent-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: transform .08s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #06121f; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------- Cards / Grid ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 860px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

/* Geräte-Skizzen in Karten */
.card img.gear {
  display: block; width: 100%; height: auto;
  border-radius: 8px; background: var(--bg-grad);
  border: 1px solid var(--border); margin-bottom: 14px;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: border-color .15s ease, transform .1s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--text-dim); }
/* Karten mit zwei Abs\xe4tzen (Beschreibung + Ziel), wie auf der Core-War-Startseite:
   ohne Abstand liest sich die Zielzeile als Fortsetzung des Flie\xdftextes. */
.card p + p { margin-top: 12px; }
.card p.ziel { color: var(--accent); font-size: 0.9rem; }
.card .ico { font-size: 1.6rem; margin-bottom: 6px; }

/* ---------- Sections ---------- */
section { padding: 40px 0; }
section h2 { font-size: 1.7rem; margin: 0 0 6px; }
section .sub { color: var(--text-dim); margin: 0 0 24px; }
.eyebrow { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Feature list ---------- */
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.features li { display: flex; gap: 12px; align-items: flex-start; }
.features li .mark { color: var(--accent); font-family: var(--mono); flex: none; }
.features li b { color: var(--text); }

/* ---------- Code / Mono ---------- */
code, .mono { font-family: var(--mono); }
pre.code {
  background: var(--bg-grad); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 0.88rem;
  color: var(--text); line-height: 1.55;
}
pre.code .c { color: var(--text-dim); }
pre.code .k { color: var(--accent-2); }
pre.code .g { color: var(--accent); }

/* ---------- Status-Badge (z. B. "on air") ---------- */
.live-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.9rem; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.dot.live { background: var(--accent); box-shadow: 0 0 0 0 rgba(77,171,247,0.6); animation: pulse 1.8s infinite; }
.dot.idle { background: var(--text-dim); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(77,171,247,0.5);} 70%{box-shadow:0 0 0 10px rgba(77,171,247,0);} 100%{box-shadow:0 0 0 0 rgba(77,171,247,0);} }

/* ---------- Info-Tabelle ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.info-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.info-table th, .info-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.info-table th { color: var(--text-dim); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.info-table td.mono { font-family: var(--mono); }

/* ---------- Blog ---------- */
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.post-list a.post { display: block; }
.post-list .meta { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); }
article.prose { max-width: 760px; }
article.prose h1 { font-size: 2.1rem; line-height: 1.15; margin: 0 0 8px; }
article.prose h2 { margin-top: 36px; }
article.prose p, article.prose li { color: var(--text); }
article.prose .meta { font-family: var(--mono); color: var(--text-dim); margin-bottom: 28px; }
article.prose img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
article.prose blockquote { border-left: 3px solid var(--accent); margin: 0; padding: 4px 16px; color: var(--text-dim); }

/* Platzhalter-Hinweis für Seiten im Aufbau */
.placeholder {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 20px 22px; color: var(--text-dim); background: var(--surface);
}

/* ---------- Footer ---------- */
footer.site { border-top: 1px solid var(--border); margin-top: 60px; padding: 32px 0; color: var(--text-dim); font-size: 0.9rem; }
footer.site .cols { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
footer.site a { color: var(--text-dim); }
footer.site a:hover { color: var(--text); }
footer.site .legal a { margin-right: 16px; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- Wer-schlaegt-wen-Explorer (/corewar/explorer.html) ---------- */
.cw-input {
  width: 100%; max-width: 460px; margin: 6px 0 10px;
  padding: 10px 12px; font-size: 1rem; font-family: var(--sans);
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
#cw-explorer label { display: block; font-weight: 600; }
.cw-treffer { list-style: none; padding: 0; margin: 0 0 14px; max-width: 460px; }
.cw-treffer li { margin: 0 0 4px; }
.cw-treffer-btn {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 8px 12px; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
}
.cw-treffer-btn:hover { border-color: var(--accent); }
.cw-kopf { margin: 18px 0 6px; }
.cw-kopf h2 { margin: 0; }
/* Zwei Ranglisten nebeneinander, auf schmalen Displays untereinander */
.cw-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 14px; }
@media (max-width: 700px) { .cw-zwei { grid-template-columns: 1fr; } }
.cw-liste h3 { margin: 0 0 8px; font-size: 1rem; }
.cw-rang { list-style: none; padding: 0; margin: 0; }
.cw-rang li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.cw-wert {
  font-family: var(--mono); font-weight: 700; color: var(--accent);
  min-width: 3.6em; text-align: right; flex: none;
}
.cw-vergleich { margin-top: 28px; }
.cw-vergleich h3 { margin: 0 0 8px; }

/* ---------- Core-War-Arena (/corewar/arena) ---------- */
/* Zwei Quelltextfelder nebeneinander, auf schmalen Displays untereinander. */
.cw-arena-quellen { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
@media (max-width: 760px) { .cw-arena-quellen { grid-template-columns: 1fr; } }
.cw-arena-quellen label { display: block; font-weight: 600; margin-bottom: 6px; }
.cw-arena-code {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--mono); font-size: .86rem; line-height: 1.45;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-grad); color: var(--text);
}
.cw-arena-code:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.cw-arena-tempo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.cw-arena-tempo label { font-weight: 600; flex: none; }
.cw-arena-tempo input[type="range"] { flex: 1 1 240px; min-width: 180px; accent-color: var(--accent); }

/* Das Raster. image-rendering: pixelated haelt die Zellkanten scharf, wenn der
   Browser die Leinwand skaliert - sonst verwaschen 3-px-Zellen zu Brei. */
.cw-arena-core {
  display: block; width: 100%; height: auto; margin: 10px 0;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); image-rendering: pixelated;
}

.cw-arena-legende { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.cw-arena-punkt {
  display: inline-block; width: 11px; height: 11px; border-radius: 2px;
  vertical-align: middle; flex: none;
}

/* Assembler-Warnungen: sichtbar, aber nicht alarmierend - sie halten den Kampf
   nicht auf. Deshalb gedaempft und ohne Rot. */
.cw-arena-hinweise { list-style: none; padding: 0; margin: 6px 0; }
.cw-arena-hinweise li {
  padding: 5px 10px; margin: 0 0 4px; border-radius: 6px;
  border-left: 3px solid var(--border); background: var(--surface);
}

.cw-arena-bericht { margin-top: 26px; }
.cw-arena-bericht h2 { margin-bottom: 6px; }

/* ---------- Arena-Auswahl "Wer gegen wen?" ---------- */
.cw-arena-wahl { margin: 8px 0 28px; }
.cw-arena-wahl > .muted { margin-top: 0; }

.cw-wahl-liste { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
/* Die Kachel-Optik sitzt am <li>; darin die Schaltflaeche (Titel, Namen,
   Erklaerung) und daneben die Fusszeile mit dem Weiterlesen-Link. Der Link darf
   NICHT in den Button - <button> vertraegt kein interaktives Kindelement. */
.cw-wahl-paarung {
  padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .15s ease;
}
.cw-wahl-paarung:hover { border-color: var(--accent); }
/* Die Schaltflaeche selbst ist unsichtbar - sie traegt keine eigene Optik,
   sondern fuellt die Kachel. font: inherit, sonst greift die Browser-Schrift. */
.cw-wahl-knopf {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
}
.cw-wahl-knopf:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cw-wahl-titel { display: block; font-weight: 700; }
.cw-wahl-ab { display: block; font-family: var(--mono); font-size: .82rem; color: var(--text-dim); margin: 1px 0 6px; }
.cw-wahl-achten { display: block; font-size: .9rem; }
.cw-wahl-fuss { display: block; font-size: .82rem; color: var(--text-dim); margin-top: 8px; }
.cw-wahl-fuss b { color: var(--accent); font-family: var(--mono); }

/* Der Clear-Kasten unter der Clear-Paarung. */
.cw-wahl-kasten { margin: 6px 0 0 14px; font-size: .9rem; }
.cw-wahl-kasten summary { cursor: pointer; color: var(--accent); padding: 4px 0; }
/* 6 px reichten, solange ein Kasten aus EINEM Absatz bestand. Der Raster-Kasten
   hat sechs - da klebt der Text sonst zu einem Block zusammen. Die Tippflaeche
   der Zusammenfassung bekommt ausserdem etwas mehr Hoehe. */
.cw-wahl-kasten p { margin: 10px 0 0; color: var(--text-dim); line-height: 1.55; }
.cw-wahl-kasten summary { padding: 6px 0; }

.cw-wahl-frei { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.cw-wahl-frei h3 { flex-basis: 100%; margin: 0 0 2px; font-size: 1rem; }
.cw-wahl-frei label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.cw-wahl-select {
  font-family: var(--sans); font-size: .9rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  max-width: 100%;
}
.cw-wahl-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.cw-wahl-hinweis { margin-top: 18px; border-left: 3px solid var(--border); padding-left: 12px; }
.cw-wahl-hinweis p { margin: 0 0 8px; }
.cw-wahl-hinweis p:last-child { margin-bottom: 0; }

.cw-arena-verlauf { list-style: none; padding: 0; margin: 0; max-width: 560px; }
.cw-arena-verlauf li { margin: 0 0 4px; }

/* Blaetternavigation im Lernpfad (/corewar/): zurueck links, weiter rechts.
   Stapelt auf schmalen Displays, damit lange Kapiteltitel nicht gequetscht werden. */
.stepnav { display: flex; justify-content: space-between; gap: 16px; font-weight: 600; }
@media (max-width: 560px) {
  .stepnav { flex-direction: column; gap: 10px; }
}
.center { text-align: center; }
.muted { color: var(--text-dim); }
.small { font-size: 0.88rem; }
/* Für Screenreader sichtbar, visuell ausgeblendet (semantische Überschriften) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
