/* /masjid/: the map is the page, and the list lives in a drawer over it
   (a floating panel on desktop, a bottom sheet you drag up on phones).
   The map floats on the homepage's sky, which follows the time of day. */

.mm-body { overflow: hidden; overscroll-behavior: none; }
:root { --mm-top: 64px; --mm-bottom: 0px; }

.mm-stage {
    --mh-ink: #12362f;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--mm-top);
    bottom: var(--mm-bottom);
    overflow: hidden;
    isolation: isolate;
    background: #eef7fb;
    touch-action: none;
}
.mm-map { position: absolute; inset: 0; z-index: 1; }
.mm-map.mini-map { height: auto; min-height: 0; border-radius: 0; box-shadow: none; background: none; cursor: default; overflow: hidden; }
.mm-map.is-free { cursor: grab; }
.mm-map.is-grabbing { cursor: grabbing; }
/* Phones, while the 3D map loads: the model as a picture, placed exactly where
   the model will draw Ohio (js/map/poster.js), then faded into the model. */
.mm-map.has-poster::before {
    content: '';
    position: absolute;
    inset: 0;
    /* The far land hazes over and fades into the sky, as the model's horizon does. */
    background: linear-gradient(180deg, var(--map-haze) 0%, transparent 58%) 0 0 / 100% 100% no-repeat, url('/assets/map/lite.webp') var(--poster-x) var(--poster-y) / var(--poster-w) auto no-repeat;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%);
    mask-image: linear-gradient(180deg, transparent 0, #000 16%);
    pointer-events: none;
    transition: opacity 900ms ease;
    animation: mm-poster-in 450ms ease backwards;
}
[data-phase="dusk"] > .mm-map.has-poster::before,
[data-phase="night"] > .mm-map.has-poster::before { background-image: linear-gradient(180deg, var(--map-haze) 0%, transparent 58%), url('/assets/map/lite-night.webp'); }
.mm-map.has-poster.is-ready::before { opacity: 0; }
@keyframes mm-poster-in { from { opacity: 0; } }

/* ------------------------------------------------------------ the sky */

