/* ======================================================
   GLOBAL / GRUNDLAYOUT
   ====================================================== */

/* Body: Grundstruktur der Seite (Flex Layout für Sticky Footer) */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;

    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Hauptbereich wächst automatisch und erlaubt Scrollen */
main {
    flex: 1 0 auto;
    overflow-y: auto;
}


/* ======================================================
   BLOG / ARTIKEL LAYOUT
   ====================================================== */

/* Einzelner Blogpost-Container */
.post {
    background: var(--post-bg);
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 12px;
}

/* Titel (h2) */
.post h2 {
    font-weight: 600;
    margin-top: -5px;
    margin-bottom: 5px;
}

/* Datum unter Titel */
.post .date {
    margin-bottom: 10px;
}

/* Textinhalt im Blogpost */
.post .text {
    line-height: 1.6;
    margin-bottom: 15px;
}


/* ======================================================
   HIGHLIGHT BILD (TOP IMAGE IM POST)
   ====================================================== */

.preview-container {
    text-align: center;
}

.preview {
    max-width: 100%;
    max-height: 600px;
    width: auto;
    height: auto;
    border-radius: 10px;
}


/* ======================================================
   GALLERY (HORIZONTAL SCROLL + SNAP)
   ====================================================== */

.gallery {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 15px;
    padding-bottom: 10px; /* oder 12–16px je nach Geschmack */

    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    -ms-overflow-style: auto;
}

/* Scrollbar Styling (WebKit Browser) */
.gallery::-webkit-scrollbar {
    height: 8px;
}

.gallery::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.gallery::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Einzelne Bilder in der Galerie */
.gallery img {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;

    border-radius: 6px;
    cursor: pointer;

    object-fit: cover;
    scroll-snap-align: start;
}


/* ======================================================
   LIGHTBOX OVERLAY
   ====================================================== */

/* Vollbild Overlay */
#lightbox {
    position: fixed;
    inset: 0;
    display: none;

    background: var(--lightbox-bg);

    justify-content: center;
    align-items: center;

    z-index: 999;
}

/* Bild innerhalb der Lightbox */
#lightbox-img {
    max-width: 98vw;
    max-height: 95vh;

    width: auto;
    height: auto;

    object-fit: contain;
    border-radius: 8px;
}

/* optionale Ausrichtung (falls JS das setzt) */
#lightbox-img.landscape {
    width: 98vw;
    height: auto;
}

#lightbox-img.portrait {
    width: auto;
    height: 95vh;
}


/* ======================================================
   LIGHTBOX CONTROLS (BUTTONS)
   ====================================================== */

/* Basis-Style für alle Buttons */
.control {
    position: absolute;

    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--control-bg);
    color: var(--control-color);

    cursor: pointer;
    user-select: none;

    opacity: 0.6;

    transition: 
        opacity 0.3s ease,
        background 0.3s ease,
        transform 0.2s ease;
}

/* Positionierung */
#prev {
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

#next {
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

#close {
    top: 15px;
    right: 15px;
    font-size: 1.4em;
}


/* ======================================================
   POSITION INFO (LIGHTBOX COUNTER)
   ====================================================== */

#position-info {
    position: fixed;
    top: 25px;
    left: 15px;

    padding: 4px 10px;
    border-radius: 6px;

    font-size: 1rem;
    font-family: 'Inter', sans-serif;

    background: var(--position-info-bg);
    color: var(--control-color);
}

#position-info .current {
    font-weight: bold;
}

#position-info .total {
    font-weight: normal;
}


/* Scroll Lock wenn Lightbox aktiv ist */
body.lightbox-open {
    overflow: hidden;
}


/* ======================================================
   BLOG LINKS (HEADER + DATUM)
   ====================================================== */

/* Entfernt Standard-Link-Styling komplett */
.post h2 a,
.post .date a {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* verhindert lila visited links */
.post h2 a:visited,
.post .date a:visited {
    color: inherit;
}


/* ======================================================
   SUBTILE HOVER EFFECTS (MODERN UX)
   ====================================================== */

.post h2 a:hover {
    opacity: 0.75;
    transform: translateX(2px);
}

.post .date a:hover {
    opacity: 0.6;
}

/* Klick-Feedback */
.post h2 a:active,
.post .date a:active {
    opacity: 0.5;
    transform: translateX(1px);
}


/* ======================================================
   RESPONSIVE DESIGN (MOBILE)
   ====================================================== */

@media (max-width: 600px) {

    /* Galerie wird kompakter */
    .gallery img {
        width: 45px;
        height: 45px;
    }

    /* Galerie darf umbrechen auf Mobile */
    .gallery {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        overflow-x: hidden;
    }

    /* größere Touch Controls */
    .control {
        width: 52px;
        height: 52px;
    }
}

/* sehr kleine Geräte */
@media (max-width: 400px) {
    .gallery img {
        width: 35%;
        height: auto;
    }
}


/* ======================================================
   HOVER NUR FÜR MOUSE DEVICES
   ====================================================== */

@media (hover: hover) {
    .control:hover {
        background: var(--control-hover-bg);
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Touch Geräte: verhindert Sticky Hover Bugs */
.control:active {
    opacity: 0.6 !important;
    transform: scale(1);
}
