/* ==========================================================================
   MSV Lohn – Grundlayout für alle Seiten
   Seitenspezifische Styles liegen in assets/css/templates/{template}.css
   und werden im Header automatisch geladen.
   ========================================================================== */

:root {
    --msv-blue: #162562;
    --msv-yellow: #fde028;
    --text-color: #333;
    --bg-light: #f9f9f9;
    --link-red: #d93025;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
html, body { min-height: 100vh; overflow-x: hidden; }
body {
    background-color: var(--bg-light);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}
a { text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Sichtbarer Tastatur-Fokus (auf hellem und dunklem Hintergrund erkennbar) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--msv-blue);
    box-shadow: 0 0 0 4px var(--msv-yellow);
    outline-offset: 2px;
}

/* Nur für Screenreader sichtbar */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Globale Seitenbreite & Ränder */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}
@media (min-width: 768px) {
    .container {
        padding: 0 40px;
    }
}

/* --- Header & Navigation --- */
.header-wrapper {
    background: var(--msv-blue);
    border-bottom: 5px solid var(--msv-yellow);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
header.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    padding-bottom: 15px;
    flex-wrap: wrap; /* Notwendig, damit die Navi drunter rutscht */
}

/* Verhindert, dass der Text das Hamburger-Menü wegdrückt */
.logo {
    flex: 1;
    max-width: calc(100% - 50px);
}
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.header-logo {
    height: 45px;
    width: auto;
    margin-right: 15px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Responsive Text */
.logo-text {
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.desktop-text { display: none; }
.mobile-text { display: inline; font-size: 1.4rem; }

@media (min-width: 600px) {
    .desktop-text { display: inline; font-size: clamp(18px, 3.5vw, 24px); }
    .mobile-text { display: none; }
}

/* Hamburger-Menü: Checkbox unsichtbar, aber per Tastatur bedienbar */
.menu-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}
.menu-toggle {
    display: none;
    color: var(--msv-yellow);
    cursor: pointer;
    padding: 5px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
}
.menu-checkbox:focus-visible + .menu-toggle {
    outline: 2px solid var(--msv-yellow);
    outline-offset: 2px;
}

nav.main-nav { width: 100%; }

/* Aktive Seite im Menü */
nav.main-nav > ul > li.is-active > a,
nav.main-nav .dropdown a[aria-current="page"] {
    color: var(--msv-yellow);
}

/* Desktop-Ansicht */
@media (min-width: 900px) {
    .menu-checkbox { display: none; }
    .menu-toggle { display: none !important; }
    nav.main-nav { width: auto; display: block !important; }

    nav.main-nav > ul {
        display: flex;
        list-style: none;
        gap: 25px;
        flex-wrap: wrap;
    }
    nav.main-nav > ul > li {
        position: relative;
        padding: 10px 0;
    }
    nav.main-nav a {
        color: #fff;
        font-weight: 600;
        font-size: 15px;
        transition: color 0.2s;
    }
    nav.main-nav > ul > li > a:hover {
        color: var(--msv-yellow);
    }

    .dropdown {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--msv-blue);
        box-shadow: 0 8px 20px rgba(0,0,0,0.3);
        min-width: 220px;
        z-index: 100;
        border-top: 3px solid var(--msv-yellow);
        flex-direction: column;
        border-radius: 0 0 4px 4px;
    }
    /* Untermenü per Maus UND Tastatur öffnen */
    nav.main-nav > ul > li:hover .dropdown,
    nav.main-nav > ul > li:focus-within .dropdown { display: flex; }
    .dropdown li { list-style: none; width: 100%; }
    .dropdown a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        transition: all 0.2s;
        font-weight: 500;
        color: #fff;
    }
    .dropdown li:last-child a { border-bottom: none; }
    .dropdown a:hover {
        background-color: rgba(0,0,0,0.2);
        color: var(--msv-yellow);
        padding-left: 25px;
    }
}

