/*
 * person.css — the person page (P1a) + the person forms (add spouse / add parents). Baseline-loaded
 * (Assets::VIEW_CSS) so it applies whether a page renders whole or swaps in as a fragment. Colours are
 * --foliale-* / --bs-* variables only.
 */

/* === The person page: the SPINE ===================================================================
   One label column down the left of the main panel, running through every block; every block and
   every row inside it is a labelled row off it (DESIGN-INTENT Day 26). On a narrow screen the label
   sits above its row. */
.person-page {
    max-width: 960px;
}

/* Painting P2: every spine row is a WHITE ROW (base.css .fo-row's look): the 120px label cell on --foliale-label,
   the value beside it, 2px of the surface grey between rows. A row whose label is empty keeps the grey cell, so
   the label column runs unbroken down a section. */
.spine-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    background: var(--foliale-row);
    margin-bottom: 2px;
}

.spine-label {
    background: var(--foliale-label);
    color: var(--foliale-heading);
    font-size: 14px;
    font-weight: 400;
    padding: 8px 10px;
}

.spine-body {
    min-width: 0;
    padding: 8px 12px;
    color: var(--foliale-text);
}

/* A NON-ROW section (Images, Map): one white block under its heading — no label column. */
.spine-row--block {
    grid-template-columns: minmax(0, 1fr);
}
.spine-row--block > .spine-label {
    display: none;
}
.spine-row--block > .spine-body {
    padding: 12px;
}

/* A section: 14px of the grey above every section after the first (the header block is the first). */
.person-block {
    scroll-margin-top: 1rem;   /* a jump-index click lands the heading clear of the top edge */
    margin-top: 14px;
}
/* The section HEADING on the grey: .fo-heading on the left, the section's actions right (12px, teal). */
.spine-row.spine-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0;
    padding: 0 0 6px;
    background: transparent;
}
.spine-head .spine-label {
    background: transparent;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--foliale-heading);
}
.spine-head .spine-body {
    padding: 0;
}
/* A heading row that carries a control (Facts: "Add event", right-aligned): the <h2> is the label cell,
   sized by the row like the plain headings; the control drops the heading's uppercase / tracking. */
.spine-head .spine-head-title {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    align-self: center;
}
.spine-head .spine-head-actions {
    text-transform: none;
    letter-spacing: normal;
}
/* A per-family block heading ("Family 2", "Parents 1"): the "View family" icon sits right beside the name in the
   spine, at the heading's size — not pushed to the far right of the row. */
.person-block-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.person-block-heading .family-view-link {
    font-size: 1rem;
    line-height: 1;
}

/* Rows are separated by the 2px surface gap (.spine-row), not rules. An open group's member rows sit beneath its
   summary row, the same 2px apart. */
.fact-group[open] > .fact-group-rows {
    margin-top: 2px;
}

/* A collapsed RUN of one many-per-person type (_person-facts: PageFactGroup) — a <details> like the census
   row: the summary is the row (label | "4 places, 1848–1902" | caret); opening it shows the members as
   ordinary fact rows beneath (already in the page, no request). */
.fact-group-summary {
    cursor: pointer;
    list-style: none;
}
.fact-group-summary::-webkit-details-marker {
    display: none;
}
.fact-group-caret {
    transition: transform 0.15s ease;
    color: var(--bs-secondary-color);
}
.fact-group[open] .fact-group-caret {
    transform: rotate(180deg);
}

/* Painting P2 — the person HEADER block (white, .fo-page-head): the name 24px / 600, the gender glyph after it
   (18px, regular, the gender colour); the dates / age / ID line muted; the relatives line beneath. */
.person-header .person-header-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--foliale-text);
}
.person-gender {
    font-size: 18px;
    font-weight: 400;
    margin-left: 0.15rem;
}
.person-gender--female {
    color: var(--foliale-female);
}
.person-gender--male {
    color: var(--foliale-male);
}
.person-header-meta {
    color: var(--foliale-muted);
}
.person-relatives {
    color: var(--foliale-muted);
}

/* The home icon in the header's metadata line (not pinned to the portrait): inline, after the I-code. */
.person-header-meta .home-icon {
    position: static;
    display: inline-flex;
    align-items: center;
}

/* Evidence lines beneath a fact: indented under the row, compact. */
.evidence-lines {
    margin-top: 0.25rem;
}
.evidence-line + .evidence-line {
    margin-top: 0.25rem;
}
.evidence-cite,
.place-chain-link,
.person-brief-name,
.person-source-cite {
    text-decoration: none;
}
.evidence-cite:hover,
.place-chain-link:hover,
.person-brief-name:hover,
.person-source-cite:hover {
    text-decoration: underline;
}

/* Superscripts: small, tight, never break the line they annotate. */
.cite-sups {
    white-space: nowrap;
    margin-left: 0.1rem;
}
.cite-sup {
    text-decoration: none;
    font-size: 0.75em;
}
.cite-sup + .cite-sup {
    margin-left: 0.15rem;
}

/* A census row is a <details>: the summary IS the collapsed row (no marker; a caret that turns). */
.census-summary {
    cursor: pointer;
    list-style: none;
}
.census-summary::-webkit-details-marker {
    display: none;
}
.census-caret {
    transition: transform 0.15s ease;
    color: var(--bs-secondary-color);
}
.census-fact[open] .census-caret {
    transform: rotate(180deg);
}
.census-household {
    /* Painting leftovers 1b: under the row's value, the LABEL COLUMN kept unbroken beside it (a 120px band in the label grey). */
    padding-left: 120px;
    background: linear-gradient(to right, var(--foliale-label) 120px, var(--foliale-row) 120px);
    margin-bottom: 2px;
}
.census-household-table {
    white-space: nowrap;   /* the table scrolls sideways (.table-responsive), lines never wrap */
}
/* The page's own person in the household: a soft tint (--foliale-action-tint), weight unchanged. Set via
   Bootstrap's own table-cell variable so the tint survives .table's cell background. */
