/* ═══════════════════════════════════════════════════════════════
   Category Card Explosion System v2 — Global Landing Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Z-Index Scale (shared with community.css and index.html) ── */

/* --- Landing Section --- */
.jm-category-landing {
    padding: 3rem 0 4rem;
}

.jm-landing-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.jm-landing-header h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #e8e8f0;
    margin-bottom: 0.5rem;
}

.jm-landing-subtitle {
    font-size: 1.1rem;
    color: #8888a0;
    font-weight: 400;
}

/* --- Category Card Grid (2-col, first card spans full width) --- */
.jm-cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    perspective: 1200px;
}

@media (max-width: 768px) {
    .jm-cat-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* --- Category Card --- */
.jm-cat-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 10;
    transform-style: preserve-3d;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.06);
}

.jm-cat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 60px rgba(231, 76, 111, 0.25);
}

.jm-cat-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.jm-cat-card:hover .jm-cat-card-bg {
    transform: scale(1.08);
}

.jm-cat-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.15) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem 1.8rem;
}

.jm-cat-card-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
}

.jm-cat-card-count {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-top: 0.3rem;
}

.jm-cat-card-count span {
    color: #f7931e;
    font-weight: 700;
    font-size: 1.1rem;
}

.jm-cat-card-tagline {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    margin-top: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Expanded Overlay --- */
.jm-expanded-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg, #0a0a12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.jm-expanded-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.jm-expanded-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 10, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 1rem 2rem;
}

.jm-expanded-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.jm-expanded-title-row > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.jm-expanded-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #e8e8f0;
}

.jm-exp-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 8px 18px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.jm-exp-back-btn:hover {
    background: rgba(231, 76, 111, 0.2);
    border-color: #e74c6f;
    color: #fff;
}

/* --- Sort controls row --- */
.jm-exp-sort-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
    padding-bottom: 0.3rem;
}

.jm-exp-sort-label {
    font-size: 0.72rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 0.2rem;
}

.jm-exp-sort-btn {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #777;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.jm-exp-sort-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #bbb;
}

.jm-exp-sort-btn.active {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e8e8f0;
}

/* --- Premium unlock overlay --- */
.jm-exp-unlock-overlay {
    grid-column: 1 / -1;
    -webkit-column-span: all;
    column-span: all;
    break-inside: avoid;
    position: relative;
    z-index: 5;
    margin: 0.5rem 0;
}

.jm-exp-unlock-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(231,76,111,0.12) 0%, rgba(108,92,231,0.12) 100%);
    border: 1px solid rgba(231,76,111,0.25);
    backdrop-filter: blur(10px);
}

.jm-exp-unlock-icon {
    color: #e74c6f;
    flex-shrink: 0;
}

.jm-exp-unlock-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.jm-exp-unlock-text strong {
    font-size: 1rem;
    color: #e8e8f0;
}

.jm-exp-unlock-text span {
    font-size: 0.82rem;
    color: #888;
}

.jm-exp-unlock-btn {
    padding: 10px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e74c6f, #f7931e);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.jm-exp-unlock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231,76,111,0.4);
}

@media (max-width: 768px) {
    .jm-exp-unlock-inner {
        flex-direction: column;
        text-align: center;
        padding: 1.2rem;
        gap: 0.8rem;
    }
    .jm-exp-sort-row {
        flex-wrap: wrap;
    }
}

/* --- Sub-filter pills (neighborhoods) --- */
.jm-expanded-sub-filters {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.3rem;
}

.jm-expanded-sub-filters::-webkit-scrollbar {
    display: none;
}

.jm-sub-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.jm-sub-pill:hover,
.jm-sub-pill.active {
    background: linear-gradient(135deg, #e74c6f, #f7931e);
    border-color: transparent;
    color: #fff;
}

/* --- View switcher --- */
.jm-exp-view-switcher {
    display: flex;
    gap: 0.4rem;
}

.jm-exp-view-btn {
    width: 34px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    transition: all 0.2s;
    padding: 0;
}

.jm-exp-view-btn svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.jm-exp-view-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #ccc;
}

.jm-exp-view-btn.active {
    background: linear-gradient(135deg, #e74c6f, #f7931e);
    border-color: transparent;
    color: #fff;
}

/* --- Expanded grid --- */
.jm-expanded-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    padding: 1.5rem 2rem 3rem;
    align-items: stretch;
}

