/* ============================================================
   TOROS – GALERIE / MEDIEN / DOKUMENTE
   ============================================================ */

.media-page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 60px;
}

.media-head {
    text-align: center;
    margin-bottom: 20px;
}

/* Galerie-Header: gleiche linke Navigation wie auf den Standortseiten. */
.media-head-gallery {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    min-height: 190px;
    text-align: initial;
}

.media-head-side {
    min-width: 0;
}

.media-head-side-left {
    display: flex;
    justify-content: flex-start;
}

.media-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-head-gallery .media-logo-link img {
    width: auto;
    height: auto;
    max-width: 540px;
    max-height: 230px;
    object-fit: contain;
}

.media-head img {
    width: min(260px, 55vw);
    height: auto;
}

.media-logo-link {
    position: relative;
    z-index: 1;
    display: inline-block;
    border-radius: 50%;
    line-height: 0;
    cursor: pointer;
    transition: transform 220ms ease, filter 220ms ease;
}

.media-logo-link:hover {
    transform: translateY(-4px);
    filter: drop-shadow(0 8px 14px rgba(227, 199, 103, 0.24));
}

.media-logo-link:focus-visible {
    outline: 3px solid #e3c767;
    outline-offset: 5px;
}

.media-head h1 {
    margin: 12px 0 0;
    color: #e3c767;
    font-family: Georgia, serif;
    font-weight: 400;
}

.media-back {
    display: inline-block;
    margin-top: 8px;
    color: #cbbd9b;
    text-decoration: none;
}

.media-back:hover {
    color: #ffe49a;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: start;
}

.media-grid-documents {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.media-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(220, 180, 58, 0.28);
    border-radius: 5px;
    background: rgba(8, 8, 8, 0.72);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.18);
}

.media-image-link {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    line-height: 0;
    cursor: zoom-in;
}

.media-card img,
.media-card video {
    width: 100%;
    display: block;
    max-height: 360px;
    object-fit: cover;
    background: #050505;
}

.media-card img {
    transition: transform 180ms ease, filter 180ms ease;
}

.media-image-link img {
    height: 100%;
    max-height: none;
    object-fit: cover;
}

.media-image-link:hover img {
    transform: scale(1.015);
    filter: brightness(1.05);
}

body.media-lightbox-open {
    overflow: hidden;
}

.media-lightbox {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(3, 3, 3, 0.96);
    color: #f4e7bd;
}

.media-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.88);
}

.media-lightbox-shell {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.media-lightbox-head {
    min-height: 48px;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
}

.media-lightbox-status {
    min-width: 0;
    margin: 0;
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.media-lightbox-title {
    overflow: hidden;
    color: #e3c767;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-lightbox-counter {
    flex: 0 0 auto;
    color: #a99d7d;
    font-size: 0.86rem;
}

.media-lightbox-close,
.media-lightbox-nav {
    border: 1px solid rgba(227, 199, 103, 0.46);
    background: rgba(12, 12, 12, 0.72);
    color: #f8e8ac;
    cursor: pointer;
}

.media-lightbox-close:hover,
.media-lightbox-nav:hover {
    border-color: #e3c767;
    background: rgba(227, 199, 103, 0.14);
}

.media-lightbox-close:focus-visible,
.media-lightbox-nav:focus-visible {
    outline: 3px solid #e3c767;
    outline-offset: 2px;
}

.media-lightbox-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
}

.media-lightbox-stage {
    min-height: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 12px;
    align-items: center;
}

.media-lightbox-image {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.media-lightbox-nav {
    width: 56px;
    height: 72px;
    border-radius: 8px;
    font-size: 3rem;
    line-height: 1;
}

.media-lightbox-nav[hidden] {
    visibility: hidden;
}

.media-lightbox-hint {
    margin: 8px 0 0;
    color: #8f856d;
    font-size: 0.78rem;
    text-align: center;
}

.media-caption {
    padding: 8px 10px;
    border-top: 1px solid rgba(220, 180, 58, 0.16);
    color: #cbbd9b;
    font-size: 0.84rem;
}

.media-caption {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.media-caption strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e3c767;
    font-weight: 500;
}

.media-caption span,
.media-document-text span {
    flex: 0 0 auto;
    color: #948b74;
    font-size: 0.78rem;
}

.media-document {
    min-height: 150px;
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 14px;
    align-items: center;
}

.media-document-icon {
    width: 54px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(220, 180, 58, 0.42);
    border-radius: 4px;
    background: rgba(211, 165, 47, 0.08);
    color: #e3c767;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.media-document-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.media-document-text strong {
    overflow-wrap: anywhere;
    color: #e3c767;
    font-weight: 500;
}

.media-document-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.media-file-only {
    padding: 12px;
}

.media-caption-file {
    padding: 0 0 10px;
    border-top: 0;
}

.media-file-button {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid rgba(220, 180, 58, 0.48);
    border-radius: 5px;
    background: rgba(211, 165, 47, 0.08);
    color: #e3c767;
    text-align: center;
    text-decoration: none;
}

.media-file-button:hover {
    border-color: rgba(235, 194, 72, 0.9);
    color: #ffe49a;
}

.media-file-button-secondary {
    border-color: rgba(203, 189, 155, 0.28);
    background: rgba(255, 255, 255, 0.025);
    color: #cbbd9b;
}

@media (max-width: 700px) {
    .media-page {
        width: min(1180px, calc(100% - 16px));
        padding-top: 10px;
    }

    .media-head-gallery {
        grid-template-columns: minmax(82px, 1fr) minmax(112px, 150px) minmax(82px, 1fr);
        gap: 6px;
        min-height: 116px;
        margin-bottom: 14px;
    }

    .media-head-gallery .media-logo-link img {
        max-width: 150px;
        max-height: 105px;
    }
}

@media (max-width: 390px) {
    .media-head-gallery {
        grid-template-columns: minmax(76px, 1fr) minmax(102px, 132px) minmax(76px, 1fr);
        gap: 5px;
        min-height: 102px;
    }

    .media-head-gallery .media-logo-link img {
        max-width: 132px;
        max-height: 92px;
    }
}

@media (max-width: 600px) {
    .media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .media-grid-documents {
        grid-template-columns: 1fr;
    }

    .media-lightbox-shell {
        padding-right: 8px;
        padding-left: 8px;
    }

    .media-lightbox-stage {
        position: relative;
        display: flex;
        justify-content: center;
    }

    .media-lightbox-image {
        width: calc(100% - 8px);
    }

    .media-lightbox-nav {
        position: absolute;
        z-index: 1;
        top: 50%;
        width: 48px;
        height: 64px;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.58);
    }

    .media-lightbox-prev {
        left: 0;
    }

    .media-lightbox-next {
        right: 0;
    }
}

@media (max-width: 390px) {
    .media-grid {
        grid-template-columns: 1fr;
    }
}
