/* Header-Hintergrund — zwei Holz-Fotos, eines pro Color-Scheme.
 *
 * Tagmodus (default): "light oak wood plank texture background",
 *   simon (@simon_berger) via Unsplash, photo-1611072337226-1140ab367200.
 * Nachtmodus (slate): "brown wooden board",
 *   Joshua Bartell (@jjbart7) via Unsplash, photo-1546484396-fb3fc6f95f98.
 * Beide Standard Unsplash License — frei nutzbar ohne Attributionspflicht,
 * hier trotzdem dokumentiert. Beide auf 1920 px Breite skaliert. */

[data-md-color-scheme="default"] .md-header {
  background-image: url('../images/header-wood-light.jpg');
  background-size: cover;
  background-position: center;
}

[data-md-color-scheme="slate"] .md-header {
  background-image: url('../images/header-wood-dark.jpg');
  background-size: cover;
  background-position: center;
}

/* Tagmodus: dunkle Schrift und Icons auf hellem Holz.
 * Material-Theme nutzt --md-primary-bg-color für die Schrift- und
 * Icon-Farbe im Header — wir überschreiben sie mit einem warmen
 * Dunkelbraun (passend zum hellen Eichen-Holz).
 * Subtiler heller Halo statt dunkler Shadow für Lesbarkeit. */
[data-md-color-scheme="default"] {
  --md-primary-bg-color: #2a1a0a;
  --md-primary-bg-color--light: rgba(42, 26, 10, 0.7);
}

[data-md-color-scheme="default"] .md-header__title,
[data-md-color-scheme="default"] .md-header__button {
  text-shadow: 0 1px 2px rgba(255, 248, 235, 0.6);
}

/* Nachtmodus: helle Schrift bleibt Material-Default, dunkler Shadow
 * für Lesbarkeit auf dunkler Holz-Textur. */
