/* Blätter: Arbeitsblätter, Skripte, Handouts – gedruckt (A4) und am
   Bildschirm. Setzt marke.css voraus.

   Aufbau einer Seite:
     <article class="page">
       <header class="header"> … </header>       nur auf der ersten Seite
       <section class="info"> <h2 class="info-title">…</h2> … </section>
       <section class="section"> <h2 class="section-title">…</h2> … </section>
       <footer class="footer"> … </footer>
     </article>

   Lehrerfassung: :root { --show-answer: none; --show-solution: block; }
   Webseite statt A4: <body class="web"> – Seiten werden zu einer
   durchgehenden Spalte ohne feste Höhe. */

:root {
  --show-answer: block;
  --show-solution: none;
}

body {
  margin: 0;
  font-family: var(--schrift-text);
  font-size: 11pt;
  line-height: 1.45;
  color: var(--tinte);
  background: var(--flaeche);
  counter-reset: task page;
}

/* ---------- Seite ---------- */

.page {
  position: relative;
  box-sizing: border-box;
  width: 210mm;
  height: 297mm;
  margin: 8mm auto;
  padding: 13mm 15mm 22mm;
  background: #fff;
  box-shadow: 0 1px 4px rgb(36 48 58 / 0.12);
  counter-increment: page;
}

body.web .page {
  width: auto;
  max-width: 46rem;
  height: auto;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  box-shadow: none;
  background: transparent;
}

body.web { background: var(--papier); font-size: 17px; }

/* ---------- Kopf: Reihe klein oben, Titel groß darunter ---------- */

.header {
  margin-bottom: 7mm;
  padding-bottom: 4mm;
  border-bottom: 1.5pt solid var(--bereich);
}

.header-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8mm;
}

.title-block { flex: 1; }

.header h1 {
  margin: 0 0 1.5mm;
  font-family: var(--schrift-text);
  font-size: 9pt;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bereich);
}

.subtitle {
  font-family: var(--schrift-titel);
  font-variation-settings: "SOFT" 100;
  font-size: 18pt;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tinte);
}

.meta-field {
  width: 48mm;
  padding-bottom: 1mm;
  border-bottom: 0.8pt solid var(--tinte);
}

.meta-label {
  font-size: 9pt;
  color: var(--tinte-leise);
}

/* ---------- Erklärung ---------- */

.info { margin: 0 0 6mm; }

.info-title {
  margin: 0 0 2mm;
  font-family: var(--schrift-titel);
  font-variation-settings: "SOFT" 100;
  font-size: 13.5pt;
  font-weight: 600;
  color: var(--bereich);
}

.info p, .section p { margin: 1.5mm 0; }

/* ---------- Aufgabe: Nummer im Kreis ---------- */

.section { margin: 0 0 7mm; }

.section-title {
  display: flex;
  align-items: center;
  gap: 2.5mm;
  margin: 0 0 2mm;
  font-family: var(--schrift-titel);
  font-variation-settings: "SOFT" 100;
  font-size: 12.5pt;
  font-weight: 600;
  color: var(--tinte);
}

.section-title:not(.no-task-number)::before {
  counter-increment: task;
  content: counter(task);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 7mm;
  height: 7mm;
  padding: 0 1.2mm;
  box-sizing: border-box;
  border-radius: 3.5mm;
  background: var(--bereich);
  color: #fff;
  font-family: var(--schrift-text);
  font-size: 10pt;
  font-weight: 700;
}

.zusatz .section-title::after {
  content: "für Schnelle";
  margin-left: 1mm;
  padding: 0.3mm 2mm;
  border: 0.8pt solid var(--bereich);
  border-radius: 3mm;
  font-family: var(--schrift-text);
  font-size: 8.5pt;
  font-weight: 600;
  color: var(--bereich);
}

/* ---------- Merke, Tipp, Lösung ---------- */

.merke {
  margin: 3mm 0;
  padding: 2.5mm 4mm;
  background: var(--schule-hell);
  border-left: 3pt solid var(--schule);
}

.merke::before {
  content: "Merke";
  display: block;
  margin-bottom: 0.5mm;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--schule);
}

