/*
 * Die Oberfläche von mergewerk.
 *
 * Zwei Fassungen, ein Regelwerk: Alle Farben stehen als Merkmale in `:root`, der
 * Nachtmodus setzt dieselben Namen neu. Kein Bauteil kennt eine Farbe unmittelbar —
 * deshalb gibt es nichts, was in der einen Fassung stimmt und in der anderen nicht.
 *
 * Hell ist die Grundeinstellung, auch auf einem Gerät, das dunkel bevorzugt. Der Wechsel
 * ist eine Entscheidung des Betrachters, keine des Betriebssystems; getroffen wird sie
 * über den Schalter in der Kopfzeile.
 */

:root {
    color-scheme: light;

    /* #01396A ist das Blau des Fördergerüsts aus dem Logo. */
    --marke: #01396a;
    --marke-hell: #0a4f8f;
    --marke-schwach: #e8f0f9;
    --auf-marke: #ffffff;

    --grund: #f6f8fb;
    --platte: #ffffff;
    --platte-schwach: #eef2f7;
    --text: #16202b;
    --text-schwach: #5b6878;
    --linie: #dde4ec;

    --gut: #1a7f52;
    --gut-schwach: #e6f4ed;
    --schlecht: #b3261e;
    --schlecht-schwach: #fceceb;
    --warnung: #9a6400;
    --warnung-schwach: #fdf3e2;

    --rund: 0.625rem;
    --rund-klein: 0.375rem;
    --schatten: 0 1px 2px rgb(16 32 48 / 6%), 0 1px 3px rgb(16 32 48 / 4%);
    --schatten-hoch: 0 4px 12px rgb(16 32 48 / 8%), 0 1px 3px rgb(16 32 48 / 6%);
    --breite: 68rem;
}

[data-thema="nacht"] {
    color-scheme: dark;

    --marke: #7db4e8;
    --marke-hell: #a3ccf2;
    --marke-schwach: #16273a;
    --auf-marke: #0b1620;

    --grund: #0e1319;
    --platte: #151c24;
    --platte-schwach: #1c252f;
    --text: #e6ecf3;
    --text-schwach: #9aa8b8;
    --linie: #2a3541;

    --gut: #5cc38f;
    --gut-schwach: #14291f;
    --schlecht: #ef8b84;
    --schlecht-schwach: #2d1917;
    --warnung: #e0aa52;
    --warnung-schwach: #2a2114;

    --schatten: 0 1px 2px rgb(0 0 0 / 40%);
    --schatten-hoch: 0 4px 14px rgb(0 0 0 / 45%);
}

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

body {
    margin: 0;
    background: var(--grund);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

/* Ein sichtbarer Fokus überall: Wer mit der Tastatur bedient, muss sehen, wo er steht. */
:focus-visible {
    outline: 2px solid var(--marke);
    outline-offset: 2px;
    border-radius: var(--rund-klein);
}

a {
    color: var(--marke);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

code {
    padding: 0.1em 0.35em;
    border-radius: var(--rund-klein);
    background: var(--platte-schwach);
    font-size: 0.9em;
}

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

.kopf {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--linie);
    background: var(--platte);
}

.kopf-innen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    max-width: var(--breite);
    margin: 0 auto;
    padding: 0.65rem 1.25rem;
}

.marke {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    color: var(--marke);
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.marke img {
    display: block;
    width: 2rem;
    height: 2rem;
}

.kopf-rechts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.navigation a {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0.7rem;
    border-radius: var(--rund-klein);
    color: var(--text-schwach);
    font-size: 0.95rem;
    text-decoration: none;
}

.navigation a:hover {
    background: var(--platte-schwach);
    color: var(--marke);
}

.navigation a.aktiv {
    background: var(--marke-schwach);
    color: var(--marke);
    font-weight: 600;
}

/* Der Schalter für den Nachtmodus. Er trägt ein Symbol und einen Text für Vorleseanwendungen. */
.thema-schalter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--linie);
    border-radius: var(--rund-klein);
    background: var(--platte);
    color: var(--text-schwach);
    cursor: pointer;
}

