/* maschke.ai — Stufe 1. Rein typografisch. Dunkelkammer. */

/* ---------- Schrift ---------- */

@font-face {
  font-family: "N27";
  src: url("../fonts/n27-extralight-webfont.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "N27";
  src: url("../fonts/n27-regular-webfont.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Grundwerte ---------- */

:root {
  color-scheme: dark;

  /* Kontraste gegen --dunkel gerechnet: still 5,9:1 · tief 5,0:1 · licht 4,7:1 */
  --papier: #f1ede5;
  --papier-still: #918b80;
  --papier-tief: #857f74;
  --dunkel: #08080a;
  --licht: #6a66ff; /* Phosphor — das einzige Licht im Raum */

  --sans: "N27", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --rand: clamp(1.25rem, 5.5vw, 6rem);
  --takt: clamp(4.5rem, 13vh, 9rem);

  --hair: #26252a;
}

/* ---------- Licht-Modus (Grundzustand) ----------
   Kein zweites Design, dieselben Werte in Grau: alles entsättigt, der
   Grund ein helles Grau, das Licht wird Tinte. So schlägt die Seite auf:
   die Klasse steht im Markup, nicht erst im Skript — ohne Skript bleibt
   es hell. Kein Speicher, kein Cookie — nur die Abweichung steht in der
   Adresse (#dunkel) und wandert deshalb über die internen Links mit.
   Kontraste gegen den Grund #cfcfcf gerechnet: papier 8,7:1 ·
   still 5,4:1 · tief 4,7:1 · licht 13,5:1 */

html.hell {
  color-scheme: light;

  --papier: #2e2e2e;
  --papier-still: #4d4d4d;
  --papier-tief: #565656;
  --dunkel: #cfcfcf;
  --licht: #000000; /* keine Farbe mehr, nur noch Tinte */

  --hair: #a6a6a6;

  /* Knopffläche und die vier Kanten, aus denen das Relief entsteht:
     außen hart hell/dunkel, innen weich — so wurden Knöpfe damals
     gezeichnet. Text auf der Fläche: 9,6:1. */
  --knopf: #d9d9d9;
  --knopf-hell: #e2e2e2;
  --relief-oben: #ffffff;
  --relief-oben-innen: #ececec;
  --relief-unten-innen: #a6a6a6;
  --relief-unten: #6f6f6f;
}

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

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

body {
  margin: 0;
  background: var(--dunkel);
  color: var(--papier);
  font-family: var(--sans);
  font-weight: 200;
  font-size: clamp(1.0625rem, 0.95rem + 0.6vw, 1.3125rem);
  line-height: 1.5;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Korn. Ein Bild entsteht auf Papier, nicht auf Glas. */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Im Licht kein Korn: Zeilen. Ein Bild entsteht auf einer Röhre. */
html.hell body::before {
  inset: 0;
  opacity: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.13) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px
  );
}

/* Auf hellem Grund trägt die dünne Schrift besser ohne Glättungstrick. */
html.hell body {
  -webkit-font-smoothing: auto;
}

::selection {
  background: var(--licht);
  color: var(--dunkel);
}

/* ---------- Typografische Grundformen ---------- */

h1,
h2,
h3 {
  font-weight: 200;
  margin: 0;
  letter-spacing: -0.028em;
  line-height: 0.94;
  text-wrap: balance;
}

p {
  margin: 0 0 1.15em;
  max-width: 34ch;
}

a {
  color: inherit;
}

.marke {
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.mono {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.6;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--papier-still);
}

.still {
  color: var(--papier-still);
}

.licht {
  color: var(--licht);
}

/* Blinkende Einfügemarke — der Rest des Fossils. */
.marke-cursor {
  display: inline-block;
  width: 0.42em;
  height: 0.86em;
  margin-left: 0.16em;
  translate: 0 0.04em;
  background: var(--licht);
  animation: blink 1.15s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Filmrand: wie tief das Papier schon entwickelt ist. */
.sediment {
  position: fixed;
  top: 0;
  left: 0;
  width: 2px;
  height: 100vh;
  z-index: 3;
  background: var(--licht);
  transform: scaleY(0);
  transform-origin: 0 0;
  opacity: 0.85;
  pointer-events: none;
}

/* ---------- Schalter für das Licht ---------- */

/* Der Halter hält nur die Position — er fängt keine Klicks. */
.schalter-halter {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  max-width: 92rem;
  margin: 0 auto;
  padding: clamp(0.5rem, 2vh, 1.25rem) var(--rand);
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

/* Ohne Skript schaltet nichts — dann steht auch kein Knopf da. */
html:not(.js) .schalter-halter {
  display: none;
}

.schalter {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.7rem 0 0.9rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--dunkel);
  color: var(--papier-still);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.schalter:hover,
.schalter:focus-visible {
  color: var(--papier);
}

.schalter__klammer {
  color: var(--licht);
}

/* Im Licht ist es ein Knopf, wie ihn Fenster damals hatten: die Fläche
   einen Ton heller als der Grund, außen eine harte Kante, innen eine
   weiche. Der Rahmen liegt schon im Grundzustand (1px, durchsichtig),
   der Schatten ist innen — der Knopf springt beim Umschalten nicht. */
html.hell .schalter {
  background: var(--knopf);
  color: var(--papier);
  border-color: var(--relief-oben) var(--relief-unten) var(--relief-unten)
    var(--relief-oben);
  box-shadow: inset 1px 1px 0 var(--relief-oben-innen),
    inset -1px -1px 0 var(--relief-unten-innen);
}

html.hell .schalter:hover,
html.hell .schalter:focus-visible {
  background: var(--knopf-hell);
}

/* Gedrückt: dasselbe Relief, nur andersherum. */
html.hell .schalter:active {
  background: var(--knopf);
  border-color: var(--relief-unten) var(--relief-oben) var(--relief-oben)
    var(--relief-unten);
  box-shadow: inset 1px 1px 0 var(--relief-unten-innen),
    inset -1px -1px 0 var(--relief-oben-innen);
}

/* ---------- Gerüst ---------- */

.blatt {
  position: relative;
  z-index: 1;
  padding: 0 var(--rand);
  max-width: 92rem;
  margin: 0 auto;
}

.bogen {
  position: relative;
  padding: var(--takt) 0;
  border-top: 1px solid var(--hair);
}

/* Passermarke: die Nummer sitzt auf der Linie. */
.passer {
  position: absolute;
  top: -0.62em;
  left: 0;
  background: var(--dunkel);
  padding-right: 1.1em;
  z-index: 2;
}

/* Im Licht darf die Passermarke kein Loch in die Zeilen schlagen: sie
   deckt die Linie weiter ab, trägt aber dasselbe Raster — am Fenster
   verankert, wie die Röhre selbst, damit die Zeilen durchlaufen. */
html.hell .passer {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.13) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px
  );
  background-attachment: fixed;
}

.passer::before {
  content: "";
  display: inline-block;
  width: 1.6rem;
  height: 1px;
  translate: 0 -0.32em;
  margin-right: 0.9em;
  background: var(--licht);
}

/* ---------- Kopf ---------- */

.kopf {
  padding-top: clamp(2.5rem, 9vh, 5.5rem);
  padding-bottom: var(--takt);
}

.kopf__marke {
  font-size: clamp(2.75rem, 13.5vw, 11rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin: 0.5em 0 0;
}

.kopf__deskriptor {
  margin: clamp(1.75rem, 5vh, 3rem) 0 0;
  font-size: clamp(1.375rem, 1rem + 3.1vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  max-width: 26ch;
}

/* Zeilen treten nach rechts — der Blick fällt schräg ein. */
.kopf__deskriptor span {
  display: block;
}

.kopf__deskriptor span:nth-child(2) {
  padding-left: 1.1em;
}

.kopf__deskriptor span:nth-child(3) {
  padding-left: 2.2em;
}

.kopf__haltung {
  margin: clamp(2.5rem, 8vh, 5rem) 0 0;
  border-left: 1px solid var(--licht);
  padding-left: clamp(1rem, 3vw, 2.5rem);
  font-size: clamp(1.0625rem, 0.95rem + 0.6vw, 1.375rem);
  max-width: 30ch;
  color: var(--papier);
}

.kopf__haltung b {
  font-weight: 400;
  display: block;
}

/* ---------- Fließtext-Bögen ---------- */

.satz {
  font-size: clamp(1.5rem, 1.05rem + 2.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 30ch;
  margin: 0;
}

.satz + .satz {
  margin-top: 0.7em;
}

.satz--weit {
  max-width: 38ch;
}

.absatz {
  margin-top: clamp(2rem, 6vh, 3.5rem);
  max-width: 60ch;
  columns: 1;
}

.absatz p {
  max-width: 46ch;
}

/* ---------- Arbeitsmodi ---------- */

.modi {
  list-style: none;
  margin: clamp(3rem, 9vh, 5.5rem) 0 0;
  padding: 0;
}

.modus {
  position: relative;
  padding-top: clamp(2.25rem, 6vh, 3.5rem);
  margin-top: clamp(2.25rem, 6vh, 3.5rem);
  border-top: 1px solid var(--hair);
}

.modus:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

/* Die Ziffer ist Bild, nicht Beschriftung: offen, überstehend.
   -0.083em ist die linke Seitenlage der „0" in N27 ExtraLight (aus der
   Schriftdatei gelesen) — so steht die Kontur bündig auf der Blattkante,
   nicht um ihre eigene Vorbreite nach innen versetzt. */
.modus__zahl {
  font-size: clamp(4.5rem, 17vw, 9rem);
  font-weight: 200;
  line-height: 0.78;
  letter-spacing: -0.05em;
  margin: 0 0 -0.12em -0.083em;
  color: var(--papier-tief);
  max-width: none;
}

@supports ((-webkit-text-stroke: 1px #000) or (text-stroke: 1px #000)) {
  .modus__zahl {
    color: transparent;
    -webkit-text-stroke: 1px var(--papier-tief);
  }
}

.modus__titel {
  font-size: clamp(1.625rem, 1.1rem + 3vw, 3.25rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.035em;
}

.modus__strich {
  color: var(--licht);
  font-weight: 200;
  padding: 0 0.12em;
}

.modus__zeile {
  margin: 0.7em 0 clamp(1.25rem, 4vh, 2rem);
  font-size: clamp(1.125rem, 1rem + 0.8vw, 1.5rem);
  color: var(--papier);
  max-width: 24ch;
}

.modus__inhalt p:not(.modus__zeile):not(.modus__lead) {
  color: var(--papier-still);
}

/* 04 trägt mehr: mehr Fläche, mehr Text, das Phosphor-Licht am Rand. */
.modus--lang {
  border-top-color: var(--licht);
}

.modus--lang .modus__zahl {
  color: transparent;
  -webkit-text-stroke: 1px var(--licht);
}

@supports not ((-webkit-text-stroke: 1px #000) or (text-stroke: 1px #000)) {
  .modus--lang .modus__zahl {
    color: var(--licht);
  }
}

.modus--lang .modus__titel {
  font-size: clamp(1.875rem, 1.1rem + 4.2vw, 4.25rem);
}

.modus__lead {
  font-size: clamp(1.25rem, 1rem + 1.6vw, 2rem);
  line-height: 1.14;
  letter-spacing: -0.028em;
  max-width: 28ch;
  margin-bottom: clamp(1.5rem, 5vh, 2.5rem);
  color: var(--papier);
}

.modus__spalten p {
  max-width: 46ch;
}

/* Erzähllogik, an den Rand notiert. */
.spur {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 2.5rem;
  margin: clamp(2.5rem, 7vh, 4rem) 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hair);
  color: var(--papier-tief);
}

/* ---------- Gebaut ---------- */

.faelle {
  list-style: none;
  margin: clamp(3rem, 9vh, 5rem) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(2.5rem, 8vh, 4.5rem);
}

.fall {
  border-left: 1px solid var(--hair);
  padding-left: clamp(1rem, 3.5vw, 2.25rem);
}

.fall__wer {
  margin: 0 0 clamp(1rem, 3vh, 1.5rem);
  color: var(--papier-tief);
}

.fall__titel {
  font-size: clamp(1.375rem, 1.05rem + 1.9vw, 2.25rem);
  font-weight: 200;
  line-height: 1.06;
  margin-bottom: clamp(1rem, 3vh, 1.5rem);
  max-width: 28ch;
}

.fall p:not(.fall__wer):not(.fall__wirkung) {
  color: var(--papier-still);
}

.fall__wirkung {
  margin: clamp(1.25rem, 4vh, 2rem) 0 0;
  max-width: 32ch;
}

.fall__wirkung .mono {
  display: block;
  margin-bottom: 0.5em;
}

/* ---------- Anfang ---------- */

.anfang__satz {
  font-size: clamp(1.125rem, 1rem + 1vw, 1.5rem);
  max-width: 34ch;
  margin-top: clamp(1.5rem, 5vh, 2.5rem);
}

.termin {
  display: inline-block;
  margin-top: clamp(2.5rem, 8vh, 4.5rem);
  padding: 0.9rem 0 0.7rem;
  min-height: 44px;
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
}

.termin__mass {
  display: block;
  color: var(--licht);
  margin-bottom: 0.9em;
}

.termin__wort {
  display: block;
  font-size: clamp(1.75rem, 1.05rem + 5vw, 5.5rem);
  font-weight: 200;
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.termin__wort::after {
  content: "→";
  display: inline-block;
  margin-left: 0.35em;
  color: var(--licht);
  transition: translate 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.termin:hover,
.termin:focus-visible {
  border-bottom-color: var(--licht);
}

.termin:hover .termin__wort::after,
.termin:focus-visible .termin__wort::after {
  translate: 0.28em 0;
}

.anfang__nach {
  margin-top: clamp(1.5rem, 4vh, 2rem);
  font-size: 1rem;
}

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

.fuss {
  border-top: 1px solid var(--hair);
  padding: clamp(3rem, 9vh, 5rem) 0 clamp(2.5rem, 6vh, 4rem);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem clamp(1.5rem, 6vw, 5rem);
  align-items: baseline;
}

.fuss__block {
  flex: 1 1 14rem;
}

.fuss__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.75rem;
}

.fuss a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--papier-still);
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.fuss a:hover,
.fuss a:focus-visible {
  color: var(--papier);
  border-bottom-color: var(--licht);
}

/* ---------- Rechtsseiten ---------- */

.recht {
  padding-top: clamp(2.5rem, 8vh, 4.5rem);
  padding-bottom: var(--takt);
  max-width: 44rem;
}

.recht h1 {
  font-size: clamp(2rem, 1.4rem + 3.4vw, 4rem);
  margin: 1.5rem 0 clamp(2rem, 6vh, 3rem);
}

.recht h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.6;
  color: var(--licht);
  margin: clamp(2.25rem, 6vh, 3.25rem) 0 0.9rem;
}

.recht p,
.recht address {
  max-width: 58ch;
  font-style: normal;
  margin: 0 0 1.15em;
}

.recht a {
  color: var(--papier);
  text-decoration: none;
  border-bottom: 1px solid var(--licht);
}

.zuruck {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--papier-still);
  text-decoration: none;
}

.zuruck:hover,
.zuruck:focus-visible {
  color: var(--papier);
}

.zuruck::before {
  content: "←";
  margin-right: 0.9em;
  color: var(--licht);
}

/* ---------- Entwicklung: Text kommt aus dem Bad ---------- */

.entwickelt {
  opacity: 0;
  transform: translateY(14px);
}

.js .entwickelt {
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.entwickelt.fertig {
  opacity: 1;
  transform: none;
}

html:not(.js) .entwickelt {
  opacity: 1;
  transform: none;
}

:focus-visible {
  outline: 2px solid var(--licht);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .marke-cursor {
    animation: none;
  }

  .js .entwickelt {
    transition: none;
  }

  .entwickelt {
    opacity: 1;
    transform: none;
  }

  .sediment {
    display: none;
  }
}

/* ---------- Breiter Tisch ---------- */

@media (min-width: 60rem) {
  .kopf {
    padding-top: clamp(4rem, 14vh, 9rem);
  }

  .absatz {
    columns: 2;
    column-gap: clamp(2rem, 5vw, 5rem);
  }

  .absatz p {
    max-width: none;
  }

  /* Die Ziffer rückt in den Rand, der Text hält seine Spalte. */
  .modus {
    display: grid;
    grid-template-columns: minmax(7rem, 13vw) minmax(0, 1fr);
    column-gap: clamp(2rem, 4.5vw, 5rem);
    align-items: start;
  }

  .modus__zahl {
    margin: -0.14em 0 0 -0.083em;
    line-height: 0.8;
  }

  .modus--lang .modus__zahl {
    font-size: clamp(7rem, 13vw, 12rem);
  }

  .modus__spalten {
    columns: 2;
    column-gap: clamp(2rem, 4vw, 4rem);
    margin-top: 0.5rem;
  }

  .modus__spalten p {
    max-width: none;
  }

  .spur {
    justify-content: flex-end;
    text-align: right;
  }

  .faelle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2rem, 5vw, 5rem);
  }

  .kopf__deskriptor {
    max-width: 20ch;
  }
}