.merke p { margin: 1mm 0; }

.tipp {
  margin: 2mm 0;
  font-size: 9.8pt;
  color: var(--tinte-leise);
}

.tipp::before {
  content: "Tipp ";
  font-weight: 700;
  color: var(--bereich);
}

.solution {
  display: var(--show-solution);
  margin-top: 3mm;
  padding: 2.5mm 4mm;
  background: #f1f6f1;
  border: 0.8pt dashed var(--gut);
  border-radius: var(--rundung);
}

.solution::before {
  content: "Lösung ";
  font-weight: 700;
  color: var(--gut);
}

/* ---------- Antwortfeld: Punktraster ---------- */

.answer-space {
  display: var(--show-answer);
  margin-top: 3mm;
  background-image: radial-gradient(circle, rgb(120 110 98 / 0.32) 0.42mm, transparent 0.48mm);
  background-size: 5mm 5mm;
  background-position: 2.5mm 2.5mm;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.lines-2 { height: 1cm; }
.lines-4 { height: 2cm; }
.lines-6 { height: 3cm; }
.lines-8 { height: 4cm; }
.lines-10 { height: 5cm; }
.lines-12 { height: 6cm; }
.lines-16 { height: 8cm; }
.lines-20 { height: 10cm; }

/* ---------- Tabellen: wie table.plan in den Programmen ---------- */

.task-table {
  width: 100%;
  margin: 3mm 0;
  border-collapse: collapse;
  font-size: 9.8pt;
}

.task-table th,
.task-table td {
  padding: 1.6mm 2mm;
  border: 0.7pt solid var(--linie);
  vertical-align: middle;
  text-align: left;
}

/* Keine Großbuchstaben: In Tabellenköpfen stehen oft Variablen (c, y, x1, θ). */
.task-table th {
  font-size: 9pt;
  font-weight: 600;
  color: var(--tinte-leise);
  background: var(--flaeche);
}

.compact-table td { height: 7mm; padding: 1.1mm 1.8mm; }

/* ---------- Formeln und Code ---------- */

.formula-box {
  margin: 3mm 0;
  padding: 2.5mm 4mm;
  background: var(--flaeche);
  border-radius: var(--rundung);
  font-family: var(--schrift-code);
  font-size: 10pt;
}

pre.code {
  margin: 3mm 0;
  padding: 2.5mm 3.5mm;
  background: var(--flaeche);
  border-left: 3pt solid var(--bereich);
  border-radius: 0 var(--rundung) var(--rundung) 0;
  font-family: var(--schrift-code);
  font-size: 8.6pt;
  line-height: 1.4;
  white-space: pre;
  overflow: hidden;
}

pre.code.klein { font-size: 8pt; line-height: 1.3; }
pre.code .nr { display: inline-block; margin-right: 3mm; color: var(--linie-stark); user-select: none; }
pre.code .neu { background: #fbecc0; }
pre.code .luecke { padding-left: 1mm; color: var(--linie-stark); }

code {
  padding: 0 0.8mm;
  background: var(--flaeche);
  border-radius: 0.8mm;
  font-family: var(--schrift-code);
  font-size: 0.9em;
  white-space: nowrap;
}

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

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6mm;
  align-items: start;
}

.muted { color: var(--tinte-leise); font-size: 9.5pt; }

/* ---------- Fußzeile mit der Welle ---------- */

.footer {
  position: absolute;
  left: 15mm;
  right: 15mm;
  bottom: 9mm;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 2mm;
  font-size: 8.5pt;
  color: var(--tinte-leise);
}

.footer-left, .footer-right { display: flex; align-items: center; gap: 2.5mm; }
.footer-left img { width: 24mm; }
.footer-sep { color: var(--linie-stark); }
.page-number::before { content: counter(page); font-weight: 600; color: var(--tinte); }

body.web .footer { position: static; margin-top: 2rem; }
body.web .page-number { display: none; }

/* ---------- Druck ---------- */

@media print {
  @page { size: A4; margin: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .page { margin: 0; box-shadow: none; page-break-after: always; }
}
