/* ============================================================
   Tacto Onboarding-Kurs — Design System
   Palette: validierte Referenz-Palette (light + dark)
   ============================================================ */

:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);

  --accent: #2a78d6;        /* blue  — Slot 1 */
  --accent-ink: #1c5cab;
  --aqua: #1baf7a;          /* Slot 2 */
  --yellow: #eda100;        /* Slot 3 */
  --green: #008300;         /* Slot 4 */
  --violet: #4a3aa7;        /* Slot 5 */
  --red: #e34948;           /* Slot 6 */
  --orange: #eb6834;        /* Slot 8 */

  --tacto: #ff6414;        /* Tacto Brand-Orange — nur dekorativ */
  --tacto-ink: #c14a0e;    /* textsichere Variante */

  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --accent-wash: rgba(42, 120, 214, 0.08);
  --good-wash: rgba(12, 163, 12, 0.08);
  --warn-wash: rgba(250, 178, 25, 0.12);
  --crit-wash: rgba(208, 59, 59, 0.08);
  --violet-wash: rgba(74, 58, 167, 0.08);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.05);
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242423;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);

    --accent: #3987e5;
    --accent-ink: #6da7ec;
    --aqua: #199e70;
    --yellow: #c98500;
    --violet: #9085e9;
    --red: #e66767;
    --orange: #d95926;

    --tacto-ink: #ff8a52;

    --good-text: #0ca30c;

    --accent-wash: rgba(57, 135, 229, 0.14);
    --good-wash: rgba(12, 163, 12, 0.14);
    --warn-wash: rgba(250, 178, 25, 0.10);
    --crit-wash: rgba(208, 59, 59, 0.16);
    --violet-wash: rgba(144, 133, 233, 0.14);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar .brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.topbar .brand span { color: var(--tacto-ink); }

.module-dots {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.module-dots a {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  transition: transform 0.12s ease;
}

.module-dots a:hover { transform: translateY(-1px); color: var(--ink); }

.module-dots a.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.module-dots a.done {
  background: var(--good-wash);
  border-color: var(--good);
  color: var(--good-text);
}

/* ---------- Layout ---------- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 20px 80px;
}

.kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tacto-ink);
  margin: 0 0 6px;
}

h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.lede {
  font-size: 19px;
  color: var(--ink-2);
  margin: 0 0 8px;
  max-width: 46em;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 56px 0 12px;
  padding-top: 8px;
}

h2 .h-num {
  color: var(--ink-muted);
  font-weight: 600;
  margin-right: 8px;
}

h3 { font-size: 18.5px; margin: 30px 0 8px; }

p { margin: 0 0 14px; }

a { color: var(--accent-ink); }

ul, ol { padding-left: 24px; margin: 0 0 14px; }
li { margin-bottom: 6px; }

strong { font-weight: 650; }

hr { border: none; border-top: 1px solid var(--hairline); margin: 40px 0; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 6px;
  align-items: center;
}

/* ---------- Cards & callouts ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin: 16px 0;
}

.card h3:first-child, .card h4:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
.grid2 .card, .grid3 .card { margin: 0; }

.callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  border: 1px solid var(--border);
  background: var(--accent-wash);
}
.callout > :last-child { margin-bottom: 0; }
.callout .co-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 4px;
}
.callout.good { background: var(--good-wash); }
.callout.warn { background: var(--warn-wash); }
.callout.crit { background: var(--crit-wash); }
.callout.violet { background: var(--violet-wash); }

blockquote {
  margin: 18px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
  font-style: italic;
}
blockquote p { margin-bottom: 6px; }
blockquote .src { font-style: normal; font-size: 13.5px; color: var(--ink-muted); }

/* ---------- Badges & pills ---------- */

.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 650;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.blue   { background: var(--accent-wash); color: var(--accent-ink); }
.badge.good   { background: var(--good-wash);   color: var(--good-text); }
.badge.warn   { background: var(--warn-wash); }
.badge.violet { background: var(--violet-wash); color: var(--violet); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 16px 0; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  background: var(--surface-2);
}
tr:last-child td { border-bottom: none; }

/* ---------- Accordion (details/summary) ---------- */

details.acc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 10px 0;
  overflow: hidden;
}
details.acc summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after {
  content: "+";
  margin-left: auto;
  font-size: 20px;
  font-weight: 400;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
}
details.acc[open] summary::after { transform: rotate(45deg); }
details.acc .acc-body { padding: 0 18px 16px; }
details.acc .acc-body > :last-child { margin-bottom: 0; }
details.acc summary .badge { flex-shrink: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  color: var(--accent-ink);
}
.btn.done-state {
  background: var(--good-wash);
  border-color: var(--good);
  color: var(--good-text);
  cursor: default;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Quiz ---------- */

.quiz { margin: 24px 0; }

.quiz .q-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 14px 0;
}
.quiz .q-text { font-weight: 650; margin: 0 0 12px; }
.quiz .q-text .q-num { color: var(--ink-muted); margin-right: 6px; }

.quiz label.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  cursor: pointer;
  transition: background 0.1s ease;
}
.quiz label.opt:hover { background: var(--surface-2); }
.quiz label.opt input { margin-top: 4px; accent-color: var(--accent); }

.quiz .q-item.correct label.opt.chosen { border-color: var(--good); background: var(--good-wash); }
.quiz .q-item.wrong label.opt.chosen { border-color: var(--critical); background: var(--crit-wash); }
.quiz .q-item.wrong label.opt.is-answer,
.quiz .q-item.correct label.opt.is-answer { border-color: var(--good); background: var(--good-wash); }

