
#map {
    position: relative; /* This makes the container the positioning context */
    width: 100%;
    height: 800px;
    border-radius: 10px;
    overflow: visible; /* Allow popups to extend beyond map boundaries */
}

.mapboxgl-map {
    overflow: visible !important; /* Allow popups to overflow */
}

.mapboxgl-canvas-container {
    overflow: hidden; /* Keep map tiles clipped */
}

/* Ensure popups can extend beyond map boundaries */
.mapboxgl-popup {
    overflow: visible !important;
    /* Constrain popup position to viewport */
    max-width: calc(100vw - 20px) !important;
}

/* Ensure popup content doesn't exceed viewport */
.mapboxgl-popup-content {
    max-height: calc(100vh - 40px);
    max-width: calc(100vw - 40px);
}

/* Viewport adjustment for popups that would extend beyond screen */
.mapboxgl-popup.mjm-popup-repositioned {
    --mjm-popup-adjust-x: 0px;
    --mjm-popup-adjust-y: 0px;
}

/* Apply adjustment to popup content wrapper */
.mapboxgl-popup.mjm-popup-repositioned .mapboxgl-popup-content {
    position: relative;
    left: var(--mjm-popup-adjust-x);
    top: var(--mjm-popup-adjust-y);
}

/* Hide the popup tip/arrow when repositioned as it won't point correctly */
.mapboxgl-popup.mjm-popup-repositioned .mapboxgl-popup-tip {
    display: none;
}

/* Clip the actual map canvas, not the popup layer */
.mapboxgl-canvas {
    border-radius: 10px;
}

.mapboxgl-popup-content {
    padding: 20px;
    border-radius: 10px;
    font-family: 'Citerne', sans-serif !important;
    font-size: 12px;
}

.mapboxgl-popup-content strong {
    font-size: 16px;
}

.mapboxgl-popup-content a {
    font-size: 16px;
    color: #ff4a0a;
    text-decoration: none;
}

.mapboxgl-popup-content a:visited {
    color: #1a6b82; /* Improved contrast from #96D3E5 */
}

.mapboxgl-popup-close-button {
    border-radius: 0 10px 0 0;
    height: 32px;
    color: black;
    width: 32px;
    font-size: 32px;
    padding: 0;
    line-height: 32px;
}

/* Fullscreen button - positioned left of close button */
.mjm-popup-fullscreen-btn {
    position: absolute;
    top: 0;
    right: 32px;
    height: 32px;
    width: 32px;
    background: transparent;
    border: none;
    color: black;
    font-size: 20px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
    line-height: 32px;
    outline: none;
}

.mjm-popup-fullscreen-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mjm-popup-fullscreen-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.mjm-popup-fullscreen-btn:focus {
    outline: 2px solid #ff4a0a;
    outline-offset: 2px;
}

.mjm-popup-fullscreen-btn:focus:not(:focus-visible) {
    outline: none;
}

.custom-marker {
    width: 25px;
    height: 25px;
    background-size: cover;
    background-image: url('../../assets/images/museum-marker.png');
    background-repeat: no-repeat;
}

.primary-museum-marker {
    width: 50px;
    height: 50px;
    position: relative;
    z-index: 3;
    background-image: url('../../assets/images/museum-marker.png');
    background-size: cover;
    background-repeat: no-repeat;
}

.secondary-museum-marker {
    width: 50px;
    height: 50px;
    position: relative;
    z-index: 3;
    background-image: url('../../assets/images/museum-marker.png');
    background-size: cover;
    background-repeat: no-repeat;
}

/* ============================================
   Museum Popup Styles (Map > Museums)
   Inspired by search-toggle-container design
   ============================================ */

.mjm-museum-popup-container .mapboxgl-popup-content {
    padding: 0;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(150, 211, 229, 0.2);
    border-top: 3px solid #ff4a0a;
    overflow: hidden;
    min-width: 320px;
    max-width: 380px;
}

.mjm-museum-popup-container .mapboxgl-popup-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    color: #666;
    font-size: 18px;
    line-height: 24px;
    transition: all 0.2s ease;
    z-index: 10;
}

