/* Duplex as a BANNER, not a modal — King's order, 2026-09-20:
 * "I just want it to flow naturally like a banner that comes up ... so I can
 *  still use my phone while using duplex ... I shouldn't be just stuck with a
 *  full view either."
 *
 * The voice panel itself is untouched. This only changes how it is PRESENTED,
 * so the capture path (pre-roll + VAD) and the audio element never come into
 * it. Three states, and he can move between all of them by swiping:
 *   peek   — a thin pill, out of the way
 *   banner — the default: a slim bar showing listening / thinking / speaking
 *   full   — the original panel, for the volume slider and re-enrol
 */

/* Banner + peek: the overlay stops being a backdrop, so the phone stays usable.
   pointer-events:none on the overlay is what actually frees the screen — the
   bar re-enables them for itself.

   EVERY !important here is load-bearing. #voice-overlay in grasp.html carries
   an INLINE style attribute (position/inset/background/display/padding), and
   inline beats a stylesheet unless we say otherwise. Without these, the banner
   drew correctly but the 85%-black backdrop stayed over the whole screen and
   King's thread was dimmed to unreadable — 2026-09-20, his second report.
   The inline style stays where it is so the plain modal still works if this
   file ever fails to load. */
#voice-overlay.fd-banner-mode,
#voice-overlay.fd-peek-mode {
    position: fixed !important;
    inset: 0 0 auto 0 !important;   /* top strip only */
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
    pointer-events: none !important;
}

#voice-overlay.fd-banner-mode > div,
#voice-overlay.fd-peek-mode > div {
    max-width: none !important;
    width: auto !important;
}

/* The original close button belongs to the full panel. */
#voice-overlay.fd-banner-mode #voice-close,
#voice-overlay.fd-peek-mode #voice-close {
    display: none;
}

/* The way back DOWN from the full panel: a button he can see, not only a swipe
   (King 2026-10-11, "once I open it I can't minimize it"). Mirrors the close
   button's placement on the other corner; gone with it in banner/peek mode. */
#voice-minimize.fd-minimize {
    position: absolute;
    top: -12px;
    left: -12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    font-size: 24px;
    line-height: 32px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
#voice-overlay.fd-banner-mode #voice-minimize,
#voice-overlay.fd-peek-mode #voice-minimize {
    display: none;
}

/* The panel itself is only shown in full mode. */
#voice-overlay.fd-banner-mode #voice-container,
#voice-overlay.fd-peek-mode #voice-container {
    display: none;
}

.fd-banner {
    pointer-events: auto;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 8px;
    background: linear-gradient(180deg, rgba(20, 10, 40, 0.97), rgba(10, 10, 20, 0.95));
    border-bottom: 1px solid rgba(168, 85, 247, 0.35);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    color: #e9e4ff;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    z-index: 10000;
    transform: translateY(0);
    transition: transform 0.22s ease, opacity 0.22s ease;
    touch-action: none;         /* we handle the vertical drag ourselves */
    cursor: grab;
}

/* Swiped up: almost gone, but still reachable — never trapped either way. */
#voice-overlay.fd-peek-mode .fd-banner {
    transform: translateY(calc(-100% + 18px));
    opacity: 0.92;
}

#voice-overlay:not(.fd-banner-mode):not(.fd-peek-mode) .fd-banner {
    display: none;              /* full panel is showing; the bar steps aside */
}

.fd-banner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    flex: 0 0 auto;
    box-shadow: 0 0 10px currentColor;
    animation: fd-banner-pulse 1.6s ease-in-out infinite;
}

@keyframes fd-banner-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* Respect a reduced-motion preference — a pulsing bar pinned to the top of
   the screen is exactly the thing that setting exists for. */
@media (prefers-reduced-motion: reduce) {
    .fd-banner-dot { animation: none; }
    .fd-banner { transition: none; }
}

.fd-banner-state {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
}

.fd-banner-who {
    color: #c4b5fd;
    font-size: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.fd-banner-btn {
    flex: 0 0 auto;
    border: none;
    border-radius: 14px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #e9e4ff;
}

.fd-banner-btn.fd-banner-end {
    background: #ef4444;
    color: #fff;
}

/* The grab handle doubles as the "there's more here" hint. */
.fd-banner-grip {
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.28);
}

/* Her eyes on the bar (2026-09-24): thumbnail of what she sees, only while on */
.fd-banner-eyes-view {
    display: none;
    width: 44px;
    height: 33px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #4ade80;
    background: #000;
    flex: none;
}
.fd-banner-eyes-view.on { display: inline-block; }

/* King 2026-10-12: a minimized call now docks to the side (SideDock), not the top bar.
   fd-docked hides the whole voice overlay while the call keeps running; the side tab restores it. */
#voice-overlay.fd-docked { display: none !important; }
