/* ==============================
   BASE MOBILE (<=767px)
   ============================== */
@media (max-width: 767px) {
    html,
    body {
        height: auto;
        overflow: auto;
        min-height: 100vh;
    }

    body,
    html {
        overflow-x: hidden; /* chosen */
    }
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* Header & Navigation */
    .sketch-header {
        flex-wrap: wrap;
        margin-bottom: 0 !important;
        position: relative;
    }
    .sketch-header .liquidGlass-text {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .sketch-header-nav {
        display: flex;
        gap: 5px;
        justify-content: flex-start; /* tighter grouping */
        align-items: stretch;
        flex-wrap: nowrap; /* keep single row for horizontal scroll */
        width: 100%;
        order: 2;
        overflow-x: auto; /* enable horizontal scroll */
        overflow-y: hidden; /* hide vertical overflow */
        -webkit-overflow-scrolling: touch; /* smooth iOS */
        scrollbar-width: none; /* hide Firefox scrollbar */
    }
    .sketch-header-nav::-webkit-scrollbar { display: none; }

/* Transparent edge fade via CSS mask (no color tint) */
:root { --nav-fade-width: 24px; }
/* Disable old overlay fades if present */
.nav-edge-fade { display: none !important; }

/* Apply masks on the scroll container to fade content to transparent at edges */
.sketch-header-nav.mask-left,
.sketch-header-nav.mask-right,
.sketch-header-nav.mask-both {
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
}

/* Fade on the left edge only */
.sketch-header-nav.mask-left {
  -webkit-mask-image: linear-gradient(to right,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) 100%);
  mask-image: linear-gradient(to right,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) 100%);
}

/* Fade on the right edge only */
.sketch-header-nav.mask-right {
  -webkit-mask-image: linear-gradient(to left,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) 100%);
  mask-image: linear-gradient(to left,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) 100%);
}

