/* ===========================================
   STORY DRAWER PANEL
   Slide-in drawer for immersive story experience
   =========================================== */

/* ---- Drawer Container ---- */
.mjm-story-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: #fff;
    z-index: 20;
    overflow: hidden;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.mjm-story-drawer[aria-hidden="false"] {
    width: 45%;
}

/* ---- Top Action Buttons ---- */
.mjm-drawer-top-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 25;
    display: flex;
    gap: 8px;
    align-items: center;
}

.mjm-drawer-open-story,
.mjm-drawer-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 16px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.mjm-drawer-close {
    font-size: 20px;
}

.mjm-drawer-open-story:hover,
.mjm-drawer-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.mjm-drawer-open-story:focus,
.mjm-drawer-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- Scrollable Content ---- */
.mjm-drawer-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ---- Hero Section ---- */
.mjm-drawer-hero {
    position: relative;
    width: 100%;
    height: 364px;
    overflow: hidden;
    background: #e0e0e0;
    flex-shrink: 0;
}

/* ---- Hero Carousel ---- */
.mjm-drawer-carousel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mjm-drawer-carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.mjm-drawer-carousel-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
}

.mjm-drawer-carousel-item.active {
    opacity: 1;
    pointer-events: auto;
}

.mjm-drawer-carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

/* Video slides fill the carousel area */
.mjm-drawer-carousel-item--video {
    background: #000;
}

.mjm-drawer-carousel-item--video .mjm-video-embed {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
}

.mjm-drawer-carousel-item--video iframe,
.mjm-drawer-carousel-item--video video {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 0;
}

.mjm-drawer-carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
}

.mjm-drawer-carousel-prev,
.mjm-drawer-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 24;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mjm-drawer-carousel-prev:hover,
.mjm-drawer-carousel-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.mjm-drawer-carousel-prev {
    left: 10px;
}

.mjm-drawer-carousel-next {
    right: 10px;
}

.mjm-drawer-carousel-indicators {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 24;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    pointer-events: none;
}

.mjm-drawer-hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #96D3E5 0%, #6bb8d0 100%);
    color: #fff;
    font-size: 48px;
}

.mjm-drawer-hero--text-only .mjm-drawer-hero-placeholder i {
    display: none;
}

.mjm-drawer-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 24px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
    color: #fff;
}

.mjm-drawer-title {
    font-family: 'Citerne', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.mjm-drawer-address {
    font-size: 14px;
    margin: 0;
    opacity: 0.9;
}

.mjm-drawer-address .mjm-address-icon {
    margin-right: 4px;
}

/* ---- Sticky Audio Bar ---- */
.mjm-drawer-audio-bar {
    position: sticky;
    top: 0;
    z-index: 22;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px;
    display: none; /* Hidden until audio is populated */
}

/* Override map-inline.css styles for audio player inside drawer */
.mjm-drawer-audio-bar .mjm-story-audio-player {
    border-left: none;
    padding: 0;
    border-radius: 0;
}

/* Reduce volume slider width inside drawer (default is 90px/60px) */
.mjm-drawer-audio-bar .plyr__volume input[type=range] {
    max-width: 50px;
    min-width: 35px;
}

.mjm-drawer-audio-bar.has-audio {
    display: block;
}

.mjm-drawer-audio-bar .mjm-audio-container {
    margin-bottom: 8px;
}

.mjm-drawer-audio-bar .mjm-audio-container:last-child {
    margin-bottom: 0;
}

.mjm-drawer-audio-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mjm-drawer-audio-label i {
    color: #96D3E5;
}

/* Plyr skip buttons styling within the drawer audio bar */
.mjm-drawer-audio-bar .plyr__controls [data-plyr="rewind"],
.mjm-drawer-audio-bar .plyr__controls [data-plyr="fast-forward"] {
    color: #555;
}

.mjm-drawer-audio-bar .plyr__controls [data-plyr="rewind"]:hover,
.mjm-drawer-audio-bar .plyr__controls [data-plyr="fast-forward"]:hover {
    color: #96D3E5;
}

/* ---- Description Section ---- */
.mjm-drawer-description {
    padding: 24px;
    font-size: 15px;
    line-height: 1.7;
    color: #333;
}

.mjm-drawer-description p {
    margin: 0 0 16px;
}

.mjm-drawer-description p:last-child {
    margin-bottom: 0;
}

.mjm-drawer-description a {
    color: #ff4a0a;
    text-decoration: underline;
}

.mjm-drawer-description img {
    max-width: 100%;
    height: auto;
}


/* ---- Lightbox Overlay ---- */
.mjm-drawer-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mjm-drawer-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.mjm-drawer-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.mjm-drawer-lightbox-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 80vw;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 4px;
}

