/* ==========================================================================
   Öffentlicher AutoPass - Darstellung einer Version (Bausteine unter Components/AutoPass). Geladen nach public.css
   und VOR autopass-theme.css. Bei 390 px entworfen, 360 px und 200 % Schrift geprüft, danach Desktop (S-1, S-8).
   Alle Maße in rem, damit die Seite der Schriftgröße des Browsers folgt. Kein Skript: Auf- und Zuklappen über
   <details>, große Bilder über die Großansicht mit :target (5a) bzw. einen Link auf die Datei.

   Farben nur über Tokens. Die Werte hier sind der neutrale Rückfall ohne Theme; die Markenwerte stehen in
   autopass-theme.css. Auffälligkeiten am Fahrzeug stehen in „offen“ (Gelb), nie in Rot.

   Gliederung: 1 Rückfall-Tokens · 2 Rahmen · 3 Fahrzeugkopf · 4 Marken und Prüfpunkte · 5 Bilder, Dokumente, Händler
   · 6 Anordnung „Bericht“ · 7 Anordnung „Zusammenfassung“ · 8 Anordnung „Auffälligkeiten“ · 9 Entwurfsrahmen.
   Die Abschnitte 6 bis 8 gehören je zu einer Variante des Entwurfsschritts - die zwei verworfenen entfallen mit ihr.
   ========================================================================== */

/* ── 1 Rückfall-Tokens ── */
:root {
    /* Das Theme hat keinen Dunkelmodus: Die Seite bleibt auch im Dunkelmodus des Geräts hell (S-8). */
    color-scheme: light;
    --marke-toenung: #ededed;
    --status-offen-flaeche: #f2f2f2;
    --status-offen-schrift: #1f1f1f;
    --status-erledigt-flaeche: #f2f2f2;
    --status-erledigt-schrift: #1f1f1f;
    --status-neutral-flaeche: #f2f2f2;
    --status-neutral-schrift: #5c5c5c;
    --radius-klein: 0;
}

/* ── 2 Rahmen ── */
.inhalt-breit {
    max-width: 58rem;
}

.ap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Lange Wörter umbrechen statt abschneiden - wichtig bei 360 px und bei 200 % Schrift (S-8). */
    overflow-wrap: break-word;
}

/* Silbentrennung nur in den Texten der Erfassung und in Überschriften - nie in Sätzen, in denen die Marke
   „AutoPass“ steht (sie wird nicht getrennt). */
.ap h1,
.ap h2,
.ap h3,
.ap h4,
.ap-knopf,
.ap-punkt-name,
.ap-punkt-text,
.ap-eintraege,
.ap-sammel-liste,
.ap-kopf-info,
.ap-klapp-titel,
.ap-inhaltsverzeichnis a {
    hyphens: auto;
}

.ap h1,
.ap h2,
.ap h3,
.ap h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

.ap h1 {
    font-size: 1.5rem;
}

.ap h2 {
    font-size: 1.1875rem;
    margin-bottom: 0.75rem;
}

.ap h3 {
    font-size: 1rem;
    margin: 1.25rem 0 0.375rem;
}

.ap h4 {
    font-size: 0.9375rem;
    margin: 1rem 0 0.25rem;
    color: var(--muted-foreground);
}

.ap p {
    margin: 0 0 0.5rem;
}

.ap a:focus-visible,
.ap summary:focus-visible,
.entwurf-band a:focus-visible {
    outline: 0.125rem solid var(--primary);
    outline-offset: 0.125rem;
}

