/* Remove extra margin/padding below header */
body.media-page main,
body.media-page .media-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Make background solid (optional) */
body.media-page {
    background: #ffffff; /* or your theme light background */
}

/* -----------------------------------------
   Media Page – Two Column Layout (30/70)
------------------------------------------*/

#mediaLayout {
    display: flex;
    flex-direction: row-reverse; /* visual order */
    min-height: 100vh;
    background: #fafafa;
}

/* ---------------------- */
/* LEFT SIDEBAR – 30%     */
/* ---------------------- */
#mediaSidebar {
    width: 30%;
    border-right: 2px solid #ddd;
    padding: 1.5rem;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

#mediaSidebar h2 {
    margin-top: 2rem;
    font-size: 1.4rem;
    font-weight: 700;
}

#mediaSidebar .album-entry {
    margin: 0.5rem 0 1rem;
    padding: 0.6rem 1rem;
    background: #fff; 
    border-radius: 8px;
    border: 1px solid #ccc;
    cursor: pointer;
}

#mediaSidebar .album-entry:focus,
#mediaSidebar .album-entry:hover {
    border-color: #bb0000;
    box-shadow: 0 0 0 2px #bb000044;
}

/* ---------------------- */
/* RIGHT CONTENT AREA – 70% */
/* ---------------------- */
#mediaContent {
    width: 70%;
    padding: 2rem;
    max-width: none;   /* ensure full 70% space */
    overflow-y: auto;
}

#mediaContent h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#mediaContent p {
    margin-bottom: 2rem;
}

/* Album title (H3) */
#albumTitle {
    font-size: 1.4rem;
    margin: 1rem 0 1rem;
    font-weight: 600;
}

/* Album item grid */
#albumItems {
    width: 100%;
    display: block;       /* allow child grid to control layout */
    padding: 0;
    margin: 0;
}

/* Right-side album thumbnail grid */
#albumItems .media-grid {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);   /* EXACTLY 3 per row */
    gap: 1.2rem;
    list-style: none !important;
    margin: 1rem 0 2rem 0;
    padding: 0;
}

#albumItems .media-item {
    list-style: none !important;
    padding: 0;
}

/* optional polishing of media section */
.media-main-title {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.media-main-desc {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    max-width: 700px;
}

.album-heading {
    font-size: 1.4rem;
    margin: 1rem 0 1rem;
    font-weight: 600;
}


/* Thumbnails */
#albumItems img,
#albumItems video {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

#albumItems img:focus,
#albumItems video:focus {
    outline: none;
    border-color: #bb0000;
}

/* Thumbnails - This ensures 3 columns forever on desktop. */
#albumItems .media-thumb img,
#albumItems .media-thumb video {
    width: 100%;
    display: block;
    border-radius: 8px;
}

/* media light box view when video or picture open */
#mediaLightbox {
    position: fixed;
    inset: 0;
    z-index: 9999; /* MUST be above sidebar + content */
    background: rgba(0,0,0,0.88);
    display: none;
    align-items: center;
    justify-content: center;
}

/* Visible state */
#mediaLightbox.visible {
    display: flex;
}

/* Inner container */
#mediaLightboxInner {
    max-width: 70%;
    max-height: 90%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Media scaling */
#mediaLightbox img,
#mediaLightbox video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* Close button */
.media-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10000;
}

/* Right panel stays 70% */
#mediaContent {
    width: 70%;
    padding: 2rem;
}

/* Sidebar stays 30% */
#mediaSidebar {
    width: 30%;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff4f4, #ffe6e6);
  color: var(--color-fg);
    border-right: 2px solid #ddd;
    height: 100vh;
    overflow-y: auto;
}

/* -----------------------------------------
   MOBILE VERSION – for screens < 900px
------------------------------------------*/
@media (max-width: 900px) {

    #albumItems .media-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Sidebar becomes full width on top */
    #mediaSidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 2px solid #ddd;
    }

    /* Content becomes full width */
    #mediaContent {
        width: 100%;
        padding: 1.2rem;
    }

    /* Lightbox becomes full screen */
    #mediaLightbox {
        left: 0;
        right: 0;
        position: fixed;
        inset: 0;          /* replaces top/left/right/bottom */
        width: 100vw;
        height: 100vh;
        padding: 1rem;
        align-items: center;
        justify-content: center;
    }

    #mediaLightboxInner {
        max-width: 100%;
        max-height: 100%;
        padding: 1rem;
    }

.media-lightbox-close {
        top: env(safe-area-inset-top, 16px);
        right: 16px;
    }
}

/* -----------------------------------------
   EXTRA SMALL MOBILE – 1 column grid
------------------------------------------*/
@media (max-width: 600px) {
    #albumItems .media-grid {
        grid-template-columns: 1fr;
    }
}

.sidebar-album-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-album-list li {
    margin-bottom: .5rem;
}

body.lightbox-open {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* -----------------------------------------
   MEDIA THUMBNAIL CAPTIONS (ALT TEXT)
------------------------------------------ */
.media-caption {
    margin-top: 0.4rem;
    font-size: 0.85rem;          /* smaller than body text */
    line-height: 1.25;
    color: #555;                /* subtle, readable or use darck red - var(--color-primary); */
    text-align: center;
    font-weight: 400;
}

/* High-contrast mode support */
html[data-contrast="true"] .media-caption {
    color: #000;
}

/* Large-text mode support */
html[data-large="true"] .media-caption {
    font-size: 1rem;
}
