/* ==========================================================================
   schweigertIT – base.css
   Gemeinsame Grundlage ALLER Seiten: Reset, Design-Tokens (beide Modi),
   Typografie, Layout-Container, Header inkl. Modus-Umschalter, Buttons,
   Footer und Fokus-Stile.

   Modus-Umschaltung: Das Attribut data-mode am <html>-Element steuert die
   Tokens. Ohne Attribut (oder mit data-mode="blue") gilt der helle
   Defense-Modus, mit data-mode="red" der dunkle Offense-Modus.
   ========================================================================== */

/* ---------- Schriften (selbst gehostet, keine Fremdressourcen) ----------
   IBM Plex Serif, SIL Open Font License – Lizenz liegt in assets/fonts/.
   Nur für Überschriften; Fließtext bleibt Systemschrift. */
@font-face {
  font-family: "IBM Plex Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexSerif-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Serif";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/IBMPlexSerif-SemiBold.woff2") format("woff2");
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ==========================================================================
   Design-Tokens
   ========================================================================== */

/* ---------- Modusunabhängig: Schriften, Maße, Timing ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;

  --radius: 6px;
  --radius-sm: 4px;
  --section-pad: clamp(4.5rem, 9vw, 7rem);
  --container: 1120px;      /* Seitenbreite, einheitlich für alle Seiten */
  --measure: 46rem;         /* Lesebreite für Fließtext (Writeups/Advisories) */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --mode-transition: background-color 0.45s var(--ease), color 0.45s var(--ease),
                     border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);

  /* Terminal- und Code-Flächen bleiben in BEIDEN Modi dunkel:
     eigene, modusunabhängige Farbwerte. */
  --terminal-bg: #05070a;
  --terminal-text: #d8dde6;
  --code-bar-bg: #101319;
  --code-bar-border: #232834;
  --code-bar-text: #7c8492;
}

/* ---------- Helle Tokens: Defense / Blue Team (Standard) ---------- */
:root,
:root:not([data-mode="red"]) {
  --font-accent: var(--font-sans);

  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #eef3fa;
  --surface-hover: #f2f6fd;
  --text: #0e2038;
  --text-muted: #4d6076;
  --text-faint: #5b6d82;
  --accent: #1a56db;
  --accent-strong: #1244b8;
  --accent-contrast: #ffffff;   /* Textfarbe auf Akzentflächen */
  --accent-soft: #e5edfc;
  --accent-soft-border: #c9d9f6;
  --border: #dbe4f0;
  --border-strong: #c2cfe0;
  --tint: rgba(14, 32, 56, 0.035);  /* sehr dezente Flächenaufhellung */
  --shadow-sm: 0 1px 2px rgba(14, 32, 56, 0.06);
  --shadow-md: 0 6px 24px -8px rgba(14, 32, 56, 0.14);
  --shadow-lg: 0 12px 32px -16px rgba(14, 32, 56, 0.18);
  --header-bg: rgba(246, 248, 252, 0.85);
}

/* ---------- Dunkle Tokens: Offense / Red Team ---------- */
:root[data-mode="red"] {
  --font-accent: var(--font-mono);

  --bg: #0a0c10;
  --surface: #12151d;
  --surface-2: #171b25;
  --surface-hover: #1a1f2a;
  --text: #e9ecf2;
  --text-muted: #9aa3b2;
  --text-faint: #8b94a3;
  --accent: #f04d5a;
  --accent-strong: #ff6b73;
  --accent-contrast: #0a0c10;   /* Textfarbe auf Akzentflächen */
  --accent-soft: rgba(240, 77, 90, 0.10);
  --accent-soft-border: rgba(240, 77, 90, 0.32);
  --border: #232834;
  --border-strong: #323949;
  --tint: rgba(255, 255, 255, 0.015);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --header-bg: rgba(10, 12, 16, 0.82);
}

/* ==========================================================================
   Basis
   ========================================================================== */
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: var(--mode-transition);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--accent-contrast); }

/* ---------- Layout ---------- */
.container {
  width: min(var(--container), calc(100% - 3rem));
  margin-inline: auto;
}
@media (max-width: 560px) {
  .container { width: calc(100% - 2.5rem); }
}

/* ---------- Nur für Screenreader ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Sprunglink zum Inhalt ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 400;
  padding: 0.7rem 1.15rem;
  border-radius: 0 0 var(--radius-sm) 0;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ==========================================================================
   Typografie
   ========================================================================== */
/* Überschriften der ersten beiden Ebenen in der Serifenschrift – die Seite
   soll wie ein gesetztes Gutachten wirken, nicht wie eine Produktseite. */
h1, h2 { font-family: var(--font-serif); font-weight: 600; line-height: 1.12; letter-spacing: -0.012em; }
h3 { font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }
h1 { font-size: clamp(2.3rem, 5.4vw, 3.6rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); }
h3 { font-size: 1.12rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-accent);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
  transition: var(--mode-transition);
}

.section-head { max-width: 44rem; margin-bottom: clamp(2.4rem, 5vw, 3.6rem); }
.section-head p { color: var(--text-muted); margin-top: 0.9rem; font-size: 1.08rem; transition: var(--mode-transition); }