/* Fade on both edges */
.sketch-header-nav.mask-both {
  -webkit-mask-image: linear-gradient(to right,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) calc(100% - var(--nav-fade-width)),
    rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to right,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,1) var(--nav-fade-width),
    rgba(0,0,0,1) calc(100% - var(--nav-fade-width)),
    rgba(0,0,0,0) 100%);
}

    .nav-button {
        flex: 0 0 auto !important; /* natural width, no stretch */
        min-width: 0 !important;
        padding: clamp(0.2rem, 1.5vw, 0.35rem) clamp(0.45rem, 2.2vw, 0.55rem); /* slightly smaller */
        font-size: clamp(0.68rem, 2.2vw, 0.85rem) !important; /* closer to original compact size */
        font-weight: 700 !important;
        justify-content: center;
        line-height: 1.1 !important; /* prevent vertical clipping */
        min-width: max-content !important; /* fit text */
        max-width: none !important; /* allow full text */
    }
    .sketch-header-nav a.nav-button:first-of-type {
        flex: 0 0 auto !important; /* remove special stretch so scrolling uniform */
    }
    .sketch-header-nav a.nav-button[href*="info"],
    .sketch-header-nav a.nav-button[href*="map"] {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        padding-left: clamp(0.15rem, 1.5vw, 0.35rem) !important;
        padding-right: clamp(0.15rem, 1.5vw, 0.35rem) !important;
    }
    .sketch-header-nav a[href*="gallery"] + a[href*="gallery"] {
        display: none !important;
    }
    .nav-button .liquidGlass-text {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: clamp(4px, 1.5vw, 8px) !important;
        padding: 0 !important;
        width: 100% !important;
        letter-spacing: normal !important;
        /* ALT original included white-space: nowrap; (comment if you want it) */
        white-space: nowrap; 
        align-items: center !important;
        white-space: nowrap !important; /* keep single line for scroll */
     }

    .nav-button img {
        width: 0.9rem !important;
        height: 0.9rem !important; /* scale icon down slightly */
        flex-shrink: 0 !important;
    }

    /* Header Nav Compact Adjustments (smaller text/height, larger icons) */
    .nav-button {
        /* reduce vertical & horizontal padding */
        padding: clamp(0.15rem, 1.2vw, 0.28rem) clamp(0.4rem, 2vw, 0.5rem) !important;
        /* smaller font size */
        font-size: 10px !important;
        line-height: 1.05 !important;
        min-height: 20px !important; /* was inherited 44px */
    }
    .nav-button img {
        /* increase icon size */
        width: 1.15rem !important; /* was 0.9rem */
        height: 1.15rem !important;
    }
    /* Make only the Map icon larger on mobile; keep Info icon as-is */
    .sketch-header-nav img[alt="Map"],
    .sketch-header-nav img[src*="map.svg"] {
        width: 2rem !important;
        height: 2rem !important;
    }
    /* ensure icon/text balance when text wraps off (forced single line earlier) */
    .nav-button .liquidGlass-text { gap: clamp(3px, 1vw, 6px) !important; }

    /* Navigation Scroll Indicators */
    .nav-scroll-indicator {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 10px;
        height: 100%;
        border-radius: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(0.3rem);
        background: rgba(255, 255, 255, 0.2);
    }
    
    .nav-scroll-indicator.show {
        opacity: 1;
    }

    .nav-scroll-indicator.left {
        left: 0;
        border-radius: 3px 0 0 3px;
    }
    
    .nav-scroll-indicator.right {
        right: 0;
        border-radius: 0 3px 3px 0;
    }
    
    .nav-scroll-indicator::after {
        content: '';
        width: 0;
        height: 0;
        border-style: solid;
    }
    
    .nav-scroll-indicator.left::after {
        border-width: 5px 6px 5px 0;
        border-color: transparent #555 transparent transparent;
        margin-left: 0px;
    }
    
    .nav-scroll-indicator.right::after {
        border-width: 5px 0 5px 6px;
        border-color: transparent transparent transparent #555;
        margin-right: 0px;
    }

    /* Main Layout */
    main {
        padding: 8px;
        flex-direction: column;
        gap: 12px;
        overflow: auto;
        height: auto;
    }
    .left-column {
        width: 100%;
        height: auto;
        flex: none;
        gap: 8px; 
    }
    .right-section {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 12px !important;
    }

    #gallery {
        padding: 10px 4px 10px 10px;
        min-height: 20rem;
        max-height: 28rem;
        overflow: hidden; /* prevent section scrolling */
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
    #gallery .liquidGlass-text {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        position: relative !important;
        height: 100% !important;
        overflow-y: auto !important; /* this handles scrolling */
        overflow-x: hidden !important;
        scrollbar-width: none !important; /* Firefox: hide native scrollbar */
    }
    #gallery .liquidGlass-text::-webkit-scrollbar { width: 0 !important; height: 0 !important; }

    .gallery-grid {
        display: grid !important;
        grid-template-columns: 1fr !important; /* revert to single column */
        grid-auto-rows: 140px !important; /* fixed row height for cards */
        gap: 5px !important;
        width: 100% !important;
        height: auto !important; /* natural height */
        overflow: visible !important; /* no scrolling on grid; parent scrolls */
        padding: 0 !important;
        box-sizing: border-box !important;
        scrollbar-width: none !important;
        align-content: start !important;
    }
    .gallery-grid::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }
    .gallery-grid.is-placeholder,
    .gallery-grid.is-empty,
    .calendar-events.is-placeholder,
    .calendar-events.is-empty {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        padding-right: 0 !important;
    }

    /* Custom Gallery Scrollbar */
    /* Custom Gallery Scrollbar */
    #gallery .gallery-grid { padding-right: 10px !important; }
    #gallery .gallery-grid.is-placeholder,
    #gallery .gallery-grid.is-empty { padding-right: 0 !important; }
    /* Anchor the custom scrollbar to #gallery (non-scrolling) */
    #gallery .gallery-scrollbar {
        position: absolute !important;
        top: 10px !important; /* respect gallery padding */
        right: 10px !important;
        bottom: 10px !important;
        width: 8px !important;
        background: transparent !important;
        border-radius: 6px !important;
        z-index: 20 !important;
        overflow: hidden !important; /* hide any internal native scroll */
        pointer-events: none !important; /* only thumb handles events */
        box-sizing: border-box !important;
    }
    #gallery .gallery-scrollbar::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
    #gallery .gallery-scrollbar .gallery-scrollbar-track {
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.05);
        border-radius: 6px;
    }
    #gallery .gallery-scrollbar .gallery-scrollbar-thumb {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        background: rgba(0,0,0,0.35);
        border-radius: 6px;
        min-height: 24px;
        touch-action: none;
        will-change: transform, height;
        transition: background-color 0.15s;
        pointer-events: auto !important; /* enable dragging */
    }
    #gallery .gallery-scrollbar .gallery-scrollbar-thumb:hover,
    #gallery .gallery-scrollbar .gallery-scrollbar-thumb:active {
        background: rgba(0,0,0,0.5);
    }

    /* Gallery Cards */
    .gallery-card,
    .gallery-grid .gallery-card {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* prevent wrapping so columns stay side-by-side */
        align-items: stretch !important;
        width: 100% !important;
        height: 140px !important; /* fixed card height */
        aspect-ratio: auto !important; /* cancel desktop square rule */
        position: relative !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        background: #91AE7E !important;
        min-height: 0 !important;
    }
    /* Hard enforce both immediate children to 50% each */
    .gallery-grid .gallery-card > * {
        flex: 0 0 50% !important;
        width: 50% !important;
        max-width: 50% !important;
        min-width: 0 !important;
        height: 100% !important;
        align-self: stretch !important;
    }
    .gallery-card-image {
        position: relative !important;
        width: 50% !important;
        height: 100% !important;
        flex: 0 0 50% !important;
        z-index: 0 !important;
        order: 2 !important; /* move image to the right */
    }
    /* Increase specificity to override desktop square rules */
    .gallery-grid .gallery-card .gallery-card-image {
        position: relative !important;
        inset: auto !important;
        width: 50% !important;
        height: 100% !important;
        flex: 0 0 50% !important;
        order: 2 !important;
    }
    /* Ensure immediate children follow a strict 50/50 split */
    .gallery-grid .gallery-card > .gallery-card-image,
    .gallery-grid .gallery-card > .gallery-card-preview {
        position: relative !important;
        inset: auto !important;
        width: 50% !important;
        max-width: 50% !important;
        min-width: 0 !important;
        height: 100% !important;
        flex: 0 0 50% !important;
    }
    .gallery-card-image img,
    .gallery-card img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }

    .gallery-card-preview {
        position: relative !important;
        inset: auto !important;
        width: 50% !important;
        height: 100% !important;
        flex: 0 0 50% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important; /* vertically centered text */
        align-items: center !important;
        padding: 8px !important;
        background: #91AE7E !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 1 !important;
        transition: none !important;
        overflow: hidden !important;
        order: 1 !important; /* move preview to the left */
    }
    .gallery-grid .gallery-card .gallery-card-preview {
        position: relative !important;
        inset: auto !important;
        width: 50% !important;
        height: 100% !important;
        flex: 0 0 50% !important;
        order: 1 !important;
        justify-content: center !important;
        align-items: center !important;
        background: #91AE7E !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .gallery-card-preview-text {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 1 !important;
    }
    .gallery-card-content {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        min-height: 80px !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: relative !important;
        overflow: visible !important;
    }

    .gallery-card-title {
        font: 800 14px/1.25 'Red Hat Display','Inter','SF Pro Display',-apple-system,BlinkMacSystemFont,sans-serif !important;
        text-align: center !important;
        color: #ffffff !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
        margin: 0 0 2px 0 !important;
        padding: 0 !important;
        font-size: 1.2rem !important;
    }

    /* Overrides vs desktop / inline JS */
    .gallery-card .gallery-card-preview,
    .gallery-grid .gallery-card .gallery-card-preview {
        opacity: 1 !important;
        visibility: visible !important;
        display: flex !important;
        position: relative !important;
        background: #91AE7E !important;
    }
    .gallery-card .gallery-card-title,
    .gallery-grid .gallery-card .gallery-card-title,
    .gallery-card-preview .gallery-card-title,
    .gallery-card-preview-text .gallery-card-title {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        color: #4a5568 !important;
        text-shadow: none !important;
    }
    .gallery-card-title[style],
    .gallery-card-preview[style],
    .gallery-card-preview-text[style] {
        color: #4a5568 !important;
        opacity: 1 !important;
        display: flex !important;
        visibility: visible !important;
        background: transparent !important;
    }
    .gallery-card-title[style*="text-shadow"],
    .gallery-card-title[style*="font-size:17px"],
    .gallery-card-title[style*="font-size: 17px"] {
        color: #1a202c !important;
        font-size: 11px !important;
        background: #fff !important;
        padding: 4px !important;
        border-radius: 4px !important;
    }
    .gallery-card-preview[style*="position:absolute"],
    .gallery-card-preview[style*="top:0"],
    .gallery-card-preview[style*="left:0"] {
        position: relative !important;
        inset: auto !important;
        height: auto !important;
        width: 50% !important;
        background: #fff !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px !important;
    }

    /* Region Icons Wrapper */
    #region-icons {
        height: auto !important;
        min-height: 95px !important; /* preserve minimum visual footprint */
        overflow: visible !important; /* allow labels to extend */
        width: 100% !important;
        padding: 10px !important;
        order: 1 !important;
        position: relative !important;
        overscroll-behavior-x: contain;
    }
    #region-icons .liquidGlass-text {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 0px !important;
        height: auto !important; /* was auto already (kept) */
        overflow: visible !important; /* explicit */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        position: relative !important;
        z-index: 5 !important;
        scrollbar-width: none !important;
        --scroll-pct: 0%;
    }
    #region-icons .region-icons-row {
        display: flex !important;
        flex-direction: row !important;
        gap: 5px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none !important;
        padding-bottom: 0px !important;
    }
    #region-icons .region-icons-row::-webkit-scrollbar,
    #region-icons .liquidGlass-text::-webkit-scrollbar { width: 0 !important; height: 0 !important; }

    #region-icons .region-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding-bottom: 4px !important; /* extra space for label */
        flex: 0 0 auto !important;
        width: 80px !important;
        background: #91AE7E;
        border-radius: 6px;
        padding: 8px;
        cursor: pointer;
    }
    #region-icons .region-item .sort-btn { height: 56px !important; }
    @media (max-height: 580px) {
        #region-icons .region-item .sort-btn { height: 48px !important; }
    }

    #region-icons .sort-btn {
        padding: 4px !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 2px !important;
        font-size: 0 !important;
        line-height: 0 !important;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 2px !important; /* separate icon block from label */
    }
    #region-icons .sort-btn.selected {
        transform: none !important;
        background: none !important;
    }
    #region-icons .sort-btn.selected::after { color: #2d3748 !important; }
    #region-icons .sort-btn::before {
        content: '' !important;
        width: 56px !important;
        height: 56px !important;
        margin: 0 !important;
        display: block !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        line-height: 0 !important;
    }
    #region-icons .sort-btn::after {
        margin: 0 !important;
        font-size: 0.6rem !important;
        line-height: 1.05 !important;
        display: block !important;
        white-space: nowrap !important;
        position: static !important;
        transform: none !important;
        background: transparent !important;
        margin-top: -2px !important;
    }

    #region-icons .region-label {
        width: 100% !important;
        display: block !important; /* ensure it occupies its own line */
        white-space: normal !important; /* allow wrapping */
        line-height: 1.2 !important; /* improve vertical rhythm with larger text */
        text-align: center !important;
        margin-top: 0px !important;
        overflow: visible !important; /* ensure text not clipped */
        font-size: 0.68rem !important;
        background: none !important;
        box-shadow: none !important;
        position: relative !important;
        z-index: 6 !important;
        mix-blend-mode: normal !important;
        opacity: 1 !important;
        padding: 0 !important;
        font-weight: 700 !important; /* default deselected weight */
    }
    /* Selected region: stronger weight */
    #region-icons .region-item .sort-btn.selected + .region-label {
        font-weight: 900 !important;
    }
    #region-icons .liquidGlass-shine,
    #region-icons .liquidGlass-tint,
    #region-icons .liquidGlass-effect { z-index: 0 !important; }
    #region-icons .region-label::before,
    #region-icons .region-label::after { content: none !important; }

    /* Event Calendar */
    #event-calendar {
        width: 100% !important;
        padding: 10px !important;
        height: auto !important;
        height: 428px !important;
        order: 2 !important;
    }
    #event-calendar.has-open-item { height: 1200px !important; }
    #event-calendar.has-open-item .calendar-events { max-height: 80vh !important; }
    .calendar-events {
        height: auto !important;
        max-height: 24rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    .event-dropdown-box summary {
        padding: 12px 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        height: auto;
    }
    .event-dropdown-box summary .event-title {
        font-size: 1.2rem;
        margin-left: 0.5rem;
        flex: 1;
        min-width: 0;
    }
    .event-date-header {
        font-size: 0.8rem;
        margin: 0 0 0 auto;
        text-align: right;
        white-space: nowrap;
        margin-right: 0.5rem;
    }
    .event-content {
        padding: 10px;
    }
    .event-details-flex {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .event-details-info,
    .event-details-img {
        width: 100% !important;
        flex: none !important;
    }
    /* Keep image column position; only place register/organiser under info */
    .event-details-img {
        order: 1 !important;
        display: contents !important;
    }
    .event-details-info {
        order: 2 !important;
        gap: 10px !important;
    }

    /* Children of image column become flex items due to display: contents */
    .event-poster-img-wrapper {
        order: 1 !important;
    }
    .event-register-btn {
        order: 3 !important;
    }
    .event-organiser {
        order: 4 !important;
    }
    .event-poster-img {
        height: 200px !important;
    }
    .event-poster-img {
        width: 100% !important;
        height: auto !important;
        max-height: 200px !important;
    }
    .event-poster-img[style] {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        display: block !important;
    }
    .event-info-box {
        padding: 0.6em 0.8em !important;
        font-size: 0.95em !important;
    }
    .event-info-box .liquidGlass-text {
        gap: 12px !important;
        flex-direction: column !important;
    }
    .event-register-btn {
        padding: 0.6em 1em !important;
        font-size: 0.9rem !important;
        margin: 0 auto 0 !important;
        align-self: center !important;
    }
    /* Remove the apparent "top margin" caused by parent flex gap above the register button */
    .event-details-flex > .event-register-btn {
        margin-top: -10px !important; /* cancels .event-details-flex { gap: 10px } */
    }
    .event-organiser {
        position: relative !important;
        margin: 1em 0 0 !important;
        text-align: center !important;
        align-self: center !important;
    }

    /* Ensure full image is visible within a fixed-height area */
    .event-poster-img-wrapper {
        width: auto !important;           /* shrink to image width */
        max-width: 100% !important;       /* but never overflow the container */
        height: 200px !important;         /* fixed display area height */
        display: inline-block !important; /* allow shrink-to-fit */
        position: relative !important;
        overflow: hidden !important;
        align-self: center !important;    /* center within the column layout */
    }
    .event-poster-img-wrapper .event-poster-img,
    .event-poster-img {
        width: auto !important;           /* let width follow aspect ratio */
        max-width: 100% !important;       /* but respect container width */
        height: 100% !important;          /* fit the 200px area height */
        object-fit: contain !important;   /* show full image without cropping */
        object-position: center center !important;
        display: block !important;
    }
    .event-organiser .liquidGlass-text {
        text-align: center !important;
    }

    .placeholder-message {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100%;
        width: 100%;
        padding: 2rem;
        color: #718096;
        font-size: 1.1rem;
        font-weight: 500;
        background: none;
        border-radius: 8px;
        text-align: center;
        box-sizing: border-box;
    }

    /* Gallery Modal */
    .gallery-modal {
        padding: 80px 10px !important;
    }

    .gallery-modal-content {
        max-width: 100%;
        margin: 0;
    }

    .gallery-modal-title {
        font-size: 1.5rem !important;
        padding: 16px;
        margin: 0;
        box-sizing: border-box;
        line-height: 1.3;
        display: block;
        width: 100%;
    }

    .gallery-modal-main-row {
        flex-direction: column;
        padding: 16px 16px 0 16px !important;
    }

    .gallery-modal-left {
        width: 100% !important;
        height: 60% !important;
        flex-direction: column !important;
        margin-bottom: 0 !important;
    }
    .gallery-modal-thumbnails {
        width: 100% !important;
        height: 60px !important;
        min-height: 60px !important;
        flex-direction: row !important;
        justify-content: flex-start !important; /* prevent centering that can crop ends */
        gap: 8px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
        align-items: center !important;
        flex-shrink: 0 !important;
        padding-right: 0 !important;
    }
    /* Show and style native horizontal scrollbar for thumbnails on mobile */
    .gallery-modal-thumbnails {
        scrollbar-width: thin !important; /* Firefox */
        -ms-overflow-style: auto !important; /* IE/Edge */
    }
    .gallery-modal-thumbnails::-webkit-scrollbar { height: 6px !important; }
    .gallery-modal-thumbnails::-webkit-scrollbar-track { background: rgba(0,0,0,0.06) !important; border-radius: 3px !important; }
    .gallery-modal-thumbnails::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.35) !important; border-radius: 3px !important; }
    /* Hide the vertical custom scrollbar when thumbnails are horizontal on mobile */
    .gallery-modal-thumbnails-scrollbar { display: none !important; }
    /* Now fully hide the thumbnails row on mobile (we use a carousel with dots) */
    .gallery-modal-thumbnails,
    #modal-thumbnails {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    .gallery-modal-thumbnail {
        width: 60px !important;
        height: 60px !important;
        flex-shrink: 0 !important;
        object-fit: cover !important;
        border-radius: 4px !important;
        filter: brightness(0.7) !important;
        transition: filter 0.2s ease !important;
        background: none !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    
    .gallery-modal-thumbnail.selected,
    .gallery-modal-thumbnail.active,
    .gallery-modal-thumbnail:active,
    .gallery-modal-thumbnail[aria-selected="true"] {
        filter: brightness(1) !important;
        outline: none !important;
        box-shadow: none !important;
        background: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .gallery-modal-thumbnail:focus,
    .gallery-modal-thumbnail:focus-visible,
    .gallery-modal-thumbnail:focus-within {
        border: none !important;
        box-shadow: none !important;
        background: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    .gallery-modal-image {
        width: 100% !important;
        height: auto !important;
        max-height: 40vh !important;
        order: 2 !important;
    }
    /* Carousel styles for mobile modal */
    .gallery-modal-image.has-carousel { display: flex !important; flex-direction: column !important; gap: 8px !important; }
    .gallery-modal-carousel { display: flex !important; overflow-x: auto !important; scroll-snap-type: x mandatory !important; -webkit-overflow-scrolling: touch !important; gap: 0 !important; }
    .gallery-modal-carousel::-webkit-scrollbar { height: 6px !important; }
    .gallery-modal-carousel .carousel-slide { flex: 0 0 100% !important; width: 100% !important; scroll-snap-align: center !important; display: flex !important; align-items: center !important; justify-content: center !important; }
    .carousel-dots { display: flex !important; gap: 6px !important; align-items: center !important; justify-content: center !important; padding-bottom: 4px !important; }
    .carousel-dots .dot {
        width: 8px !important;
        height: 8px !important;
        border-radius: 50% !important;
        background: rgba(0,0,0,0.35) !important;
        border: 0 !important;
        padding: 0 !important;
        transform: scaleX(1) !important;
        transform-origin: center !important;
        transition: transform 160ms ease, background-color 160ms ease !important;
    }
    .carousel-dots .dot.active {
        background: rgba(0,0,0,0.7) !important;
        transform: scale(1.3) !important; /* expand a bit horizontally and vertically */
    }
    @media (prefers-reduced-motion: reduce) {
        .carousel-dots .dot { transition: none !important; }
    }
    .gallery-modal-text {
        width: 100% !important;
        height: 40% !important;
        padding: 0 !important;
        order: 3 !important;
    }
    .gallery-modal-description {
        padding-right: 1rem;
    }

    .gallery-modal-header-box {
        padding-top: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* Modal Scroll Prevention */
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        touch-action: none !important;
    }

    /* Ensure modal content can still scroll internally */
    .gallery-modal.modal-open {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Touch / Accessibility */
    .nav-button,
    .gallery-card,
    .sort-btn,
    .event-dropdown-box summary { min-height: 44px; }
    input,
    select,
    textarea { font-size: 16px; }
    .nav-button,
    .gallery-card,
    .sort-btn,
    .event-register-btn { -webkit-tap-highlight-color: rgba(118,150,102,0.3); }
}