[data-md-color-scheme="slate"] .md-header__title,
[data-md-color-scheme="slate"] .md-header__button {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* ──────────────────────────────────────────────────────────────────────
 * Globale Body-Schriftgröße — Material-Default 0.8rem ist für längere
 * Lese-Inhalte (Glossar-Einträge) zu klein. Auf 1rem hochsetzen.
 * ────────────────────────────────────────────────────────────────────── */

.md-typeset {
  font-size: 1.0rem !important;
  line-height: 1.65 !important;
}

/* ──────────────────────────────────────────────────────────────────────
 * Aufklappbare Sektionen — per JS aus jedem H2-Abschnitt erzeugt.
 *
 * Akkordeon-Stil: subtile horizontale Linie zwischen Sektionen, klickbarer
 * Titel mit chevron rechts. Default zu, Klick öffnet, sanfter Übergang.
 * ────────────────────────────────────────────────────────────────────── */

details.glossar-section {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  margin: 0;
  /* Material setzt .md-typeset details { font-size: .64rem } für
   * pymdownx-Details-Boxen. Das vergiftet alle em-basierten Kind-
   * Berechnungen (auch das summary). Zurück auf Body-Größe. */
  font-size: 1.0rem !important;
}

details.glossar-section:first-of-type {
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

details.glossar-section > summary.glossar-section-summary {
  cursor: pointer;
  padding: 0.9rem 0.5rem 0.9rem 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.4em;
  font-weight: 500;
  font-family: var(--md-text-font-family, inherit);
  line-height: 1.35;
  color: var(--md-default-fg-color);
  user-select: none;
  transition: color 0.15s ease-out;
}

/* Auf dem Smartphone wirkt das 1.4em zu gross relativ zum schmalen
 * Viewport. Nur dort auf 1.0em senken (Desktop unverändert); Padding/
 * Klickfläche bleibt, damit der Tap-Bereich komfortabel bleibt.
 * 44.9375em = Material-Telefon-Breakpoint. */
@media screen and (max-width: 44.9375em) {
  details.glossar-section > summary.glossar-section-summary {
    font-size: 1.0em;
  }
}

/* Standard-Disclosure-Marker in allen Browsern unterdrücken.
 * Material's eigenes details-Styling rendert zusätzlich ein Dreieck-
 * Icon via ::before, das wir explizit überschreiben. */
details.glossar-section > summary.glossar-section-summary::-webkit-details-marker,
details.glossar-section > summary.glossar-section-summary::marker {
  display: none;
  content: "";
}

details.glossar-section > summary.glossar-section-summary::before {
  display: none !important;
  content: none !important;
}

/* CSS-Chevron rechts vom Titel, dreht beim Öffnen. */
details.glossar-section > summary.glossar-section-summary::after {
  content: "";
  margin-left: auto;
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease-out;
  opacity: 0.5;
}

details.glossar-section[open] > summary.glossar-section-summary::after {
  transform: rotate(45deg);
  opacity: 0.8;
}

details.glossar-section > summary.glossar-section-summary:hover {
  color: var(--md-accent-fg-color);
}

/* Innenabstand für den ausgeklappten Inhalt, damit er nicht direkt am
 * Summary klebt. */
details.glossar-section[open] > *:not(summary) {
  margin-top: 0.25rem;
}

details.glossar-section[open] {
  padding-bottom: 0.75rem;
}

/* Material setzt .md-typeset details > * { font-size: .64rem } für
 * pymdownx-Details-Boxen. Das schrumpft auch unsere Glossar-Sektions-
 * Inhalte. Wir setzen alle Body-Elemente innerhalb explizit auf die
 * Body-Größe zurück. Spezifität wird per html-Prefix erhöht, damit
 * Material's Regel auch ohne !important geschlagen würde. */
html .md-typeset details.glossar-section p,
html .md-typeset details.glossar-section li,
html .md-typeset details.glossar-section td,
html .md-typeset details.glossar-section th,
html .md-typeset details.glossar-section blockquote,
html .md-typeset details.glossar-section dt,
html .md-typeset details.glossar-section dd {
  font-size: 1.0rem !important;
}

/* Sub-Überschriften (H3-H6) innerhalb der Akkordeon-Sektion
 * proportional größer als Body. Material's details > * Schrumpf-Regel
 * würde sie sonst auf 0.64rem reduzieren. */
html .md-typeset details.glossar-section h3 { font-size: 1.3rem !important; }
html .md-typeset details.glossar-section h4 { font-size: 1.2rem !important; }
html .md-typeset details.glossar-section h5 { font-size: 1.15rem !important; }
html .md-typeset details.glossar-section h6 { font-size: 1.0rem !important; }

/* Auf dem Smartphone den Lese-Body etwas verkleinern (1.0rem → 0.8rem).
 * Trifft den globalen Body (.md-typeset) und die separat gepinnten
 * Kapitel-Inhalts-Elemente. Abschnittsüberschriften (h3–h6, in rem) und
 * das Kapitel-Summary bleiben unberührt. Nach den 1.0rem-Pins platziert,
 * damit die Quell-Reihenfolge die Überschreibung trägt.
 * 44.9375em = Material-Telefon-Breakpoint. */
@media screen and (max-width: 44.9375em) {
  .md-typeset {
    font-size: 0.8rem !important;
  }
  html .md-typeset details.glossar-section p,
  html .md-typeset details.glossar-section li,
  html .md-typeset details.glossar-section td,
  html .md-typeset details.glossar-section th,
  html .md-typeset details.glossar-section blockquote,
  html .md-typeset details.glossar-section dt,
  html .md-typeset details.glossar-section dd {
    font-size: 0.8rem !important;
  }
}

/* Navigationsmenü links (Primary) und Inhaltsverzeichnis rechts
 * (Secondary): beide auf Body-Größe hochziehen, Material-Default
 * ist deutlich kleiner. */
.md-sidebar--primary .md-nav__link,
.md-sidebar--primary .md-nav__title,
.md-sidebar--secondary .md-nav__link,
.md-sidebar--secondary .md-nav__title {
  font-size: 1.0rem !important;
}

/* ──────────────────────────────────────────────────────────────────────
 * Download-Buttons unter jedem Glossar-Eintrag (.md · .txt · BibTeX).
 * ────────────────────────────────────────────────────────────────────── */

.md-typeset .download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.md-typeset a.download-btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--md-default-fg-color--light);
  text-decoration: none;
  background: transparent;
  transition: all 0.15s ease-out;
}

.md-typeset a.download-btn:hover {
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
  background: var(--md-accent-fg-color--transparent);
}

/* ──────────────────────────────────────────────────────────────────────
 * Versions-Footer-Zeile (Stand vX.Y.Z · Welle Wn · DOI ...).
 * ────────────────────────────────────────────────────────────────────── */

.md-copyright__version {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.2rem;
}

.md-copyright__version a {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
}

.md-copyright__version a:hover {
  opacity: 1;
  text-decoration-style: solid;
}

