/* MatheBytes – Miura-Faltbogen auf Weiß
   Ein weißer Bogen, Bergfalten grau, Talfalten blau gestrichelt, Goldfolie nur dort, wo man starten kann. */

@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --sheet: #ffffff;
  --ink: #12151c;
  --ink-2: #4b515d;
  --mountain: #a9acb2;
  --mountain-soft: #dcdee2;
  --valley: #9dbbe6;
  --valley-ink: #2856a3;
  --valley-tint: #eef4fc;
  --foil: #cfa13a;
  --foil-light: #e9c66f;
  --foil-dark: #8f6b14;
  --facet: #f1f2f4;

  --display: "Chakra Petch", "Bahnschrift", "Segoe UI", sans-serif;
  --text: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --slant: -11deg;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--foil-light); color: var(--ink); }

a { color: var(--valley-ink); text-underline-offset: .2em; text-decoration-thickness: 1px; }

:focus-visible { outline: 3px solid var(--valley-ink); outline-offset: 3px; }

html { scrollbar-color: var(--mountain) var(--sheet); }

@view-transition { navigation: auto; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Kopfzeile ---------- */

.kopf {
  border-bottom: 1px solid var(--mountain-soft);
  position: relative;
}
.kopf .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 72px;
}
.marke {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--ink); text-decoration: none;
  font: 700 1.25rem/1 var(--display); letter-spacing: .01em;
}
.marke svg { width: 34px; height: 30px; flex: none; }
.kopf nav { display: flex; gap: 4px; }
.kopf nav a {
  font: 600 .875rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; padding: 10px 14px; position: relative;
}
.kopf nav a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  background: var(--foil); transform: skewX(var(--slant)) scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.kopf nav a:hover { color: var(--ink); }
.kopf nav a:hover::after, .kopf nav a[aria-current="page"]::after { transform: skewX(var(--slant)) scaleX(1); }
.kopf nav a[aria-current="page"] { color: var(--ink); }

/* ---------- Brotkrumen ---------- */

.krumen {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font: 600 .8125rem/1.3 var(--display); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2);
}
.krumen li { display: inline-flex; align-items: center; gap: 10px; }
.krumen li + li::before {
  content: ""; width: 14px; height: 1px; background: var(--mountain);
  transform: rotate(-60deg);
}
.krumen a { color: var(--ink-2); text-decoration: none; }
.krumen a:hover { color: var(--valley-ink); text-decoration: underline; }

/* ---------- Startseite: Bogen ---------- */

