/* Gallery overview — responsive grid of event cards */
.onedrive-galerie-uebersicht {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
    /* Override WordPress is-layout-constrained max-width on block group children */
    max-width: none !important;
}

/* Override WordPress is-layout-constrained max-width on headings */
.wp-block-heading {
    max-width: none !important;
}

/* Single gallery — tighter grid of thumbnails */
.onedrive-galerie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin: 1.5rem 0;
    /* Override WordPress is-layout-constrained max-width on block group children */
    max-width: none !important;
}

/* Year separator row — spans full grid width */
.galerie-jahr-trenner {
    grid-column: 1 / -1;
    font-size: 1.1rem;
    font-weight: 700;
    color: #444;
    padding: 0.4rem 0 0.3rem;
    border-bottom: 2px solid #ddd;
    margin-top: 0.5rem;
}

.galerie-jahr-trenner:first-child {
    margin-top: 0;
}

/* Event card */
.galerie-card a {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.2s;
}

.galerie-card a:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.galerie-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.galerie-card-info {
    padding: 0.6rem 0.8rem 0.8rem;
    background: #fff;
}

.galerie-titel {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.galerie-datum {
    display: block;
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.15rem;
}

.galerie-anzahl {
    display: block;
    font-size: 0.82rem;
    color: #666;
    margin-top: 0.2rem;
}

/* Placeholder when no cover image is available */
.galerie-card-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #e8e8e8;
}

/* Single-item embed — constrain width and collapse to one column.
   Two-class selectors (specificity 0,2,0) beat the base rule's max-width:none !important (0,1,0). */
.onedrive-galerie-grid.onedrive-galerie-grid--single {
    grid-template-columns: 1fr !important;
}

/* Single-item embed: let the thumbnail fill the container width at its natural
   aspect ratio instead of being cropped to the forced 4/3 grid ratio. */
.onedrive-galerie-grid--single .galerie-item img {
    aspect-ratio: unset;
    object-fit:   unset;
    height:       auto;
    min-height:   unset;
}

/* Inline video embed: fill the container width at the video's natural aspect ratio. */
.onedrive-galerie-grid--embed .wog-inline-video {
    display: block;
    width:   100%;
    height:  auto;
}

.onedrive-galerie-grid.onedrive-galerie-grid--size-small {
    max-width: 200px !important;
}

.onedrive-galerie-grid.onedrive-galerie-grid--size-medium {
    max-width: 380px !important;
}

/* Single gallery thumbnail item */
.galerie-item {
    display: block;
    position: relative;
}

.galerie-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    background: #f0f0f0;
    min-height: 120px;
    transition: opacity 0.2s;
}

.galerie-item:hover img {
    opacity: 0.88;
}

/* Video play icon overlay — shown on top of the thumbnail in the grid */
.galerie-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.galerie-play-overlay svg {
    width: 52px;
    height: 52px;
    color: rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
    transition: transform 0.2s;
}

.galerie-item:hover .galerie-play-overlay svg {
    transform: scale(1.12);
}

/* Date line in single-gallery heading context */
.galerie-datum--single {
    font-size: 1rem;
    color: #888;
    margin: -0.4rem 0 1.2rem;
}

/* Back link */
.galerie-zurueck {
    display: inline-block;
    margin-bottom: 1.5rem;
    text-decoration: none;
    color: #555;
    font-size: 1.05rem;
}

.galerie-zurueck:hover {
    color: #222;
}

/* Error / notice messages inside shortcode */
.wog-notice {
    padding: 0.8rem 1rem;
    border-radius: 4px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    margin: 1rem 0;
}

.wog-notice--error {
    background: #fce8e8;
    border-color: #c62828;
    color: #c62828;
}

/* GLightbox — fit image, centered, no borders, no scrollbars */
.glightbox-container .gslide {
    display:         flex !important;
    align-items:     center !important;
    justify-content: center !important;
}

