/* Version 3.3: Typografie und Lesbarkeit
Die Inter-Dateien können lokal unter assets/fonts/ abgelegt werden.
Falls sie fehlen, greifen die System-Fallbacks. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef4ff;
  --text: #172033;
  --muted: #667085;
  --line: #00050e;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
  --radius: 18px;
  color-scheme: light;
  --content-width: 1200px;
  --reading-size: 1.15rem;
  --reading-line: 1.8;
}

:root.dark {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #1e293b;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: #334155;
  --accent: #60a5fa;
  --accent-2: #2dd4bf;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1.2rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  min-width: 230px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: white;
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.calc-logo {
  max-width: 30%;
  height: auto;
}

.menu-toggle,
.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.menu-toggle {
  display: inline-block;
  font-size: 1.05rem;
  line-height: 1;
}

.top-search {
  position: relative;
  flex: 1;
}

.top-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

.search-results a {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.search-results a:hover {
  background: var(--surface-2);
}

.search-results small {
  display: block;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  gap: 1.25rem;
  max-width: 1500px;
  margin: 1.25rem auto;
  padding: 0 1.25rem;
  transition: grid-template-columns 0.2s ease;
}

.sidebar-backdrop {
  display: none;
}

body.sidebar-collapsed .layout {
  grid-template-columns: minmax(0, 1fr) 280px;
  max-width: 1180px;
}

body.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar,
.content-card,
.info-panel > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 1rem;
}

.menu-toggle[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--accent);
}

.side-nav h3 {
  margin: 1rem 0.65rem 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.side-nav a {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;

  color: var(--text);
  text-decoration: none;
  padding: 0.48rem 0.65rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.25;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--surface-2);
  color: var(--accent);
}

.side-nav a.completed {
  position: relative;
  padding-right: 2rem;
}

.side-nav a.completed::after {
  content: "✓";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  font-weight: 800;
}

.reset-progress {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.reset-progress:hover {
  color: var(--text);
  border-color: var(--accent);
}

.content-card {
  min-width: 0;
  padding: clamp(1.35rem, 3vw, 3rem);
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1.1rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.nav-button,
.complete-button,
.button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}

.nav-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;

  min-height: 38px;
  max-width: 240px;
  padding: 0.45rem 0.8rem;

  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;

  color: var(--text);
  text-decoration: none;

  font-size: 0.95rem; /* entspricht etwas weniger als Fließtext */
  line-height: 1.3;
  font-weight: 500;

  transition: all 0.2s ease;
}

.nav-button:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.complete-button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.info-panel {
  display: grid;
  gap: 1rem;
  align-self: start;
  position: sticky;
  top: 86px;
}

.info-panel h2 {
  font-size: 1.05rem;
  margin: 0.2rem 0 0.7rem;
  letter-spacing: -0.02em;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.tip-card p,
.progress-card p {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--muted);
}

code {
  background: var(--surface-2);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 2rem;
}

/* ============================
   Responsive Layout
   ============================ */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  body.sidebar-collapsed .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .info-panel {
    grid-column: 2;
    position: static;
    grid-template-columns: repeat(3, 1fr);
  }

  body.sidebar-collapsed .info-panel {
    grid-column: 1;
  }
}

