/* MINTucation – gemeinsamer Rahmen aller Seiten: Farben, Schriften, Kopf- und Fußzeile.

   Jede Seite unter site/ bindet diese Datei ein; rahmen.py setzt den Verweis und Kopf/Fuß (python sync.py).
   Die Bereiche (Einheiten, Pylino, Strom …) definieren keine eigenen Grundfarben,
   sondern greifen auf die Variablen hier zu – so bleibt alles einheitlich.
   Klassen tragen das Präfix mt-, damit sie nicht mit den Klassen der Bereiche kollidieren.

   Gestaltung „Labor“: Millimeterpapier, Datenblatt-Linien, Logo aus vier Kacheln.
   Die Kachelfarben sind zugleich die Fächerfarben: M Mathematik, I Informatik, N Naturwissenschaften, T Technik. */

:root {
  color-scheme: light dark;
  --bg: #FAFAF6;
  --tint: #EFF1EA;            /* leicht abgesetzte Fläche (Auswahl, Leisten) */
  --ink: #13171F;
  --muted: #5B6270;
  --rule: #13171F;            /* kräftige Linie */
  --hair: #D9DDD6;            /* feine Linie */
  --grid-fine: rgb(19 163 143 / 10%);
  --grid-bold: rgb(19 163 143 / 22%);
  --mint: #0E9F8A;            /* Akzent: Flächen, Pfeile, Linien */
  --mint-ink: #0B7A69;        /* Mint für Text, ausreichend Kontrast */
  --mint-soft: rgb(14 159 138 / 13%);
  --ok: #2B8A3E;
  --err: #D63A2F;
  --warn: #A15C00;
  --focus: #0E9F8A;
  --backdrop: rgb(19 23 31 / 45%);
  --tile-ink: #13171F;        /* Schrift auf Kacheln und Mint-Flächen, auch im Dunkelmodus dunkel */
  --tile-line: #13171F;
  --karte: #FFFFFF;           /* Blatt auf dem Papier: Karten, Titelleiste, Knöpfe */
  --kaestchen: rgb(19 120 160 / 12%);  /* Kästchenpapier der Inhalte */
  /* Linien und Schatten der Inhalts-Bausteine – auch für die Anpassungen fremder Exporte (tafelbild.css …) */
  --blatt-rand: 2px solid var(--rule);
  --knopf-schatten: 3px 3px 0 var(--rule);
  --knopf-gedrueckt: 1px 1px 0 var(--rule);
  /* Fächer */
  --mathe: #9D7DFF;
  --info: #FF4FA3;
  --natur: #2ED8B2;           /* Naturwissenschaften */
  --technik: #FF8F3F;
  /* Schriften (Dateien in shared/fonts/) */
  --font-text: 'Lexend', system-ui, sans-serif;
  --font-head: 'Bricolage Grotesque', 'Lexend', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, Consolas, monospace;
}
/* Dunkelmodus nach Geräteeinstellung – außer auf Seiten mit <html class="mt-hell"> (Tafelbilder für den Beamer) */
:root.mt-hell { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not(.mt-hell) {
    --bg: #0C1311;
    --tint: #15201C;
    --ink: #E8F0EC;
    --muted: #94A39C;
    --rule: #E8F0EC;
    --hair: #23302B;
    --grid-fine: rgb(80 230 200 / 7%);
    --grid-bold: rgb(80 230 200 / 15%);
    --mint: #4FE0C4;
    --mint-ink: #4FE0C4;
    --mint-soft: rgb(79 224 196 / 14%);
    --ok: #8FDC97;
    --err: #FF8F87;
    --warn: #F2C14E;
    --focus: #4FE0C4;
    --backdrop: rgb(0 0 0 / 60%);
    --tile-line: #E8F0EC;
    --karte: #141E1B;
    --kaestchen: rgb(150 220 240 / 8%);
  }
}

/* Kachel: Grundbaustein für Logo und Bildkacheln */
.mt-kachel {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  background: var(--c, var(--tint)); color: var(--tile-ink); border: 2px solid var(--tile-line);
  font: 800 1em/1 var(--font-head);
}
[data-f="mathe"] { --c: var(--mathe); }
[data-f="info"] { --c: var(--info); }
[data-f="natur"] { --c: var(--natur); }
[data-f="technik"] { --c: var(--technik); }