.jm-exp-place-card {
    display: flex !important;
    flex-direction: column;
    width: auto;
    margin-bottom: 0;
}
/* Equal-height rows: stretch every card to its row's tallest (overrides the
   older align-self:start in community.css). Short cards get blank space below. */
.jm-expanded-grid .jm-exp-place-card { align-self: stretch !important; }

@media (max-width: 768px) {
    .jm-expanded-header { padding: 0.8rem 1rem; }
    .jm-expanded-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    .jm-expanded-title { font-size: 1.2rem; }
    .jm-category-landing { padding: 2rem 0 3rem; }
    .jm-landing-header { margin-bottom: 1.5rem; }
}

/* --- Place cards in expanded view --- */
.jm-exp-place-card {
    border-radius: 16px !important;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}

.jm-exp-place-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* --- Explosion particles --- */
.jm-explosion-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
}

/* --- Hide sections when category mode is active --- */
body.jm-category-mode .neighborhood {
    display: none !important;
}

body.jm-category-mode .sticky-nav-wrapper {
    display: none !important;
}

body.jm-category-mode .mobile-menu,
body.jm-category-mode .mobile-menu-overlay {
    display: none !important;
}

body.jm-category-mode #noResults {
    display: none !important;
}

/* --- Ensure export bar shows ABOVE the expanded overlay --- */
.export-bar {
    z-index: var(--z-lightbox);
}

/* --- List view for expanded grid --- */
.jm-expanded-grid.jm-exp-list-view {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin: 0 auto;
}

.jm-exp-list-view .jm-exp-place-card {
    display: grid;
    grid-template-columns: 260px 1fr;
}

.jm-exp-list-view .jm-exp-place-card .carousel {
    height: 100%;
}

.jm-exp-list-view .jm-exp-place-card .carousel-img {
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .jm-exp-list-view .jm-exp-place-card {
        grid-template-columns: 1fr;
    }
}

/* On mobile, the Budget / Community Guides / View Trip pills live in the
   hamburger drawer — so hide them from the overlay tools bar to give the
   3/5 column toggle proper breathing room and a cleaner mobile header. */
@media (max-width: 768px) {
    .jm-exp-tools-bar .jm-budget-btn,
    .jm-exp-tools-bar .jm-community-btn,
    .jm-exp-tools-bar .jm-trip-exp-btn {
        display: none !important;
    }
}

/* Mobile-only hamburger menu trigger inside the category overlay.
   Prepended to .jm-expanded-title-row so it sits at the FAR LEFT of the header. */
