/* mobile-map-view.css — Family Atlas iPhone surface.
 *
 * Train: harnessing-iphone-flotilla S6 (2026-05-08).
 * Mock:  tools/mobile-pilot/outputs/mobile_p0_10_map_view_2026-05-08.html (LOCKED).
 *
 * Substrate matches S3/S5 modal palette (#0a2e2e). Pin amber (#e8a040) +
 * subtle vector strokes (rivers + state lines) come from the MapLibre
 * vector style, not from this stylesheet.
 *
 * z-index: overlay rides at 11700 — above tab-bar (11000), above import
 * media toast (11200), but below drawer (12000) and below UMI (which uses
 * its own modal stack and freezes the map per UMI Heart Principle).
 */

.mmv-overlay {
    position: fixed;
    inset: 0;
    z-index: 11700;
    background: #0a2e2e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.mmv-search {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 46, 46, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(232, 160, 64, 0.32);
    border-radius: 12px;
    padding: 10px 12px;
    color: #f4ead4;
}

.mmv-search-ico {
    width: 18px;
    height: 18px;
    color: rgba(232, 160, 64, 0.9);
    flex: 0 0 auto;
}

.mmv-search-input {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    outline: none;
    color: #f4ead4;
    font: 500 16px/1.3 -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 2px 0;
}

.mmv-search-input::placeholder {
    color: rgba(244, 234, 212, 0.55);
}

.mmv-search-clear {
    background: transparent;
    border: 0;
    color: rgba(244, 234, 212, 0.7);
    font-size: 22px;
    line-height: 1;
    padding: 0 6px;
    min-width: 28px;
    min-height: 28px;
    cursor: pointer;
}

.mmv-map {
    position: absolute;
    inset: 0;
    /* Below the search bar, above nothing else */
    z-index: 1;
}

.mmv-map .maplibregl-ctrl-bottom-left,
.mmv-map .maplibregl-ctrl-bottom-right {
    /* Reposition attribution above the contextual TabBar (~88px tall) +
       collapsed sheet handle so it doesn't get covered. */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 152px);
}

.mmv-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 46, 46, 0.88);
    color: #f4ead4;
    border: 1px solid rgba(232, 160, 64, 0.42);
    border-radius: 10px;
    padding: 10px 18px;
    font: 500 14px/1.3 -apple-system, BlinkMacSystemFont, sans-serif;
    z-index: 5;
}

.mmv-trunc-banner {
    position: absolute;
    top: calc(max(12px, env(safe-area-inset-top)) + 56px);
    left: 12px;
    right: 12px;
    z-index: 5;
    background: rgba(232, 160, 64, 0.22);
    border: 1px solid rgba(232, 160, 64, 0.55);
    color: #f4ead4;
    border-radius: 10px;
    padding: 8px 12px;
    font: 500 13px/1.3 -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: center;
}

/* ── Ambient Fergi's answer line (truly-ambient-fergiai S3, W3.1) ──
   The Atlas's search box IS the room's ambient control, so the room owes the
   member a visible answer to what it did — law 6, visible causality. It sits
   directly under the truncation banner and shares its geometry so the two can
   never occupy the same strip. */

.mmv-ambient-note {
    position: absolute;
    top: calc(max(12px, env(safe-area-inset-top)) + 100px);
    left: 12px;
    right: 12px;
    z-index: 5;
    background: rgba(10, 46, 46, 0.88);
    border: 1px solid rgba(232, 160, 64, 0.42);
    color: #f4ead4;
    border-radius: 10px;
    padding: 8px 12px;
    font: 500 13px/1.35 -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: center;
}

.mmv-ambient-note[hidden] { display: none; }
.mmv-ambient-note.mmv-note-busy { opacity: 0.8; }
.mmv-ambient-note.mmv-note-warn { border-color: rgba(232, 120, 64, 0.75); }

/* ── Bottom sheet (locations list) ── */

.mmv-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)); /* sit above TabBar */
    z-index: 3;
    background: rgba(10, 46, 46, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(232, 160, 64, 0.4);
    border-radius: 16px 16px 0 0;
    transition: max-height 0.28s ease-out;
    color: #f4ead4;
    max-height: 116px;
    overflow: hidden;
}

.mmv-sheet[data-state="expanded"] {
    max-height: 56vh;
    overflow-y: auto;
}

.mmv-sheet.mmv-frozen {
    pointer-events: none;
    opacity: 0.4;
}

.mmv-sheet-handle {
    width: 44px;
    height: 4px;
    background: rgba(244, 234, 212, 0.45);
    border-radius: 2px;
    margin: 8px auto 6px;
    cursor: grab;
}

.mmv-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px 8px;
    gap: 12px;
}

.mmv-sheet-title {
    font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, sans-serif;
    color: #f4ead4;
}

.mmv-sheet-sort {
    display: flex;
    gap: 4px;
}

.mmv-sort-btn {
    background: transparent;
    border: 1px solid rgba(232, 160, 64, 0.42);
    color: rgba(244, 234, 212, 0.85);
    border-radius: 12px;
    padding: 4px 10px;
    font: 500 12px/1.3 -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
}

.mmv-sort-btn[aria-pressed="true"] {
    background: rgba(232, 160, 64, 0.32);
    color: #f4ead4;
    border-color: rgba(232, 160, 64, 0.85);
}

.mmv-sheet-body {
    padding: 0 16px 16px;
}

.mmv-sheet-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(244, 234, 212, 0.08);
    cursor: pointer;
}

.mmv-sheet-row:last-child { border-bottom: 0; }

.mmv-sheet-row-name {
    font: 500 14px/1.3 -apple-system, BlinkMacSystemFont, sans-serif;
    color: #f4ead4;
    margin-bottom: 4px;
}

.mmv-sheet-row-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mmv-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(232, 160, 64, 0.22);
    color: #f4ead4;
    font: 500 11px/1.4 -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.02em;
}

.mmv-pill-date {
    background: rgba(109, 212, 212, 0.18);
}

.mmv-sheet-empty {
    padding: 18px 0;
    text-align: center;
    color: rgba(244, 234, 212, 0.6);
    font: 500 13px/1.4 -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── State 6 contextual TabBar additions ── */

.ctxbar-filter-chip.ctxbar-filter-active {
    background: rgba(232, 160, 64, 0.32);
    border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .mmv-sheet { transition: none; }
}