.bogen {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--mountain-soft);
}
.bogen .wrap {
  position: relative; z-index: 1;
  padding-top: clamp(48px, 9vw, 120px);
  padding-bottom: clamp(40px, 6vw, 88px);
}
.bogen h1 {
  position: relative; z-index: 2;
  margin: 0;
  font: 700 clamp(3.25rem, 9.5vw, 6rem)/.92 var(--display);
  letter-spacing: -.02em;
  text-wrap: balance;
}
.bogen h1 span {
  display: block;
  font-weight: 500;
  font-size: .5em;
  letter-spacing: 0;
  margin-top: .35em;
  color: var(--ink-2);
}
.bogen p {
  max-width: 34ch;
  text-wrap: balance;
  margin: 28px 0 0;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.5;
  color: var(--ink);
}
.faltfeld {
  position: absolute; z-index: 0;
  top: 0; right: 0; bottom: 0;
  width: min(62vw, 860px);
  pointer-events: none;
}
.faltfeld svg { width: 100%; height: 100%; display: block; }
.bogen:has(.herz) .faltfeld {
  -webkit-mask-image: radial-gradient(ellipse 40% 52% at 62% 50%, transparent 45%, #000 85%);
  mask-image: radial-gradient(ellipse 40% 52% at 62% 50%, transparent 45%, #000 85%);
}
.faltfeld .berg { stroke: var(--mountain); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.faltfeld .tal { stroke: var(--valley); stroke-width: 1; stroke-dasharray: 5 4; fill: none; vector-effect: non-scaling-stroke; }
.faltfeld .facette { fill: var(--facet); }
.faltfeld .schatten { fill: #e4e6ea; }
/* Mathe-Herz: liegt auf dem entfalteten Bogen */
.herz {
  position: absolute; z-index: 1;
  right: clamp(24px, 7vw, 120px); top: 50%;
  width: clamp(280px, 33vw, 470px); height: auto;
  transform: translateY(-50%);
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 1px #fff);
  animation: herz-schreiben 1.8s var(--ease) .35s backwards;
  pointer-events: none;
}
@keyframes herz-schreiben {
  from { clip-path: inset(0 100% 0 0); opacity: .2; }
  30% { opacity: 1; }
  to { clip-path: inset(0 0 0 0); }
}

/* ---------- Abschnittskopf ---------- */

.abschnitt { padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 8vw, 112px); }
.abschnitt > .wrap > h2,
.seitenkopf h1 {
  margin: 0;
  font: 700 clamp(2.25rem, 5vw, 3.5rem)/1.02 var(--display);
  letter-spacing: -.015em;
  text-wrap: balance;
}
.nachschlagen { padding-top: 0; }
.nachschlagen > .wrap { border-top: 1.5px dashed var(--valley); padding-top: clamp(40px, 6vw, 72px); }
.flaeche h3 + p { margin-top: 12px; }
.seitenkopf { position: relative; overflow: hidden; padding: clamp(28px, 4vw, 48px) 0 clamp(36px, 5vw, 64px); border-bottom: 1px solid var(--mountain-soft); }
.seitenkopf .wrap { position: relative; z-index: 1; }
.seitenkopf .faltfeld { width: min(46vw, 640px); }
.seitenkopf h1 { margin-top: 28px; }
.seitenkopf p {
  max-width: 62ch; margin: 18px 0 0; color: var(--ink-2);
  font-size: 1.1875rem;
}

/* ---------- Faltflächen (Fach, Thema, Lernpfad) ---------- */

.flaechen {
  display: grid;
  gap: clamp(20px, 2.6vw, 32px);
  margin-top: clamp(32px, 4vw, 48px);
  padding: 0 14px;
}
.flaechen.zwei { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.flaechen.reihe { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }

.flaeche {
  position: relative;
  isolation: isolate;
  display: flex; flex-direction: column;
  padding: 28px 34px 30px;
  color: var(--ink);
  text-decoration: none;
  min-height: 100%;
  transform-origin: 0 50%;
  animation: entfalten .7s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 90ms + 80ms);
}
.flaeche::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border: 1px solid var(--mountain);
  background: var(--sheet);
  transform: skewX(var(--slant));
  transition: border-color .3s var(--ease), background-color .3s var(--ease), box-shadow .4s var(--ease);
}
/* Goldecke: hier geht es los */
.flaeche.offen::after {
  content: ""; position: absolute; top: 0; right: -6px; z-index: -1;
  width: 46px; height: 46px;
  background:
    linear-gradient(to bottom left, transparent 50%, var(--foil-dark) 50%) 0 0 / 50% 50% no-repeat,
    var(--foil);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform: skewX(var(--slant)); transform-origin: top right;
  transition: transform .35s var(--ease);
}
a.flaeche:hover::before {
  border-color: var(--ink);
  box-shadow: 0 18px 40px -24px rgba(18, 21, 28, .35);
}
a.flaeche:hover::after { transform: skewX(var(--slant)) scale(1.35); }
a.flaeche:focus-visible { outline: none; }
a.flaeche:focus-visible::before { border-color: var(--valley-ink); box-shadow: 0 0 0 3px var(--valley-ink); }

/* Noch gefaltet: kommt bald */
.flaeche.bald { color: var(--ink-2); }
.flaeche.bald::before {
  border: 1.5px dashed var(--valley);
  background: repeating-linear-gradient(-59deg, transparent 0 22px, var(--valley-tint) 22px 23px);
}

.marker {
  font: 600 .8125rem/1 var(--display); text-transform: uppercase; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px;
  border: 1px solid currentColor;
  transform: skewX(var(--slant));
  letter-spacing: .1em;
}
.marker > * { transform: skewX(calc(var(--slant) * -1)); }
.marker svg { width: 16px; height: 14px; }

.flaeche h2, .flaeche h3 {
  margin: 18px 0 0;
  font: 700 clamp(1.5rem, 2.4vw, 2rem)/1.08 var(--display);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.flaechen.zwei .flaeche h2 { font-size: clamp(2.25rem, 4.6vw, 3.25rem); }
.flaeche p { margin: 12px 0 0; max-width: 46ch; color: var(--ink-2); font-size: 1.0625rem; }
.flaeche.bald h2, .flaeche.bald h3 { color: var(--ink-2); }

.themenliste {
  list-style: none; margin: 22px 0 0; padding: 0;
  border-top: 1px solid var(--mountain-soft);
}
.themenliste li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--mountain-soft);
  font-size: 1.0625rem;
}
.themenliste li span:last-child {
  font: 600 .875rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
}
.themenliste li.ist-bald { color: var(--ink-2); }

.daten {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 18px 0 0; padding: 0;
  font: 500 .9375rem/1.3 var(--display); letter-spacing: .02em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.daten div { display: flex; gap: 6px; }
.daten dt { color: var(--ink-2); font-weight: 600; text-transform: uppercase; font-size: .875rem; letter-spacing: .1em; align-self: center; }
.daten dt::after { content: ""; }
.daten dd { margin: 0; color: var(--valley-ink); font-weight: 600; }
.flaeche.bald .daten dd { color: var(--ink-2); }

/* Teil-Nummer in der Titelzeile */
.flaeche h2 .nr {
  display: inline-block; min-width: 1.15em; margin-right: .3em;
  color: var(--valley-ink); font-variant-numeric: tabular-nums;
}
.flaeche.bald h2 .nr { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.flaeche > h2:first-child, .flaeche > h3:first-child { margin-top: 0; }
.flaeche.bald .fuss-aktion { color: var(--ink-2); }

/* Nachschlage-Material in der Fachkarte: eigener Block unter den Themen */
.nachschlag-liste { margin-top: 18px; border-top: 1.5px dashed var(--valley); }

.fuss-aktion {
  margin-top: auto;
  padding-top: 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.weiter {
  display: inline-flex; align-items: center; gap: 12px;
  font: 600 .9375rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink);
}
.weiter svg { width: 30px; height: 12px; transition: transform .35s var(--ease); }
a.flaeche:hover .weiter svg { transform: translateX(6px); }

/* Startknopf in Goldfolie */
.start {
  position: relative; isolation: isolate; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 30px 15px 26px;
  font: 700 1rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink);
}
.start::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--foil);
  transform: skewX(var(--slant));
  transition: background-color .3s var(--ease);
}
a.flaeche:hover .start::before { background-color: var(--foil-light); }
.start svg { width: 18px; height: 16px; }
.groesse { font: 500 .875rem/1.2 var(--display); color: var(--ink-2); letter-spacing: .04em; white-space: nowrap; }

