/*
 * Stylesheet des öffentlichen Gebrauchtwagen-Portals (resources/views/gebrauchtwagen/**), bewusst nah an der Jobplattform (public/css/jobs.css):
 * weißes Kopfband mit Logo, dunkler Titelblock über die volle Breite, weiße Karten auf hellgrauem Grund, monochrom, nur Hell-Modus.
 * Gleiche Tokens (Farben, Radius) und dieselben lokalen Schriften wie die Jobplattform (public/fonts/jobs/, Lizenz OFL-*.txt dort) — die Schriften werden
 * nicht kopiert, die @font-face-Regeln zeigen auf dieselben Dateien.
 * Statische Datei (docs/gebrauchtwagen.md „Gestaltung“); jede in den Views benutzte Klasse steht hier und umgekehrt
 * (Wächter: tests/Unit/GwStylesheetWaechterTest.php).
 *
 * Grenzen: keine Fremdressourcen, kein Inline-Style, kein Script (die Galerie ist reines CSS: Scroll-Schiene mit Einrasten, Vorschaubilder als Anker);
 * Kontrast mindestens AA (Werte der Tokens wie in jobs.css: Tinte auf Papier 16,17 · Stahl auf Papier 5,63 · Stahl auf Karte 6,43 · Karte auf Fläche 16,58 ·
 * Papier auf Fläche 14,50), sichtbarer Fokus, Zielgrößen mindestens 44 px.
 */

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/jobs/archivo-latin-700-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/jobs/archivo-latin-800-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/jobs/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/jobs/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}

:root {
    --papier: #eef0f1;
    --karte: #ffffff;
    --tinte: #111417;
    --flaeche: #1b1f23;
    --flaeche-hell: #e3e6e8;
    --stahl: #566067;
    --fehler: #a32121;
    --linie: #c4cbcf;
    --radius: 8px;
    --schrift-titel: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --schrift-text: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --uebergang: 150ms ease;
    color-scheme: light;
}

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

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

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--papier);
    color: var(--tinte);
    font-family: var(--schrift-text);
    font-size: 1.125rem;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--schrift-titel);
    font-weight: 800;
    margin: 0 0 0.75rem;
}

h1 {
    font-size: clamp(2rem, 5.5vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--tinte);
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
    transition: color var(--uebergang);
}

a:hover {
    color: var(--stahl);
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
.fahrzeug-karte:focus-within {
    outline: 3px solid var(--tinte);
    outline-offset: 3px;
}

.knopf:focus-visible {
    box-shadow: inset 0 0 0 2px var(--karte);
}

/* Rahmen und Seitenaufbau */
.huelle {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding-right: 1rem;
    padding-left: 1rem;
}

.ueberspringen {
    position: absolute;
    left: 0.5rem;
    top: -5rem;
    z-index: 20;
    padding: 0.75rem 1rem;
    border: 2px solid var(--tinte);
    border-radius: var(--radius);
    background: var(--karte);
    color: var(--tinte);
    font-weight: 700;
}

.ueberspringen:focus {
    top: 0.5rem;
}

.kopf {
    border-bottom: 1px solid var(--linie);
    background: var(--karte);
}

.marke {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 0;
    color: var(--tinte);
    font-family: var(--schrift-titel);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.marke-logo {
    display: block;
    width: auto;
    height: 2.25rem;
}

.inhalt {
    flex: 1 0 auto;
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.fuss {
    border-top: 1px solid var(--linie);
    background: var(--karte);
    padding: 0.5rem 0;
}

.fuss-innen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 1.5rem;
}

.fuss-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5rem;
}

.fuss-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.fuss-name {
    margin: 0;
    color: var(--stahl);
    font-size: 1rem;
}

/* Titelblock: dunkle Fläche direkt unter dem Kopfband, die h1 in Großbuchstaben */
.titelblock {
    padding: 1.5rem 0 2.25rem;
    background: var(--flaeche);
    color: var(--karte);
}

.titelblock a:focus-visible {
    outline-color: var(--karte);
}

.titelblock .zurueck {
    margin-bottom: 1.25rem;
}

.titelblock-titel {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 1rem + 4vw, 3.25rem);
    overflow-wrap: break-word;
    hyphens: auto;
    text-transform: uppercase;
}