/* Mobile-Ansicht (unter 900px) */
@media (max-width: 899px) {
    .menu-toggle { display: flex; }

    nav.main-nav {
        display: none;
        width: 100%;
        margin-top: 15px;
        background: rgba(0,0,0,0.15);
        border-radius: 6px;
        padding: 10px 0;
    }

    #mobile-menu-toggle:checked ~ nav.main-nav { display: block; }

    nav.main-nav > ul { flex-direction: column; gap: 0; list-style: none; }
    nav.main-nav > ul > li { border-bottom: 1px solid rgba(255,255,255,0.05); width: 100%; padding: 0; }
    nav.main-nav > ul > li:last-child { border-bottom: none; }
    nav.main-nav > ul > li > a { display: block; padding: 15px 20px; font-weight: 600; color: #fff; }

    .dropdown {
        display: flex;
        flex-direction: column;
        position: static;
        box-shadow: none;
        border-top: none;
        border-left: 3px solid var(--msv-yellow);
        margin-bottom: 10px;
        margin-left: 20px;
        margin-right: 20px;
        background: rgba(0,0,0,0.2);
        border-radius: 0 4px 4px 0;
    }
    .dropdown li { list-style: none; width: 100%; }
    .dropdown a { display: block; padding: 10px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); color: #ddd; font-size: 0.95rem; }
    .dropdown li:last-child a { border-bottom: none; }
}

/* --- Hauptinhalt --- */
main.page-content { flex: 1; padding: 50px 20px; }
@media (min-width: 768px) {
    main.page-content { padding: 50px 40px; }
}

/* Einheitliche Seitentitel */
.page-title {
    color: var(--msv-blue);
    font-size: clamp(1.9rem, 6vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 10px;
}
.page-title--center { text-align: center; }
.page-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

.text-content { line-height: 1.7; font-size: 1.05rem; }
.text-content p { margin-bottom: 20px; }

/* "Zurück"-Links oberhalb des Titels */
.back-link {
    color: var(--msv-blue);
    font-weight: 600;
    display: inline-block;
    margin-bottom: 20px;
}
.back-link:hover { color: var(--link-red); }

/* --- Hero-Banner (Startseite, Verein) --- */
.hero-banner {
    width: 100%;
    height: clamp(250px, 40vh, 500px);
    background-color: var(--msv-blue);
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-top: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.hero-banner--spaced { margin-bottom: 40px; }
.hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
}
@media (max-width: 600px) {
    .hero-banner { margin-top: 20px; }
}

/* --- Grids --- */
.fahrer-grid, .links-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 30px;
    margin-top: 40px;
}
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 25px;
}

/* Base Cards */
.news-card, .fahrer-card, .link-group {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* News-Karten (Startseite & Archiv) */
.news-card {
    padding: 20px;
    border-bottom: 3px solid var(--msv-blue);
    display: flex;
    flex-direction: column;
}
.news-card h3 { color: var(--msv-blue); font-size: 1.3rem; margin-bottom: 15px; line-height: 1.3; }
.news-card p { font-size: 0.95rem; line-height: 1.5; margin-bottom: 15px; color: #555; }
.news-card .read-more { margin-top: auto; padding-top: 15px; }
.read-more { color: var(--link-red); font-weight: bold; }

/* Contact Layout */
.contact-wrapper { display: grid; gap: 40px; }
@media (min-width: 900px) {
    .contact-wrapper { grid-template-columns: 1fr 1fr; }
}
.contact-form-card { background: #fff; padding: clamp(20px, 4vw, 40px); border-radius: 8px; border-top: 4px solid var(--msv-blue); box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.map-fullwidth { width: 100%; height: clamp(300px, 50vh, 500px); border: 2px solid var(--msv-yellow); background: #eee; border-radius: 8px; overflow: hidden; }
.map-fullwidth iframe { width: 100%; height: 100%; border: none; }

/* Forms */
input[type="text"], input[type="email"], input[type="url"], textarea { width: 100%; padding: 12px 15px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 1rem; transition: border-color 0.3s; }
input:focus, textarea:focus { border-color: var(--msv-blue); outline: none; }
button[type="submit"] { background: var(--msv-blue); color: #fff; border: none; padding: 14px 25px; font-size: 1.05rem; cursor: pointer; font-weight: bold; border-radius: 4px; transition: all 0.3s; width: 100%; }
@media (min-width: 600px) { button[type="submit"] { width: auto; } }
button[type="submit"]:hover { background: var(--msv-yellow); color: var(--msv-blue); }

/* --- Footer --- */
.site-footer {
    background-color: var(--msv-blue);
    border-top: 25px solid var(--msv-yellow);
    padding: 30px 0;
    margin-top: 40px;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    color: #fff;
}
.footer-links {
    display: flex;
    gap: 20px;
}
.footer-links a {
    color: #fff;
    text-decoration: none;
}
.footer-links a:hover { color: var(--msv-yellow); }

/* ==========================================================================
   Lightbox (Snippet site/snippets/lightbox.php, Script assets/js/lightbox.js)
   ========================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.lightbox.active {
    display: flex;
}
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox img {
    max-width: 100%;
    max-height: 85vh;
    box-shadow: 0 5px 30px rgba(0,0,0,0.6);
    border: 3px solid var(--msv-yellow);
    border-radius: 4px;
}
.lb-close,
.lb-nav {
    border: 0;
    font-family: inherit;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    user-select: none;
}
.lb-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    font-size: 44px;
    padding: 5px 10px;
    z-index: 10000;
}
.lb-close:hover { color: var(--msv-yellow); }
.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: background 0.2s, transform 0.2s;
}
.lb-nav[hidden] { display: none; }
.lb-nav:hover {
    background: rgba(0,0,0,0.8);
    color: var(--msv-yellow);
    transform: translateY(-50%) scale(1.1);
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-counter {
    color: #aaa;
    margin-top: 12px;
    font-size: 0.9rem;
    letter-spacing: 1px;
}
@media (max-width: 600px) {
    .lightbox-content { max-width: 96%; }
    .lb-nav { width: 44px; height: 44px; font-size: 20px; }
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
    .lb-close { top: 8px; right: 8px; }
}