/* Bildkachel: Kachel mit dem Bild eines Bereichs statt einer Nummer (Bilder in shared/bilder/, einfarbig).
   Neuer Bereich = eine SVG-Datei und eine Zeile hier. */
.mt-bild { position: relative; }
.mt-bild::before {
  content: ""; position: absolute; inset: 14%; background: currentColor;
  -webkit-mask: var(--bild) center / contain no-repeat; mask: var(--bild) center / contain no-repeat;
}
[data-bild="calliope"] { --bild: url(bilder/calliope.svg); }
[data-bild="einheiten"] { --bild: url(bilder/einheiten.svg); }
[data-bild="strom"] { --bild: url(bilder/strom.svg); }
[data-bild="pylino"] { --bild: url(bilder/pylino.svg); }

/* Kopf- und Fußzeile. Alle Eigenschaften werden gesetzt, damit Stile der Bereiche
   (z. B. header { … } in einer App) nicht durchschlagen. Maße in px, nicht rem: Manche Seiten
   ändern die Grundschriftgröße (Tafelbild), der Rahmen soll trotzdem überall gleich groß sein. */
header.mt-kopf, footer.mt-fuss {
  display: block; flex: none; position: static; margin: 0; padding: 0; box-shadow: none; border-radius: 0;
  background: var(--bg); color: var(--ink); font: 350 16px/1.4 var(--font-text); text-align: left;
}
.mt-kopf *, .mt-fuss * { box-sizing: border-box; }
.mt-wrap { max-width: 1152px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 48rem) { .mt-wrap { padding: 0 40px; } }
.mt-breit .mt-wrap { max-width: none; }
@media (min-width: 48rem) { .mt-breit .mt-wrap { padding: 0 24px; } }

header.mt-kopf { border-bottom: 1px solid var(--rule); }
.mt-kopf .mt-wrap {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 6px 24px; min-height: 48px; padding-top: 8px; padding-bottom: 8px;
}
.mt-logo {
  display: inline-flex; align-items: center; gap: 3px; text-decoration: none; color: var(--ink);
  font: 800 19px/1 var(--font-head); letter-spacing: -0.01em;
}
.mt-logo .mt-kachel { width: 26px; height: 26px; font-size: 16px; border-width: 1.5px; }
.mt-logo-rest { margin-left: 3px; }
.mt-nav { display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 0; padding: 0; }
.mt-nav a {
  color: var(--muted); text-decoration: none;
  font: 500 12px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em;
}
.mt-nav a:hover, .mt-nav a[aria-current] { color: var(--ink); }
.mt-nav a[aria-current] { text-decoration: underline 2px var(--mint); text-underline-offset: 5px; }

/* Menü auf dem Handy: Bereiche hinter einem Knopf (Popover, ohne Skript). Browser ohne Popover
   zeigen die Bereiche wie am Desktop als Zeile(n). */
.mt-menu-knopf, .mt-menu-zu {
  display: none; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px;
  margin: 0; padding: 0; border: 1.5px solid var(--rule); border-radius: 0; background: var(--bg); color: var(--ink);
  cursor: pointer;
}
.mt-menu-knopf svg, .mt-menu-zu svg { width: 20px; height: 20px; }
@media (max-width: 47.99rem) {
  @supports selector(:popover-open) {
    .mt-menu-knopf { display: inline-flex; }
    .mt-nav:not(:popover-open) { display: none; }
    .mt-nav:popover-open {
      display: flex; flex-direction: column; gap: 0; position: fixed; inset: 0 0 auto 0;
      width: auto; height: auto; max-height: 100vh; margin: 0; padding: 6px 16px 16px; overflow: auto;
      border: 0; border-bottom: 1px solid var(--rule); background: var(--bg); color: var(--ink);
    }
    .mt-nav::backdrop { background: var(--backdrop); }
    .mt-nav:popover-open .mt-menu-zu { display: inline-flex; align-self: flex-end; margin-bottom: 6px; }
    .mt-nav:popover-open a {
      padding: 12px 0; border-top: 1px solid var(--hair); color: var(--ink); font-size: 14px;
    }
    .mt-nav:popover-open a[aria-current] { text-underline-offset: 6px; }
  }
}
@media (min-width: 48rem) {
  .mt-nav[popover] {
    display: flex; position: static; inset: auto; width: auto; height: auto; overflow: visible;
    margin: 0; padding: 0; border: 0; background: none; color: inherit;
  }
}

