/* z-fighting: eine Spalte, eine Schrift, zwei Farben. */
:root {
  --papier: #fbfaf7;
  --tinte: #1b1b1d;
  --leise: #8a8985;
  --knopf: #29292c;
  --blau: #2d3c96;
  --rot: #d7463c;
  --spalte: 34rem;
}
* { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  margin: 0; padding: 0 1.25rem;
  background: var(--papier); color: var(--tinte);
  font-family: "Courier Prime", "Courier New", Courier, ui-monospace, monospace;
  line-height: 1.55;
}
a { color: var(--blau); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 1px solid var(--blau); outline-offset: 3px; }

header, footer {
  display: flex; justify-content: space-between; gap: 1rem;
  max-width: 62rem; margin: 0 auto; padding: 1.4rem 0;
}
header .titel { color: var(--tinte); }
footer { color: var(--leise); padding: 5rem 0 2rem; }

main { max-width: 62rem; margin: 0 auto; }

figure { margin: 0; }
figcaption { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 0.7rem; }
.leise { color: var(--leise); }

.werk { max-width: 40rem; margin: 2.5rem auto 0; }
.werk canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; cursor: grab; touch-action: pan-y; image-rendering: pixelated; }
.werk canvas.zieht { cursor: grabbing; }
button { font: inherit; color: var(--blau); background: none; border: 0; padding: 0; cursor: pointer; }
button:hover { text-decoration: underline; }
.schalter { display: flex; gap: 1.1rem; }

/* Regler: je Werk, unter der Bildzeile, erst auf Wunsch sichtbar (zf.js baut sie). */
.regler { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem 2rem; padding-top: 1.4rem; }
.regler label { display: block; min-width: 0; }
.regler .kopf { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--leise); }
.regler output { color: var(--tinte); white-space: nowrap; }
.regler input {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 2.2rem; margin: 0;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.regler input::-webkit-slider-runnable-track { height: 1px; background: var(--leise); }
.regler input::-moz-range-track { height: 1px; background: var(--leise); }
.regler input::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -5px; border: 0; border-radius: 0; background: var(--tinte); }
.regler input::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 0; background: var(--tinte); }
.regler .zeile { display: flex; align-items: center; gap: 1.5rem; min-height: 2.2rem; align-self: end; }
.regler .zeile button { color: var(--leise); padding: 0.5rem 0; }
.regler .zeile button[aria-pressed="true"] { color: var(--tinte); }
@media (max-width: 640px) { .regler { grid-template-columns: 1fr 1fr; gap: 0.4rem 1.5rem; } }

.satz { max-width: 40rem; margin: 5rem auto 0; color: var(--leise); }

[hidden] { display: none !important; }
article { margin-top: 1rem; }
/* Ein Werk zur Zeit. Die Pfeile stehen vor dem Titel, damit sie beim Wechseln nicht wandern. */
.wahl { display: flex; align-items: center; gap: 0.2rem; }
.wahl button { color: var(--tinte); padding: 0.5rem 0.7rem; margin: -0.5rem 0; }
.wahl button:first-child { margin-left: -0.7rem; }
.wahl span { margin-left: 0.4rem; }
article .werk { margin-top: 0; }
.quelle { max-width: 40rem; margin: 2.2rem auto 0; }
.quelle p { margin: 0 0 1.2rem; }
.quelle pre { margin: 0 0 1.4rem; font: inherit; line-height: 1.6; overflow-x: auto; }
.quelle i { font-style: italic; }


.serie { max-width: 40rem; margin: 7rem auto 0; }
table { border-collapse: collapse; }
td { padding: 0.15rem 1.5rem 0.15rem 0; vertical-align: top; }
td:first-child { color: var(--leise); width: 3rem; }

