/* Mathetiger – Seitenkopf ([mt_header]). Eigenständig & responsive.
   Zeile 1: Logo auf Weiß. Zeile 2: Breadcrumb-Band in der Klassenfarbe mit
   heller 4-px-Linie; jeder Breadcrumb-Eintrag ist eine weiße Pille. Die weiße
   Fläche ist die Lesegrundlage für die Silbenfärbung (Plugin „Mildenberger
   Silben“: #1a56c4 / #d0021b, beide ≥ 4,5 : 1 auf Weiß) – auf dem Band selbst
   wären diese Farben nicht lesbar. Die Plakette und das Haus-Symbol in der
   Bandfarbe (dunkel genug für weißen Text) sitzen bündig am Pillenrand.

   Breite: Der Kopf legt keine eigene Breite fest. Im Theme-Builder-Header wird der
   Divi-Abschnitt samt Zeile an den Content-Abschnitt angeglichen (siehe „Divi-
   Theme-Builder-Header“) – gleiche Breite und gleicher Seitenrand wie der Content.
   Nur die Farbflächen (weiße Zeile, Band, Linie) laufen über die ganze
   Fensterbreite (siehe „Randlose Flächen“). */
:root{
    /* Maximale Breite des Content-Abschnitts inkl. Seitenrand (Divi-Body-Abschnitt:
       max-width 1440px, 20 px Rand). Ändert sich dort der Wert, hier nachziehen. */
    --mt-page-max:1440px;

    /* EINZIGE Stelle für den Abstand zwischen Kopf (Unterkante der Linie) und
       Beginn des Contents – auf allen Ebenen gleich. Gelesen in book-view.css
       (Filterleiste der Auswahl-/Seitenansichten, Hero der Inhaltsseite);
       Divi-Zusatzabstände darüber werden dort neutralisiert. */
    --mt-content-gap:clamp(10px,3vw,15px);
}
.mt-hd{
    --mt-hd-band:#335b89;   /* Startebene: Farbe des Footers */
    --mt-hd-stripe:#83caf0;
    --mt-hd-ink:#1d3a5f;
    --mt-hd-pill-h:40px;    /* Höhe einer Pille */
    --mt-hd-pill-lead:28px; /* Plakette / Haus-Kreis; (40 − 28) / 2 = 6 px Rand → konzentrisch */
    --mt-hd-gutter:0px;     /* nur nötig, wenn der Kopf außerhalb einer Divi-Zeile steht */
    --mt-hd-font:"Nunito","Segoe UI",system-ui,-apple-system,Roboto,Helvetica,Arial,sans-serif;
    display:block;
    width:100%;
    font-family:var(--mt-hd-font);
    color:var(--mt-hd-ink);
    line-height:1.4;
}
.mt-hd *,
.mt-hd *::before,
.mt-hd *::after{box-sizing:border-box}

