/* ================================================================
   FriendsByChance — components/popover.css
   FBC.ui.Popover — anchored overlay (.fbc-popover namespace).
   Positioned by JS (position: fixed, appended to body).
   ================================================================ */

/* `spanEl`: over an element, its whole width — as tall as there is room
   for, scrolling past that (The Map's People cards, over the left pane). */
.fbc-popover.fbc-popover--span {
    max-width:  none;
    overflow-y: auto;
    padding:    12px 14px;
}
.fbc-popover {
    position:      fixed;
    z-index:       420;          /* above panes (20) and notif overlay (400),
                                    below modals (tle-overlay 300 is page-level,
                                    tlp/confirm 700 stay on top on purpose)   */
    background:    var(--color-surface);
    border:        1px solid var(--color-divider);
    border-radius: 8px;
    box-shadow:    0 6px 24px rgba(0, 0, 0, 0.18);
    padding:       11px 13px 10px;
    max-width:     min(320px, calc(100vw - 16px));
    display:       flex;
    flex-direction: column;
    gap:           7px;
}

/* ── THE CARD (FBC.ui.Popover.card): what a chip pressed shows ──────
   Its head — the chip, a face and name — with its square buttons on the
   same line, at its right end (the user, 2026-11-02); its blocks below. */

.fbc-popover-head {
    display:     flex;
    align-items: center;
    gap:         8px;
    min-width:   0;
}
.fbc-popover-head > :first-child { flex: 0 1 auto; min-width: 0; }

/* The chip inside a popover may wrap — it is not in a tight row here. */
.fbc-popover-head .tl-chip {
    max-width:   100%;
    white-space: normal;
    overflow:    visible;
}

/* The buttons: THE side column (.fbc-side-col) laid out as a row, pushed
   to the head's right end; top-aligned, so a chip that wraps grows down
   beside them, not round them.  Both classes: shared.css may load after. */
.fbc-side-col.fbc-popover-head-actions {
    flex-direction: row;
    gap:            6px;
    padding-top:    0;
    margin-left:    auto;
    padding-left:   10px;
    flex:           none;
    align-self:     flex-start;
}

/* The blocks are children of this wrapper, not of .fbc-popover — the
   popover holds a single element and could not space them itself. */
.fbc-popover-body {
    display:        flex;
    flex-direction: column;
    gap:            7px;
    min-width:      0;
}

/* ── The blocks below the chip ───────────────────────────────────
   Each block is a separate answer — when this is, what it says — so each
   gets a rule above it and clear air on both
   sides.  In an overlay this small, blocks butted together read as one
   smudge of text.

   The space ABOVE a block is its own padding-top; the space BELOW comes
   from .fbc-popover-body's flex `gap`, so the two never have to be kept
   in step by hand and no block needs a bottom margin of its own. */
.fbc-popover-meta,
.fbc-popover-desc {
    border-top:  1px solid var(--color-divider);
    padding-top: 10px;
    margin-top:  3px;
}

/* One fact per line — a date, then each recurrence window.  Stacked, not
   wrapped inline: these are separate statements, not a list of tags. */
.fbc-popover-meta {
    display:        flex;
    flex-direction: column;
    align-items:    flex-start;
    gap:            6px;
}

.fbc-popover-summary {
    font-size:   0.8rem;
    line-height: 1.5;
    color:       var(--color-text-secondary);
}

.fbc-popover-desc {
    font-size:     0.84rem;
    line-height:   1.55;
    color:         var(--color-text-secondary);
    white-space:   pre-wrap;
    overflow-wrap: anywhere;
    max-height:    12em;
    overflow-y:    auto;
}

/* ── Tooltip variant ─────────────────────────────────────────────
   Used by FBC.ui.iconBtn's long-press tooltip: same anchored shell,
   but compact and non-interactive. */
.fbc-popover.fbc-tooltip {
    padding:       6px 10px;
    max-width:     min(240px, calc(100vw - 24px));
    font-size:     0.82rem;
    line-height:   1.35;
    color:         var(--color-text);
    pointer-events: none;
}

/* ── A menu (FBC.ui.Popover.menu): one thing to do per line ──────── */
.fbc-menu { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.fbc-menu-item {
    display:       flex;
    align-items:   center;
    gap:           8px;
    background:    none;
    border:        none;
    border-radius: 6px;
    padding:       8px 10px;
    cursor:        pointer;
    font:          inherit;
    font-size:     0.88rem;
    color:         var(--color-text);
    text-align:    left;
}
.fbc-menu-item:hover:not(:disabled) { background: var(--color-hover); }
.fbc-menu-item:disabled { opacity: 0.5; cursor: default; }
/* Between two groups of a menu ({ gap: true }): air, not a rule. */
.fbc-menu-gap { height: 8px; flex: none; }

/* `icons` (Popover.menu): one row of square buttons, air between groups;
   the green line under it unfolds them as rows, with their words. */
.fbc-menu--icons { min-width: 0; gap: 0; }
.fbc-menu-icons { display: flex; align-items: center; gap: 4px; }
.fbc-menu-icons-gap { width: 10px; flex: none; }
/* `slots`: always the same slots — each group's buttons, a narrow column
   of air after it (the columns: Popover.menu) — so the menu keeps one
   width, folded or unfolded: its rows, under it, never widen it (they take
   its width, not give it). */
.fbc-menu-icons--slots {
    display:      grid;
    column-gap:   4px;
    margin-right: -14px;      /* the last column of air is no part of its width */
}
.fbc-menu--icons:has(.fbc-menu-icons--slots) .fbc-menu-rows { width: 0; min-width: 100%; }
.fbc-menu--icons > .fbc-fold-rule { margin: 14px 0 8px; }
.fbc-menu-rows { display: flex; flex-direction: column; gap: 2px; }
.fbc-menu-rows:empty { display: none; }
.fbc-menu-item svg { color: var(--color-primary); flex-shrink: 0; }

/* One of a set of choices (Popover.menu `checked`): the one in force. */
.fbc-menu-item[aria-checked="true"] {
    font-weight: 700;
    background:  var(--color-selected);
}