footer.mt-fuss { border-top: 1px solid var(--rule); }
.mt-fuss .mt-wrap {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 16px;
  padding-top: 11px; padding-bottom: 13px;
  font: 500 11.5px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.mt-fuss nav { display: flex; gap: 20px; }
.mt-fuss a { color: var(--muted); }
.mt-fuss a:hover, .mt-fuss a[aria-current] { color: var(--ink); }

.mt-kopf a:focus-visible, .mt-fuss a:focus-visible,
.mt-kopf button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- Bausteine für die Inhalte (Apps, Tafelbilder, Übungen) ----------
   Vorbild ist das Calliope-Tafelbild („Heft“): Blätter mit kräftigem Rand auf Kästchenpapier,
   greifbare Knöpfe mit hartem Versatz-Schatten, Textmarker in der Fachfarbe. Eckig wie die Kacheln.
   Der Rahmen (Kopf, Fuß, Startseite, Übersichten) bleibt ruhig; diese Bausteine gelten innerhalb. */

/* Kästchenpapier als Untergrund */
.mt-papier {
  background-color: var(--bg);
  background-image: linear-gradient(var(--kaestchen) 1px, transparent 1px),
                    linear-gradient(90deg, var(--kaestchen) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Titelleiste direkt unter dem Kopf: Bildkachel, Titel, darunter Fach; rechts die Bedienung */
.mt-leiste {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px;
  padding: 12px 16px; background: var(--karte); color: var(--ink); border-bottom: var(--blatt-rand);
}
@media (min-width: 48rem) { .mt-leiste { padding: 12px 24px; } }
.mt-leiste-titel { display: flex; align-items: center; gap: 14px; min-width: 0; margin-right: auto; }
.mt-leiste-titel .mt-kachel { flex: none; width: 44px; height: 44px; }
.mt-leiste h1, .mt-leiste-name { margin: 0; font: 800 clamp(22px, 4vw, 30px)/1.05 var(--font-head); letter-spacing: -0.02em; }
.mt-leiste-fach {
  margin: 4px 0 0; color: var(--muted);
  font: 500 11.5px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em;
}
.mt-leiste-aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Knöpfe: Blatt mit kräftigem Rand und hartem Schatten; beim Drücken sinkt der Knopf ein */
.mt-knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px; border: var(--blatt-rand); border-radius: 0;
  background: var(--karte); color: var(--ink); box-shadow: var(--knopf-schatten);
  font: 600 1rem/1.2 var(--font-text); text-decoration: none; cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background 120ms ease-out;
}
.mt-knopf:hover { background: var(--tint); }
.mt-knopf:active { transform: translate(2px, 2px); box-shadow: var(--knopf-gedrueckt); }
.mt-knopf:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.mt-knopf:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: var(--knopf-schatten); }
.mt-knopf--haupt { background: var(--mint); color: var(--tile-ink); }
.mt-knopf--haupt:hover { background: var(--mint); filter: brightness(1.08); }
.mt-knopf--klein { min-height: 32px; padding: 4px 10px; gap: 4px; font-size: 0.82rem; box-shadow: 2px 2px 0 var(--rule); }
.mt-knopf--klein:active { box-shadow: 0 0 0 var(--rule); }
/* Knöpfe in der Titelleiste: überall gleich hoch (Calliope-Kapitel: tafelbild.css, Einheiten: diese Regel) */
.mt-leiste .mt-knopf { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.mt-leiste .mt-knopf--symbol { width: 40px; padding: 0; }
/* Symbol-Knopf (z. B. Vollbild): quadratisch, das Symbol ist eine Maske in Textfarbe (hell/dunkel automatisch) */
.mt-knopf--symbol { width: 44px; padding: 0; }
.mt-knopf--klein.mt-knopf--symbol { width: 32px; }
.mt-symbol { display: inline-block; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--symbol) center / contain no-repeat; mask: var(--symbol) center / contain no-repeat; }
.mt-symbol--vollbild { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9V3h6M15 3h6v6M21 15v6h-6M9 21H3v-6'/%3E%3C/svg%3E"); }
.mt-symbol--vollbild-aus { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3v6H3M21 9h-6V3M15 21v-6h6M3 15h6v6'/%3E%3C/svg%3E"); }
/* Teilen (geschwungener Pfeil nach rechts oben, Nutzerwunsch „wie bei TikTok“), Arbeitsblatt (Blatt mit Stift), Einstellungen (Zahnrad) – Nutzerwunsch Nov. 2026:
   Knöpfe der Titelleiste als Symbole, damit sie sich von den Reitern abheben. Immer mit title und aria-label. */
.mt-symbol--teilen { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='black' stroke-width='1.4' stroke-linejoin='round' d='M13 3.5L21.5 11L13 18.5V14C8 14 5 15.8 2.5 20C3 12.8 7 8.2 13 8z'/%3E%3C/svg%3E"); }
.mt-symbol--blatt { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.5 9.5V6.5l-4-4h-9v19h7M13.5 2.5v4h4M7.5 9h5.5M7.5 12.5h4M14 21.6l.7-3.1 5.9-5.9a1.6 1.6 0 0 1 2.3 2.3L17 20.8z'/%3E%3C/svg%3E"); }
.mt-symbol--einstellungen { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' d='M19.15 9.43L21.98 9.9L21.98 14.1L19.15 14.57L18.88 15.24L20.54 17.57L17.57 20.54L15.24 18.88L14.57 19.15L14.1 21.98L9.9 21.98L9.43 19.15L8.76 18.88L6.43 20.54L3.46 17.57L5.12 15.24L4.85 14.57L2.02 14.1L2.02 9.9L4.85 9.43L5.12 8.76L3.46 6.43L6.43 3.46L8.76 5.12L9.43 4.85L9.9 2.02L14.1 2.02L14.57 4.85L15.24 5.12L17.57 3.46L20.54 6.43L18.88 8.76ZM15.3 12a3.3 3.3 0 1 0-6.6 0a3.3 3.3 0 1 0 6.6 0Z'/%3E%3C/svg%3E"); }
/* Blättern: schlanke Pfeilspitzen ohne Strich (Simulationen: vorige/nächste Szene); hoch statt breit */
.mt-symbol--zurueck { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 42' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 3L4 21l12 18'/%3E%3C/svg%3E"); }
.mt-symbol--weiter { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 42' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3l12 18L4 39'/%3E%3C/svg%3E"); }
/* Symbol-Knopf, der etwas aufklappt (Einstellungen): offen = gedrückt wie ein aktiver Reiter */
.mt-knopf--symbol[aria-expanded="true"] { background: var(--ink); color: var(--bg); box-shadow: none; transform: translate(2px, 2px); }

/* Vollbild (Knopf mit .mt-symbol--vollbild, Skript setzt <html class="mt-vollbild">): Kopf- und Fußzeile von
   MINTucation verschwinden, der Inhalt bekommt den ganzen Bildschirm. */
:root.mt-vollbild .mt-kopf, :root.mt-vollbild .mt-fuss { display: none; }

/* Rückweg im Etikett der Titelleiste: „← Bereich · Kapitel“ */
.mt-leiste-fach a, a.mt-leiste-fach { color: inherit; text-decoration: none; }
a.mt-leiste-fach { display: block; }
.mt-leiste-fach a:hover, a.mt-leiste-fach:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Karte: weißes Blatt mit kräftigem Rand */
.mt-karte { background: var(--karte); color: var(--ink); border: var(--blatt-rand); border-radius: 0; }

/* Textmarker unter einer Überschrift, in der Fachfarbe (data-f am Element oder darüber) */
.mt-marker {
  padding: 0 0.15em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: linear-gradient(transparent 58%, var(--c, var(--technik)) 58%, var(--c, var(--technik)) 92%, transparent 92%);
}
@media (prefers-color-scheme: dark) {
  :root:not(.mt-hell) .mt-marker { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--c, var(--technik)) 40%, transparent) 58%,
               color-mix(in srgb, var(--c, var(--technik)) 40%, transparent) 92%, transparent 92%); }
}