.jm-exp-mobile-menu-btn {
    background: transparent;
    border: none;
    color: #e8e8f0;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}
.jm-exp-mobile-menu-btn:hover { background: rgba(255,255,255,0.05); }

/* Column-count toggle (3 / 5) inside the overlay tools bar.
   Default is 3 columns from the existing .jm-expanded-grid { columns: 3 } rule.
   Selecting 5 promotes the grid to 5 columns via .jm-grid-5-cols modifier. */
.jm-grid-cols-toggle {
    display: inline-flex;
    gap: 2px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 3px;
    flex-shrink: 0;
}
.jm-grid-cols-btn {
    background: none;
    border: none;
    color: #888;
    min-width: 32px;
    height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.jm-grid-cols-btn svg { display: block; }
.jm-grid-cols-btn:hover { color: #fff; }
.jm-grid-cols-btn.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.jm-expanded-grid.jm-grid-5-cols { grid-template-columns: repeat(5, 1fr) !important; }

/* 5-up gallery view: strip noise so cards stay compact and scan-able.
   Hide Google Maps / Find Tours / Comments buttons, description prose,
   tag chips (English OK, Escape Rooms, etc.) and metadata badges except
   the rating. Image + title + rating is enough at gallery density. */
.jm-grid-5-cols .jm-exp-place-card .cat,
.jm-grid-5-cols .jm-exp-place-card .meta,
.jm-grid-5-cols .jm-exp-place-card .links,
.jm-grid-5-cols .jm-exp-place-card .badge-reviews,
.jm-grid-5-cols .jm-exp-place-card .badge-price,
.jm-grid-5-cols .jm-exp-place-card .badge-hours,
.jm-grid-5-cols .jm-exp-place-card .badge-website {
    display: none !important;
}
.jm-grid-5-cols .jm-exp-place-card .body {
    padding: 0.55rem 0.7rem 0.7rem !important;
}
.jm-grid-5-cols .jm-exp-place-card .body h3 {
    font-size: 0.88rem !important;
    line-height: 1.2 !important;
    margin: 0.3rem 0 0.1rem !important;
}
.jm-grid-5-cols .jm-exp-place-card .card-info {
    margin: 0 !important;
    gap: 0.3rem !important;
}
.jm-grid-5-cols .jm-exp-place-card .badge-rating {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
}
.jm-grid-5-cols .jm-exp-place-card .carousel {
    height: 140px !important;
    min-height: 140px !important;
}
.jm-grid-5-cols .jm-exp-place-card .carousel img,
.jm-grid-5-cols .jm-exp-place-card .carousel .carousel-img {
    height: 140px !important;
    max-height: 140px !important;
    object-fit: cover !important;
}
.jm-grid-5-cols .jm-exp-place-card .body > p {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    margin: 0.3rem 0 0 !important;
    color: #b0b0c8 !important;
}

@media (max-width: 1200px) {
    .jm-expanded-grid.jm-grid-5-cols { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (max-width: 900px) {
    .jm-expanded-grid.jm-grid-5-cols { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 768px) {
    .jm-expanded-grid.jm-grid-5-cols { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Search results counter ("5 results · 12 in Premium") */
.jm-exp-search-count {
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Locked preview cards — premium matches shown blurred during search.
   Wrap pattern: blurred card inner + crisp lock overlay sibling. */
.jm-locked-preview-wrap {
    position: relative;
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    isolation: isolate;
}
.jm-locked-preview-wrap .jm-locked-preview-inner {
    filter: blur(6px) brightness(0.7);
    pointer-events: none;
    margin: 0 !important;
    width: 100% !important;
    transition: filter 0.2s ease;
}
.jm-locked-preview-wrap:hover .jm-locked-preview-inner {
    filter: blur(4px) brightness(0.85);
}
.jm-locked-preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: rgba(0,0,0,0.28);
    z-index: 5;
    color: #fff;
    pointer-events: none;
    border-radius: 16px;
}
.jm-locked-preview-overlay svg { color: #fff; }
.jm-locked-preview-overlay span {
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    background: linear-gradient(135deg, #ffd166, #f6a821);
    color: #000;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Search-active layout: switch from multi-column (which stacks 2 results
   vertically in column 1) to flex-wrap so few matches sit side-by-side. */
.jm-expanded-grid.jm-search-active {
    columns: unset !important;
    display: flex !important;
    flex-wrap: wrap;
    gap: 1.2rem !important;
    column-gap: 1.2rem !important;
    row-gap: 1.2rem !important;
}
.jm-expanded-grid.jm-search-active .jm-exp-place-card:not(.jm-locked-preview-inner),
.jm-expanded-grid.jm-search-active .jm-locked-preview-wrap {
    width: calc((100% - 2.4rem) / 3) !important;
    margin: 0 !important;
    break-inside: auto;
    flex-shrink: 0;
}
.jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-exp-place-card:not(.jm-locked-preview-inner),
.jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-locked-preview-wrap {
    width: calc((100% - 4 * 1.2rem) / 5) !important;
}
.jm-expanded-grid.jm-search-active .jm-exp-unlock-overlay {
    width: 100%;
    flex-basis: 100%;
}
@media (max-width: 900px) {
    .jm-expanded-grid.jm-search-active .jm-exp-place-card:not(.jm-locked-preview-inner),
    .jm-expanded-grid.jm-search-active .jm-locked-preview-wrap,
    .jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-exp-place-card:not(.jm-locked-preview-inner),
    .jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-locked-preview-wrap {
        width: calc((100% - 1.2rem) / 2) !important;
    }
}
@media (max-width: 540px) {
    .jm-expanded-grid.jm-search-active .jm-exp-place-card:not(.jm-locked-preview-inner),
    .jm-expanded-grid.jm-search-active .jm-locked-preview-wrap,
    .jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-exp-place-card:not(.jm-locked-preview-inner),
    .jm-expanded-grid.jm-search-active.jm-grid-5-cols .jm-locked-preview-wrap {
        width: 100% !important;
    }
}

/* search-explode: in category mode the old card sections + inline search indicator
   stay hidden no matter what the per-guide live filter sets (search opens the
   exploded all-categories overlay on Enter instead). */
body.jm-category-mode .neighborhood{display:none!important}
body.jm-category-mode #searchIndicator,body.jm-category-mode #noResults{display:none!important}
