/* ==========================================================================
   baufranke.de – Feinschliff 2026-09 (wird auf allen Seiten zuletzt geladen)
   Ziel: ruhigeres Raster, konsistente Abstände/Typo, saubere Mobil-Reihenfolge.
   Struktur der Seiten bleibt; alles hier ist rein CSS und rückbaubar.
   ========================================================================== */

:root {
    --section-y: clamp(3.25rem, 7vw, 6.5rem);
    --header-gap: clamp(1.5rem, 3.5vw, 2.75rem);
    --radius-card: 16px;
    --grid-gap: clamp(1rem, 2.2vw, 1.75rem);
    --brand-gradient: linear-gradient(135deg, #0f6b2f 0%, #1f9a45 100%);
}

/* --------------------------------------------------------------------------
   Typografie & Rhythmus
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 { text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -0.012em; line-height: 1.18; }
h3 { font-size: clamp(1.15rem, 1rem + 0.9vw, 1.5rem); }
.section-padding { padding: var(--section-y) 0; }
.section-header { margin-bottom: var(--header-gap); }
.section-header h2 { margin-bottom: 0.5rem; }
.section-subtitle,
.section-header p { max-width: 62ch; margin-left: auto; margin-right: auto; line-height: 1.55; }
.section-header.text-center + * { margin-top: 0; }
.lead { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem); line-height: 1.55; }
p { line-height: 1.65; }
.container { padding-left: clamp(1rem, 4vw, 1.5rem); padding-right: clamp(1rem, 4vw, 1.5rem); }

/* Seitenkopf: kompakter, Untertitel lesbar */
.page-header { padding: calc(var(--spacing-2xl) + 64px) 0 var(--spacing-2xl); }
.page-header h1 { margin-bottom: 0.5rem; }
.page-header p { color: rgba(255, 255, 255, 0.88); max-width: 60ch; margin: 0 auto; }

/* Buttons: gleiche Höhe, kein Springen */
.btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-large { min-height: 52px; }
.cta-actions, .hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* --------------------------------------------------------------------------
   Startseite
   -------------------------------------------------------------------------- */
.intro-grid { gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.intro-image img { width: 100%; height: auto; } /* Freisteller mit Alpha – bewusst ohne Rahmen/Schatten */
.key-benefits { display: grid; gap: 0.75rem; margin-top: var(--spacing-lg); }
.benefit-item { padding: 0.85rem 1rem; border-radius: 12px; background: rgba(15, 107, 47, 0.06); align-items: center; }
.benefit-item h3, .benefit-content h3, .benefit-content h4 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.benefit-content p { margin: 0; font-size: 0.95rem; }
body.dark-mode .benefit-item { background: rgba(255, 255, 255, 0.05); }

.services-grid { max-width: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap); margin-top: var(--spacing-xl); }
a.service-card, .service-card {
    text-align: left; padding: 1.5rem; border-radius: var(--radius-card); gap: 0.75rem;
    box-shadow: var(--shadow-sm); transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
a.service-card:hover, a.service-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-green-text); outline: none; }
.service-card-icon {
    width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
    background: var(--brand-gradient); color: #fff; margin-bottom: 0.25rem; flex: none;
}
.service-card-icon svg { width: 26px; height: 26px; }
.service-card h3 { margin: 0; font-size: 1.2rem; }
.service-card p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
.service-card p { flex: 1 1 auto; }
.service-card-link { margin-top: auto; padding-top: 0.5rem; }
.services-grid + .text-center { margin-top: var(--spacing-xl); }

/* Karte + Legende: Legende gleichmäßig, Karte mit Rand */
.legend-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--grid-gap); }
.legend-item { border-radius: 14px; height: 100%; }
.map-container, #projectMap, .project-map { border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-md); }

/* Kontaktblock Startseite: lesbare Karten */
.contact-section .contact-info-card, .contact-section .contact-card { backdrop-filter: none; }

/* --------------------------------------------------------------------------
   Leistungen: Sektionen kompakter, Glass-Card lesbar, Mobil volle Breite
   -------------------------------------------------------------------------- */
.service-section { min-height: 88vh; padding: clamp(64px, 9vw, 110px) 0; }
.text-box { max-width: 520px; background: rgba(255, 255, 255, 0.94); box-shadow: var(--shadow-lg); }
body.dark-mode .text-box { background: rgba(6, 26, 22, 0.88); }
.service-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.25rem; }
.service-tags .tag { margin: 0; }
/* Flip-Karten: Vorder- und Rückseite teilen sich eine Grid-Zelle → Höhe folgt dem Inhalt,
   nichts wird mehr abgeschnitten (vorher absolute Positionierung mit fester min-height). */
