/*
 * people.css — styling for the People index list panel. BASELINE-loaded (see
 * Assets::VIEW_CSS) so it also styles the list when swapped in as an htmx fragment.
 * The shared rail paint (head, search, white touching rows, the open row) is base.css's
 * .rail-head / .rail-search / .rail-row; this file is the People rail's own shape.
 *
 * The panel is a flex COLUMN filling the right rail: the search box is pinned at the
 * top (flex-shrink:0) and only the results region scrolls (flex-grow:1 overflow-y:auto).
 * Paging is htmx infinite scroll (a revealed-trigger sentinel) — no Next/Prev pager.
 */

/* List-specific font tokens that DEFAULT to the site-wide ones, so the People list's font can be
   tuned later WITHOUT disturbing the global default. */
.people-panel {
    /* (the list's font tokens are base.css :root's, Dark mode 1) */

    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;          /* let the results child shrink and scroll */
    font-family: var(--foliale-people-font-family);
    font-size: var(--foliale-people-font-size);
}

/* Use our OWN clear button, not the browser's focus-only native one. */
.people-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

/* Show the clear button only when the input has a value (a filter is in place),
   regardless of focus. An empty input matches :placeholder-shown (it has a
   placeholder), so the following-sibling clear button is hidden then. */
.people-search .form-control:placeholder-shown ~ .people-clear {
    display: none;
}

.people-results {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;       /* only the list scrolls, beneath the fixed search */
}

.people-list {
    margin: 0;
}

/* Surname GROUP HEADING (people-rows.php) — .fo-heading (base.css) on a WHITE BAND the full row width, with the
   same surface hairline below it as between rows, so a group reads as one white block with its heading on top;
   10px of the surface grey above each block. Ellipsed when long. */
.people-group {
    margin-top: 10px;
    padding: 0.3rem 0.5rem 0.2rem;
    background: var(--foliale-band);
    border-bottom: 1px solid var(--foliale-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.people-list > .people-group:first-child {
    margin-top: 0;
}

/* A person ROW (.rail-row: white, touching, the hairline between rows): a 4px STRIP on the left in the
   gender colour — never a fill (DECISIONS Day 33). Every row carries one modifier; unknown (and a living
   person hidden from this account) takes the unknown grey. */
.people-row {
    display: flex;
    align-items: center;
    border-left: 4px solid var(--foliale-unknown);
    padding: 0.15rem 0.5rem 0.15rem 0.35rem;
}
.people-row--female {
    border-left-color: var(--foliale-female);
}
.people-row--male {
    border-left-color: var(--foliale-male);
}
.people-row--unknown {
    border-left-color: var(--foliale-unknown);
}

/* The row's link is the flex TRACK of FIXED SLOTS, so the columns align down the rail:
     rings (14px) | given names (flex, truncates) | house (15px) | dates (fixed, right) | ID (fixed, right)
   min-width:0 is what actually lets the name shrink below its content width. */
.people-row a {
    text-decoration: none;
    color: inherit;        /* the row is clickable, but must NOT read as blue link text */
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* The partner-rings slot: two overlapping circles for a partner; EMPTY otherwise (the slot keeps its width). */
.people-rings {
    flex: 0 0 14px;
    width: 14px;
    display: inline-flex;
    align-items: center;
    color: var(--foliale-muted);
}

/* THE TRUNCATING COLUMN. Everything to its right is protected (flex:0 0 auto), so a long
   name ellipses while the dates + I-number stay fully visible — they are what you scan for.
   people.js attaches the Bootstrap tooltip ONLY when this span is actually truncated. */
.people-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--foliale-text);
}
.people-row.is-open .people-name {
    font-weight: 500;
}

/* The default-person slot: the green house when this is the default person; empty otherwise. */
.people-house {
    flex: 0 0 15px;
    width: 15px;
    text-align: center;
}
.people-home {
    color: var(--foliale-home);
}

/* Never cut, right-aligned in fixed widths: the identifying facts. */
.people-dates {
    flex: 0 0 5.5rem;
    width: 5.5rem;
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
    color: var(--foliale-muted);
}
.people-id {
    flex: 0 0 2.75rem;
    width: 2.75rem;
    text-align: right;
    white-space: nowrap;
    font-size: 11px;
    color: var(--foliale-faint);
    font-variant-numeric: tabular-nums;
}

/* Status icon: two overlapping circles = partnered (the rail's rings slot; the relationship modal's married
   symbol), one circle = single (the relationship modal). Circles absolutely positioned in a small
   fixed-width box. */
.status-icon {
    position: relative;
    display: inline-block;
    width: 0.85em;   /* box scaled to the smaller 0.50em circles */
    height: 1em;
    flex: 0 0 auto;
    vertical-align: middle;
}

.status-icon .bi {
    position: absolute;
    top: 50%;                          /* centre each circle vertically in the box */
    transform: translateY(-50%);
    font-size: 0.50em;                 /* smaller circles (Roger's original value) */
    line-height: 1;
}

.status-icon--single .bi {
    left: 0.3em;                       /* ~centred single circle in the box */
}

.status-icon--partnered .bi:nth-child(1) {
    left: 0;
}

.status-icon--partnered .bi:nth-child(2) {
    left: 0.65em;   /* offset (in circle-em) keeps a proportional overlap at 0.50em */
}

/* Infinite-scroll sentinel: a small, centred row at the list's end. Its "Loading…"
   label is shown ONLY while the next batch is being fetched — htmx adds .htmx-request
   to the sentinel during the request — so it never sits as a misleading permanent
   label when idle (which read as a "stall"). */
.people-more {
    list-style: none;
    padding: 0.5rem 0;
    text-align: center;
}

.people-more-label {
    display: none;
}

.people-more.htmx-request .people-more-label {
    display: inline;
}