/* ==========================================================================
   Header + Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: var(--mode-transition);
}
.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;      /* schmale Viewports: Zurück-Link darf umbrechen */
  gap: 0.75rem 1.5rem;
  min-height: 4.25rem;
  padding-block: 0.6rem;
}
.brand {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand .brand-it {
  color: var(--accent);
  transition: var(--mode-transition);
}
.brand:hover .brand-it { color: var(--accent-strong); }
:root[data-mode="red"] .brand { font-family: var(--font-mono); letter-spacing: 0; }

.site-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}
.site-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }

/* Rechte Gruppe: optionaler Zurück-Link + Umschalter */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: 0.75rem;
}

/* Einheitlicher Zurück-Link auf Unterseiten (ersetzt .back-link/.header-back) */
.back-link {
  font-family: var(--font-accent);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.back-link:hover,
.back-link:focus-visible {
  color: var(--accent-strong);
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

/* ----- Sprachumschalter DE | EN -----
   Segmentierter Schalter; die aktuelle Sprache trägt aria-current. Seiten
   ohne Übersetzung (Impressum, Datenschutz, AGB) verlinken auf die
   Startseite der anderen Sprache. */
.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: var(--mode-transition);
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 2.1rem;
  padding: 0 0.62rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.lang-switch a + a { border-left: 1px solid var(--border); }
.lang-switch a:hover { color: var(--text); background: var(--surface-hover); }
.lang-switch a[aria-current] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: default;
}
.lang-switch a:focus-visible { outline-offset: -2px; }

/* ----- Burger-Button: nur in der mobilen Ansicht ----- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: var(--mode-transition);
}
.nav-toggle svg { width: 1.25rem; height: 1.25rem; }
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ----- Abdunkelnder Hintergrund hinter dem Drawer (per site.js erzeugt) ----- */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(4, 7, 12, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

/* Scroll-Sperre, solange der Drawer offen ist */
body.nav-open { overflow: hidden; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-backdrop { display: block; }
  .nav-backdrop.is-open { opacity: 1; pointer-events: auto; }

  /* Die Navigation wird zum Off-Canvas-Drawer, der von rechts einfährt.
     Der Drawer liegt UNTER der Kopfleiste (z-index 50), damit der
     Modus-Umschalter jederzeit sichtbar und bedienbar bleibt. */
  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(19rem, 82vw);
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 5.75rem 1.15rem 2rem;
    overflow-y: auto;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.32s var(--ease), visibility 0s linear 0.32s,
                background-color 0.45s var(--ease), border-color 0.45s var(--ease);
  }
  .site-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.32s var(--ease), visibility 0s linear 0s,
                background-color 0.45s var(--ease), border-color 0.45s var(--ease);
  }
  .site-nav a {
    font-size: 1.02rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
  }
  .header-actions { margin-left: auto; }
}

/* Ohne Bewegung: kein Einfahren, nur Ein- und Ausblenden */
@media (prefers-reduced-motion: reduce) and (max-width: 860px) {
  .site-nav { transform: none; opacity: 0; }
  .site-nav.is-open { opacity: 1; }
}
@media (max-width: 560px) {
  .back-link { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
  .lang-switch a { min-height: 2rem; padding: 0 0.5rem; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: var(--mode-transition);
}
.btn svg { width: 1.05rem; height: 1.05rem; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn.is-disabled {
  border: 1px dashed var(--border-strong);
  color: var(--text-faint);
  pointer-events: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:root[data-mode="red"] .btn { font-family: var(--font-mono); font-size: 0.92rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.6rem 0;
  margin-top: clamp(3rem, 7vw, 5rem);
  transition: var(--mode-transition);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}
.footer-brand { font-weight: 700; letter-spacing: -0.02em; }
.footer-brand .brand-it { color: var(--accent); transition: var(--mode-transition); }
:root[data-mode="red"] .footer-brand { font-family: var(--font-mono); letter-spacing: 0; }
.footer-tag { font-size: 0.86rem; color: var(--text-faint); transition: var(--mode-transition); }
.footer-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.footer-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.footer-links a:hover { color: var(--accent); }
/* Sprachhinweis an Links, die in die andere Sprache führen */
.footer-lang { font-size: 0.85em; color: var(--text-faint); }
.footer-ai { width: 100%; font-size: 0.82rem; color: var(--text-faint); transition: var(--mode-transition); }
.footer-copy { width: 100%; font-size: 0.82rem; color: var(--text-faint); transition: var(--mode-transition); }
@media (max-width: 700px) {
  .footer-links { margin-left: 0; }
}

/* ==========================================================================
   Fehlerseite (404.html lädt nur base.css)
   ========================================================================== */
.err-wrap { max-width: 44rem; text-align: center; padding-block: clamp(4rem, 12vw, 8rem); }
.err-wrap .eyebrow { justify-content: center; }
.err-wrap .lead { color: var(--text-muted); font-size: 1.1rem; margin: 1rem auto 1.8rem; }
.err-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }

/* ==========================================================================
   Fokus-Stile
   ========================================================================== */
:where(a, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ==========================================================================
   Gemeinsame Animation
   ========================================================================== */
@keyframes blink { 50% { opacity: 0; } }

/* ==========================================================================
   Bewegung reduzieren
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