.mjm-museum-popup-container .mapboxgl-popup-close-button:hover {
    background-color: #ff4a0a;
    border-color: #ff4a0a;
    color: white;
}

.mjm-museum-popup-container .mapboxgl-popup-tip {
    border-top-color: rgba(255, 255, 255, 0.96);
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    align-self: center;
    border-bottom: none;
    border-top-color: #fff;
    z-index: 12;
}

.mjm-museum-popup {
    display: flex;
    flex-direction: column;
}

.mjm-museum-popup-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background-color: #f0f0f0;
    position: relative;
    border-bottom: 3px solid #ff4a0a;
}

.mjm-museum-popup-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.15), transparent);
    pointer-events: none;
}

.mjm-museum-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.mjm-museum-popup:hover .mjm-museum-popup-image img {
    transform: scale(1.03);
}

.mjm-museum-popup-content {
    padding: 15px 18px 18px;
}

.mjm-museum-popup-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    font-family: 'Citerne', sans-serif;
    line-height: 1.3;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(150, 211, 229, 0.3);
}

.mjm-museum-popup-description {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    font-family: 'Citerne', sans-serif;
}

.mjm-museum-popup-description p {
    margin: 0 0 10px 0;
}

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

.mjm-museum-popup-description a {
    color: #ff4a0a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mjm-museum-popup-description a:hover {
    color: #e04209;
    text-decoration: underline;
}

/* Responsive adjustments for museum popup */
@media (max-width: 480px) {
    .mjm-museum-popup-container .mapboxgl-popup-content {
        min-width: 260px;
        max-width: 300px;
    }

    .mjm-museum-popup-image {
        height: 160px;
    }

    .mjm-museum-popup-content {
        padding: 12px 15px 15px;
    }

    .mjm-museum-popup-title {
        font-size: 14px;
    }

    .mjm-museum-popup-description {
        font-size: 12px;
    }
}

/* Tabbed Popup Styles */
.mjm-tabbed-popup .mapboxgl-popup-content {
    padding: 0;
    width: 780px;
    overflow: visible;
    z-index:11;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.18);
}

.mjm-tabbed-popup, .mapboxgl-popup {
    z-index: 12 !important;
}

.mjm-popup-tabs {
    display: flex;
    flex-direction: column;
}

.mjm-tab-buttons {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background-color: #f5f5f5;
    border-radius: 10px 10px 0 0;
}

.mjm-tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Citerne', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
}

.mjm-tab-btn:first-child {
    border-radius: 10px 0 0 0;
}

.mjm-tab-btn:last-child {
    border-radius: 0 10px 0 0;
}

.mjm-tab-btn:hover {
    background-color: #e8e8e8;
    color: #333;
}

.mjm-tab-btn:focus {
    outline: 2px solid #ff4a0a;
    outline-offset: -2px;
}

.mjm-tab-btn:focus:not(:focus-visible) {
    outline: none;
}

.mjm-tab-btn.active {
    background-color: white;
    color: #ff4a0a;
    border-bottom: 3px solid #ff4a0a;
}

.mjm-tab-content {
    padding: 20px;
    height: auto;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Description tab should not scroll and adjust to content */
#tab-description {
    overflow: hidden;
    padding-bottom: 0 !important;
    height: auto;
    min-height: auto;
}

.mjm-tab-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mjm-tab-pane {
    display: none;
}

.mjm-tab-pane.active {
    display: block;
}

.mjm-tab-pane h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.mjm-tab-pane p {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.5;
}

.mjm-view-details {
    display: inline-block;
    margin-top: 10px;
    margin-bottom: 0;
    padding: 8px 15px;
    background-color: #ff4a0a;
    color: white !important;
    text-decoration: none !important;
    border-radius: 5px;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.mjm-view-details:hover {
    background-color: #e04209;
}

/* Description Tab Layout */
.mjm-description-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
    width: 100%;
}

.mjm-description-layout {
    display: grid;
    grid-template-columns: 30% 1fr;
    gap: 15px;
}