.thema-schalter:hover {
    background: var(--platte-schwach);
    color: var(--marke);
}

/* Ohne JavaScript wäre der Schalter ein Knopf ohne Wirkung; dann bleibt er weg. */
.thema-schalter[hidden] {
    display: none;
}

.nur-vorlesen {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ------------------------------------------------------------------- Inhalt */

.inhalt {
    max-width: var(--breite);
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
    font-weight: 650;
    letter-spacing: -0.025em;
}

h2 {
    margin: 2.5rem 0 0.75rem;
    font-size: 1.3rem;
    font-weight: 650;
    letter-spacing: -0.015em;
}

h3 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.anriss {
    max-width: 46rem;
    margin: 0 0 2rem;
    color: var(--text-schwach);
    font-size: 1.1rem;
}

.hinweis {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    color: var(--text-schwach);
    font-size: 0.9rem;
}

.hinweis .fa-solid {
    margin-top: 0.25rem;
}

/* Eine Karte fasst zusammen, was zusammengehört. */
.karte {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--linie);
    border-radius: var(--rund);
    background: var(--platte);
    box-shadow: var(--schatten);
}

.karte > :first-child {
    margin-top: 0;
}

.karte > :last-child {
    margin-bottom: 0;
}

/* Eine Karte, die nur ein Formular trägt, wird nicht breiter als das Formular. */
.karte-schmal {
    max-width: 38rem;
}

/* Die Einstiegspunkte auf der Startseite. */
.kacheln {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    margin: 2rem 0;
    padding: 0;
    list-style: none;
}

.kachel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--linie);
    border-radius: var(--rund);
    background: var(--platte);
    box-shadow: var(--schatten);
    color: inherit;
    text-decoration: none;
}

.kachel:hover {
    border-color: var(--marke);
    box-shadow: var(--schatten-hoch);
}

.kachel .fa-solid {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--rund-klein);
    background: var(--marke-schwach);
    color: var(--marke);
    font-size: 1.1rem;
    line-height: 2.5rem;
    text-align: center;
}

.kachel strong {
    font-size: 1.05rem;
    font-weight: 650;
}

.kachel span {
    color: var(--text-schwach);
    font-size: 0.9rem;
}

/* ----------------------------------------------------------------- Meldungen */

/*
 * Farbe allein trägt nichts: Das Symbol und der Text sagen, was los ist. Wer Farben nicht
 * unterscheidet, liest dasselbe.
 */
.meldung {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0 0 1.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--linie);
    border-left-width: 4px;
    border-radius: var(--rund-klein);
    background: var(--platte);
}

.meldung .fa-solid {
    margin-top: 0.2rem;
}

.meldung-erfolg {
    border-left-color: var(--gut);
    background: var(--gut-schwach);
}

.meldung-erfolg .fa-solid {
    color: var(--gut);
}

.meldung-fehler {
    border-left-color: var(--schlecht);
    background: var(--schlecht-schwach);
}

.meldung-fehler .fa-solid {
    color: var(--schlecht);
}

/* ----------------------------------------------------------------- Formulare */

/*
 * Symfony fasst jede Zeile eines Formulars in ein schmuckloses `div`. Die Regeln hier
 * greifen deshalb auf `.formular > div` — nicht auf eigene Klassen, die es im erzeugten
 * Markup nicht gibt.
 */
.formular {
    display: grid;
    gap: 1.25rem;
    max-width: 34rem;
    margin-bottom: 2rem;
}

.formular > div {
    display: grid;
    gap: 0.35rem;
}

.formular label {
    font-size: 0.95rem;
    font-weight: 600;
}

/*
 * Eine Gruppe aus Auswahlknöpfen: je Zeile ein Knopf und seine Beschriftung. Nebeneinander
 * gesetzt bräche der Umbruch das Paar auseinander — der letzte Knopf stünde am Zeilenende
 * und seine Beschriftung darunter.
 */
.formular > div > div:not(.help-text) {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem 0.6rem;
}

.formular > div > div:not(.help-text) label {
    margin: 0;
    font-weight: 400;
}