.flip-card { display: grid; min-height: 0; }
.flip-card-front, .flip-card-back { position: relative; grid-area: 1 / 1; min-height: 0; height: auto; }
.flip-card-container { min-height: 0; }
@media (max-width: 768px) {
    .service-section { min-height: 0; padding: 48px 0 64px; }
    .text-box { max-width: none; margin: 0 1rem; }
    .parallax-bg { top: 0; height: 100%; }
}

/* Projektablauf: Original-Timeline (vertikal) bleibt unverändert */

/* --------------------------------------------------------------------------
   Referenzen
   -------------------------------------------------------------------------- */
.features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); }
.feature-item { border-radius: var(--radius-card); overflow: hidden; }
/* Video-Masonry (7/5-Raster bleibt): gleiche Zeilenhöhe, damit die Reihen bündig sind */
.video-masonry { gap: var(--grid-gap); }
.video-masonry-item { border-radius: var(--radius-card); overflow: hidden; height: clamp(220px, 26vw, 380px); }
.video-masonry-item .masonry-video { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
    .features-grid { grid-template-columns: 1fr; }
    .video-masonry { grid-template-columns: 1fr; }
    .video-masonry-item, .video-masonry-item:nth-child(n) { grid-column: 1 / -1; height: auto; aspect-ratio: 16 / 9; }
}
.filter-navigation { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 0.6rem; max-width: none; }
.filter-btn { width: auto; border-radius: 999px; padding: 0.55rem 1.15rem; font-size: 0.95rem; }
.project-cards-grid { gap: var(--grid-gap); }
.project-card { border-radius: var(--radius-card); }
.project-card-header { padding: 0.9rem 1rem; }
.project-card-body { padding: 1rem 1.25rem 1.25rem; }
.project-card-footer { padding: 0 1.25rem 1.25rem; }
.project-card-title { font-size: 1.1rem; line-height: 1.35; }

/* --------------------------------------------------------------------------
   Karriere
   -------------------------------------------------------------------------- */
