/**
 * AP Family Archive - public archive styles.
 *
 * Display styles (the APON precedent), chosen on the settings screen:
 *   .apfa-style-heritage  - serif display, warm paper tones, verdant + amber
 *                           accents; matches the AP Family Trees front end.
 *   .apfa-style-none      - theme default: only the structural rules below,
 *                           every visual decision left to the theme.
 * The Modern style joins with the Pro tier. Shared structural rules first,
 * the Heritage skin next, printer-friendly rules last. Everything is scoped
 * under .apfa-pub so themes are never touched.
 */

.apfa-pub {
    --apfa-ink: #1a1a18;
    --apfa-paper: #f4f2ec;
    --apfa-verdant: #2f4a3f;
    --apfa-stone: #6b6e6c;
    --apfa-amber: #c4831a;
    --apfa-line: rgba(26, 26, 24, 0.14);
    line-height: 1.6;
}

/* ── Shared bits ─────────────────────────────────────────────────────────── */

.apfa-empty,
.apfa-admin-notice {
    font-style: italic;
    opacity: 0.75;
}

.apfa-placeholder {
    font-style: italic;
    opacity: 0.65;
}

.apfa-lifespan,
.apfa-surname-count,
.apfa-result-places,
.apfa-event-info {
    opacity: 0.7;
    font-size: 0.92em;
}

.apfa-count {
    font-size: 0.92em;
    opacity: 0.8;
}

.apfa-pagination {
    margin: 1.2em 0;
}

.apfa-page-x-of-y {
    margin: 0 0.6em;
    opacity: 0.75;
    font-size: 0.92em;
}

/* ── Vitals / timeline ───────────────────────────────────────────────────── */

ul.apfa-vitals,
ul.apfa-timeline {
    list-style: none;
    margin: 0.6em 0 1em;
    padding: 0;
}

ul.apfa-vitals li,
ul.apfa-timeline li {
    padding: 0.2em 0;
}

.apfa-vital-label {
    display: inline-block;
    min-width: 5.5em;
    font-weight: 600;
}

/* ── Person page ─────────────────────────────────────────────────────────── */

.apfa-person-years {
    margin-top: -0.5em;
    opacity: 0.75;
}

.apfa-family-block {
    margin: 1.2em 0;
    padding: 0.8em 1em;
    border-left: 3px solid rgba(0, 0, 0, 0.12);
}

.apfa-family-link {
    font-size: 0.8em;
    font-weight: 400;
}

ul.apfa-parents,
ul.apfa-partners {
    list-style: none;
    margin: 0.4em 0 1em;
    padding: 0;
}

ol.apfa-children {
    margin: 0.4em 0 0.6em 1.4em;
}

/* ── Surname index ───────────────────────────────────────────────────────── */

.apfa-az {
    margin: 0.6em 0 1em;
    letter-spacing: 0.15em;
    word-wrap: break-word;
}

.apfa-az a {
    text-decoration: none;
    padding: 0 0.1em;
}

.apfa-az a.apfa-az-current {
    font-weight: 700;
    text-decoration: underline;
}

ul.apfa-surname-list {
    list-style: none;
    margin: 0;
    padding: 0;
    column-width: 14em;
    column-gap: 2em;
}

ul.apfa-surname-list li {
    break-inside: avoid;
    padding: 0.15em 0;
}

ul.apfa-people-list {
    list-style: none;
    margin: 0.6em 0;
    padding: 0;
}

ul.apfa-people-list li {
    padding: 0.2em 0;
}

/* ── Record IDs (TNG-familiar I/F numbers) ───────────────────────────────── */

.apfa-record-id {
    font-family: monospace;
    font-size: 0.6em;
    font-weight: 400;
    opacity: 0.55;
    vertical-align: middle;
}

.apfa-person-nav {
    font-size: 0.92em;
    margin: 0.2em 0 1em;
}

/* ── Hub ─────────────────────────────────────────────────────────────────── */

.apfa-hub-stats {
    display: flex;
    gap: 1.6em;
    margin: 1em 0;
    flex-wrap: wrap;
}