.mjm-drawer-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mjm-drawer-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mjm-drawer-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mjm-drawer-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mjm-drawer-lightbox-prev {
    left: 20px;
}

.mjm-drawer-lightbox-next {
    right: 20px;
}

/* ---- Videos Section ---- */
.mjm-drawer-videos {
    padding: 0 24px 24px;
}

.mjm-drawer-videos-title {
    font-family: 'Citerne', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #96D3E5;
}

.mjm-drawer-videos .mjm-video-embed {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
}

.mjm-drawer-videos .mjm-video-embed:last-child {
    margin-bottom: 0;
}

.mjm-drawer-videos iframe,
.mjm-drawer-videos video {
    border-radius: 8px;
}

/* ---- Related Locations Section ---- */
.mjm-drawer-related {
    padding: 0 24px 24px;
}

.mjm-drawer-related-title {
    font-family: 'Citerne', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #96D3E5;
}

.mjm-drawer-related-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.mjm-drawer-related-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s, box-shadow 0.2s;
    border: 1px solid #e0e0e0;
}

.mjm-drawer-related-card:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #ff4a0a;
}

.mjm-drawer-related-card i {
    color: #ff4a0a;
    font-size: 16px;
    flex-shrink: 0;
}

.mjm-drawer-related-card span {
    font-size: 14px;
    line-height: 1.3;
}

/* ---- Footer (kept minimal for bottom padding) ---- */
.mjm-drawer-footer {
    padding: 0 24px 24px;
}

/* ===========================================
   RESPONSIVE: TABLET (768px - 1024px)
   =========================================== */
@media screen and (max-width: 1024px) {
    .mjm-story-drawer[aria-hidden="false"] {
        width: 55%;
    }

}

/* ===========================================
   RESPONSIVE: MOBILE BOTTOM SHEET (<768px)
   =========================================== */
@media screen and (max-width: 767px) {
    .mjm-story-drawer {
        /* Bottom sheet: slides up from bottom */
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important; /* Override inline & desktop width */
        height: 0;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mjm-story-drawer[aria-hidden="false"] {
        width: 100% !important;
        height: 85vh;
    }

    /* Swipe handle */
    .mjm-drawer-swipe-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }

    .mjm-drawer-hero {
        height: 260px;
    }

    .mjm-drawer-title {
        font-size: 18px;
    }

    .mjm-drawer-description {
        padding: 16px;
        font-size: 14px;
    }

    .mjm-drawer-videos {
        padding: 0 16px 16px;
    }

    .mjm-drawer-related {
        padding: 0 16px 16px;
    }

    .mjm-drawer-footer {
        padding: 0 16px 20px;
    }

    .mjm-drawer-audio-bar {
        padding: 10px 16px;
    }

    .mjm-drawer-top-actions {
        top: 8px;
        right: 8px;
    }
}

/* Swipe handle hidden on desktop */
.mjm-drawer-swipe-handle {
    display: none;
}

/* ===========================================
   REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    .mjm-story-drawer {
        transition: none !important;
    }

    .mjm-drawer-carousel-item {
        transition: none !important;
    }

    .mjm-drawer-lightbox {
        transition: none !important;
    }
}

/* ===========================================
   HIGH CONTRAST MODE
   =========================================== */
@media (forced-colors: active) {
    .mjm-drawer-close,
    .mjm-drawer-open-story {
        border: 2px solid CanvasText;
    }

    .mjm-drawer-related-card {
        border: 2px solid CanvasText;
    }

    .mjm-drawer-lightbox-close,
    .mjm-drawer-lightbox-nav {
        border: 2px solid CanvasText;
    }
}