.quiz .q-explain {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14.5px;
  color: var(--ink-2);
}
.quiz .q-item.answered .q-explain { display: block; }

.quiz .quiz-result {
  display: none;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-weight: 650;
  border: 1px solid var(--border);
}
.quiz .quiz-result.show { display: block; }
.quiz .quiz-result.pass { background: var(--good-wash); color: var(--good-text); }
.quiz .quiz-result.fail { background: var(--warn-wash); }

/* ---------- Flashcards ---------- */

.flashcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.flashcard {
  perspective: 900px;
  cursor: pointer;
  height: 150px;
}
.flashcard .fc-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.flashcard .fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.flashcard .fc-front {
  background: var(--surface);
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow);
}
.flashcard .fc-front .fc-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}
.flashcard .fc-back {
  background: var(--accent-wash);
  transform: rotateY(180deg);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  overflow-y: auto;
}

/* ---------- Checklists ---------- */

.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
}
.checklist input[type="checkbox"] {
  width: 19px; height: 19px;
  margin-top: 3px;
  accent-color: var(--good);
  flex-shrink: 0;
  cursor: pointer;
}
.checklist label { cursor: pointer; }
.checklist li:has(input:checked) { opacity: 0.62; }
.checklist li:has(input:checked) label { text-decoration: line-through; text-decoration-color: var(--ink-muted); }

/* ---------- Diagrams / figures ---------- */

figure.diagram {
  margin: 22px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
figure.diagram svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
figure.diagram figcaption {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-top: 12px;
  text-align: center;
}

/* ---------- Stat tiles ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 18px 0; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .stat-value { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat .stat-label { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------- Progress ---------- */

.progressbar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.progressbar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ---------- Module cards on index ---------- */

.module-list { display: flex; flex-direction: column; gap: 14px; margin: 24px 0; }

a.module-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
a.module-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.module-card .m-num {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 750;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.module-card.is-done .m-num { background: var(--good-wash); color: var(--good-text); }
.module-card h3 { margin: 0 0 4px; font-size: 17.5px; }
.module-card p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.module-card .m-meta { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.module-card .m-status { font-size: 13px; font-weight: 650; color: var(--ink-muted); }
.module-card.is-done .m-status { color: var(--good-text); }

/* ---------- Prev/Next footer nav ---------- */

.module-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.module-nav a {
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  max-width: 48%;
  transition: border-color 0.12s ease;
}
.module-nav a:hover { border-color: var(--accent); }
.module-nav .dir { font-size: 12.5px; color: var(--ink-muted); display: block; }
.module-nav .next { margin-left: auto; text-align: right; }

/* ---------- Misc ---------- */

.footnote { font-size: 13.5px; color: var(--ink-muted); }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin: 20px 0;
  font-size: 15px;
}
.toc ol { margin: 6px 0 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

kbd {
  font-family: inherit;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
}

.center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 14px; }

/* ---------- Glossar-Tooltips (Abkürzungen) ----------
   Wird von course.js automatisch um die erste Erwähnung
   jeder bekannten Abkürzung gelegt: Begriff + kleines i-Icon
   + Tooltip. Läuft per Hover (Desktop) und Tap (Mobil). */

.gl { position: relative; display: inline; white-space: nowrap; }
.gl-term { border-bottom: 1px dotted var(--ink-muted); }

.gl-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px; height: 13px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  font: 700 9px/1 Georgia, "Times New Roman", serif;
  font-style: italic;
  vertical-align: super;
  cursor: help;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.gl:hover .gl-i,
.gl.gl-open .gl-i { background: var(--accent); color: #fff; }

.gl-tip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(280px, 78vw);
  white-space: normal;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--page);
  box-shadow: var(--shadow);
}
.gl.gl-open .gl-tip { display: block; }
.gl-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--gl-caret, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.gl.gl-below .gl-tip { bottom: auto; top: calc(100% + 9px); }
.gl.gl-below .gl-tip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}

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

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  main { padding: 24px 14px 60px; }

  .topbar-inner { padding: 8px 12px; gap: 8px; }
  .topbar .brand { font-size: 13px; }
  .module-dots { gap: 4px; }
  .module-dots a { width: 24px; height: 24px; font-size: 10.5px; }

  h1 { font-size: clamp(26px, 8vw, 32px); }
  .lede { font-size: 17px; }
  h2 { font-size: 20.5px; margin-top: 44px; }
  h3 { font-size: 17px; }

  .card { padding: 16px; }
  .callout { padding: 12px 14px; }
  .toc { padding: 12px 16px; font-size: 14px; }
  blockquote { padding: 2px 14px; margin: 14px 0; }

  th, td { padding: 8px 10px; font-size: 13.5px; }

  /* Breite Diagramme: horizontal scrollen statt unlesbar schrumpfen */
  figure.diagram { padding: 12px; }
  figure.diagram svg { min-width: 660px; }

  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; }
  .stat .stat-value { font-size: 21px; }

  .module-nav { flex-direction: column; }
  .module-nav a { max-width: none; }
  .module-nav .next { margin-left: 0; text-align: left; }

  .module-card { padding: 16px; gap: 12px; }
  .module-card .m-num { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }

  details.acc summary { padding: 12px 14px; font-size: 15px; }
  details.acc .acc-body { padding: 0 14px 14px; }

  .flashcards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .flashcard { height: 165px; }
  .flashcard .fc-back { font-size: 12.5px; }

  .quiz .q-item { padding: 14px; }
  .btn { padding: 9px 16px; font-size: 14.5px; }
}

@media (max-width: 380px) {
  .flashcards { grid-template-columns: 1fr; }
  .flashcard { height: 140px; }
  .topbar .brand span { display: none; }
}