/* Klassenstufen-Farbschema: Band + Linie. */
.mt-hd.mt-klasse--1{--mt-hd-band:#1b4f8c;--mt-hd-stripe:#83caf0}
.mt-hd.mt-klasse--2{--mt-hd-band:#a85a0c;--mt-hd-stripe:#f0b26a}
.mt-hd.mt-klasse--3{--mt-hd-band:#2f7a3e;--mt-hd-stripe:#93cf9f}
.mt-hd.mt-klasse--4{--mt-hd-band:#6a40c0;--mt-hd-stripe:#bba6ef}

.mt-hd__inner{
    display:flex;
    align-items:center;
    width:100%;
    padding:0 var(--mt-hd-gutter);
}
.mt-hd .mt-hd__sr{
    position:absolute;
    width:1px;
    height:1px;
    margin:-1px;
    padding:0;
    overflow:hidden;
    clip:rect(0 0 0 0);
    white-space:nowrap;
    border:0;
}

/* =========================================================================
   Zeile 1: Logo
   ====================================================================== */
.mt-hd__top{
    position:relative;
    isolation:isolate;
}
.mt-hd__top .mt-hd__inner{min-height:64px}
.mt-hd .mt-hd__logo{
    display:flex;
    align-items:center;
    flex:none;
}
.mt-hd .mt-hd__logo img{
    display:block;
    height:34px;
    width:auto;
    max-width:none;
}

/* =========================================================================
   Zeile 2: Breadcrumb-Band
   ====================================================================== */
.mt-hd__band{
    position:relative;
    isolation:isolate;
    padding-bottom:4px;     /* Platz für die Linie (siehe „Randlose Flächen“) */
    color:#fff;
}
.mt-hd__band .mt-hd__inner{height:60px}

.mt-hd .mt-hd__crumbs{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
    margin:0;
    padding:0;
    list-style:none;
    font-size:16px;
    font-weight:600;
    white-space:nowrap;
    color:var(--mt-hd-ink);
}
.mt-hd .mt-hd__item{
    display:flex;
    align-items:center;
    flex:0 1 auto;
    gap:8px;
    min-width:96px;         /* Trenner + Pille bleiben auch gekürzt als Pille erkennbar */
    margin:0;
    padding:0;
    list-style:none;
}
/* Kürzen in Stufen, wenn die Kette nicht passt: zuerst der aktuelle (tiefste)
   Eintrag, dann die Ebenen ab der dritten; Wurzel und Buch-/Heft-Ebene (kurze
   Titel wie „Mathetiger 1“) werden nicht gekürzt – es sei denn, sie sind selbst
   der aktuelle Eintrag. Die Faktoren gewichten die Verteilung (Flex-Shrink). */
.mt-hd .mt-hd__item:nth-child(2){flex-shrink:0}
.mt-hd .mt-hd__item:nth-child(n+3){flex-shrink:6}
.mt-hd .mt-hd__item.mt-hd__item--current{flex-shrink:100;min-width:150px} /* Spezifität über :nth-child */
.mt-hd .mt-hd__item--root{flex:none}
.mt-hd .mt-hd__sep{flex:none;color:rgba(255,255,255,.85)}

/* Pille: weiße Fläche mit dunkelblauem Text. Verlinkt und aktuell (letzter
   Eintrag) sehen gleich aus; der aktuelle ist nur fetter und nicht klickbar.
   Der Text liegt in .mt-hd__text (trägt die Ellipse und das Silben-Plugin-Span);
   die Zeilenhöhe 1,5 lässt Umlaut-Punkte und Unterlängen („g“) im abgeschnittenen
   Textfeld stehen. */
.mt-hd .mt-hd__link{
    display:inline-flex;
    align-items:center;
    gap:8px;
    flex:0 1 auto;
    min-width:0;
    height:var(--mt-hd-pill-h);
    padding:0 18px;
    border-radius:999px;
    background:#fff;
    color:var(--mt-hd-ink);
    text-decoration:none;
    letter-spacing:.01em;
    transition:background-color .15s ease, box-shadow .15s ease;
}
/* Plakette bzw. Haus-Kreis vorn: weniger Innenabstand links, damit der Rand rund
   um das Element überall gleich (6 px) ist. */
.mt-hd .mt-hd__link--lead{padding-left:calc((var(--mt-hd-pill-h) - var(--mt-hd-pill-lead)) / 2)}
.mt-hd .mt-hd__text{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    line-height:1.5;
}
.mt-hd a.mt-hd__link:hover{
    color:var(--mt-hd-ink);
    background:color-mix(in srgb, var(--mt-hd-band) 10%, #fff);
}
.mt-hd .mt-hd__link--current{
    cursor:default;
}
.mt-hd .mt-hd__home{
    flex:none;
    width:var(--mt-hd-pill-lead);
    height:var(--mt-hd-pill-lead);
    padding:6px;
    border-radius:50%;
    background:color-mix(in srgb, var(--mt-hd-band) 13%, #fff);
    color:var(--mt-hd-band);
}
.mt-hd .mt-hd__badge{
    display:inline-flex;
    flex:none;
    align-items:center;
    justify-content:center;
    width:var(--mt-hd-pill-lead);
    height:var(--mt-hd-pill-lead);
    border-radius:4px 14px 14px 14px;
    background:var(--mt-hd-band);
    font-size:15px;
    font-weight:800;
    line-height:1;
    letter-spacing:0;
    color:#fff;
}
.mt-hd .mt-hd__strong{font-weight:800;margin-right:5px}

.mt-hd .mt-hd__hint{
    margin:0;
    font-size:16px;
    font-weight:700;
    color:#fff;
}

/* Nur Smartphone: runder Zurück-Knopf „‹“ + Pille der aktuellen Ebene (dieselbe
   Pille wie der letzte Breadcrumb-Eintrag). Der Knopf ist so hoch wie die Pille
   und kreisrund – das Gegenstück zum Haus-Kreis am Anfang des Breadcrumbs. */
.mt-hd .mt-hd__mobile{
    display:none;
    align-items:center;
    gap:8px;
    min-width:0;
    max-width:100%;
    font-size:16px;
    font-weight:700;
    white-space:nowrap;
    color:var(--mt-hd-ink);
}
.mt-hd .mt-hd__up{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:none;
    width:var(--mt-hd-pill-h);
    height:var(--mt-hd-pill-h);
    border-radius:50%;
    background:#fff;
    color:var(--mt-hd-band);
    text-decoration:none;
    transition:background-color .15s ease;
}
.mt-hd .mt-hd__up svg{flex:none;margin-left:-2px} /* optisch mittig */
.mt-hd a.mt-hd__up:hover{
    color:var(--mt-hd-band);
    background:color-mix(in srgb, var(--mt-hd-band) 10%, #fff);
}
.mt-hd .mt-hd__mobile .mt-hd__link{padding-right:16px}
.mt-hd .mt-hd__mobile .mt-hd__link:not(.mt-hd__link--lead){padding-left:16px}

/* Tastaturfokus: dunkel auf Weiß, weiß auf dem Band. */
.mt-hd a:focus-visible{
    outline:3px solid var(--mt-hd-band);
    outline-offset:2px;
}
.mt-hd__band a:focus-visible{outline-color:#fff}

/* =========================================================================
   Randlose Flächen: weiße Zeile, Band und Linie laufen über die volle
   Fensterbreite, der Inhalt bleibt in der Breite der umgebenden Zeile. Der
   Schatten (Spread 100vmax) erzeugt keinen horizontalen Scroll; clip-path
   begrenzt ihn auf die Höhe der jeweiligen Fläche.
   ====================================================================== */
.mt-hd__top::before,
.mt-hd__band::before,
.mt-hd__band::after{
    content:"";
    position:absolute;
    left:0;
    right:0;
    z-index:-1;
    clip-path:inset(0 -100vmax);
}
.mt-hd__top::before{
    top:0;
    bottom:0;
    background:#fff;
    box-shadow:0 0 0 100vmax #fff;
}
.mt-hd__band::before{
    top:0;
    bottom:4px;
    background:var(--mt-hd-band);
    box-shadow:0 0 0 100vmax var(--mt-hd-band);
}
.mt-hd__band::after{
    bottom:0;
    height:4px;
    background:var(--mt-hd-stripe);
    box-shadow:0 0 0 100vmax var(--mt-hd-stripe);
}

/* =========================================================================
   Divi-Theme-Builder-Header: Abschnitt und Zeile um den Kopf herum wie im
   Content-Abschnitt aufgebaut – Abschnitt max. --mt-page-max, zentriert, mit dem
   Seitenrand aus den Divi-Einstellungen; Zeile 100 % davon (statt Divi-Standard
   80 % / 1080 px). Der Kopf bestimmt seine Höhe selbst: feste Höhe und
   Unterkante des früheren Header-Abschnitts entfallen, sonst überdeckt der
   Content die untere Linie.
   ====================================================================== */
.et-l--header .et_pb_section:has(.mt-hd){
    max-width:var(--mt-page-max) !important;
    margin-left:auto !important;
    margin-right:auto !important;
    height:auto !important;
    min-height:0 !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
    border-bottom:0 !important;
}
.et-l--header .et_pb_row:has(.mt-hd){
    width:100% !important;
    max-width:100% !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
}
.et-l--header .et_pb_column:has(.mt-hd),
.et-l--header .et_pb_module:has(.mt-hd){
    margin-bottom:0 !important;
}

/* =========================================================================
   Divi-Theme-Builder-Footer: Der Tiger (mathetiger-footer.webp) entfällt auf
   allen Seiten. Sein Abschnitt enthält nur dieses Bild; ausgeblendet wird der
   ganze Abschnitt, damit auch dessen Innenabstand (2 × 50 px) verschwindet.
   Erkannt über die Bildquelle, nicht über die Position: wird der Abschnitt im
   Theme Builder gelöscht, greift die Regel einfach nicht mehr. Steht hier, weil
   header.css auf jeder Seite geladen wird.
   ====================================================================== */
.et-l--footer .et_pb_section:has(img[src*="mathetiger-footer"]){
    display:none !important;
}

/* =========================================================================
   Smartphone
   ====================================================================== */
@media (max-width:760px){
    .mt-hd__top .mt-hd__inner{min-height:56px}
    .mt-hd .mt-hd__logo img{height:24px}
    .mt-hd__band .mt-hd__inner{height:56px}

    /* Band: Zurück-Knopf + aktuelle Ebene statt der ganzen Kette. */
    .mt-hd .mt-hd__crumbs{display:none}
    .mt-hd .mt-hd__mobile{display:flex}
}