.mjm-description-carousel {
    min-width: 200px;
}

.mjm-description-text {
    overflow-y: auto;
    max-height: 280px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding-bottom: 0;
}

.mjm-description-text::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mjm-description-text p {
    margin-top: 0;
    margin-bottom: 10px;
}

.mjm-description-text p:last-of-type {
    margin-bottom: 0;
}

.mjm-no-media {
    font-size: 12px;
    color: #666; /* Improved contrast from #999 */
    text-align: center;
    padding: 20px 0;
}

/* Small Carousel Styles */
.mjm-small-carousel {
    position: relative;
    width: 100%;
}

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

.mjm-small-carousel-item {
    display: none;
    width: 100%;
    position: relative;
}

.mjm-small-carousel-item.active {
    display: block;
}

.mjm-small-carousel-image {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: 5px;
    display: block;
}

.mjm-small-carousel-prev,
.mjm-small-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 5px 8px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.mjm-small-carousel-prev:hover,
.mjm-small-carousel-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.mjm-small-carousel-prev:focus,
.mjm-small-carousel-next:focus {
    outline: 2px solid #ff4a0a;
    outline-offset: 2px;
}

.mjm-small-carousel-prev:focus:not(:focus-visible),
.mjm-small-carousel-next:focus:not(:focus-visible) {
    outline: none;
}

.mjm-small-carousel-prev {
    left: 5px;
}

.mjm-small-carousel-next {
    right: 5px;
}