.ap-karte {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

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

.ap-nr {
    display: inline-block;
    min-width: 1.75em;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

.ap-gedaempft {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Hauptaktion: gefüllte Fläche in Primär (corporate-design.md 2c) - mindestens 44 px hoch (S-2). */
.ap-knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.5rem 1.125rem;
    border-radius: var(--radius-klein);
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.ap-sprung {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    font-size: 0.875rem;
}

/* Hinweis „Es gibt eine neuere Version“ (ADR-006 Punkt 5): Tönung der Marke, kein Status. */
.ap-versionshinweis {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-klein);
    border-left: 0.25rem solid var(--primary);
    background-color: var(--marke-toenung);
}

.ap-versionshinweis p {
    margin: 0;
}

.ap-versionshinweis a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    font-weight: 600;
}

/* ── 3 Fahrzeugkopf ── */
.ap-kopf {
    padding: 0;
    overflow: hidden;
}

.ap-kopf .ap-bild {
    margin: 0;
}

.ap-kopf .ap-bild img {
    border-radius: 0;
}

.ap-kopf-text {
    padding: 1rem;
}

.ap-kopf-ueber {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.ap-eckdaten {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin: 0.875rem 0;
}

.ap-eckdaten div {
    min-width: 6.5rem;
}

.ap-eckdaten dt {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.ap-eckdaten dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ap-kopf-info {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.ap-kopf-info strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted-foreground);
}

.ap-kopf-aktion {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 1rem;
}

@media (min-width: 48rem) {
    .ap-kopf {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    }

    /* Das Titelbild füllt seine Spalte, auch wenn der Text daneben höher ist. */
    .ap-kopf .ap-bild,
    .ap-kopf .ap-bild a,
    .ap-kopf .ap-bild img {
        height: 100%;
    }

    .ap-kopf-text {
        padding: 1.5rem;
    }

    .ap h1 {
        font-size: 1.75rem;
    }

    .ap-kopf-aktion {
        align-items: flex-start;
    }

    .ap-karte {
        padding: 1.5rem;
    }

    .ap-kopf.ap-karte {
        padding: 0;
    }
}

/* ── 4 Marken und Prüfpunkte ── */
.ap-marke {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.125rem 0.5rem 0.125rem 0.375rem;
    border: 1px solid transparent;
    border-radius: 999rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
}

.ap-marke-symbol {
    flex: none;
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
}

.ap-marke-unauffaellig {
    background-color: var(--status-erledigt-flaeche);
    color: var(--status-erledigt-schrift);
}

.ap-marke-auffaellig {
    background-color: var(--status-offen-flaeche);
    color: var(--status-offen-schrift);
}

.ap-marke-nicht-vorhanden {
    background-color: var(--status-neutral-flaeche);
    color: var(--status-neutral-schrift);
}

.ap-marke-nicht-pruefbar {
    background-color: var(--card);
    border: 1px dashed currentColor;
    color: var(--status-neutral-schrift);
}

.ap-zaehlzeile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.ap-punkt {
    padding: 0.5625rem 0;
    border-top: 1px solid var(--border);
}

.ap-punkte > .ap-punkt:first-child {
    border-top: 0;
}

/* Auffällig oder nicht prüfbar: zusätzlich zur Marke eine Linie links - Form, nicht nur Farbe. */
.ap-punkt-hervor {
    padding-left: 0.625rem;
    border-left: 0.1875rem solid var(--status-offen-schrift);
}

.ap-punkt-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
}

.ap-punkt-name {
    flex: 1 1 9rem;
}

.ap-punkt-name-ort {
    font-weight: 600;
}

.ap-punkt-ort {
    display: block;
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.ap-punkt-wert {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ap .ap-punkt-text {
    margin: 0.3125rem 0 0;
    font-size: 0.9375rem;
}

.ap-eintraege {
    margin: 0.375rem 0 0;
    padding: 0;
    list-style: none;
}

.ap-eintraege li {
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.375rem;
    border-radius: var(--radius-klein);
    background-color: var(--background);
    font-size: 0.9375rem;
}

.ap-eintrag-titel {
    font-weight: 600;
}

.ap-eintrag-zusatz {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.ap-eintrag-zusatz strong {
    color: var(--foreground);
}

/* Unauffälliges zusammengefasst (DM-20): eine Marke mit der Zahl, darunter alle Bezeichnungen. */
.ap-sammel {
    padding: 0.5rem 0 0.625rem;
}

.ap-sammel-liste {
    margin: 0.375rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.ap-sammel-liste li {
    display: inline;
}

.ap-sammel-liste li:not(:last-child)::after {
    content: " · ";
}

.ap-abschnitt-e4 {
    margin-top: 0.25rem;
}

/* ── 5 Bilder, Dokumente, Händler ── */
.ap-bild {
    margin: 0.5rem 0 0;
}

.ap-bild a {
    display: block;
}

.ap-bild img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-klein);
    background-color: var(--border);
}

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

.ap-bild figcaption {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.ap-galerie {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 100%), 1fr));
    gap: 0.75rem;
}

.ap-galerie .ap-bild {
    margin: 0;
}

.ap-punkt > .ap-bild {
    max-width: 26rem;
}

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

.ap-dokumente li + li {
    border-top: 1px solid var(--border);
}

.ap-dokumente a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.375rem 0;
    font-weight: 600;
}