@media (max-width: 820px) {
  body {
    font-size: 17px;
  }

  .brand {
    min-width: auto;
  }

  .brand small {
    display: none;
  }

  .layout,
  body.sidebar-collapsed .layout {
    display: block;
    padding: 0 0.75rem;
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    display: none;
    position: fixed;
    inset: 70px 0.75rem auto 0.75rem;
    z-index: 30;
    max-height: 70vh;
  }

  .sidebar.open,
  body.sidebar-collapsed .sidebar.open {
    display: block;
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 25;
  }

  .content-card {
    margin-top: 0.75rem;
  }

  .info-panel {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 1rem;
    position: static;
  }

  .lesson-footer {
    grid-template-columns: 1fr;
  }

  .lesson-footer .nav-button:last-child {
    text-align: left;
  }

  .topbar {
    gap: 0.6rem;
  }

  .top-search input {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
/* Kapitelnummerierung */

.chapter-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;

  margin: 0 0 0.35rem;
  padding: 0.35rem 0.7rem;

  border-radius: 999px;

  background: var(--surface-2);
  color: var(--accent);

  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.side-nav h3 .nav-section-number {
  display: inline-grid;
  place-items: center;
  min-width: 1.8rem;
  height: 1.8rem;
  margin-right: 0.35rem;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.side-nav a .nav-number {
  flex: 0 0 auto;
  min-width: 2.25rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.side-nav a.active .nav-number,
.side-nav a:hover .nav-number {
  color: var(--accent);
}

.lesson-footer small {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.2;
}

.chapter-num {
  display: inline-block;
  min-width: 2.8em;
  margin-right: 0.45rem;
  color: var(--accent);
  font-weight: 700;
}

.lesson-footer .nav-button:last-child {
  text-align: right;
}

.side-nav a.active .chapter-num {
  color: inherit;
}

/* Kapitelnummer in der Überschrift */

.h1-chapter-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  margin-right: 0.75rem;
  padding: 0.18rem 0.55rem;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 0.5em;
  font-weight: 800;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .h1-chapter-number {
    display: inline-flex;
    margin-right: 0.45rem;
    min-width: 2.7rem;
  }
}

.download-card p {
  margin-bottom: 0.75rem;
}

.download-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.download-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
  word-break: break-word;
}

.download-link::before {
    content: "";
    display: inline-block;
    width: 1.3rem;
    height: 1.3rem;
    margin-right: 0.45rem;

    background-color: currentColor;

    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3v11m0 0l-4-4m4 4l4-4M5 19h14' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3v11m0 0l-4-4m4 4l4-4M5 19h14' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;

    -webkit-mask-size: contain;
    mask-size: contain;
}

.download-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Zuletzt besucht */

.last-visited-card p {
  margin: 0.35rem 0;
}

.last-visited-label {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.92rem;
}

.last-visited-title {
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}

.last-visited-date {
  color: var(--muted);
  font-size: 0.9rem;
}

.continue-button {
  margin-top: 0.6rem;
  width: 100%;
  text-align: center;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 800;
}

.continue-button:hover {
  filter: brightness(1.05);
}

/* Version 3.1: bewusster Lernfortschritt */

.chapter-completion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
  flex-basis: 100%;
  margin-top: 0.5rem;
}

.chapter-completion[hidden] {
  display: none !important;
}

.completion-status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.complete-button[disabled] {
  opacity: 0.75;
  cursor: default;
  background: var(--surface-2);
  color: var(--accent-2);
  border-color: var(--line);
}

body {
  margin: 0;

  font-family: "Inter", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.72;
  letter-spacing: -0.006em;

  color: var(--text);
  background: var(--bg);

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.lesson {
  font-size: var(--reading-size);
  line-height: var(--reading-line);
}

.lesson h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.15;
  margin: 0.15rem 0 1.25rem;
  padding-bottom: 0.3em;

  font-weight: 700;
  color: var(--text);

  /*max-width: 18ch;*/
  text-wrap: pretty;
}

.lesson h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  line-height: 1.25;
  margin: 2.7rem 0 0.9rem;
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3em;
  color: var(--text);
  max-width: var(--content-width);

  text-wrap: balance;
}

.lesson h3 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 2rem 0 0.65rem;
  padding-bottom: 0.2em;
  font-weight: 700;
  color: var(--text);
  max-width: var(--content-width);
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.2em;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.lesson p,
.lesson li {
  max-width: var(--content-width);
}

.lesson p {
  margin: 0 0 1.22em;
}

.lesson ul,
.lesson ol {
  max-width: var(--content-width);
  padding-left: 4.5rem;
  margin: 1rem 0 1.35rem;
}

.lesson li {
  margin: 0.35rem 0;
}

.lesson strong,
.lesson b {
  font-weight: 700;
}

