/* Globale Schriftarten-Definition */
html, body {
    /* 1. Segoe UI: Standard für Windows (sehr klar und modern)
       2. -apple-system / BlinkMacSystemFont: Standard für Mac & iOS 
       3. Roboto: Standard für Android & ChromeOS
       4. Oxygen / Ubuntu: Gute Linux-Fallbacks
       5. Cantarell: Standard für GNOME (Linux)
       6. "Helvetica Neue", Arial: Die universellen Klassiker
       7. sans-serif: Der ultimative Sicherheits-Fallback */
    
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    
    /* Optimierung für Lesbarkeit */
    font-size: 18px;            /* Standard-Größe für gute Lesbarkeit */
    font-weight: 500;
    color: rgb(51, 51, 51);             /* Sanftes Schwarz für weniger Augenbelastung */
    background-color: #ffffff;
    
    /* Schärfere Schriftdarstellung auf Mac/iOS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Damit Formularelemente nicht plötzlich in einer anderen Schrift erscheinen */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* --- Standard-Einstellung (für große Bildschirme / Desktop) --- */
.nur-desktop {
    display: block; /* Desktop-Text anzeigen */
}

.nur-handy {
    display: none;  /* Handy-Text auf dem Desktop verstecken */
}

.kein-rand {
    margin: 0;
}

.container {
    width: 100%;           /* Jetzt klappt 100% wieder! */
    max-width: 1170px; 
    margin: 0 auto;        /* Kurzschreibweise für mittig */
    padding: 0 15px;       /* 15px Abstand links/rechts */
    box-sizing: border-box; /* DAS ist der Zauberbefehl */
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Zentriert alles innerhalb dieses Elements */
.text-center {
    text-align: center;
}

.info-text {
    margin: 0;
    text-align: center;
    line-height: 1.35; /* Kompakter Zeilenabstand für den Zeilenumbruch auf Handys mit großem Text */
    font-size: 0.85rem;
    color: rgb(102,102,102);
}

/* Sorgt für Abstand nach oben (Margin Top) */
.mt-4 {
    margin-top: 1.5rem !important;
}

/* Gestaltet den Einleitungstext */
.intro-text {
    font-size: 18px;  
    line-height: 1.6;
    color: rgb(51, 51, 51); 
    max-width: 800px; /* Begrenzt die Textbreite für bessere Lesbarkeit */
    margin-left: auto;
    margin-right: auto;
}

.image-preview {
    display: block;      /* Der Container belegt die volle Breite */
    text-align: center;  /* Zentriert alles, was darin ist (wie das Bild) */
    width: 100%;         /* Gehe sicher, dass er den ganzen Platz nutzt */
    padding: 40px 0;     /* Ein schöner Abstand nach oben und unten */
}

.image-preview img {
    display: inline-block; /* Erlaubt dem text-align: center zu greifen */
    border: 1px solid #ccc; /* Optional: Ein ganz feiner Rahmen fürs Bild */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); /* Ein dezenter Schatten */
    transition: transform 0.3s ease; /* Macht das Bild interaktiver */
}

.image-preview img:hover {
    transform: scale(1.02); /* Das Bild wird beim Drüberfahren minimal größer */
}

/* Stil für das Overlay */
.lightbox {
    display: none; /* Standardmäßig unsichtbar */
    position: fixed;
    z-index: 3000; /* Höher als deine Navbar (2000) */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Dunkler Hintergrund */
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

/* Das große Bild im Overlay */
.lightbox img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    border: 3px solid white;
}

/* Das Kreuz oben rechts */
.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ccc;
}

/* Container für Bild und Text auf den Büchereiserviceseiten */
.custom-info-container {
    display: flex;
    align-items: center;
    gap: 40px; /* Abstand zwischen den beiden Hälften */
    margin: 40px 0;
    width: 100%;
}

.custom-info-image {
    flex: 0 0 calc(50% - 20px); /* Nimmt exakt 50% abzüglich des halben Gaps ein */
}
.custom-info-image-small {
    flex: 0 0 calc(30% - 20px); /* Nimmt exakt 30% abzüglich des halben Gaps ein */
}

.custom-info-image img, 
.custom-info-image-small img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    display: block;
}

.custom-info-text {
    flex: 0 0 calc(50% - 20px); /* Auch der Text bekommt genau 50% minus Gap */
}

.custom-info-text-small {
    flex: 0 0 calc(70% - 20px); /* Auch der Text bekommt genau 70% minus Gap */
}

.custom-info-text p {
    margin: 0;
    text-align: left;
    line-height: 1.7; /* Etwas mehr Zeilenabstand für bessere Lesbarkeit bei breitem Text */
    font-size: 0.85rem;
    color: rgb(102,102,102);
}

/* Mobil-Optimierung: Unter 768px Breite untereinander stapeln */
@media (max-width: 768px) {
    .custom-info-container {
        flex-direction: column;
    }
    .custom-info-image, 
    .custom-info-image-small, 
    .custom-info-text, 
    .custom-info-text-small {
        flex: 0 0 100%;
        width: 100%;
    }
    .nur-desktop {
        display: none;  /* Desktop-Text auf dem Handy verstecken */
    }
    .nur-handy {
        display: block; /* Handy-Text auf dem Handy anzeigen */
    }
}

/* ueber uns */
.matrix-grid {
    display: grid;
    /* Erzeugt so viele 120px breite Kacheln wie möglich pro Zeile */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 20px 0;
}

.tile {
    position: relative;
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    cursor: pointer;
    border-radius: 6px;
    background: #f0f0f0;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease; /* Zoom-Effekt beim Bild */
}

/* Der Namens-Container (standardmäßig versteckt) */
.tile-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 15px 5px 8px 5px;
    font-size: 0.9rem;
    text-align: center;
    
    /* Animation: Schiebt den Namen nach unten aus dem Sichtfeld */
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

/* Interaktion beim Drüberfahren */
.tile:hover img {
    transform: scale(1.1); /* Bild zoomt leicht rein */
}

.tile:hover .tile-name {
    transform: translateY(0); /* Name schiebt sich nach oben ins Bild */
}

/* Lightbox Styling */
.lightbox {
    display: none; /* Standardmäßig unsichtbar */
    position: fixed;
    z-index: 9999;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 90%;
    max-height: 80%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 3px solid white;
}

.close-btn {
    position: absolute;
    top: 20px; right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}