.apfa-hub-stat-n {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    line-height: 1.1;
}

.apfa-hub-stat-l {
    display: block;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

.apfa-hub-links {
    margin: 0.8em 0 1.2em;
}

/* ── Statistics ──────────────────────────────────────────────────────────── */

.apfa-stats-table th {
    text-align: left;
    padding: 0.3em 1.2em 0.3em 0;
    font-weight: 600;
    white-space: nowrap;
}

.apfa-stats-table td {
    padding: 0.3em 0;
}

/* ── Most Wanted ─────────────────────────────────────────────────────────── */

ul.apfa-mostwanted-list {
    list-style: none;
    margin: 0.6em 0;
    padding: 0;
}

ul.apfa-mostwanted-list > li {
    padding: 0.5em 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.apfa-mostwanted-note {
    margin: 0.2em 0 0;
    font-size: 0.92em;
    opacity: 0.8;
}

/* ── Reports ─────────────────────────────────────────────────────────────── */

.apfa-report-subject {
    font-size: 1.05em;
    margin-bottom: 1em;
}

ol.apfa-ahnentafel-list {
    margin: 0.4em 0 1em 2.4em;
}

ul.apfa-descend-list,
ul.apfa-descend-list ul {
    list-style: none;
    margin: 0.2em 0 0.2em 1.2em;
    padding: 0;
}

.apfa-daboville {
    font-family: monospace;
    font-size: 0.85em;
    opacity: 0.65;
    margin-right: 0.3em;
}

.apfa-descend-spouse {
    opacity: 0.8;
    font-size: 0.95em;
}

/* ── Sources ─────────────────────────────────────────────────────────────── */

ol.apfa-sources {
    margin: 0.4em 0 1em 1.6em;
    font-size: 0.95em;
}

.apfa-source-meta {
    opacity: 0.7;
}

blockquote.apfa-source-text {
    margin: 0.3em 0 0.5em 1em;
    padding-left: 0.8em;
    border-left: 2px solid rgba(0, 0, 0, 0.15);
    font-style: italic;
    opacity: 0.85;
}

/* Per-event citation markers ([n] superscripts on the timeline). */
sup.apfa-cite-ref {
    font-size: 0.72em;
    line-height: 0;
}

sup.apfa-cite-ref a {
    text-decoration: none;
    padding: 0 0.1em;
}

.apfa-source-event {
    font-size: 0.88em;
    opacity: 0.75;
    font-style: italic;
}

/* Source detail page. */
ul.apfa-source-detail .apfa-vital-label {
    min-width: 7.5em;
}

/* ── Media (portrait, galleries, listing thumbnails) ─────────────────────── */

figure.apfa-portrait {
    float: right;
    margin: 0 0 0.8em 1.2em;
    max-width: 180px;
}

figure.apfa-portrait img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 3px;
    background: #fff;
}

ul.apfa-media-list {
    list-style: none;
    margin: 0.6em 0 1em;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    clear: both;
}

ul.apfa-media-list li.apfa-media-item {
    margin: 0;
    max-width: 130px;
}

ul.apfa-media-list img {
    max-width: 120px;
    max-height: 120px;
    height: auto;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 3px;
    background: #fff;
}

.apfa-media-caption {
    display: block;
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 0.25em;
    line-height: 1.35;
}

.apfa-media-date {
    opacity: 0.75;
}

img.apfa-list-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 0.5em;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ── Anniversaries ───────────────────────────────────────────────────────── */

.apfa-ann-form label {
    margin-right: 0.8em;
}

/* ── Search form ─────────────────────────────────────────────────────────── */

.apfa-search-form label {
    margin-right: 0.8em;
}

.apfa-search-form input[type="number"] {
    width: 6em;
}

.apfa-phonetic {
    white-space: nowrap;
}

/* ── HERITAGE - matches the AP Family Trees / APON front end ─────────────── */

/* The whole block reads like a printed register: serif throughout (form
   controls keep the browser/theme UI font). */
.apfa-style-heritage,
.apfa-style-heritage p,
.apfa-style-heritage li,
.apfa-style-heritage td,
.apfa-style-heritage th {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--apfa-ink);
}