.job-listings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); }
.job-listings .jobs-loading, .job-listings .jobs-error, .job-listings .no-jobs { grid-column: 1 / -1; }
@media (max-width: 900px) { .job-listings { grid-template-columns: 1fr; } }
.job-card { border-radius: var(--radius-card); display: flex; flex-direction: column; }
.apprenticeship-grid { gap: clamp(1.5rem, 4vw, 3rem); }
@media (max-width: 900px) { .apprenticeship-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Kontakt
   -------------------------------------------------------------------------- */
.contact-main { min-height: 0; }
.contact-grid-main { gap: clamp(2rem, 5vw, 4.5rem); }
.contact-form-wrapper, .contact-form-container { border-radius: var(--radius-card); }
.form-group input, .form-group select, .form-group textarea { min-height: 46px; border-radius: 10px; }
.form-group textarea { min-height: 140px; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
body.dark-mode .leaflet-popup-content-wrapper, body.dark-mode .leaflet-popup-tip { background: #0f2320; color: #e6f0ea; }
body.dark-mode .leaflet-popup-content a { color: #5ed087; }

/* --------------------------------------------------------------------------
   Footer & Kleinigkeiten
   -------------------------------------------------------------------------- */
.footer-grid { gap: clamp(1.5rem, 4vw, 3rem); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-section h4 { margin-bottom: 0.75rem; }
.footer-section ul li { margin-bottom: 0.4rem; }

/* Fokus-Sichtbarkeit (Tastatur) */
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--primary-green-text); outline-offset: 2px; }

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Mobil-Feinschliff */
@media (max-width: 768px) {
    .section-padding { padding: 3rem 0; }
    .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
    a.service-card, .service-card { padding: 1.1rem; }
    .service-card-icon { width: 42px; height: 42px; border-radius: 11px; }
    .service-card h3 { font-size: 1.05rem; }
    .service-card p { font-size: 0.9rem; }
    .intro-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .intro-image { order: -1; }
    .page-header { padding: calc(var(--spacing-xl) + 64px) 0 var(--spacing-xl); }
    .cta-actions .btn, .hero-actions .btn { width: 100%; }
    .filter-navigation { gap: 0.45rem; }
    .filter-btn { padding: 0.5rem 0.9rem; font-size: 0.9rem; }
}
@media (max-width: 420px) {
    .services-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Modale: ein gemeinsames Schema (2026-09)
   Vorher hatte jedes Modal eigene Overlay-Farben, Radien, Close-Buttons und
   z-index-Werte. Hier werden alle auf dieselben Tokens gezogen; Struktur und
   JS bleiben unverändert.
   ========================================================================== */
:root {
    --modal-overlay: rgba(9, 24, 16, 0.78);
    --modal-blur: blur(6px);
    --modal-radius: 18px;
    --modal-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    --modal-header: linear-gradient(135deg, #0f6b2f 0%, #1f9a45 100%);
    --z-modal: 10000;
    --z-lightbox: 10100;
}

/* --- Overlays: gleiche Farbe, gleicher Blur, gleiche Ebene ---------------- */
.modal-overlay,
.project-modal .project-modal-backdrop,
.project-modal .project-modal-overlay,
.pdf-modal,
.angebot-pdf-modal .angebot-pdf-overlay,
.privacy-modal .privacy-modal-overlay,
.video-lightbox .video-lightbox-overlay {
    background: var(--modal-overlay) !important;
    -webkit-backdrop-filter: var(--modal-blur);
    backdrop-filter: var(--modal-blur);
}
.modal-overlay, .project-modal, .pdf-modal, .privacy-modal { z-index: var(--z-modal); }
.angebot-pdf-modal, .video-lightbox { z-index: calc(var(--z-modal) + 1); }

/* --- Container: gleicher Radius, gleicher Schatten ------------------------ */
.modal-overlay .modal,
.project-modal-container,
.pdf-modal-content,
.angebot-pdf-container,
.privacy-modal-content,
.video-lightbox-container {
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);
    overflow: hidden;
}

/* --- Kopfzeile: überall der grüne Markenverlauf --------------------------- */
.modal-overlay .modal-header,
.project-modal-header,
.pdf-modal-header,
.angebot-pdf-header,
.privacy-modal-header {
    background: var(--modal-header);
    border-bottom: none;
    padding: 1.15rem clamp(1.25rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.modal-overlay .modal-title,
.project-modal-title,
.pdf-modal-title,
.angebot-pdf-header h3,
.privacy-modal-header h2 {
    color: #fff;
    margin: 0;
    font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.45rem);
    line-height: 1.25;
    font-weight: 700;
}

/* --- Schließen-Button: überall derselbe runde Knopf ----------------------- */
.modal-overlay .modal-close,
.project-modal-close,
.pdf-modal-close,
.angebot-pdf-close,
.privacy-modal-close {
    width: 42px; height: 42px; min-width: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; flex: none; padding: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}
.modal-overlay .modal-close:hover,
.project-modal-close:hover,
.pdf-modal-close:hover,
.angebot-pdf-close:hover,
.privacy-modal-close:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.06); }
.modal-overlay .modal-close::before { color: #fff; font-size: 1.5rem; line-height: 1; }
.pdf-modal-close { font-size: 1.6rem; line-height: 1; }
.privacy-modal-close svg, .project-modal-close svg, .angebot-pdf-close svg { width: 22px; height: 22px; }

/* --- Body: gleiche Innenabstände ----------------------------------------- */
.modal-overlay .modal-body,
.project-modal-body,
.project-modal-content,
.pdf-modal-body,
.privacy-modal-body { padding: clamp(1.25rem, 3vw, 2rem); }

/* --------------------------------------------------------------------------
   Bilder im Projektmodal: ruhiges Raster, erstes Bild groß
   -------------------------------------------------------------------------- */
.modal-images-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
}
.modal-image-item { aspect-ratio: 1; border-radius: 12px; margin: 0; }
.modal-image-item:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: 1; }
.modal-images-container img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-image-item:hover { transform: none; }
.modal-image-item:hover img { transform: scale(1.04); }
.modal-images-container img { transition: transform 0.35s ease; }
.modal-image-caption { font-size: 0.8rem; padding: 0.6rem 0.7rem; }
.modal-image-item:first-child .modal-image-caption { font-size: 0.9rem; }
@media (max-width: 900px) { .modal-images-container { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
    .modal-images-container { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .modal-image-item:first-child { grid-column: span 2; grid-row: auto; aspect-ratio: 4 / 3; }
}

/* --------------------------------------------------------------------------
   Gemeinsame Lightbox (assets/js/lightbox.js)
   -------------------------------------------------------------------------- */
.fx-lightbox {
    position: fixed; inset: 0; z-index: var(--z-lightbox);
    display: none; align-items: center; justify-content: center;
    padding: clamp(3.5rem, 8vh, 5rem) clamp(0.75rem, 5vw, 5rem) clamp(5.5rem, 12vh, 7rem);
}
.fx-lightbox.is-open { display: flex; }
.fx-lightbox-backdrop { position: absolute; inset: 0; background: rgba(6, 16, 11, 0.94); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.fx-lightbox-bar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: clamp(0.75rem, 2vw, 1.25rem);
}
.fx-lightbox-counter { color: rgba(255, 255, 255, 0.9); font-size: 0.95rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.fx-lightbox-btn {
    width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.12);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background 0.2s ease, transform 0.2s ease;
}
.fx-lightbox-btn:hover { background: rgba(255, 255, 255, 0.24); transform: scale(1.06); }
.fx-lightbox-btn[hidden] { display: none; }
.fx-lightbox-prev, .fx-lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 52px; height: 52px; }
.fx-lightbox-prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.fx-lightbox-next { right: clamp(0.5rem, 2vw, 1.5rem); }
.fx-lightbox-prev:hover, .fx-lightbox-next:hover { transform: translateY(-50%) scale(1.06); }
.fx-lightbox-stage { position: relative; z-index: 1; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; max-width: 100%; max-height: 100%; }
.fx-lightbox-image {
    max-width: min(1400px, 100%); max-height: calc(100vh - 12rem);
    width: auto; height: auto; object-fit: contain; border-radius: 10px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    opacity: 0; transition: opacity 0.25s ease;
}
.fx-lightbox-image.is-loaded { opacity: 1; }
.fx-lightbox-caption { color: rgba(255, 255, 255, 0.88); font-size: 0.92rem; text-align: center; max-width: 70ch; line-height: 1.45; }
.fx-lightbox-strip {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    display: flex; gap: 8px; justify-content: flex-start; align-items: center;
    padding: clamp(0.6rem, 2vw, 1rem); overflow-x: auto; scrollbar-width: none;
}
.fx-lightbox-strip::-webkit-scrollbar { display: none; }
.fx-lightbox-strip button {
    flex: none; width: 74px; height: 52px; padding: 0; cursor: pointer;
    border: 2px solid transparent; border-radius: 8px; overflow: hidden;
    background: none; opacity: 0.55; transition: opacity 0.2s ease, border-color 0.2s ease;
}
.fx-lightbox-strip button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-lightbox-strip button:hover { opacity: 0.85; }
.fx-lightbox-strip button.is-active { opacity: 1; border-color: #3fbf6a; }
.fx-lightbox-btn:focus-visible, .fx-lightbox-strip button:focus-visible { outline: 3px solid #3fbf6a; outline-offset: 2px; }
@media (max-width: 640px) {
    .fx-lightbox-prev, .fx-lightbox-next { width: 44px; height: 44px; }
    .fx-lightbox-strip button { width: 58px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) { .fx-lightbox-image { transition: none; opacity: 1; } }


/* ==========================================================================
   WCAG 2.1 AA – Kontrastkorrekturen  (09.09.2026)
   Jeder Wert ist gegen den tatsaechlichen Hintergrund nachgerechnet;
   das erreichte Verhaeltnis steht jeweils im Kommentar. Ziel: >= 4.5:1
   fuer normalen Text, >= 3:1 fuer grosse Schrift und UI-Flaechen.
   ========================================================================== */

/* 1) Primaerbutton im Hover – weisser Text auf #38A169 war 3.25:1 */
.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: #1F7A45;                      /* 5.35:1 */
}

/* 2) Sekundaerbutton im Hover – weisser Text auf #ea580c war 3.56:1 */
.btn-secondary:hover,
.btn-secondary:focus-visible {
    background-color: #C2410C;                      /* 5.18:1 */
}

/* 3) Footer-Links im Hover – #92400E auf #164231 war 1.59:1, praktisch unlesbar */
.footer-section a:hover,
.footer-legal a:hover {
    color: #FBBF77;                                 /* 6.90:1 */
}
body.dark-mode .footer-section a:hover,
body.dark-mode .footer-legal a:hover {
    color: #FB923C;                                 /* 7.64:1 auf #031e23 */
}

/* 4) LiraCore-Signatur – blauer Gradient (#003da0) auf Dunkelgruen war 1.17:1 */
.signature-brand {
    background: linear-gradient(135deg, #CFE3CF 0%, #7FD8A0 100%);
    -webkit-background-clip: text;
    background-clip: text;
}                                                   /* 8.37:1 bis 6.58:1 */
.signature-link:hover .signature-brand {
    background: linear-gradient(135deg, #FFFFFF 0%, #A8E6C0 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
.signature-text {
    color: rgba(255, 255, 255, 0.75);               /* 7.0:1 */
}

/* 5) Platzhalter im Suchfeld – rgba(0,0,0,.5) war 3.95:1 */
.search-input::placeholder {
    color: rgba(0, 0, 0, 0.6);                      /* 5.74:1 auf Weiss */
}
body.dark-mode .search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);                /* 6.85:1 auf #031e23 */
}

/* 6) Die uebrigen Formularfelder hatten ueberhaupt keine Placeholder-Regel und
      liefen auf den Browser-Default (im Dark Mode hell optimiert, dort zu blass). */
input::placeholder,
textarea::placeholder {
    color: #5C5C5C;                                 /* 7.0:1 auf Weiss */
}
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);                /* 6.85:1 */
}

/* 7) Dark Mode: dunkler Text (#031e23) auf #B36205 war 3.84:1 */
body.dark-mode {
    --secondary-orange: #D97706;                    /* 5.43:1 */
}

/* 8) Dark Mode: Untertitel im Seitenkopf – rgba(148,163,184,.8) auf dem
      gruenen Header-Gradient war 2.32:1 */
body.dark-mode .page-subtitle,
body.dark-mode .page-header p {
    color: rgba(255, 255, 255, 0.88);               /* 6.11:1 */
}


/* ==========================================================================
   Responsive-Korrekturen (09.09.2026)
   ========================================================================== */

/* Lange URLs als Linktext (Impressum, Datenschutz, AGB) sprengten bei 320px
   den Viewport und erzeugten horizontales Scrollen auf der ganzen Seite. */
p a,
li a,
td a,
.legal-content a {
    overflow-wrap: anywhere;
}

/* Lange zusammengesetzte Woerter in Ueberschriften und Fliesstext taten dasselbe.
   break-word greift nur, wenn ein Wort sonst nicht in die Zeile passt, und
   aendert das Umbruchverhalten normaler Texte nicht. */
body,
h1, h2, h3, h4, h5, h6,
p, li, dt, dd, th, td, figcaption, blockquote, summary, label {
    overflow-wrap: break-word;
}

/* Projektlegende auf der Startseite: die feste Spaltenbreite (minmax(300px,1fr))
   war unter ca. 400px breiter als der verfuegbare Platz und schob die Seite auf.
   min() begrenzt die Spalte zusaetzlich auf die Containerbreite. */
.legend-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

@media (max-width: 480px) {
    /* 48px Innenabstand liessen auf 320px nur 184px fuer den Inhalt uebrig */
    .project-legend {
        padding: var(--spacing-lg);
    }
}

/* Zustimmungs-Checkboxen: das Label war ein Flex-Container ohne Umbruch, der
   Link "Datenschutzerklaerung" dadurch ein eigenes Item, das aus dem Viewport
   ragte. Als normaler Fliesstext mit absolut gesetztem Kaestchen bricht der
   Satz sauber um. Die kompakten Mehrfachauswahl-Labels bleiben unveraendert. */
.checkbox-label {
    display: block;
    position: relative;
    padding-left: calc(20px + var(--spacing-sm));
}
.checkbox-label > .checkmark {
    position: absolute;
    left: 0;
    top: 2px;
}
.checkbox-label a {
    display: inline;
}


/* ==========================================================================
   Referenzen-Modal: Galerie im Aufbau der Startseite  (09.09.2026)
   Vorher Kachelraster mit object-fit: cover -> jedes Bild wurde auf ein
   Quadrat zugeschnitten, dazu die pro Kachel wiederholte Bildunterschrift als
   Overlay ueber dem Motiv. Jetzt ein grosses Bild mit object-fit: contain
   (nichts wird beschnitten) plus Thumbnail-Leiste, gesteuert per Button,
   Pfeiltaste und Lightbox. Die Klassen dafuer sind dieselben wie auf der
   Startseite und in main.css/responsive.css bereits durchdekliniert.
   ========================================================================== */

#modalImages[hidden],
#modalThumbnails[hidden] {
    display: none !important;
}

#modalImages {
    margin-top: var(--spacing-lg);
    /* .project-modal-body ist ein Flex-Container; ohne diese Angaben wird die
       Galerie als Flex-Item auf wenige Pixel zusammengedrueckt. Ausserdem die
       vh-Deckel aus responsive.css aufheben - die Hoehe kommt jetzt aus dem
       Seitenverhaeltnis des Bildes. */
    flex: 0 0 auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
}

#modalThumbnails {
    flex: 0 0 auto !important;
}

/* object-fit: contain laesst je nach Bildformat Raender frei - die bekommen
   eine ruhige Flaeche statt der Modalfarbe. */
.project-image-main img {
    background: rgba(0, 0, 0, 0.04);
}
body.dark-mode .project-image-main img {
    background: rgba(255, 255, 255, 0.04);
}

/* Bildrahmen der Referenzen-Galerie: Hoehe ergibt sich aus dem
   Seitenverhaeltnis des Bildes (per JS gesetzt), nicht aus festen vh-Werten.
   Die !important-Angaben ueberschreiben die vier Breakpoint-Bloecke in
   responsive.css, die dort Hoehen erzwingen. */
#modalImages .project-image-main {
    height: auto !important;
    min-height: 0 !important;
    max-height: 62vh !important;
    aspect-ratio: 4 / 3;
    width: 100%;
}
#modalImages .project-image-main img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}