.ap-dokumente a span {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted-foreground);
}

.ap-haendler address {
    font-style: normal;
}

/* ── 5a Großansicht der Fotos (Bildergalerie, ohne Skript über :target) ──
   Wunsch Daniel Simon (S3), 2026-11-17. Fläche aus der Textfarbe, Schrift in der Vordergrundfarbe der Primärfläche - keine
   neue Farbe. Offen: Seite dahinter ausgeblendet (dann erreicht auch Tab nur die Ansicht) und nicht rollbar. Bei 390 px
   entworfen: Kopf und Fuß je eine Zeile, Bild füllt den Rest, Knöpfe 2,75 rem (44 px). */
.ap-gross-zu {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    outline: none;
}

.ap-gross {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    background-color: var(--foreground);
    color: var(--primary-foreground);
    overscroll-behavior: contain;
}

.ap-gross:target {
    display: flex;
    animation: ap-gross-ein 0.2s ease;
}

.ap-gross:focus {
    outline: none;
}

@keyframes ap-gross-ein {
    from {
        opacity: 0;
    }
}

html:has(.ap-gross:target) {
    overflow: hidden;
}

body:has(.ap-gross:target) :is(.kopf, .fuss, .inhalt > :not(.ap-gross-folge)) {
    visibility: hidden;
}

/* Klick auf den Hintergrund schließt: ein Link über die ganze Fläche, Kopf, Bild und Fuß liegen darüber. */
.ap-gross-hintergrund {
    position: absolute;
    inset: 0;
}

.ap-gross-kopf,
.ap-gross-buehne,
.ap-gross-fuss {
    position: relative;
}

.ap-gross-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem 0.25rem 1rem;
    pointer-events: none;
}

.ap-gross-zaehler {
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.ap-gross-knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid color-mix(in srgb, var(--primary-foreground) 30%, transparent);
    border-radius: 50%;
    background-color: color-mix(in srgb, var(--foreground) 55%, transparent);
    color: var(--primary-foreground);
    pointer-events: auto;
}

.ap-gross-knopf:hover {
    background-color: color-mix(in srgb, var(--primary-foreground) 18%, var(--foreground));
}

.ap-gross-knopf:focus-visible {
    outline: 2px solid var(--primary-foreground);
    outline-offset: 2px;
}

.ap-gross-knopf svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ap-gross-buehne {
    flex: 1 1 auto;
    min-height: 0;
    pointer-events: none;
}

.ap-gross-buehne img {
    position: absolute;
    inset: 0.25rem 0.5rem;
    width: calc(100% - 1rem);
    height: calc(100% - 0.5rem);
    object-fit: contain;
    pointer-events: auto;
}

