:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #222222;
  --muted: #777777;
  --border: #e6e6e2;
  --accent: #5c7c6f;

  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,0.04);

  --max-width: 860px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;

  line-height: 1.7;

  display: flex;
  min-height: 100vh;
}

/* -------------------------------- */
/* Sidebar */
/* -------------------------------- */

.sidebar {
  width: 260px;
  padding: 32px 24px;

  background: var(--surface);
  border-right: 1px solid var(--border);

  position: sticky;
  top: 0;

  height: 100vh;
  overflow-y: auto;
}

.sidebar h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 700;
}

.sidebar p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.95rem;
}

#toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#toc a {
  text-decoration: none;
  color: var(--muted);

  padding: 6px 10px;
  border-radius: 8px;

  transition:
    background 120ms ease,
    color 120ms ease;
}

#toc a:hover {
  background: #f0f2ef;
  color: var(--accent);
}

/* -------------------------------- */
/* Main */
/* -------------------------------- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* -------------------------------- */
/* Footer */
/* -------------------------------- */

#page-footer {

  position: fixed;

  bottom: 24px;
  right: 24px;

  z-index: 100;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

#page-footer.visible {
  opacity: 1;
  visibility: visible;
}

#back-to-top {

  display: inline-block;

  padding: 12px 18px;

  background: rgba(255,255,255,0.95);

  border: 1px solid var(--border);

  border-radius: 999px;

  color: var(--text);

  text-decoration: none;

  box-shadow: 0 2px 10px rgba(0,0,0,0.08);

  backdrop-filter: blur(10px);
}

#back-to-top:hover {
  background: white;
}

/* -------------------------------- */
/* Content */
/* -------------------------------- */

#content {
  width: 100%;
  max-width: var(--max-width);

  margin: 40px auto;
  padding: 48px;

  background: var(--surface);

  border-radius: var(--radius);

  box-shadow: var(--shadow);
}

#content h1,
#content h2,
#content h3 {
  line-height: 1.2;
  margin-top: 2.2em;
}

#content h1 {
  font-size: 2rem;
}

#content h2 {
  font-size: 1.4rem;
}

#content h3 {
  font-size: 1.1rem;
}

#content p,
#content li {
  color: #333;
}

#content ul {
  padding-left: 1.4rem;
}

#content code {
  background: #f2f2f0;

  padding: 2px 6px;

  border-radius: 6px;

  font-size: 0.92em;
}

#content blockquote {
  margin: 1.5rem 0;
  padding: 0.8rem 1rem;

  border-left: 4px solid var(--accent);

  background: #f6f8f6;

  color: #444;
}

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

@media (max-width: 920px) {

  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;

    position: relative;

    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  header {
    position: relative;
  }

  #content {
    margin: 20px;
    padding: 28px;
  }
}

#content p {
  margin: 0 0 1rem;
}

/* Container für reine Bild-Paragraphen */

#content p:has(img) {

  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(220px, 1fr));

  gap: 16px;

  align-items: start;
}

/* Bilder */

#content img {

  width: 100%;
  height: auto;

  display: block;

  border-radius: 12px;

  box-shadow:
    0 2px 10px rgba(0,0,0,0.08);
}