.glightbox-container .gslide-inner-content {
    display:         flex !important;
    align-items:     center !important;
    justify-content: center !important;
    width:  100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.glightbox-container .ginner-container {
    display:         flex !important;
    align-items:     center !important;
    justify-content: center !important;
    width:      auto !important;
    height:     auto !important;
    max-width:  100vw !important;
    max-height: 100vh !important;
    overflow:   hidden !important;
    background: transparent !important;
}

.glightbox-container .gslide-media {
    display:         flex !important;
    align-items:     center !important;
    justify-content: center !important;
    width:           auto !important;
    height:          auto !important;
    max-width:       100vw !important;
    max-height:      100vh !important;
    overflow:        hidden !important;
    background:      transparent !important;
}

.glightbox-container .gslide-image img {
    display:    block !important;
    width:      auto !important;
    height:     auto !important;
    max-width:  100vw !important;
    max-height: 100vh !important;
    object-fit: contain !important;
    margin:     0 auto !important;
}

/* ── Custom video modal ──────────────────────────────────────────────────────
   Full-screen overlay for video playback. Videos bypass GLightbox entirely so
   the browser controls max-width/max-height without any wrapper interference. */

.wog-video-modal {
    position:        fixed;
    inset:           0;
    z-index:         999999;
    background:      rgba(0, 0, 0, 0.92);
    display:         flex;
    align-items:     center;
    justify-content: center;
}

.wog-video-modal[hidden] {
    display: none;
}

.wog-vm-media {
    display:         flex;
    align-items:     center;
    justify-content: center;
}

.wog-vm-video {
    display:    block;
    max-width:  92vw;
    max-height: 88vh;
    background: #000;
}

/* Gallery description — full text below the gallery title */
.galerie-beschreibung {
    margin: 0 0 1.5rem;
    line-height: 1.65;
    color: #555;
}

/* GLightbox navigation arrows — larger hit area and icon on desktop */
@media (min-width: 769px) {
    .glightbox-container .gnext,
    .glightbox-container .gprev {
        width:  70px !important;
        height: 100px !important;
    }

    .glightbox-container .gnext svg,
    .glightbox-container .gprev svg {
        width:  32px !important;
        height: 32px !important;
    }
}

/* GLightbox close button — larger hit area and icon, never clipped */
.glightbox-container .gclose {
    overflow: visible !important;
    width:  54px !important;
    height: 54px !important;
}

.glightbox-container .gclose svg {
    width:  28px !important;
    height: 28px !important;
}

/* Push the close button below the WordPress admin bar when it is present.
   The admin bar is 32 px on desktop and 46 px on mobile (≤ 600 px). */
.admin-bar .glightbox-container .gclose {
    top: 57px !important;
}

@media screen and (max-width: 600px) {
    .admin-bar .glightbox-container .gclose {
        top: 71px !important;
    }
}

/* Lightbox download button — positioned left of the info button */
.wog-dl-btn {
    display: none;           /* shown via JS */
    position: fixed;
    bottom: 20px;
    right: 74px;
    z-index: 1000001;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    transition: background 0.2s;
}

.wog-dl-btn:hover {
    background: rgba(0, 0, 0, 0.88);
}

.wog-dl-btn svg {
    width: 22px;
    height: 22px;
}

/* Lightbox info toggle button.
   Hidden by default; JS sets display:flex when the lightbox opens.
   Appended to <body> so it sits above GLightbox's stacking context. */
.wog-info-btn {
    display: none;           /* shown via JS */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000001;        /* above GLightbox (999999) */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.wog-info-btn:hover {
    background: rgba(0, 0, 0, 0.88);
}

.wog-info-btn svg {
    width: 22px;
    height: 22px;
}

/* Lightbox info panel.
   Use !important throughout — WordPress themes often set table/text colors
   that would otherwise override the panel styles. */
.wog-info-panel {
    display: none;
    position: fixed;
    bottom: 72px;
    right: 20px;
    z-index: 1000000;
    background: #fff !important;
    color: #111 !important;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    max-width: 300px;
    min-width: 200px;
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.wog-info-panel--visible {
    display: block;
}

.wog-info-table {
    border-collapse: collapse !important;
    width: 100%;
    background: #fff !important;
}

.wog-info-table th {
    text-align: left !important;
    padding: 2px 10px 2px 0 !important;
    color: #666 !important;
    font-weight: normal !important;
    white-space: nowrap !important;
    vertical-align: top !important;
    background: #fff !important;
    border: none !important;
}

.wog-info-table td {
    padding: 2px 0 !important;
    word-break: break-word;
    text-align: left !important;
    color: #111 !important;
    background: #fff !important;
    border: none !important;
}

.wog-info-table td a {
    color: #0066cc !important;
}

.wog-info-empty {
    margin: 0;
    color: #888 !important;
    font-style: italic;
}

/* Subfolder section heading inside a single gallery */
.galerie-abschnitt-titel {
    font-size: 1.05rem;
    font-weight: 700;
    color: #444;
    margin: 1.8rem 0 0.2rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #ddd;
}

/* Description / debug box below the gallery heading */
.galerie-info-box {
    margin: 0 0 1.5rem;
}

.galerie-info-box--debug {
    padding: 0.8rem 1rem;
    border: 1px solid #ffc107;
    border-radius: 4px;
    background: #fffbea;
}

.galerie-beschreibung-empty {
    margin: 0 0 0.5rem;
    color: #999;
    font-style: italic;
}

.galerie-debug {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: #555;
}

.galerie-debug summary {
    cursor: pointer;
    font-weight: 600;
    color: #856404;
    padding: 0.2rem 0;
}

.galerie-debug ul {
    margin: 0.4rem 0 0 1.2rem;
    padding: 0;
}

.galerie-debug li {
    margin: 0.15rem 0;
    line-height: 1.4;
}

/* -------------------------------------------------------------------------
   Document list — [onedrive_dokumente] shortcode
   ------------------------------------------------------------------------- */

.wog-dokumente {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 1.5rem 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

/* Breadcrumb navigation bar */
.wog-dok-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.55rem 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-size: 0.85rem;
}

.wog-dok-bc-link {
    color: #1a3a8f;
    text-decoration: none;
}

.wog-dok-bc-link:hover {
    text-decoration: underline;
}

.wog-dok-bc-sep {
    color: #aaa;
}

.wog-dok-bc-current {
    color: #444;
    font-weight: 500;
}

/* Generic item row */
.wog-dok-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}

.wog-dok-item:last-child {
    border-bottom: none;
}

.wog-dok-item:hover {
    background: #f9f9f9;
}

/* Folder row */
.wog-dok-item--folder {
    cursor: pointer;
}

.wog-dok-folder-arrow {
    flex-shrink: 0;
    color: #bbb;
    line-height: 0;
}

/* Empty state */
.wog-dok-empty {
    padding: 1.2rem 1rem;
    color: #888;
    font-size: 0.9rem;
    text-align: center;
}

.wog-dok-icon {
    flex-shrink: 0;
    line-height: 0;
}

.wog-dok-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.wog-dok-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wog-dok-item--folder .wog-dok-name {
    color: #1a3a8f;
}

.wog-dok-size {
    font-size: 0.78rem;
    color: #888;
}

.wog-dok-download {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    background: #f0f4ff;
    border: 1px solid #c5d3f5;
    color: #1a3a8f;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.wog-dok-download:hover {
    background: #dde6ff;
    border-color: #9ab0f0;
    color: #1a3a8f;
}

/* Compact layout when the container itself is narrow — not the viewport */
@container (max-width: 480px) {
    .wog-dok-download span {
        display: none;
    }

    .wog-dok-download {
        padding: 0.4rem 0.6rem;
    }

    .wog-dok-item {
        gap: 0.6rem;
    }
}

/* ── Gallery list overview ──────────────────────────────────────────────────── */

.wog-galerie-liste {
    margin: 1.5rem 0;
    max-width: none !important;
}

.wog-liste-eintrag {
    border-bottom: 1px solid #eee;
}

.wog-liste-eintrag:last-child {
    border-bottom: none;
}

.wog-liste-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.6rem 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    color: inherit;
    font-family: inherit;
    line-height: 1.4;
}

.wog-liste-toggle:hover {
    background: #f9f9f9;
}

/* Chevron indicator — dark green SVG icon, rotates 90° to point down when expanded */
.wog-liste-pfeil {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #1e6840;
    transition: transform 0.2s ease;
}

.wog-liste-pfeil svg {
    width: 18px;
    height: 18px;
    display: block;
}

.wog-liste-toggle[aria-expanded="true"] .wog-liste-pfeil {
    transform: rotate(90deg);
}

.wog-liste-text {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.wog-liste-name {
    font-weight: 600;
}

.wog-liste-datum {
    font-size: 0.82rem;
    color: #888;
}

/* Expanded gallery content area */
.wog-liste-galerie {
    padding: 0.25rem 0 1.2rem 1.4rem;
}

/* Loading spinner shown while gallery HTML is being fetched */
@keyframes wog-spin {
    to { transform: rotate(360deg); }
}

.wog-liste-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid rgba(30, 104, 64, 0.18);
    border-top-color: #1e6840;
    border-radius: 50%;
    animation: wog-spin 0.65s linear infinite;
    margin: 1rem 0;
}

/* ── Lightbox filmstrip ─────────────────────────────────────────────────────── */

/* Horizontal thumbnail row at the bottom of the lightbox overlay.
   Hidden by default; JS sets display:flex when the lightbox opens. */
.wog-filmstrip {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000000;
    background: rgba(0, 0, 0, 0.72);
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.wog-filmstrip-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.55;
    border: 2px solid transparent;
    transition: opacity 0.15s, border-color 0.15s;
}

.wog-filmstrip-thumb:hover {
    opacity: 0.85;
}

.wog-filmstrip-thumb--active {
    opacity: 1;
    border-color: #fff;
}

/* Shrink the lightbox image area so the filmstrip doesn't cover it.
   --wog-filmstrip-h is set by JS to the strip's actual rendered height. */
.wog-filmstrip-open .glightbox-container .gslide-inner-content {
    height: calc(100vh - var(--wog-filmstrip-h, 72px)) !important;
}

.wog-filmstrip-open .glightbox-container .gslide-image img {
    max-height: calc(100vh - var(--wog-filmstrip-h, 72px)) !important;
}

.wog-filmstrip-open .wog-vm-video {
    max-height: calc(88vh - var(--wog-filmstrip-h, 72px));
}

/* Video modal navigation arrows */
.wog-vm-prev,
.wog-vm-next {
    position:        fixed;
    top:             50%;
    transform:       translateY(-50%);
    z-index:         1000000;
    background:      rgba(0, 0, 0, 0.45);
    border:          none;
    border-radius:   50%;
    color:           #fff;
    cursor:          pointer;
    width:           52px;
    height:          52px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         0;
    transition:      background 0.2s;
}

.wog-vm-prev { left:  10px; }
.wog-vm-next { right: 10px; }

.wog-vm-prev:hover,
.wog-vm-next:hover {
    background: rgba(0, 0, 0, 0.75);
}

.wog-vm-prev svg,
.wog-vm-next svg {
    width:  28px;
    height: 28px;
}

/* Video modal close button */
.wog-vm-close {
    position:        fixed;
    top:             12px;
    right:           12px;
    z-index:         1000000;
    background:      rgba(0, 0, 0, 0.55);
    border:          1px solid rgba(255, 255, 255, 0.25);
    border-radius:   50%;
    color:           #fff;
    cursor:          pointer;
    width:           44px;
    height:          44px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         0;
    transition:      background 0.2s;
}

.wog-vm-close:hover {
    background: rgba(0, 0, 0, 0.85);
}

.wog-vm-close svg {
    width:  22px;
    height: 22px;
}

@media (max-width: 480px) {
    .wog-info-panel {
        right: 10px;
        left: 10px;
        max-width: none;
        bottom: 68px;
    }

    .wog-dl-btn {
        right: 64px;
    }
}