/* Lernpfad-Reihe: verbundene Falten */
.flaechen.reihe .flaeche + .flaeche::before { }
.verbinder { display: none; }

/* ---------- Hinweise ---------- */

.hinweis {
  margin-top: 40px; padding: 24px 28px; max-width: 62ch;
  border: 1.5px dashed var(--valley);
  color: var(--ink);
}
.hinweis a { font-weight: 700; }

/* ---------- Fuß ---------- */

.seitenfuss {
  margin-top: auto;
  border-top: 1px solid var(--mountain-soft);
  font-size: .9375rem; color: var(--ink-2);
}
.seitenfuss .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-top: 26px; padding-bottom: 32px;
}
.seitenfuss a { color: var(--ink-2); }

/* ---------- Impressum ---------- */
.rechtliches p { margin: 0 0 1.2em; max-width: 62ch; }
.abschnitt.rechtliches > .wrap > h2 { margin: 1.8em 0 .5em; font: 700 1.5rem/1.2 var(--display); }
.rechtliches .quelle { margin-top: 2.4em; font-size: .9375rem; color: var(--ink-2); }

/* ---------- Bewegung: eine Faltung ---------- */

@keyframes entfalten {
  from { opacity: 0; transform: perspective(1400px) rotateY(-38deg) translateX(-12px); filter: blur(2px); }
  60% { opacity: 1; filter: blur(0); }
  to { opacity: 1; transform: none; filter: none; }
}
.faltfeld .falte { animation: falte 1.6s var(--ease) .15s backwards; transform-origin: 100% 0; transform-box: view-box; }
@keyframes falte {
  from { opacity: 0; transform: scale(.18) skewX(-20deg); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- Schmal ---------- */

@media (max-width: 760px) {
  :root { --slant: -3.5deg; }
  body { font-size: 1.0625rem; }
  .kopf .wrap { min-height: 60px; }
  .kopf nav a { padding: 10px 8px; letter-spacing: .08em; font-size: .8125rem; }
  .kopf nav a::after { left: 8px; right: 8px; }
  .marke span { display: none; }
  .flaechen.zwei .flaeche h2 { font-size: 2.25rem; }
  .themenliste li { flex-wrap: wrap; gap: 2px 12px; }
  .bogen .faltfeld { width: 100%; opacity: .6; top: auto; height: 150px; }
  .herz { top: auto; bottom: 10px; right: 10px; width: 160px; transform: none; }
  .bogen:has(.herz) .faltfeld { -webkit-mask-image: radial-gradient(ellipse 30% 55% at 80% 55%, transparent 40%, #000 85%); mask-image: radial-gradient(ellipse 30% 55% at 80% 55%, transparent 40%, #000 85%); }
  .seitenkopf .faltfeld { width: 60%; opacity: .45; }
  .bogen .wrap { padding-bottom: 176px; }
  .flaeche { padding: 24px 22px 26px; }
  .flaechen { padding: 0 14px; }
  .fuss-aktion { flex-wrap: wrap; }
}

@media (min-width: 761px) and (max-width: 1060px) {
  .faltfeld { width: 54vw; opacity: .8; }
  .herz { width: 36vw; right: 16px; }
}

/* Beamer und große Bildschirme */
@media (min-width: 1600px) {
  body { font-size: 1.25rem; }
  :root { --max: 1440px; }
}

@media print {
  .faltfeld, .kopf nav { display: none; }
  .flaeche { animation: none; }
}