@media (max-width: 640px) {
  html { font-size: 13px; }
  .serie { margin-top: 4.5rem; }
  .quelle pre { font-size: 0.9em; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------------------------------------------------------------- eine Bildschirmseite, kein Scrollen
   Kopf, Buehne (nimmt den Rest), Bildzeile, unterer Bereich fester Hoehe. Im unteren Bereich steht entweder
   der Text zum Werk, die Regler oder der Satz zur Regel; die Buehne aendert ihre Groesse dabei nicht. */
:root { --unten: 15rem; }
html { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
body { height: 100%; display: flex; flex-direction: column; }
header { width: 100%; max-width: 40rem; flex: none; padding: 1rem 0 0.6rem; }
main { flex: 1; min-height: 0; width: 100%; max-width: 40rem; display: flex; flex-direction: column; }
article { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.werk, article .werk { flex: 1; min-height: 0; max-width: none; margin: 0; display: flex; flex-direction: column; }
.buehne { flex: 1; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; }
.werk canvas { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); aspect-ratio: auto; touch-action: none; }
figcaption { flex: none; }
.unten { flex: none; height: var(--unten); padding: 1rem 0 0.6rem; overflow-x: hidden; overflow-y: auto; }
.unten p { margin: 0 0 0.8rem; }
.quelle { max-width: none; margin: 0; }
.regler { padding-top: 0; }
@media (prefers-reduced-motion: no-preference) {
  .unten > * { animation: hoch 0.22s ease-out; }
  @keyframes hoch { from { transform: translateY(1.2rem); opacity: 0; } }
}
@media (min-width: 641px) { :root { --unten: 11rem; } }
/* ---------------------------------------------------------------- Bedienelemente der Bildzeile
   Umschalter und Regler-Knopf: feiner Rahmen, leicht gerundet, gefuellt heisst gewaehlt oder offen.
   Pfeile ohne Rahmen, aber mit grosser Tippflaeche. */
figcaption { align-items: center; gap: 0.5rem 1rem; }
.wahl { gap: 0; }
.wahl button, .wahl button:first-child { width: 44px; height: 40px; margin: 0; padding: 0; font-size: 1.5rem; line-height: 1; color: var(--tinte); }
.wahl button:first-child { margin-left: -12px; }
.wahl span { margin-left: 0.3rem; }
.schalter { margin-left: auto; align-items: center; gap: 0.7rem; }
.ansicht { display: inline-flex; border: 1px solid var(--knopf); border-radius: 2px; overflow: hidden; }
.ansicht button, .schalter .auf, .schalter .ar { height: 28px; padding: 0 0.6rem; color: var(--knopf); }
.schalter .auf, .schalter .ar { height: 30px; border: 1px solid var(--knopf); border-radius: 2px; }
.schalter .ar { margin-left: auto; }
.ansicht button[aria-pressed="true"], .schalter .auf[aria-expanded="true"] { background: var(--knopf); color: var(--papier); text-decoration: none; }
.wahl button:hover, .ansicht button:hover, .schalter .auf:hover, .schalter .ar:hover { text-decoration: none; }
@media (hover: hover) {
  .wahl button:hover { color: var(--leise); }
  .ansicht button[aria-pressed="false"]:hover, .schalter .auf[aria-expanded="false"]:hover { background: color-mix(in srgb, var(--knopf) 10%, transparent); }
}
@media (max-width: 640px) { .schalter { width: 100%; margin-left: 0; justify-content: space-between; } }
@media (orientation: landscape) and (max-height: 520px) {   /* Telefon quer: Buehne links, alles andere rechts */
  .werk, article .werk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 1.5rem; }
  .buehne { grid-row: 1 / 3; }
  .unten { height: auto; }
  .regler { grid-template-columns: 1fr 1fr; gap: 0.2rem 1.5rem; }
}

/* Kopfzeile: Titel links, Seiten rechts */
header nav { display: flex; gap: 1.3rem; }
header nav a { color: var(--leise); }
header nav a[aria-current="page"], header .titel { color: var(--tinte); }
/* Textseiten (about) duerfen scrollen */
html.frei { height: auto; overflow: auto; }
html.frei body { height: auto; min-height: 100dvh; }
.seite { max-width: 46ch; padding: 2.5rem 0 4rem; }
.seite p { margin: 0 0 1.1rem; }
.seite .blau { color: var(--blau); } .seite .rot { color: var(--rot); }

/* Hinweis in der Mitte der Kopfzeile, solange die Seite im Aufbau ist. */
header { gap: 0.6rem; }
header .titel, header nav { flex: 1 1 0; }
header nav { justify-content: flex-end; }
header .wip { color: var(--leise); white-space: nowrap; font-size: 0.85em; align-self: center; }