/* ──────────────────────────────────────────────────────────────────────
 * Font-Ligaturen in Code-Blöcken abschalten.
 *
 * JetBrains Mono rendert Sequenzen wie ``)>``, ``):``, ``,)`` und
 * ähnliche Kombinationen mit schliessenden Klammern als Programmier-
 * Ligaturen, die in mathematischen Glossar-Formeln als kleiner ^-Pfeil
 * fehlinterpretierbar erscheinen. In Prosa wären die Ligaturen sinnvoll;
 * in mathematischen Quasi-LaTeX-Notationen verwirren sie. Wir deaktivieren
 * sie nur für Inline-Code und Code-Blöcke.
 * ────────────────────────────────────────────────────────────────────── */

.md-typeset code,
.md-typeset pre,
.md-typeset pre code,
.md-typeset .highlight pre,
.md-typeset .highlight code {
  font-feature-settings: "liga" 0, "calt" 0, "clig" 0;
  font-variant-ligatures: none;
}

/* ──────────────────────────────────────────────────────────────────────
 * Cluster-Hervorhebung im Hamburger-Menu (Primary-Sidebar).
 *
 * Die vier Cluster (Ressourcen, Kern, Tragwerk, Holzbau) werden vom
 * Build-Hook als Top-Level-Sections in die Nav gehängt — Material
 * markiert sie mit .md-nav__item--nested. Statische Single-Page-Items
 * (Startseite / Methode / Zitieren) tragen diese Klasse nicht. Damit
 * trifft der Selektor ausschliesslich die Cluster, ohne :nth-child-
 * Tricks, und bleibt stabil, wenn neue statische Seiten dazukommen.
 *
 * Farbpaar Gold:
 *   default (hell) → dunkelgolden #8a6d12, ≈5:1 Kontrast auf Weiss
 *   slate (dunkel) → hellgolden  #e6c068, ≈9:1 Kontrast auf Slate-BG
 * ────────────────────────────────────────────────────────────────────── */

[data-md-color-scheme="default"]
  .md-nav--primary > .md-nav__list > .md-nav__item--nested
  > .md-nav__link {
  color: #8a6d12;
  font-weight: 600;
}

[data-md-color-scheme="slate"]
  .md-nav--primary > .md-nav__list > .md-nav__item--nested
  > .md-nav__link {
  color: #e6c068;
  font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────────────
 * Print-Stylesheet — beim Druck eines Glossar-Eintrags entfällt die
 * gesamte Navigations-Chrome (Header, Sidebars, Footer, Download-Knöpfe,
 * Suchfeld). Akkordeon-Sektionen werden automatisch geöffnet, damit
 * der Inhalt vollständig auf dem Papier erscheint. Farbe wird auf
 * Schwarz-auf-Weiss reduziert; Links zeigen die Ziel-URL inline, damit
 * der Verweis auch ohne Klickbarkeit nachvollziehbar bleibt.
 * ────────────────────────────────────────────────────────────────────── */

@media print {
  .md-header,
  .md-tabs,
  .md-sidebar,
  .md-footer,
  .md-search,
  .md-top,
  .md-typeset .download-row,
  .md-typeset details.glossar-section > summary::after,
  [data-md-component="announce"],
  [data-md-component="palette"] {
    display: none !important;
  }

  /* Akkordeon-Sektionen offen drucken — der Inhalt soll vollständig
   * erscheinen, unabhängig vom aktuellen open/close-State im Browser. */
  details.glossar-section,
  details.glossar-section[open] {
    border: none !important;
    page-break-inside: auto;
  }
  details.glossar-section > *:not(summary) {
    display: block !important;
  }
  details.glossar-section > summary.glossar-section-summary {
    cursor: default;
    font-size: 1.3em !important;
    page-break-after: avoid;
    border-bottom: 1px solid #888;
    margin-top: 1em;
    padding: 0.3em 0;
  }

  .md-main__inner,
  .md-content,
  .md-content__inner {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  body,
  .md-typeset {
    color: #000 !important;
    background: #fff !important;
    font-size: 10.5pt !important;
    line-height: 1.4 !important;
  }

  /* Link-URLs hinter dem Anker-Text ausgeben, damit die Referenz auch
   * im Druck nachvollziehbar bleibt. Interne Sprungmarken (#…) und
   * mailto:-Links ausgenommen — die wären auf Papier nutzlos. */
  .md-typeset a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
    word-break: break-all;
  }

  h1, h2, h3, h4 { page-break-after: avoid; }
  pre, blockquote, table { page-break-inside: avoid; }

  @page {
    margin: 18mm 16mm;
  }
}