/* ==========================================================================
   Stellenkarten auf der Karriereseite  (09.09.2026)
   ========================================================================== */

/* Kein align-items: start noetig. Die geoeffnete Karte nimmt ab 901px die
   ganze Rasterzeile ein (weiter unten), steht dort also allein - es gibt keine
   Nachbarkarte mehr, die mitgezogen werden koennte. Geschlossene Karten
   behalten dadurch ihre gleiche Hoehe pro Zeile, was ruhiger aussieht. */

/* Sichtbarkeit haengt jetzt an .is-open auf der Karte. Die Werte aus main.css
   (max-height/opacity-Animation) werden dabei neutralisiert - sie waren wegen
   des frueheren Inline-Styles ohnehin nie aktiv. */
.job-details-expanded {
    display: none;
    opacity: 1;
    max-height: none;
    transform: none;
    overflow: visible;
}

.job-card.is-open .job-details-expanded {
    display: block;
    margin-top: var(--spacing-md);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
}

.job-section + .job-section {
    margin-top: var(--spacing-lg);
}

.job-card.is-open .job-external-link {
    margin-top: var(--spacing-lg);
}

@media (min-width: 901px) {
    /* Geoeffnete Karte nimmt die volle Breite ein und legt Aufgaben, Profil
       und Angebot nebeneinander. Vorher stand alles in einer schmalen Spalte
       untereinander - auf Desktop hiess das sehr langes Scrollen. */
    .job-card.is-open {
        grid-column: 1 / -1;
    }

    /* Spaltensatz statt Raster: der Browser gleicht die Spaltenhoehen aus,
       statt jede Rasterzeile auf ihren hoechsten Abschnitt aufzublasen. */
    .job-card.is-open .job-details-expanded {
        display: block;
        columns: 3;
        column-gap: var(--spacing-2xl);
    }

    .job-card.is-open .job-section {
        break-inside: avoid;
        margin: 0 0 var(--spacing-lg);
    }

    .job-card.is-open .job-section + .job-section {
        margin-top: 0;
    }

    .job-card.is-open .job-external-link {
        column-span: all;
        margin-top: var(--spacing-md);
    }
}

/* ==========================================================================
   Scroll-nach-oben-Button an die LiraCore-Widgets angepasst (06.10.2026)
   Gleiche Maße, gleicher Rand und gleicher Abstand wie die Widget-Buttons
   in #liracore-ecke-unten-rechts; der Button stapelt sich darueber.
   Widget-Metriken: >=640px  56x56, right 28, bottom 20, gap 12 (Stapel 124)
                    <=639px  44x44, right 20, bottom 12, gap  8 (Stapel  96)
   ========================================================================== */
@media (min-width: 640px) {
    .scroll-top {
        width: 56px;
        height: 56px;
        right: 20px;
        /* 20px Grundabstand + 124px Widget-Stapel + 12px Abstand */
        bottom: 156px;
        font-size: 24px;
        line-height: 1;
        border-radius: 50%;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    }
}

@media (max-width: 639px) {
    .scroll-top {
        width: 44px;
        height: 44px;
        right: 12px;
        /* 12px Grundabstand + 96px Widget-Stapel + 8px Abstand */
        bottom: 116px;
        font-size: 20px;
        line-height: 1;
        border-radius: 50%;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    }
}