.census-own-row {
    --bs-table-bg: var(--foliale-action-tint);
}

/* Photos (P1b): the 64×48 fit-inside thumbnail (the evidence thumbnails' size), its title on one line
   beneath, the attach label, then the small actions. */
.person-photo {
    width: 7.5rem;
}
.person-photo-title {
    max-width: 100%;
}

/* The PHOTO GALLERY (/person/{id}/gallery): one uniform 120×90 slot per photo, the image fitted whole inside it
   (the 128×96 page sidecar — never cropped, never upscaled past it), the title + pencil and the label beneath. */
.person-gallery-item {
    width: 8.5rem;
}
.person-gallery-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 90px;
}
.person-gallery-img {
    width: 120px;
    height: 90px;
    object-fit: contain;
}
.person-gallery-doc {
    font-size: 2rem;
    color: var(--bs-secondary-color);
}

@media (max-width: 575.98px) {
    .spine-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .census-household {
        padding-left: 0;
        background: var(--foliale-row);
    }
}

/*
 * The ADD PAGES (add spouse / partner / parents / child — Painting leftovers 1): two section blocks, "Find an existing
 * person" and "Or create a new person", both shown (the old mode toggles are gone). A long match list scrolls inside
 * its rows.
 */
.add-spouse .spouse-results,
.add-parents .parent-results { max-height: 16rem; overflow-y: auto; }


/*
 * RELATIONSHIP (R2) — the header row (a muted, chrome-less button opening the modal) and the modal's path
 * and picker. Tokens only (--foliale-* / --bs-*).
 */
.person-relationship { min-height: 1.25rem; }
.person-relationship-open:hover,
.person-relationship-open:focus { color: var(--foliale-text) !important; }

/* The path as a small tree: the shared ancestor on top, the line(s) of descent beneath, ↓ between names. */
.relationship-tree-top { font-weight: 600; }
.relationship-arrow { color: var(--foliale-muted); line-height: 1.3; }
.relationship-line-person { padding-bottom: 0.1rem; }
/* The spouse line's partnered icon (people.css .status-icon, baseline-loaded) — default text colour, spacing only. */
.relationship-married-symbol { padding-inline: 0.35rem; }
/* .relationship-ancestor-badge: an action badge (base.css, Painting P3a); the class is a hook. */

/* The picker's rows: the whole row is one button, no chrome (the home picker's look). */
.relationship-pick {
    background: none;
    border: 0;
    color: inherit;
    border-radius: 0.375rem;
    padding-inline: 0.4rem;
}
.relationship-pick:hover,
.relationship-pick:focus { background: var(--bs-secondary-bg); }

/* --- MP2: the person page's MAP block (_person-map.php; drawn by person-map.js with the shared Leaflet) ------- */
/* (the map tokens — pin, its ink and edge, undated, the trail — are base.css :root's, Dark mode 1) */
/* the canvas keeps Leaflet's own stacking (panes 400+, controls 1000) INSIDE it, under the app's menus / modals */
.person-map-canvas {
    position: relative;
    z-index: 0;
    isolation: isolate;
    height: 22rem;
    max-height: 60vh;
}
/* a numbered pin (Leaflet divIcon): a filled disc — SOLID = the place's own point */
.person-map .person-map-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--foliale-map-pin);
    color: var(--foliale-map-pin-ink);
    border: 2px solid var(--foliale-map-pin-edge);
    box-shadow: var(--bs-box-shadow-sm);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}
/* APPROXIMATE (the nearest located ancestor's point): a solid LIGHTER fill ringed in the pin colour — seen on the dimmed
   dark tiles, and apart from a set location in both themes */
.person-map .person-map-pin--approx {
    background: var(--foliale-map-pin-approx);
    color: var(--foliale-map-pin-approx-ink);
    border: 2px solid var(--foliale-map-pin);
}
/* UNDATED: a small unnumbered dot, off the trail */
.person-map .person-map-pin--undated { background: var(--foliale-map-undated); }
.person-map .person-map-pin--undated.person-map-pin--approx { background: var(--foliale-map-undated-approx); border-color: var(--foliale-map-undated); }
/* the TRAIL joining the dated pins in order */
.person-map .person-map-trail {
    fill: none;
    stroke: var(--foliale-map-trail);
    stroke-width: 3px;
    stroke-opacity: 0.6;
}
/* the list beneath: the same number discs, clickable (opens the pin's popup) */
.person-map-list .person-map-item { padding-block: 0.1rem; }
.person-map .person-map-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 1.35rem;
    height: 1.35rem;
    padding-inline: 0.2rem;
    border-radius: 0.7rem;
    background: var(--foliale-map-pin);
    color: var(--foliale-map-pin-ink);
    border: 2px solid transparent;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}
.person-map .person-map-num--approx { background: var(--foliale-map-pin-approx); color: var(--foliale-map-pin-approx-ink); border: 2px solid var(--foliale-map-pin); }
.person-map .person-map-num--undated { min-width: 0.75rem; height: 0.75rem; margin-inline: 0.3rem; background: var(--foliale-map-undated); }
.person-map-popup { min-width: 12rem; }

/* THE ESTIMATED YEAR OF BIRTH in the household table (as the transcript page, census.css): the heading's tooltip is
   marked by a dotted underline; the disagreement mark is a shape and words, never colour alone. */
.census-household-table .census-born-head {
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
    cursor: help;
}
.census-household-table .census-born-mark {
    color: var(--foliale-danger);
    cursor: help;
}