/*
 * Ein einzelnes Ankreuzfeld. Symfony stellt die Beschriftung **vor** das Feld; hier steht
 * es davor, wo es hingehört. Umgestellt wird über das Raster, nicht über das Markup —
 * die Reihenfolge im Quelltext bleibt die, die eine Vorleseanwendung erwartet.
 */
.formular > div:has(> input[type="checkbox"]) {
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.6rem;
}

.formular > div:has(> input[type="checkbox"]) > input[type="checkbox"] {
    grid-area: 1 / 1;
}

.formular > div:has(> input[type="checkbox"]) > label {
    grid-area: 1 / 2;
    font-weight: 400;
}

.formular > div:has(> input[type="checkbox"]) > .help-text {
    grid-column: 2;
}

.formular input[type="checkbox"],
.formular input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--marke);
}

.formular input[type="text"],
.formular input[type="email"],
.formular input[type="password"],
.formular input[type="file"],
.formular select {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--linie);
    border-radius: var(--rund-klein);
    background: var(--platte);
    color: var(--text);
    font: inherit;
}

.formular input:focus,
.formular select:focus {
    border-color: var(--marke);
}

.formular input[type="file"] {
    padding: 0.5rem;
    background: var(--platte-schwach);
    cursor: pointer;
}

.formular ul {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
    color: var(--schlecht);
    font-size: 0.9rem;
}

.formular .help-text {
    margin: 0;
    color: var(--text-schwach);
    font-size: 0.85rem;
}

.formular .ankreuzfeld,
.ankreuzfeld {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    font-weight: 400;
}

.formular button {
    margin-top: 1rem;
}

button,
.knopf {
    display: inline-flex;
    gap: 0.55rem;
    align-items: center;
    justify-self: start;
    padding: 0.6rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--rund-klein);
    background: var(--marke);
    color: var(--auf-marke);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.knopf:hover {
    background: var(--marke-hell);
}

.knopf-still {
    background: var(--platte);
    border-color: var(--linie);
    color: var(--text);
}

.knopf-still:hover {
    background: var(--platte-schwach);
    border-color: var(--marke);
    color: var(--marke);
}

/* Das Ziel für Ziehen und Ablegen. */
.formular.ablegen,
#hochladen.ablegen {
    border-radius: var(--rund);
    outline: 2px dashed var(--marke);
    outline-offset: 0.75rem;
}

/* ------------------------------------------------------------------ Tabellen */

/* Auf schmalen Geräten schiebt sich die Tabelle in sich, nicht über den Rand hinaus. */
.tabellenrahmen {
    margin-bottom: 1.5rem;
    overflow-x: auto;
    border: 1px solid var(--linie);
    border-radius: var(--rund);
    background: var(--platte);
    box-shadow: var(--schatten);
}

.tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.tabelle th,
.tabelle td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--linie);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.tabelle thead th {
    background: var(--platte-schwach);
    color: var(--text-schwach);
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tabelle thead th .fa-solid {
    margin-right: 0.4rem;
    color: var(--text-schwach);
}

.tabelle tbody tr:last-child td {
    border-bottom: 0;
}

.tabelle tbody tr:hover td {
    background: var(--platte-schwach);
}

.tabelle form {
    margin: 0;
}

.tabelle button {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

.zahl {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.leer {
    padding: 2.5rem 1.25rem;
    border: 1px dashed var(--linie);
    border-radius: var(--rund);
    color: var(--text-schwach);
    text-align: center;
}

/* ------------------------------------------------------- Zustand eines Laufs */

.zustand {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--linie);
    border-radius: 999px;
    background: var(--platte);
    font-size: 0.9rem;
    font-weight: 600;
}

.zustand-finished {
    border-color: var(--gut);
    background: var(--gut-schwach);
    color: var(--gut);
}

.zustand-failed {
    border-color: var(--schlecht);
    background: var(--schlecht-schwach);
    color: var(--schlecht);
}

.zustand-awaiting_decisions {
    border-color: var(--warnung);
    background: var(--warnung-schwach);
    color: var(--warnung);
}

.zustand-queued,
.zustand-running {
    border-color: var(--marke);
    background: var(--marke-schwach);
    color: var(--marke);
}

/*
 * Das Symbol steht in `::before`, nicht als Element im Text. `zustand.js` schreibt die
 * Beschriftung über `textContent` fort — ein Kindelement wäre danach weg.
 */
.zustand::before {
    font: var(--fa-font-solid);
}

.zustand-queued::before {
    content: "\f251";
}

.zustand-running::before {
    content: "\f013";
}

.zustand-awaiting_decisions::before {
    content: "\f059";
}

.zustand-finished::before {
    content: "\f058";
}

.zustand-failed::before {
    content: "\f06a";
}

/* ------------------------------------------------------------ Widersprüche */

.konflikt {
    margin: 0 0 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--linie);
    border-radius: var(--rund);
    background: var(--platte);
    box-shadow: var(--schatten);
}

.konflikt legend {
    padding: 0 0.5rem;
    font-weight: 650;
}

.vergleich {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    margin-bottom: 1rem;
}

.vergleich h3 {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0 0 0.5rem;
    color: var(--text-schwach);
    font-size: 0.85rem;
    font-weight: 600;
}

.vergleich pre {
    margin: 0;
    padding: 0.85rem;
    overflow-x: auto;
    border: 1px solid var(--linie);
    border-radius: var(--rund-klein);
    background: var(--platte-schwach);
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.wahl {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.konflikt label {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    font-weight: 400;
}

/* -------------------------------------------------------------- Bericht */

.entscheidungen {
    margin: 0;
    padding: 0;
    list-style: none;
}

.entscheidungen li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--linie);
}

.entscheidungen li:last-child {
    border-bottom: 0;
}

.entscheidungen .ort,
.entscheidungen .quellen,
.entscheidungen .ergebnis {
    color: var(--text-schwach);
    font-size: 0.9rem;
}

.entscheidungen .ort::before,
.entscheidungen .ergebnis::before,
.entscheidungen .quellen::before {
    content: " · ";
    color: var(--linie);
}

.entfernen {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--linie);
}

.entfernen button {
    border-color: var(--linie);
    background: transparent;
    color: var(--text-schwach);
}

.entfernen button:hover {
    border-color: var(--schlecht);
    background: var(--schlecht);
    color: #fff;
}

/* Was mehrere Schaltflächen nebeneinander stellt. */
.reihe {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1.5rem 0;
}

/* ---------------------------------------------------------------- Blätterung */

.blaetterung {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.blaetterung a,
.blaetterung .aktuell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--linie);
    border-radius: var(--rund-klein);
    text-decoration: none;
}

.blaetterung a:hover {
    border-color: var(--marke);
    background: var(--platte-schwach);
}

.blaetterung .aktuell {
    border-color: var(--marke);
    background: var(--marke);
    color: var(--auf-marke);
    font-weight: 650;
}

/* ------------------------------------------------------------------- Abspann */

.abspann {
    border-top: 1px solid var(--linie);
    background: var(--platte);
}

.abspann-innen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    max-width: var(--breite);
    margin: 0 auto;
    padding: 1.25rem;
    color: var(--text-schwach);
    font-size: 0.9rem;
}

/* --------------------------------------------------------------- Fehlerseiten */

.fehlerseite {
    max-width: 34rem;
    margin: 4rem auto;
    text-align: center;
}

.fehlerseite .fa-solid {
    margin-bottom: 1rem;
    color: var(--text-schwach);
    font-size: 2.5rem;
}

.fehlerseite .anriss {
    margin: 0 auto 2rem;
}

.fehlerseite .reihe {
    justify-content: center;
}

/* Wer Bewegung nicht möchte, bekommt keine. */
@media (prefers-reduced-motion: no-preference) {
    .kachel,
    .knopf,
    button,
    .navigation a {
        transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
    }
}

@media (max-width: 40rem) {
    .kopf-innen {
        padding: 0.5rem 1rem;
    }

    .inhalt {
        padding: 1.75rem 1rem 3rem;
    }

    .navigation a {
        padding: 0.35rem 0.5rem;
    }
}