.mjm-small-carousel-indicators {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

/* Carousel Styles */
.mjm-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

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

.mjm-carousel-item {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.mjm-carousel-item.active {
    display: flex;
}

.mjm-carousel-image {
    width: 100%;
    height: auto;
    max-height: 350px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 5px;
    background-color: #f5f5f5;
}

.mjm-carousel-caption {
    margin-top: 10px;
    font-size: 12px;
    color: #555; /* Improved contrast from #666 */
    text-align: center;
    font-style: italic;
}

.mjm-carousel-prev,
.mjm-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 24px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s ease;
    z-index: 10;
}

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

.mjm-carousel-prev:focus,
.mjm-carousel-next:focus {
    outline: 2px solid #ff4a0a;
    outline-offset: 2px;
}

.mjm-carousel-prev:focus:not(:focus-visible),
.mjm-carousel-next:focus:not(:focus-visible) {
    outline: none;
}

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

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

.mjm-carousel-indicators {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

/* Location Address and Dates */
.mjm-location-address {
    margin-top: 5px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #333;
}

.mjm-location-dates {
    color: #555; /* Improved contrast from #888 */
    font-size: 12px;
}

/* Story Popup Styles */
.mjm-story-popup-container .mapboxgl-popup-content {
    padding: 25px;
    max-width: 700px;
    min-width: 550px;
    z-index: 12;
}

.mjm-story-popup {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mjm-story-header {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Audio row at top - full width */
.mjm-story-audio-row {
    width: 100%;
}

.mjm-story-audio-row .mjm-story-audio {
    margin: 0;
}

/* Two-column layout for story content */
.mjm-story-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.mjm-story-content.no-media {
    display: block;
}

/* Left column: 1/3 width for carousel */
.mjm-story-media-column {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mjm-story-media-column .mjm-small-carousel {
    width: 100%;
    height: 300px;
    position: relative;
    overflow: hidden;
}

.mjm-story-media-column .mjm-small-carousel-container {
    height: 300px;
    position: relative;
}

.mjm-story-media-column .mjm-small-carousel-item {
    height: 300px;
    position: relative;
    overflow: hidden;
}

.mjm-story-media-column .mjm-small-carousel-item.active {
    display: block !important;
}

.mjm-story-media-column .mjm-small-carousel-item .mjm-small-carousel-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
    border-radius: 6px;
    margin: 0 !important;
}

/* Right column: 50% width for description */
.mjm-story-text-column {
    flex: 1;
    min-width: 0;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar styling for description */
.mjm-story-text-column::-webkit-scrollbar {
    width: 6px;
}

.mjm-story-text-column::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mjm-story-text-column::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.mjm-story-text-column::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Plyr Audio Player Customization */
.mjm-story-audio .plyr {
    border-radius: 8px;
    overflow: hidden;
}

.mjm-story-audio .plyr--audio .plyr__controls {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 10px;
    color: #333;
}

.mjm-story-audio .plyr__control--overlaid {
    background: #ff4a0a;
}

.mjm-story-audio .plyr__control--overlaid:hover {
    background: #e04209;
}

.mjm-story-audio .plyr--full-ui input[type=range] {
    color: #ff4a0a;
}

.mjm-story-audio .plyr__control.plyr__tab-focus,
.mjm-story-audio .plyr__control:hover,
.mjm-story-audio .plyr__control[aria-expanded=true] {
    background: #ff4a0a;
    color: white;
}

.mjm-story-title {
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

.mjm-story-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mjm-story-audio {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
    border-left: 3px solid #96D3E5;
}

/* Compact audio player in media column */
.mjm-story-media-column .mjm-story-audio {
    padding: 8px;
}

.mjm-story-media-column .mjm-story-audio .plyr--audio .plyr__controls {
    padding: 6px;
}

.mjm-story-media-column .mjm-audio-container {
    margin-bottom: 0;
}

.mjm-audio-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.mjm-story-audio audio {
    flex: 1;
    height: 32px;
    width: 100%;
}

.mjm-story-address {
    margin: 0;
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mjm-address-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.mjm-story-locations {
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #ff4a0a;
}

.mjm-story-locations-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.mjm-story-locations-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.mjm-story-locations-list li {
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.mjm-story-locations-list li:last-child {
    margin-bottom: 0;
}

.mjm-story-locations-list a {
    color: #ff4a0a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mjm-story-locations-list a:hover {
    color: #e04209;
    text-decoration: underline;
}

/* ============================================
   STORY TABBED POPUP STYLES
   ============================================ */

/* Story tabbed popup specific overrides */
.mjm-story-tabbed-popup .mapboxgl-popup-content {
    padding: 0;
    width: 780px;
    overflow: visible;
}

/* Audio Tab Styles */
.mjm-audio-tab-header {
    margin-bottom: 20px;
    text-align: center;
}

.mjm-audio-section-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.mjm-audio-subtitle {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.mjm-story-audio-players {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mjm-story-audio-player {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    border-left: 3px solid #96D3E5;
}

/* Media Tab Styles */
.mjm-story-videos {
    margin-top: 20px;
}

.mjm-media-section-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.mjm-video-embed {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
}

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

.mjm-video-embed iframe,
.mjm-video-embed video {
    display: block;
    border-radius: 8px;
}

.mjm-video-native video {
    background-color: #000;
}

/* Related Tab Styles */
.mjm-related-subtitle {
    margin: 0 0 15px 0;
    font-size: 12px;
    color: #666;
}

#tab-related .mjm-story-locations {
    margin-top: 0;
}

/* Story Description Tab - Address styling */
#tab-description .mjm-location-address {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
}

#tab-description .mjm-address-icon {
    flex-shrink: 0;
}

/* Multi-Marker List Popup Styles */
.mjm-multi-marker-popup-container .mapboxgl-popup-content {
    padding: 20px;
    max-width: 400px;
}

.mjm-multi-marker-popup {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mjm-multi-title {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.mjm-multi-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mjm-multi-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

.mjm-multi-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.mjm-multi-list li {
    margin-bottom: 6px;
}

.mjm-multi-list li:last-child {
    margin-bottom: 0;
}

.mjm-multi-item {
    color: #ff4a0a;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.mjm-multi-item:hover {
    color: #e04209;
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE STYLES FOR MOBILE DEVICES
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* Location popups - make responsive */
    .mjm-tabbed-popup .mapboxgl-popup-content {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 0;
    }

    /* Story popups - remove min-width constraint */
    .mjm-story-popup-container .mapboxgl-popup-content {
        min-width: unset;
        width: 90vw;
        max-width: 90vw;
        padding: 20px;
    }

    /* Stack story columns vertically on mobile */
    .mjm-story-content {
        flex-direction: column;
        gap: 15px;
    }

    .mjm-story-media-column {
        flex: none;
        max-width: 100%;
        width: 100%;
    }

    .mjm-story-text-column {
        max-height: none;
        overflow-y: visible;
    }

    /* Multi-marker popups */
    .mjm-multi-marker-popup-container .mapboxgl-popup-content {
        width: 90vw;
        max-width: 90vw;
    }

    /* Stack description layout vertically */
    .mjm-description-layout {
        grid-template-columns: 1fr; /* Single column layout */
        gap: 15px;
    }

    /* Remove width constraint on carousel */
    .mjm-description-carousel {
        min-width: unset;
        width: 100%;
    }

    /* Adjust text area height for mobile */
    .mjm-description-text {
        max-height: none; /* Let it flow naturally */
        overflow-y: visible;
    }

    /* Reduce tab content max-height */
    .mjm-tab-content {
        max-height: 400px;
        padding: 15px;
    }

    /* Make tab buttons more compact */
    .mjm-tab-btn {
        font-size: 11px;
        padding: 10px 8px;
    }

    /* Adjust carousel image heights */
    .mjm-carousel-image {
        max-height: 250px;
    }

    .mjm-small-carousel-image {
        max-height: 220px;
    }

    /* Close button maintains same size on mobile (32px from base styles) */

    /* Larger carousel navigation buttons */
    .mjm-carousel-prev,
    .mjm-carousel-next {
        padding: 12px 16px;
        font-size: 20px;
    }

    .mjm-small-carousel-prev,
    .mjm-small-carousel-next {
        padding: 8px 12px;
        font-size: 18px;
    }

    /* Story popup adjustments */
    .mjm-story-title {
        font-size: 18px;
    }

    .mjm-story-description {
        font-size: 13px;
    }

    /* Plyr player mobile adjustments */
    .mjm-story-audio .plyr--audio .plyr__controls {
        padding: 8px;
    }

    .mjm-story-audio .plyr__control {
        padding: 8px;
    }

    /* Enable thin scrollbar on mobile */
    .mjm-tab-content {
        scrollbar-width: thin;
    }

    .mjm-tab-content::-webkit-scrollbar {
        display: block;
        width: 4px;
    }

    .mjm-tab-content::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.3);
        border-radius: 2px;
    }

    .mjm-description-text {
        scrollbar-width: thin;
    }

    .mjm-description-text::-webkit-scrollbar {
        display: block;
        width: 4px;
    }

    .mjm-description-text::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.3);
        border-radius: 2px;
    }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
    /* Make popups nearly full width */
    .mjm-tabbed-popup .mapboxgl-popup-content {
        width: 98vw !important;
        max-width: 98vw !important;
    }

    .mjm-story-popup-container .mapboxgl-popup-content,
    .mjm-multi-marker-popup-container .mapboxgl-popup-content {
        width: 95vw;
        max-width: 95vw;
        padding: 15px;
    }

    /* Further reduce tab button size */
    .mjm-tab-btn {
        font-size: 10px;
        padding: 8px 6px;
    }

    /* Reduce padding for more content space */
    .mjm-tab-content {
        padding: 12px;
        max-height: 350px;
    }

    /* Reduce title sizes */
    .mjm-description-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .mjm-story-title {
        font-size: 16px;
    }

    /* Smaller carousel images */
    .mjm-carousel-image {
        max-height: 200px;
    }

    .mjm-small-carousel-image {
        max-height: 180px;
    }

    /* Adjust location address text */
    .mjm-location-address {
        font-size: 11px;
    }

    /* Smaller "View Details" button */
    .mjm-view-details {
        padding: 6px 12px;
        font-size: 11px;
    }

    /* Compact carousel indicators */
    .mjm-carousel-indicators,
    .mjm-small-carousel-indicators {
        font-size: 9px;
        padding: 2px 6px;
    }
}

/* Extra small devices (360px and below) */
@media (max-width: 360px) {
    .mjm-tab-btn {
        font-size: 9px;
        padding: 6px 4px;
    }

    .mjm-tab-content {
        padding: 10px;
    }

    .mjm-description-title,
    .mjm-story-title {
        font-size: 14px;
    }

    .mapboxgl-popup-content {
        font-size: 11px;
    }
}

/* ============================================
   ACCESSIBILITY UTILITIES
   ============================================ */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #ff4a0a;
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Improved focus styles for links */
.mjm-view-details:focus,
.mjm-multi-item:focus,
.mjm-story-locations-list a:focus {
    outline: 2px solid #ff4a0a;
    outline-offset: 2px;
}

.mjm-view-details:focus:not(:focus-visible),
.mjm-multi-item:focus:not(:focus-visible),
.mjm-story-locations-list a:focus:not(:focus-visible) {
    outline: none;
}

/* Minimum touch target sizes (44x44px for WCAG 2.5.5) */
@media (pointer: coarse) {
    .mjm-small-carousel-prev,
    .mjm-small-carousel-next {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 12px;
    }

    .mjm-carousel-prev,
    .mjm-carousel-next {
        min-width: 44px;
        min-height: 44px;
    }

    .mjm-popup-fullscreen-btn,
    .mapboxgl-popup-close-button {
        min-width: 44px;
        min-height: 44px;
    }

    .mjm-tab-btn {
        min-height: 44px;
    }
}

/* ============================================
   REDUCED MOTION PREFERENCES
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .mjm-popup-fullscreen-btn,
    .mjm-tab-btn,
    .mjm-view-details,
    .mjm-small-carousel-prev,
    .mjm-small-carousel-next,
    .mjm-carousel-prev,
    .mjm-carousel-next,
    .mjm-multi-item,
    .mjm-story-locations-list a {
        transition: none !important;
    }
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT FOR POPUPS
   ============================================ */

@media (forced-colors: active) {
    /* Popup container */
    .mapboxgl-popup-content {
        border: 2px solid CanvasText;
    }

    /* Tab buttons */
    .mjm-tab-btn {
        border: 1px solid CanvasText;
    }

    .mjm-tab-btn.active {
        background-color: Highlight;
        color: HighlightText;
    }

    .mjm-tab-btn:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }

    /* Carousel navigation */
    .mjm-carousel-prev,
    .mjm-carousel-next,
    .mjm-small-carousel-prev,
    .mjm-small-carousel-next {
        border: 2px solid CanvasText;
        background-color: Canvas;
        color: CanvasText;
    }

    .mjm-carousel-prev:hover,
    .mjm-carousel-next:hover,
    .mjm-small-carousel-prev:hover,
    .mjm-small-carousel-next:hover {
        background-color: Highlight;
        color: HighlightText;
    }

    .mjm-carousel-prev:focus,
    .mjm-carousel-next:focus,
    .mjm-small-carousel-prev:focus,
    .mjm-small-carousel-next:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }

    /* Close button */
    .mapboxgl-popup-close-button {
        border: 1px solid CanvasText;
    }

    .mapboxgl-popup-close-button:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }

    /* Fullscreen button */
    .mjm-popup-fullscreen-btn {
        border: 1px solid CanvasText;
    }

    .mjm-popup-fullscreen-btn:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }

    /* Links */
    .mjm-view-details,
    .mjm-multi-item,
    .mjm-story-locations-list a {
        text-decoration: underline;
    }

    .mjm-view-details:focus,
    .mjm-multi-item:focus,
    .mjm-story-locations-list a:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }

    /* Carousel indicators */
    .mjm-carousel-indicators,
    .mjm-small-carousel-indicators {
        border: 1px solid CanvasText;
        background-color: Canvas;
        color: CanvasText;
    }

    /* Multi-marker popup */
    .mjm-multi-marker-popup {
        border: 2px solid CanvasText;
    }

    .mjm-multi-title {
        border-bottom: 2px solid CanvasText;
    }
}
