/* Inhalt der Formel- und Downloadseiten (Flächenschwerpunkt, Flächenträgheitsmoment, Biegelinie …).
   Kopf, Fuß, Tokens und Basis kommen aus site.css (vorher einbinden). Mobile-first: eine Spalte am Handy, Karten-Raster ab Tablet. */
:root {
  --font-math: "Cambria Math", "STIX Two Math", "Latin Modern Math", math;
  --link: #0051a1;
  /* hervorgehobene Formelkästen (Drallsatz, Grundgleichungen …) */
  --formula-bg: #e9f3fe;
  --formula-border: #d3e6fc;
}
@media (prefers-color-scheme: dark) and (max-width: 0) {
  :root { --link: #60a5fa; --formula-bg: #0f2236; --formula-border: #1b3a5c; }
}
img { max-width: 100%; }

/* ---------- Seitenkopf ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 56px 24px 72px; }
.page-head { text-align: center; margin-bottom: 40px; }
h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(30px, 6vw, 48px); line-height: 1.1; letter-spacing: -.02em;
  overflow-wrap: break-word; hyphens: auto;
}
.lead { margin: 12px auto 0; max-width: 46ch; color: var(--text-2); font-size: 17px; }

/* Einleitungstext (Definition, Anwendung …) – bündig mit den Karten, über die volle Inhaltsbreite */
.intro { margin: 0 0 40px; color: var(--text-2); font-size: 16px; line-height: 1.65; }
.intro h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.intro h3 { margin: 24px 0 6px; font-size: 17px; font-weight: 600; color: var(--text); }
.intro p { margin: 0 0 12px; }
.intro ul, .intro ol { margin: 0 0 12px; padding-left: 1.3em; }
.intro li { margin: 4px 0; }

h2.group {
  margin: 48px 0 16px;
  font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em;
}

/* ---------- Formel-Karten ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
main .card {
  display: flex; flex-direction: column;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-align: center;
}
main .card h3 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
main .card .sub { margin: 2px 0 0; font-size: 14px; color: var(--text-3); }
main .card .note { margin: 12px 0 0; font-size: 14px; color: var(--text-2); text-align: left; }
.figure { margin: 16px 0 4px; padding: 8px 0; }
.figure img { display: block; width: 100%; max-width: 220px; height: auto; aspect-ratio: 3979 / 3133; margin: 0 auto; }
.figure.wide img { max-width: 100%; aspect-ratio: auto; }
/* Die Grafiken haben dunkle Linien: im Dark Mode invertiert, das Blau bleibt durch hue-rotate erhalten */
@media (prefers-color-scheme: dark) and (max-width: 0) { .figure img { filter: invert(1) hue-rotate(180deg); } }

.formulas { margin: 12px 0 0; padding: 0; list-style: none; }
/* alle Formelzeilen gleich hoch; zu breite Formeln lassen sich am Handy seitlich wischen statt die Seite zu sprengen */
.formulas li {
  min-height: 64px; display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--border);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.formulas li:first-child { border-top: 0; }
.formulas li > math { margin: 0 auto; padding: 4px 2px; }
math { font-family: var(--font-math); font-size: 1.2em; color: var(--text); }
math[display="block"] { margin: 0; }

/* ---------- Tabellen (z. B. Randbedingungen) – am Handy als Karten gestapelt ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table-wrap th, .table-wrap td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table-wrap thead th { background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .table-wrap.stack { border: 0; background: none; overflow: visible; }
  .table-wrap.stack table, .table-wrap.stack tbody, .table-wrap.stack tr, .table-wrap.stack td { display: block; }
  .table-wrap.stack thead { display: none; }
  .table-wrap.stack tr { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
  .table-wrap.stack td { display: grid; grid-template-columns: minmax(90px, 35%) 1fr; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); }
  .table-wrap.stack td::before { content: attr(data-label); font-size: 13px; font-weight: 500; color: var(--text-3); }
  .table-wrap.stack td > math { justify-self: start; margin: 0; } /* Formeln bündig mit dem Text der Karte */
}

/* ---------- Kontakt-Hinweis + Footer ---------- */
.contact { margin: 56px auto 0; max-width: 560px; text-align: center; color: var(--text-2); font-size: 15px; }
.contact a { color: var(--link); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }


@media (max-width: 480px) {
  main { padding-left: 16px; padding-right: 16px; }
  main { padding-top: 32px; padding-bottom: 56px; }
  .page-head { margin-bottom: 28px; }
  main .card { padding: 16px; }
  /* etwas kleinere Formeln, damit auch lange Ausdrücke ohne Wischen in die Karte passen */
  math { font-size: 1.05em; }
}

@media print {
  .site-header, .mobile-menu, .site-footer, .contact { display: none; }
  body { background: #fff; }
  main .card { break-inside: avoid; }
}