.titelblock-einleitung {
    margin: 0;
    max-width: 48ch;
    font-size: 1.25rem;
    color: var(--flaeche-hell);
}

.zurueck {
    margin: 0 0 0.5rem;
}

/* Knopf: fast schwarze Fläche, weißer Text; `knopf-zurueck` auf dunklem Grund hell umrandet */
.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--flaeche);
    border-radius: var(--radius);
    background: var(--flaeche);
    color: var(--karte);
    font-family: var(--schrift-text);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--uebergang), border-color var(--uebergang);
}

.knopf:hover {
    background: var(--tinte);
    border-color: var(--tinte);
    color: var(--karte);
}

.knopf-zurueck {
    border-color: var(--linie);
    background: transparent;
    color: var(--tinte);
}

.knopf-zurueck:hover {
    background: var(--flaeche-hell);
    border-color: var(--stahl);
    color: var(--tinte);
}

.titelblock .knopf-zurueck {
    border-color: var(--stahl);
    color: var(--karte);
}

.titelblock .knopf-zurueck:hover {
    background: var(--tinte);
    border-color: var(--karte);
    color: var(--karte);
}

.lesespalte {
    max-width: 68ch;
}

.abschnitt {
    margin: 0 0 2rem;
}

.text {
    white-space: pre-line;
}

.leer {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--karte);
}

/* Filter der Fahrzeugliste (GET-Formular ohne JavaScript) */
.filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: 1rem;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--karte);
}

.filter-feld {
    display: flex;
    flex: 1 1 12rem;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-feld label {
    font-weight: 700;
}

.filter select {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--stahl);
    border-radius: var(--radius);
    background: var(--karte);
    color: var(--tinte);
    font: inherit;
}

/* Fahrzeugliste: Kartenraster */
.fahrzeuge {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

@media (min-width: 40rem) {
    .fahrzeuge {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 64rem) {
    .fahrzeuge {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 80rem) {
    .fahrzeuge {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.fahrzeug-karte {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--karte);
    transition: border-color var(--uebergang);
}

.fahrzeug-karte:hover {
    border-color: var(--tinte);
}

.karte-bild {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: var(--flaeche-hell);
}

.karte-foto {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.karte-ohne-foto {
    color: var(--stahl);
    font-weight: 700;
}

.karte-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 1rem 1.25rem 1.25rem;
}

.karte-titel {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    line-height: 1.2;
}

.karte-link {
    color: var(--tinte);
    text-decoration: none;
}

.karte-link:hover {
    color: var(--tinte);
    text-decoration: underline;
}

/* Die ganze Karte ist klickbar; der Fokusring sitzt auf der Karte */
.karte-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.karte-link:focus-visible {
    outline: none;
}

.eckdaten {
    margin: 0 0 0.5rem;
    color: var(--stahl);
    font-size: 1rem;
}

.preis {
    margin: 0 0 0.5rem;
    font-family: var(--schrift-titel);
    font-size: 1.375rem;
    font-weight: 800;
}

.preis-gross {
    font-size: 2rem;
}

.standort {
    margin: auto 0 0;
    color: var(--stahl);
    font-size: 1rem;
}

/* Detailseite */
/* Detailseite: schmal eine Spalte; ab 64 rem Galerie links, Preis und Eckdaten rechts daneben, alles weitere über die volle Breite */
.detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 2rem;
}

.detail > * {
    min-width: 0;
}

@media (min-width: 64rem) {
    .detail {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }

    .detail > * {
        grid-column: 1 / -1;
    }

    .detail > .galerie,
    .detail > .galerie-leer {
        grid-column: 1;
        grid-row: 1;
    }

    .detail > .galerie + .abschnitt,
    .detail > .galerie-leer + .abschnitt {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
    }

    .detail > .galerie-leer {
        align-self: start;
    }

    .detail > .abschnitt:not(.kontakt) .markdown,
    .detail > .abschnitt:not(.kontakt) .text {
        max-width: 68ch;
    }
}

.galerie {
    margin: 0 0 2rem;
}

/* Platzhalter, solange im Inserat keine Fotos gewählt sind (kein Bild-Request) */
.galerie-leer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 2rem;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background: var(--flaeche);
    color: var(--stahl);
    font-weight: 700;
}

/* Fotogalerie ohne Skript: waagerechte Schiene mit Einrasten, Vorschaubilder springen per Anker */
.galerie-schiene {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    border-radius: var(--radius);
    background: var(--flaeche);
}

.galerie-bild {
    flex: 0 0 100%;
    margin: 0;
    scroll-snap-align: start;
}

.galerie-bild img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

.galerie-vorschau {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.vorschau-link {
    display: block;
    width: 5.5rem;
    overflow: hidden;
    border: 2px solid var(--linie);
    border-radius: var(--radius);
}

.vorschau-link:hover {
    border-color: var(--tinte);
}

.vorschau-bild {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* Eckdatentabelle */
.daten {
    margin: 0;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--karte);
}

.daten-zeile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--linie);
}

.daten-zeile:last-child {
    border-bottom: 0;
}

.daten-zeile dt {
    flex: 0 0 11rem;
    color: var(--stahl);
}

.daten-zeile dd {
    flex: 1 1 10rem;
    margin: 0;
    font-weight: 700;
}

/* Beschreibung (Markdown, Baustein teile/markdown) */
.markdown,
.text {
    overflow-wrap: anywhere;
}

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

.markdown ul,
.markdown ol {
    padding-left: 1.5rem;
}

.markdown a {
    overflow-wrap: anywhere;
}

/* Kontaktblock der Filiale */
.kontakt {
    padding: 1.25rem;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--karte);
}

