/**
 * BIOGRAPHY PAGES — personalities (paleontologists, paleoanthropologists, ...)
 *
 * Template page: topics/anthro/personalities/broom_robert.html
 * Load after content.css and common-style.css. Everything is scoped to
 * .bio-page (on the content container), so it cannot affect other pages.
 *
 * Building blocks:
 *   <figure class="bio-figure bio-figure--right">   image + caption, text flows around it
 *   <figure class="bio-figure bio-figure--left">    same, on the left
 *   <figure class="inline-image-caption bio-figure--wide">  full-width image + caption
 *   <figure class="bio-figure bio-figure--row">     several images side by side + one caption
 *       <div class="bio-figure__images"> <a><img></a> <a><img></a> ... </div>
 *       <figcaption>...</figcaption>
 *   </figure>
 *
 * Put a floated figure BEFORE the paragraph it belongs to (never inside a <p>).
 * The figure is exactly as wide as its image (the image's width attribute),
 * and the caption wraps to that width.
 */

/* ===== PAGE ===== */

.bio-section {
    padding: var(--space-6) 0 var(--space-7);
}

.bio-page h1 {
    margin-bottom: var(--space-5);
}

/* Sections start below any image still floating from the section before */
.bio-page h2 {
    clear: both;
    margin-top: var(--space-7);
}

/* Prev / back to index / next: aligned with the text column
   (the component's own side padding is for full-width use) */
.bio-page .year-prev-next {
    padding-left: 0;
    padding-right: 0;
    margin-bottom: var(--space-6);
}

.bio-page .bio-page__nav--bottom {
    clear: both;
    margin-top: var(--space-6);
    margin-bottom: 0;
}

/* ===== FLOATED FIGURE (image + caption beside the text) ===== */

.bio-page .bio-figure--right,
.bio-page .bio-figure--left {
    width: fit-content;
    max-width: 50%;
    margin-top: var(--space-1);
    margin-bottom: var(--space-5);
}

.bio-page .bio-figure--right {
    float: right;
    clear: right;
    margin-left: var(--space-6);
}

.bio-page .bio-figure--left {
    float: left;
    clear: left;
    margin-right: var(--space-6);
}

.bio-page .bio-figure--right img,
.bio-page .bio-figure--left img {
    display: block;
    max-width: 100%;
    height: auto;
}

.bio-page .bio-figure--right > a,
.bio-page .bio-figure--left > a {
    display: block;
}

/* ===== CAPTIONS ===== */

/* contain: inline-size keeps the caption from widening the figure:
   the image sets the width, the caption wraps inside it */
.bio-page .bio-figure figcaption {
    contain: inline-size;
    margin-top: var(--space-2);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
    text-align: left;
}

/* figcaption already sets the small size — don't shrink <small> twice */
.bio-page .bio-figure figcaption small,
.bio-page .bio-figure--wide figcaption small {
    font-size: 1em;
}

/* ===== FULL-WIDTH FIGURE ===== */

.bio-page .bio-figure--wide {
    clear: both;
    margin: var(--space-5) 0 var(--space-6);
}

/* ===== ROW OF IMAGES WITH ONE CAPTION ===== */

.bio-page .bio-figure--row {
    clear: both;
    margin: var(--space-5) 0 var(--space-6);
}

.bio-page .bio-figure__images {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    align-items: flex-start;
}

.bio-page .bio-figure__images > a {
    flex: 0 1 auto;
    min-width: 0;
}

.bio-page .bio-figure__images img {
    display: block;
    max-width: 100%;
    height: auto;
}

.bio-page .bio-figure--row figcaption {
    contain: none;
    text-align: center;
}

/* ===== PHILATELY (stamp cards) ===== */

.bio-page .bio-stamps {
    clear: both;
    padding: var(--space-5);
    border-radius: 12px;
}

/* ===== REFERENCES ===== */

.bio-page a[name="ref"] + h3 {
    clear: both;
    margin-top: var(--space-7);
}

/* ===== PHONES ===== */

@media (max-width: 576px) {
    .bio-section {
        padding-top: var(--space-4);
    }

    /* Floated images sit on their own line, centred, full width if needed */
    .bio-page .bio-figure--right,
    .bio-page .bio-figure--left {
        float: none;
        max-width: 100%;
        margin: var(--space-4) auto var(--space-5);
    }

    .bio-page .bio-figure figcaption {
        text-align: center;
    }

    /* Image rows stack */
    .bio-page .bio-figure__images {
        flex-direction: column;
        align-items: center;
    }

    .bio-page .bio-stamps {
        padding: var(--space-4);
    }
}