.mh-sky, .mh-sky i { position: absolute; inset: 0; }
.mh-sky { z-index: -3; }
.mh-sky i { opacity: 0; transition: opacity 1.6s ease; }
.mh-sky .s0 { background: linear-gradient(180deg, #c3c6ec 0%, #dccfea 38%, #f6d8c9 72%, #fbeee2 100%); }
.mh-sky .s1 { background: linear-gradient(180deg, #86c3ea 0%, #bfe2f5 50%, #eef7fb 100%); }
.mh-sky .s2 { background: linear-gradient(180deg, #edb35e 0%, #f5d59c 45%, #fcefd8 100%); }
.mh-sky .s3 { background: linear-gradient(168deg, #3d2554 0%, #7d3761 36%, #d2665b 68%, #f3ac70 100%); }
.mh-sky .s4 { background: radial-gradient(90% 70% at 72% 8%, #173f37 0%, #0b231f 55%, #061512 100%); }
[data-phase="dawn"] > .mh-sky .s0, [data-phase="day"] > .mh-sky .s1, [data-phase="golden"] > .mh-sky .s2,
[data-phase="dusk"] > .mh-sky .s3, [data-phase="night"] > .mh-sky .s4 { opacity: 1; }
.mh-stars {
    position: absolute;
    inset: 0 0 40% 0;
    z-index: -2;
    opacity: 0;
    transition: opacity 1.6s ease;
    background-image:
        radial-gradient(1.4px 1.4px at 12% 22%, #fff 99%, transparent), radial-gradient(1px 1px at 26% 60%, #fff 99%, transparent),
        radial-gradient(1.2px 1.2px at 38% 14%, #fff 99%, transparent), radial-gradient(1px 1px at 52% 38%, #fff 99%, transparent),
        radial-gradient(1.6px 1.6px at 64% 18%, #fff 99%, transparent), radial-gradient(1px 1px at 78% 46%, #fff 99%, transparent),
        radial-gradient(1.3px 1.3px at 88% 12%, #fff 99%, transparent), radial-gradient(1px 1px at 8% 50%, #fff 99%, transparent),
        radial-gradient(1px 1px at 46% 66%, #fff 99%, transparent), radial-gradient(1.2px 1.2px at 94% 34%, #fff 99%, transparent);
}
[data-phase="night"] > .mh-stars { opacity: 0.85; }
[data-phase="dusk"] > .mh-stars { opacity: 0.35; }
.mh-orb {
    /* No disc: just the light of the sun (or the moon) from where it really is
       in Ohio's sky, a broad soft glow that warms or silvers the air. */
    position: absolute;
    z-index: -2;
    left: var(--orb-x, 70%);
    top: var(--orb-y, 12%);
    width: 150vmax;
    height: 150vmax;
    margin: -75vmax 0 0 -75vmax;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 244, 205, 0.55), rgba(255, 236, 190, 0.22) 38%, rgba(255, 236, 190, 0) 72%);
    pointer-events: none;
    transition: left 2s ease, top 2s ease, opacity 1.6s ease;
}
[data-phase="dawn"] > .mh-orb, [data-phase="golden"] > .mh-orb { background: radial-gradient(closest-side, rgba(255, 206, 140, 0.55), rgba(255, 186, 120, 0.22) 38%, rgba(255, 186, 120, 0) 72%); }
[data-phase="dusk"] > .mh-orb { background: radial-gradient(closest-side, rgba(255, 168, 120, 0.42), rgba(240, 130, 100, 0.16) 38%, rgba(240, 130, 100, 0) 72%); }
[data-phase="night"] > .mh-orb { background: radial-gradient(closest-side, rgba(205, 220, 255, 0.16), rgba(190, 210, 255, 0.06) 40%, rgba(190, 210, 255, 0) 72%); }

/* ------------------------------------------------------------ chips over the map */

.ml-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #12362f;
    font-family: var(--font-display);
    font-weight: 650;
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 24px -14px rgba(18, 54, 47, 0.55);
}
.ml-chip i { color: #e3a340; }
.ml-chip::after { content: none !important; }
.ml-chip[hidden] { display: none; }
.mm-map-chips { position: absolute; z-index: 5; right: 1rem; top: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.mm-full { position: absolute; z-index: 5; right: 1rem; bottom: 1rem; }

/* ------------------------------------------------------------ the drawer */

.mm-drawer {
    position: fixed;
    z-index: 20;
    left: 16px;
    top: calc(var(--mm-top) + 16px);
    bottom: calc(var(--mm-bottom) + 16px);
    width: 430px;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    background: rgba(255, 252, 245, 0.93);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    backdrop-filter: blur(16px) saturate(1.15);
    box-shadow: 0 30px 70px -36px rgba(10, 30, 26, 0.55), 0 0 0 1px rgba(18, 54, 47, 0.08);
    transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease;
    overflow: hidden;
}
.mm-drawer.is-closed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.mm-grab { padding: 1.3rem 1.3rem 0.4rem; flex: 0 0 auto; }
.mm-handle { display: none; }
.mh-eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #b8741a;
}
.mm-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.1rem;
    line-height: 1.04;
    letter-spacing: -0.03em;
    color: #12362f;
    margin: 0 0 0.6rem;
}
.mh-hl {
    background-image: linear-gradient(rgba(227, 163, 64, 0.6), rgba(227, 163, 64, 0.6));
    background-repeat: no-repeat;
    background-position: 0 88%;
    background-size: 0% 0.34em;
    animation: mh-hl 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}
@keyframes mh-hl { to { background-size: 100% 0.34em; } }
.mm-stats { margin: 0; color: #12362f; font-size: 0.9rem; }
.mm-stats *, .mm-stats strong { color: #12362f !important; }
.mm-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.4rem 1.1rem 1.4rem;
    touch-action: pan-y;
    scroll-padding: 1rem;
}
.mm-filter { flex-direction: column; align-items: stretch; gap: 0.6rem; padding: 0.7rem; margin: 0 0 0.2rem; box-shadow: none; border: 1px solid rgba(18, 54, 47, 0.1); }
.mm-filter .search-field { flex: 0 0 auto; width: 100%; }
.mm-filter .form-check { padding-left: 0.2rem; }
.mm-scroll .chip-scroller { margin-left: 0; margin-right: 0; }
.mm-scroll #masjids-grid h2 { font-size: 1.05rem; }
.mm-scroll #masjids-grid section { margin-bottom: 1.6rem !important; }
.mm-tell { margin: 1rem 0 0; }
#masjids-grid .masjid-card { transition: box-shadow 200ms ease, transform 200ms ease; }
#masjids-grid .masjid-card:hover { transform: translateY(-2px); }
#masjids-grid .masjid-card.is-picked { box-shadow: 0 0 0 3px #e3a340, 0 18px 36px -20px rgba(18, 54, 47, 0.5); }

.mm-toggle {
    position: fixed;
    z-index: 21;
    left: calc(16px + 430px + 14px);
    top: calc(var(--mm-top) + 16px);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.85rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #12362f;
    font-family: var(--font-display);
    font-weight: 650;
    font-size: 0.82rem;
    box-shadow: 0 10px 24px -14px rgba(18, 54, 47, 0.55);
    transition: left 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.mm-drawer.is-closed ~ .mm-toggle { left: 16px; }

/* ------------------------------------------------------------ phones: a bottom sheet */

@media (max-width: 991.98px) {
    .mm-drawer {
        left: 0;
        right: 0;
        top: auto;
        bottom: var(--mm-bottom);
        width: auto;
        height: 86vh;
        height: 86svh;
        border-radius: 22px 22px 0 0;
        transition: none;
        box-shadow: 0 -18px 40px -24px rgba(10, 30, 26, 0.45), 0 0 0 1px rgba(18, 54, 47, 0.08);
        will-change: transform;
    }
    .mm-grab { padding: 0.3rem 1.1rem 0.5rem; touch-action: none; cursor: grab; }
    .mm-handle { display: block; width: 100%; padding: 0.5rem 0 0.6rem; border: 0; background: none; }
    .mm-handle span { display: block; width: 42px; height: 5px; margin: 0 auto; border-radius: 5px; background: rgba(18, 54, 47, 0.25); }
    .mh-eyebrow { display: none; }
    .mm-title { font-size: 1.55rem; margin-bottom: 0.3rem; }
    .mm-stats { font-size: 0.82rem; }
    .mm-toggle { display: none; }
    .mm-map-chips { right: 0.6rem; top: 0.6rem; }
    .mm-full { display: none; }
    /* The map takes every touch on it (the page never scrolls or bounces under
       it), and a long press on it selects nothing and opens no callout. */
    .mm-map.mini-map { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
}
/* The page itself never scrolls: only the list in the drawer does. */
html:has(> body.mm-body) { overflow: hidden; overscroll-behavior: none; }

@media (prefers-reduced-motion: reduce) {
    .mm-drawer, .mm-toggle { transition: none; }
    .mm-map.has-poster::before { transition: none; animation: none; }
    .mh-hl { animation: none; background-size: 100% 0.34em; }
}

/* While the map plays the day, the sky keeps pace. */
.mm-stage.is-playing .mh-sky i { transition-duration: 0.8s; }
.mm-stage.is-playing > .mh-orb { transition-duration: 0.3s, 0.3s, 0.8s, 0.8s; }
