html, body {
    overflow-x: hidden;
}

.wp-photo-archive {

    --cols: 12; /* Startwert: 12 Spalten */
    --gap: 4px;

    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 6px;
    box-sizing: border-box;
    background-color: var(--bg);
    touch-action: pan-x pan-y;
    will-change: transform;
}

/* Alle Überschriften und Metadaten ausblenden */
.wp-photo-archive .year-heading,
.wp-photo-archive .cat-heading,
.wp-photo-archive .card-meta {
    display: none !important;
}

/* Verschachtelte Wrapper aus dem PHP durchlässig machen */
.wp-photo-archive .archive-year-group,
.wp-photo-archive .year-content,
.wp-photo-archive .archive-cat-group,
.wp-photo-archive .cat-items {
    display: contents;
}

/* Festes Spalten-Raster für sauberes Einrasten */
.wp-photo-archive-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: var(--gap);
}

.archive-card {
    position: relative;
    background: var(--surface);
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.card-image-wrap {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-touch-callout: none;
}

.archive-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-select: none;
}

/* Stufe 1 (1 Spalte): Immer volle Bildschirmbreite */
.wp-photo-archive.is-single-col .archive-card {
    width: 100%;
    aspect-ratio: auto;
    height: auto;
    max-height: none;
    background: var(--surface);
}

.wp-photo-archive.is-single-col .card-image-wrap {
    width: 100%;
    height: auto;
}

.wp-photo-archive.is-single-col .archive-card img {
    width: 100%;
    height: auto;
    max-height: 92vh; /* Verhindert auf großen Desktop-Monitoren endloses Hochkant-Scrollen */
    object-fit: cover;
}

/* Im Querformat (Landscape) auf Smartphones: Keine Höhenbegrenzung, damit die volle Breite genutzt wird */
@media (max-width: 950px) and (orientation: landscape) {
    .wp-photo-archive.is-single-col .archive-card img {
        max-height: none;
    }
}


/* =========================================================
   VOLLBILD-OVERLAY (Lightbox)
   ========================================================= */
body.archive-overlay-open {
    overflow: hidden !important;
    touch-action: none !important;
}

.archive-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(14, 20, 18, 0.96);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    touch-action: none;
}

.archive-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-stage {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.lightbox-stage img {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
}

.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 1.5rem 1.5rem;
    background: linear-gradient(to top, rgba(14, 20, 18, 0.9) 0%, transparent 100%);
    color: #e9e7e0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Metadaten ausblenden, sobald man im Overlay tief ins Bild hineinzoomt */
.archive-lightbox.is-zoomed .lightbox-caption {
    opacity: 0;
}

.lightbox-caption .meta-date,
.lightbox-caption .meta-cat {
    font-size: 0.85rem;
    color: #9aa59f;
    margin-right: 10px;
}

.lightbox-caption .meta-cat {
    background: #1d2723;
    border: 1px solid #2b3833;
    color: #f7cf80;
    padding: 2px 8px;
    border-radius: 4px;
}

.lightbox-caption .meta-title {
    margin: 0.4rem 0 0;
    font-size: 1.25rem;
}

.lightbox-caption .meta-title a {
    color: #e9e7e0;
    text-decoration: none;
    pointer-events: auto;
}

.lightbox-caption .meta-title a:hover {
    color: #f2b544;
    text-decoration: underline;
}

/* =========================================================
   SCHWEBENDE KONTEXT-ÜBERSCHRIFT (Floating HUD)
   ========================================================= */
/* =========================================================
   SCHWEBENDE KONTEXT-ÜBERSCHRIFT UNTEN LINKS (Floating HUD)
   ========================================================= */
.archive-floating-header {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    z-index: 80;
    max-width: calc(100vw - 32px);
    padding: 0.55rem 0.95rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg, #0e1412) 78%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(43, 56, 51, 0.75);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    will-change: transform, opacity;
}


.floating-main {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text, #e9e7e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-sub {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--muted, #f7cf80);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-sub:empty {
    display: none;
}

/* Im geöffneten Vollbild-Overlay die schwebende Überschrift ausblenden */
body.archive-overlay-open .archive-floating-header {
    opacity: 0 !important;
}