.apfa-style-heritage h2,
.apfa-style-heritage h3,
.apfa-style-heritage h4 {
    font-family: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
    color: var(--apfa-ink);
    letter-spacing: -0.01em;
}

.apfa-style-heritage h3 {
    border-bottom: 2px solid var(--apfa-verdant);
    padding-bottom: 0.3em;
    display: inline-block;
}

.apfa-style-heritage .apfa-vital-label {
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--apfa-stone);
}

.apfa-style-heritage .apfa-family-block {
    background: var(--apfa-paper);
    border: 1px solid var(--apfa-line);
    border-left: 3px solid var(--apfa-verdant);
}

.apfa-style-heritage .apfa-az a {
    color: var(--apfa-verdant);
}

.apfa-style-heritage .apfa-az a.apfa-az-current {
    color: var(--apfa-amber);
}

.apfa-style-heritage .apfa-hub-stat {
    background: var(--apfa-paper);
    border: 1px solid var(--apfa-line);
    border-top: 3px solid var(--apfa-verdant);
    padding: 14px 22px;
    text-align: center;
}

.apfa-style-heritage .apfa-hub-stat-n {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: var(--apfa-verdant);
}

.apfa-style-heritage .apfa-stats-table th {
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--apfa-stone);
}

.apfa-style-heritage .apfa-stats-table tr {
    border-bottom: 1px solid rgba(26, 26, 24, 0.08);
}

.apfa-style-heritage .apfa-search-btn {
    padding: 0.45em 1.4em;
    cursor: pointer;
    border: none;
    background: var(--apfa-verdant);
    color: var(--apfa-paper);
}

.apfa-style-heritage .apfa-search-form input[type="text"],
.apfa-style-heritage .apfa-search-form input[type="number"] {
    background: #fff;
    border: 1px solid var(--apfa-line);
    padding: 0.35em 0.6em;
}

.apfa-style-heritage figure.apfa-portrait img,
.apfa-style-heritage ul.apfa-media-list img {
    background: var(--apfa-paper);
    border-color: var(--apfa-line);
}

.apfa-style-heritage blockquote.apfa-source-text {
    border-left-color: var(--apfa-amber);
}

.apfa-style-heritage ul.apfa-mostwanted-list > li {
    border-bottom-color: var(--apfa-line);
}

/* ── Printer-friendly (all public views) ─────────────────────────────────── */

@media print {
    /* Navigation and interactive chrome have no place on paper. */
    .apfa-pub .apfa-az,
    .apfa-pub .apfa-pagination,
    .apfa-pub .apfa-person-nav,
    .apfa-pub .apfa-hub-links,
    .apfa-pub .apfa-family-link,
    .apfa-pub .apfa-search-form,
    .apfa-pub .apfa-ann-form,
    .apfa-pub form,
    .apfa-pub button {
        display: none !important;
    }

    /* Ink on paper: black serif text, no link colouring or underlines -
       the record ids already identify every person/family on the page. */
    .apfa-pub,
    .apfa-pub p,
    .apfa-pub li,
    .apfa-pub td,
    .apfa-pub th,
    .apfa-pub h2,
    .apfa-pub h3,
    .apfa-pub h4 {
        color: #000 !important;
        background: transparent !important;
        font-family: Georgia, 'Times New Roman', serif;
    }

    .apfa-pub a,
    .apfa-pub a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* Keep records whole across page breaks. */
    .apfa-pub .apfa-family-block,
    .apfa-pub ul.apfa-media-list li,
    .apfa-pub ul.apfa-people-list li,
    .apfa-pub ol.apfa-sources li,
    .apfa-pub ul.apfa-mostwanted-list > li,
    .apfa-pub tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .apfa-pub .apfa-family-block {
        border: 1px solid #000;
    }

    figure.apfa-portrait img,
    ul.apfa-media-list img {
        border: 1px solid #000;
        padding: 0;
    }

}
