/*
 * Sources pages (server-rendered, crawlable): landing /recherche-genealogique/sources and the category pages.
 * Plain CSS, no Bootstrap, no masonry: the layout must render without the React/Emotion runtime. Kept small (high-traffic site).
 * The boxes keep the legacy proportions (banner 1136x190, cards 2:1, illustration square) with object-fit: cover instead of the
 * legacy stretching; every <img> carries width/height, so nothing shifts while pictures load.
 */

*,
*::before,
*::after { box-sizing: border-box; }

body { margin: 0; }

:root {
    --sources-text: #333;
    --sources-muted: #6b6b7b;
    --sources-link: #1a4fb0;
    --sources-border: #e3e3ea;
    --sources-band: #2b2550;
    --sources-badge: #f96566;
    --sources-container: 1170px;
}

.sources-main {
    color: var(--sources-text);
    font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}
.sources-main a { color: var(--sources-link); }

.sources-container {
    max-width: var(--sources-container);
    margin: 0 auto;
    padding: 1rem 15px 3rem;
}

/* ---- Landing ---- */
.sources-landing__head h1 { margin: 0.5rem 0 0.25rem; font-size: 2rem; }
.sources-landing__head h2 { margin: 0 0 1.5rem; font-size: 1.25rem; font-weight: 400; color: var(--sources-muted); }

/* CSS columns 3 / 2 / 1 (legacy masonry look without the script). */
.sources-grid { column-count: 1; column-gap: 20px; }
@media (min-width: 768px) { .sources-grid { column-count: 2; } }
@media (min-width: 992px) { .sources-grid { column-count: 3; } }
.sources-grid > .sources-card { break-inside: avoid; display: inline-block; width: 100%; margin-bottom: 20px; }