.kontakt-name {
    margin: 0 0 0.5rem;
    font-weight: 700;
}

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

@media (max-width: 39.99rem) {
    .kontakt .knopf,
    .formular .knopf,
    .filter .knopf {
        width: 100%;
    }
}

.kontakt-liste a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* Anfrageformular (Sitzungsseite): Felder, Fehler, Honeypot */
.einleitung {
    max-width: 68ch;
    color: var(--stahl);
}

.formularseite {
    max-width: 34rem;
}

.formular {
    margin-top: 1.5rem;
}

.feld {
    margin-bottom: 1.25rem;
}

.feld label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.feld input[type="text"],
.feld input[type="email"],
.feld input[type="tel"],
.feld textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--stahl);
    border-radius: var(--radius);
    background: var(--karte);
    color: var(--tinte);
    font: inherit;
}

.feld [aria-invalid="true"] {
    border-color: var(--fehler);
    border-width: 2px;
}

.feld-haken {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    gap: 0 0.75rem;
}

.feld-haken input {
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.15rem 0 0;
    accent-color: var(--flaeche);
}

.feld-haken label {
    margin-bottom: 0;
    font-weight: 400;
}

.feld-haken .fehler,
.feld-haken .hinweis-klein {
    grid-column: 2;
}

.hinweis-klein {
    margin: 0.35rem 0 0;
    color: var(--stahl);
    font-size: 1rem;
}

.fehler {
    margin: 0.35rem 0 0;
    color: var(--fehler);
    font-weight: 700;
}

.fehlerbox {
    margin: 1.25rem 0;
    padding: 0.85rem 1rem;
    border: 2px solid var(--fehler);
    border-radius: var(--radius);
    background: var(--karte);
}

.fehlerbox-titel {
    margin-bottom: 0.5rem;
    color: var(--fehler);
    font-weight: 700;
}

.fehlerbox ul {
    margin: 0;
    padding-left: 1.25rem;
}

.fehlerbox a {
    color: var(--fehler);
}

/* Honeypot: für Besucher unsichtbar, nicht per Tastatur erreichbar (tabindex im Markup) */
.falle {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