.ap-gross-pfeil {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.ap-gross-pfeil-zurueck {
    left: 0.75rem;
}

.ap-gross-pfeil-vor {
    right: 0.75rem;
}

.ap-gross-fuss {
    padding: 0.5rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    pointer-events: none;
}

.ap .ap-gross-titel,
.ap-gross-titel {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
    overflow-wrap: anywhere;
}

.ap-gross-ort {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    opacity: 0.8;
}

@media (min-width: 48rem) {
    .ap-gross-kopf {
        padding: 0.75rem 1rem 0.5rem 1.5rem;
    }

    .ap-gross-buehne img {
        inset: 0.5rem 5rem;
        width: calc(100% - 10rem);
        height: calc(100% - 1rem);
    }

    .ap-gross-pfeil {
        width: 3rem;
        height: 3rem;
    }

    .ap-gross-pfeil-zurueck {
        left: 1.25rem;
    }

    .ap-gross-pfeil-vor {
        right: 1.25rem;
    }

    .ap-gross-fuss {
        width: 100%;
        max-width: 64rem;
        margin: 0 auto;
        padding: 0.75rem 1.5rem 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ap-gross:target {
        animation: none;
    }
}

/* ── 6 Anordnung „Bericht“ (Variante A) ── */
.ap-inhaltsverzeichnis ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ap-inhaltsverzeichnis li + li {
    border-top: 1px solid var(--border);
}

.ap-inhaltsverzeichnis a {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.25rem 0;
}

@media (min-width: 48rem) {
    .ap-inhaltsverzeichnis ol {
        columns: 2;
        column-gap: 2.5rem;
    }

    .ap-inhaltsverzeichnis li {
        break-inside: avoid;
        border-top: 0;
        border-bottom: 1px solid var(--border);
    }

    .ap-inhaltsverzeichnis li + li {
        border-top: 0;
    }
}

/* ── 7 Anordnung „Zusammenfassung zuerst“ (Variante B) ── */
.ap-klapp {
    padding: 0;
}

.ap-klapp > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.375rem 0.75rem;
    min-height: 2.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
}

.ap-klapp > summary::-webkit-details-marker {
    display: none;
}

.ap-klapp-titel {
    font-size: 1.0625rem;
    font-weight: 600;
}

/* Pfeil aus zwei Kanten: zeigt nach unten, geöffnet nach oben. */
.ap-klapp-pfeil {
    width: 0.625rem;
    height: 0.625rem;
    margin: 0 0.25rem 0.25rem;
    border-right: 0.125rem solid var(--muted-foreground);
    border-bottom: 0.125rem solid var(--muted-foreground);
    transform: rotate(45deg);
}

.ap-klapp[open] > summary .ap-klapp-pfeil {
    margin-bottom: -0.25rem;
    transform: rotate(-135deg);
}

.ap-klapp > summary .ap-zaehlzeile {
    grid-column: 1 / -1;
}

.ap-klapp[open] > summary {
    border-bottom: 1px solid var(--border);
}

.ap-klapp-inhalt {
    padding: 0.25rem 1rem 1rem;
}

.ap-klapp-inhalt > .ap-abschnitt:first-child > h3:first-child,
.ap-klapp-inhalt > h3:first-child {
    margin-top: 0.75rem;
}

.ap-gesamt {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ap-gesamt p {
    margin: 0;
}

@media (min-width: 48rem) {
    .ap-klapp > summary {
        grid-template-columns: minmax(0, 1fr) auto auto;
        padding: 0.875rem 1.5rem;
    }

    .ap-klapp > summary .ap-klapp-titel {
        grid-column: 1;
        grid-row: 1;
    }

    .ap-klapp > summary .ap-zaehlzeile {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
    }

    .ap-klapp > summary .ap-klapp-pfeil {
        grid-column: 3;
        grid-row: 1;
    }

    .ap-klapp-inhalt {
        padding: 0.25rem 1.5rem 1.5rem;
    }
}

/* ── 8 Anordnung „Auffälligkeiten zuerst“ (Variante C) ── */
.ap-aufgefallen h3:first-of-type {
    margin-top: 0.75rem;
}

.ap-bauteil {
    padding: 0.625rem 0;
    border-top: 1px solid var(--border);
}

.ap .ap-bauteil h4 {
    margin: 0 0 0.25rem;
    color: var(--foreground);
}

.ap-bauteil .ap-punkt {
    padding: 0.3125rem 0;
    border-top: 0;
}

.ap-bauteil .ap-punkt-hervor {
    padding-left: 0.625rem;
}

.ap-protokoll-kopf {
    margin-top: 0.5rem;
}

.ap .ap-protokoll-kopf h2 {
    margin-bottom: 0.25rem;
}

/* ── 9 Entwurfsrahmen (nur Entwicklungsumgebung, entfällt mit dem Entwurfsschritt) ── */
.entwurf-band {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed var(--muted-foreground);
    border-radius: var(--radius-klein);
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.entwurf-band p {
    margin: 0;
}

.entwurf-band nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
}

.entwurf-band a,
.entwurf-liste a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
}

.entwurf-band a[aria-current="page"] {
    font-weight: 700;
    text-decoration: none;
}

.entwurf-liste {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.entwurf-liste li {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}

.entwurf-liste a {
    font-weight: 600;
}

.entwurf-liste p {
    margin: 0;
}