/* ---- Cards (landing, sub-categories, level-3 parent) ---- */
.sources-card { border: 1px solid var(--sources-border); border-radius: 4px; background: #fff; overflow: hidden; }
.sources-card__media { position: relative; aspect-ratio: 2 / 1; background: var(--sources-band); }
.sources-card__media--empty { aspect-ratio: auto; min-height: 3.5rem; }
.sources-card__picture { display: block; height: 100%; }
.sources-card__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sources-card__title {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 0.5rem 10px;
    font-size: 1.15rem;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}
.sources-card__media--empty .sources-card__title { position: static; background: none; }
.sources-card__title a { color: #fff; text-decoration: none; }
.sources-card__list { margin: 0; padding: 0.75rem 10px; list-style: none; }
.sources-card__level2 + li,
.sources-card__list > li + .sources-card__level2 { margin-top: 0.5rem; }

/* A level-3 entry: name truncated by CSS (legacy truncated it in script), badge kept visible. */
.sources-leaf { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0; font-size: 0.95rem; font-weight: 400; }
.sources-leaf__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources-badge {
    flex: none;
    padding: 0 0.4rem;
    border-radius: 3px;
    background: var(--sources-badge);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4rem;
}

/* ---- Category page ---- */
.sources-breadcrumb ol { display: flex; flex-wrap: wrap; margin: 0 0 0.75rem; padding: 0; list-style: none; font-size: 0.9rem; }
.sources-breadcrumb li + li::before { content: "›"; padding: 0 0.5rem; color: var(--sources-muted); }
.sources-breadcrumb [aria-current] { color: var(--sources-muted); }

/* Legacy band heights: 190 px, 156 px and 120 px depending on the screen width. */
/* Framed like the search form panel (same border and radius), the picture touching the frame: no padding. */
.sources-banner { position: relative; height: 120px; overflow: hidden; border: 1px solid #d9dde1; border-radius: 0.25rem; background: var(--sources-band); }
@media (min-width: 768px) { .sources-banner { height: 156px; } }
@media (min-width: 1170px) { .sources-banner { height: 190px; } }
.sources-banner__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* As the legacy .sources-titre-banniere: dark text kept in a narrow column on the left, where the picture fades to white, so it wraps
   before reaching the drawing (311 px wide, 240 px on small screens). Without a picture (band colour behind) the text turns white. */
.sources-banner__title {
    position: relative;
    width: 311px;
    max-width: 100%;
    margin: 0;
    padding: 15px 0 0 15px;
    color: var(--sources-text);
    font-size: 30px;
    font-weight: 700;
    line-height: 39px;
}
@media (max-width: 1169px) { .sources-banner__title { padding-top: 8px; } }
@media (max-width: 767px) { .sources-banner__title { width: 240px; line-height: 32px; } }
.sources-banner--empty .sources-banner__title { color: #fff; }
/* "Nouvelle collection" label: green, at the bottom right of the banner, as the legacy .sources-banniere span.label. */
.sources-banner__label {
    position: absolute;
    right: 13px;
    bottom: 4px;
    padding: 0.2em 0.6em 0.3em;
    border-radius: 0.25em;
    background: #11a88b;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.sources-search { margin: 1rem 0; min-height: 4rem; }
/* Placeholder of the React search form (QuickSearch, inline variant), same size as the real form so the page does not jump when it
   loads. Measured on the real form: fields 43px, button 44px, 4px above the fields; gaps 8px (< 592px), 12px (>= 592px), 16px (>= 1168px);
   from 976px the form is a bordered panel with a magnifier, two columns of fields and a round button (QuickSearch.styled.ts).
   Change the sizes there and here together. */
.sources-search-skeleton { display: flex; flex-direction: column; }
.sources-search-skeleton__glyph, .sources-search-skeleton__icon { display: none; }
.sources-search-skeleton__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.25rem; }
.sources-search-skeleton__field { height: 43px; border-radius: 4px; background: #eef0f3; }
.sources-search-skeleton__field:nth-child(n+3) { grid-column: 1 / -1; }
.sources-search-skeleton__submit {
    height: 44px;
    margin-top: 1rem;
    padding: 0 1.5rem;
    border: 0;
    border-radius: 22px;
    background: var(--sources-badge);
    color: #fff;
    font: inherit;
}
@media (min-width: 592px) {
    .sources-search-skeleton__fields { gap: 0.75rem; }
    .sources-search-skeleton__submit { margin-top: 1.5rem; }
}
@media (min-width: 976px) {
    .sources-search-skeleton {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 1.5rem;
        padding: 1rem 1.5rem;
        border: 1px solid #d9dde1;
        border-radius: 0.25rem;
        background: #fff;
    }
    .sources-search-skeleton__glyph { display: block; width: 4rem; height: 4rem; color: #d5d9dd; }
    .sources-search-skeleton__fields { margin-top: 0; }
    .sources-search-skeleton__field:nth-child(n+3) { grid-column: auto; }
    .sources-search-skeleton__submit {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 3.5rem;
        height: 3.5rem;
        margin-top: 0;
        padding: 0;
        border-radius: 50%;
    }
    .sources-search-skeleton__icon { display: block; width: 1.5rem; height: 1.5rem; }
    .sources-search-skeleton__label { display: none; }
}
@media (min-width: 1168px) {
    .sources-search-skeleton__fields { gap: 1rem; }
}

.sources-stats { display: flex; flex-wrap: wrap; gap: 20px; margin: 0 0 1.5rem; padding: 0; list-style: none; }
/* As the legacy .sources-info: a pale icon at the start, the label (grey, small) over the figure (coral, large), both centred. */
.sources-stats__item { display: flex; flex: 1 1 200px; align-items: center; gap: 0.75rem; padding: 0.9rem 1.5rem; border: 1px solid var(--sources-border); border-radius: 4px; }
.sources-stats__icon { flex: 0 0 auto; width: 2.25rem; height: 2.25rem; color: #d5d8da; }
.sources-stats__text { flex: 1 1 auto; margin-right: 2.25rem; text-align: center; }
.sources-stats__label { display: block; margin: 0 0 0.35rem; color: #757585; font-size: 0.75rem; }
.sources-stats__value { display: block; color: #ff5555; font-size: 2rem; line-height: 1.2; white-space: nowrap; }

.sources-editorial { margin-bottom: 1.5rem; }
.sources-editorial::after { content: ""; display: block; clear: both; }
.sources-editorial__image { float: right; width: 320px; max-width: 40%; height: auto; aspect-ratio: 1; margin: 0 0 1rem 1.5rem; object-fit: cover; }
.sources-editorial__chapeau { font-size: 1.1rem; font-weight: 700; }
.sources-editorial__heading { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }
/* The shared design reset (.fl-reset, filae-reset.css) removes bullets, numbers and indentation from every list; the editorial texts
   (sanitized resx HTML: ul, ol, li) need them back, as on the legacy page. */
.sources-editorial__chapeau :is(ul, ol),
.sources-editorial__description :is(ul, ol),
.sources-editorial__sources :is(ul, ol) { margin: 0 0 1rem; padding-left: 1.5rem; }
.sources-editorial__chapeau ul,
.sources-editorial__description ul,
.sources-editorial__sources ul { list-style: disc; }
.sources-editorial__chapeau ol,
.sources-editorial__description ol,
.sources-editorial__sources ol { list-style: decimal; }

.sources-subcategories { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.sources-subcategories .sources-card__title { font-size: 1.1rem; }

.sources-level3 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 992px) { .sources-level3 { grid-template-columns: 2fr 1fr; } }
.sources-level3__image { display: block; width: 100%; height: auto; aspect-ratio: 1; margin-bottom: 20px; object-fit: cover; }

/* ---- 404 ---- */
.sources-notfound { text-align: center; }
.sources-notfound img { max-width: 100%; height: auto; }