.lesson a {
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

.lesson img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.lesson figure.screenshot {
    max-width: var(--content-width);
    margin: 1.5rem auto;
}

.lesson figure.screenshot img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.lesson figure.screenshot figcaption {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
}

.lesson p:has(img) {
  margin: 1.4rem 0 1.7rem;
}

.lesson-footer {
  max-width: var(--content-width);
  margin: 3rem auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.info-box,
.download-card,
.tip-card,
.progress-card,
.info-panel > div {
  padding: 1.1rem 1.15rem;
}

.brand strong {
  font-weight: 700;
  letter-spacing: -0.025em;
}

.nav-button small {
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.content-card table {
  font-size: 0.98rem;
  line-height: 1.5;
}

@media (max-width: 820px) {
  body {
    font-size: 18px;
  }

  .lesson {
    font-size: 1.08rem;
    line-height: 1.76;
  }

  .content-card {
    padding: 1.2rem;
  }

  .lesson p,
  .lesson li,
  .lesson h2,
  .lesson h3,
  .lesson ul,
  .lesson ol {
    max-width: none;
  }
}

/* Bilder im Kurs sicher skalieren */
.image-box img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto !important;
  min-height: auto !important;
  object-fit: contain;

  padding: 10px;
  background: #fff;

  border: 1px solid var(--line);
  border-radius: 12px;

  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.image-box figcaption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

/*Info-Warning!-Box*/
.info-note,
.warning-box {
    max-width: var(--content-width);
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;

    border: 2px solid;
    border-radius: 10px;
}
.info-note {
    background: #eef6ff;
    border-color: #4f8dd6;
}

.warning-box {
    background: #fff8e8;
    border-color: #d97706;
}
.box-title {
    display: block;
    margin-bottom: 0.75rem;

    font-size: 1.25rem;
    font-weight: 700;
}

.info-note .box-title {
    color: #2f6fb2;
}

.warning-box .box-title {
    color: #d97706;
}

.summary-box {
    max-width: var(--content-width);
    margin: 2rem 0;
    padding: 1.2rem;

    background: #f5f8fc;
    border: 2px solid var(--accent);
    border-radius: 10px;
}

.summary-box .box-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.summary-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.info-table td:first-child {
    white-space: nowrap;
    width: 100px;
    font-weight: bold;
    vertical-align: top;
}

.calc-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0 2.5rem;
}

.calc-table th,
.calc-table td {
    border: 1px solid #555;
    font-size: 0.9rem;
    /*padding: 0.45rem 0.7rem;*/
    text-align: left;
    vertical-align: top;
}

.calc-table th {
    font-weight: 600;
}

.lesson-table td:first-child {
    white-space: nowrap;
    width: 100px;
    font-weight: normal;
    vertical-align: top;
}

.lesson-table {
    width: fit-content;
    max-width: 100%;
    border: 1px solid #999;
    border-collapse: collapse;
    margin: 20px 0 20px 0;
}

.lesson-table th,
.lesson-table td {
    border: 1px solid #999;
    padding: 3px;
    vertical-align: top;
}

.table-copy-container {
    margin: 1.5rem 0 2.5rem;
}

.copy-table {
    display: block;
    margin: 0 0 0.5rem auto;
    padding: 0.4rem 0.8rem;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.copy-table:hover {
    background: #eee;
}

.lernziele {
    list-style: none;
    margin: 1.5rem 0 2rem;
    padding: 0;
}

.lernziele li {
    position: relative;
    margin-bottom: 0.8rem;
    padding: 0.7rem 1rem 0.7rem 3.2rem;

    background: #f5f8fc;
    border: 1px solid #d9e2ee;
    border-radius: 6px;

    line-height: 1.5;
}

/* Häkchen */
.lernziele li::before {
    content: "✓";

    position: absolute;
    left: 0.8rem;
    top: 0.55rem;

    font-size: 1.6rem;
    line-height: 1;
    font-weight: 700;

    color: #2c63b5;
}