/*
 * Town-archive directory pages (server-rendered, crawlable).
 * Plain CSS on purpose: these pages must render fully without the React/Emotion runtime.
 * Kept lightweight, the site is under heavy traffic.
 *
 * Loaded after the shared design (filae.css): colours, spacing and type sizes come from its custom properties
 * (--clr-*, --space-*, --font-*), buttons / links / pagination from its fl-* components. This file only holds
 * the page layout and the few things the shared design has no component for. The reset is fl-reset on <main>.
 * The search form is the React <QuickSearch/> island (its own MUI styling).
 *
 * Mobile first. Custom properties cannot be used in @media, so the breakpoints repeat the --bp-* values:
 * sm 592px, md 976px, lg 1168px (each query carries a comment naming its token).
 *
 * Class names are prefixed archives-* (BEM-like), so they cannot collide with the shared CSS.
 * The greys of the legacy Genealogie app (--archives-muted / --archives-border) are kept until design
 * has picked the matching tokens.
 */

body { margin: 0; }

:root {
    --archives-muted: #d5d8da;
    --archives-border: #e3e3ea;
    --archives-container: var(--bp-lg);
}

/* Inline icon sprite (Shared/_ArchiveIcons.cshtml): takes no room, the icons reference it with <use href="#name">. */
.archives-icons { position: absolute; overflow: hidden; }

/* ---- Page grid (own classes; the markup was ported from the legacy Bootstrap pages) ---- */
.archives-container { max-width: var(--archives-container); margin: 0 auto; padding-inline: var(--space-2); }
.archives-row { display: flex; flex-wrap: wrap; margin-inline: calc(-1 * var(--space-2)); }
/* Columns are full width (stacked) on phones; the modifiers below split them from a given breakpoint. */
.archives-col { width: 100%; padding-inline: var(--space-2); }
@media (min-width: 592px) { /* --bp-sm */
    .archives-col--sm-third { width: 33.3333%; }
}
@media (min-width: 976px) { /* --bp-md */
    .archives-col--md-third { width: 33.3333%; }
    .archives-col--md-two-thirds { width: 66.6667%; }
}

/* ---- Hero band ---- */
.archives-hero { padding-bottom: var(--space-4); background-color: var(--clr-filae-dark-indigo); }
.archives-hero__top { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.archives-hero__title { flex: 1 1 auto; min-width: 0; }
.archives-hero h1 {
    margin: var(--space-3) 0 var(--space-1-25);
    color: var(--clr-common-white);
    font-size: var(--font-size-h3-mobile);
    font-weight: var(--font-weight-regular);
    line-height: 1.1;
    text-align: left;
}
.archives-hero h2 {
    margin: 0;
    color: var(--clr-common-white);
    font-size: var(--font-size-h5-desktop);
    font-weight: var(--font-weight-regular);
}
.archives-hero sup { font-size: 70%; }
.archives-hero p { color: var(--archives-muted); }
.archives-hero__accent { color: var(--clr-secondary-main); }
/* The laptop picture only shows when the band has the room (md and up). */
.archives-hero__img { display: none; }
.archives-hero__search { max-width: 900px; margin: var(--space-3) auto 0; }

/* Breadcrumb */
.archives-crumbs { padding-top: var(--space-1-25); font-size: var(--font-size-body1); line-height: var(--font-line-height-body1); }
.archives-crumbs ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.archives-crumbs li + li::before { content: "/"; padding-inline: var(--space-0-5); color: var(--clr-common-white); }
.archives-crumbs a { color: var(--clr-common-white); text-decoration: none; }
.archives-crumbs a:hover { text-decoration: underline; }
.archives-crumbs [aria-current="page"] { color: var(--archives-muted); }

/* Search-form island mount + pre-hydration skeleton.
   The React QuickSearch is centre-aligned and shrink-to-fits, so it renders at the same natural width as on the
   home page. The skeleton mirrors its form (same sizes, gaps, radius and button, the button being the shared
   fl-btn) so the island swap does not shift the layout. Gaps follow its breakpoints: 0.5rem, 0.75rem from sm,
   1rem from lg; layout switches at md; the form is 4px below the mount. The 43px / 8px literals mirror MUI's field. */
.archives-search-skeleton { display: flex; flex-direction: column; align-items: center; padding-top: var(--space-0-5); }
.archives-search-skeleton__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; width: 100%; }
.archives-search-skeleton__dates,
.archives-search-skeleton__commune { grid-column: 1 / -1; }
.archives-search-skeleton__dates { display: grid; grid-template-columns: repeat(3, 1fr); }
.archives-search-skeleton__field { height: 43px; min-width: 0; border-radius: 8px; background: var(--clr-common-white); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.23); }
.archives-search-skeleton__dates .archives-search-skeleton__field { border-radius: 0; }
.archives-search-skeleton__dates .archives-search-skeleton__field:first-child { border-radius: 8px 0 0 8px; }
.archives-search-skeleton__dates .archives-search-skeleton__field:last-child { border-radius: 0 8px 8px 0; }
.archives-search-skeleton__submit { margin-top: var(--space-2); }
@media (min-width: 592px) { /* --bp-sm */
    .archives-search-skeleton { width: min(100%, 557px); margin: 0 auto; }
    .archives-search-skeleton__grid { gap: 0.75rem; }
    .archives-search-skeleton__submit { margin-top: var(--space-3); }
}
@media (min-width: 976px) { /* --bp-md: full width, two columns, date group beside the place field */
    .archives-search-skeleton { width: 100%; }
    .archives-search-skeleton__dates,
    .archives-search-skeleton__commune { grid-column: auto; }
}
@media (min-width: 1168px) { /* --bp-lg */
    .archives-search-skeleton__grid { gap: 1rem; }
}

@media (min-width: 592px) { /* --bp-sm */
    .archives-hero h1 { font-size: var(--font-size-h1-mobile); }
    .archives-hero h2 { font-size: var(--font-size-h4-mobile); }
}
@media (min-width: 976px) { /* --bp-md: laptop picture beside the title, the band gets its desktop spacing */
    .archives-hero { padding-bottom: var(--space-6); }
    .archives-hero__top { flex-direction: row; gap: var(--space-4); }
    .archives-hero__title { margin-bottom: var(--space-6); }
    .archives-hero h1 { margin-top: var(--space-6); }
    .archives-hero__img { display: block; flex: 0 0 auto; width: 33.3333%; max-width: 360px; height: auto; margin-top: var(--space-8); }
    .archives-hero__search { margin-top: var(--space-6); }
}

/* ---- Commune / department index band ---- */
.archives-band { padding: var(--space-3) 0 var(--space-5); }
.archives-band h3 { margin: 0 0 var(--space-0-75); font-size: var(--font-size-h5-desktop); text-align: left; }
.archives-band p { margin: 0 0 var(--space-3); padding-top: var(--space-0-5); font-size: var(--font-size-body1); text-align: left; }
.archives-band ul { padding: 0; margin: 0; list-style: none; }
.archives-band li { margin-bottom: var(--space-0-75); }
@media (min-width: 592px) { /* --bp-sm: centred titles above the lists */
    .archives-band h3 { margin-top: var(--space-3); font-size: var(--font-size-h4-mobile); text-align: center; }
    .archives-band p { font-size: var(--font-size-subtitle1); text-align: center; }
}

/* Department links (France index): one list flowed into columns (3 from md, 2 from sm, 1 below), numbered top to bottom. */
.archives-deps { column-count: 1; column-gap: var(--space-4); }
.archives-deps li { padding-left: 0; break-inside: avoid; }
@media (min-width: 592px) { /* --bp-sm */
    .archives-deps { column-count: 2; }
}
@media (min-width: 976px) { /* --bp-md */
    .archives-deps { column-count: 3; }
    .archives-deps li { padding-left: 25%; }
}

/* Commune list: 2 columns on phones, 3 from sm, 4 from md, 6 from lg. Each link is a block with vertical padding,
   so the tap target is at least 24px high. */
.archives-communes { flex: 1 1 100%; min-width: 0; padding-inline: var(--space-2); }
.archives-communes__list { column-count: 2; column-gap: var(--space-4); margin: var(--space-0-5) 0 var(--space-1-25); padding: 0; list-style: none; }
.archives-communes__list li { break-inside: avoid; margin: 0; padding: 0; }
.archives-communes__list a { display: block; padding-block: var(--space-0-5); font-size: var(--font-size-body2); line-height: var(--font-line-height-body2); }
@media (min-width: 592px) { /* --bp-sm */
    .archives-communes__list { column-count: 3; }
}
@media (min-width: 976px) { /* --bp-md: pointer devices, the rows go down to the 24px minimum */
    .archives-communes__list { column-count: 4; }
    .archives-communes__list a { padding-block: var(--space-0-25); }
}
@media (min-width: 1168px) { /* --bp-lg */
    .archives-communes__list { column-count: 6; }
}

/* Commune pagination: the shared fl-pagination, centred. */
.archives-pagination { margin: var(--space-2) 0; }
.archives-pagination .fl-pagination__list { justify-content: center; }

/* Leave room for the fixed header when the pagination links jump to the list (#CommuneListResults). */
#CommuneListResults { scroll-margin-top: var(--space-11); }

/* ---- Sources / contact / region / associations ---- */
.archives-sources { margin: var(--space-5) 0 var(--space-7); }
.archives-sources h3 { margin-top: 0; font-size: var(--font-size-h4-mobile); text-align: left; }
.archives-sources h4 { margin-bottom: 0; color: var(--clr-secondary-main); font-weight: var(--font-weight-bold); }
.archives-sources h5 { margin-bottom: var(--space-2); font-weight: var(--font-weight-bold); font-size: var(--font-size-h6-desktop); }
.archives-sources h6 { font-size: var(--font-size-h6-desktop); }
.archives-sources address { font-style: normal; font-size: var(--font-size-body1); }
.archives-sources ul { padding: 0; margin: 0; list-style: none; }
.archives-sources__contact p { font-size: var(--font-size-body1); }
.archives-sources__contact a.disabled { color: var(--clr-text-disabled); text-decoration: none; cursor: default; pointer-events: none; }
.archives-contact__block { margin-top: var(--space-6); }
.archives-contact__block a,
.archives-contact__block li { font-size: var(--font-size-body1); }
.archives-contact__assoc { padding-top: var(--space-4); }
.archives-contact__associations li { padding: var(--space-1) 0; border-bottom: 1px solid var(--archives-border); }
.archives-contact__associations li span { display: block; }
/* Vertical separator between the marketing column and the contact column on the department page, only in the
   side-by-side layout (md and up): below that the columns stack, and the town page has no pitch column. */
@media (min-width: 976px) { /* --bp-md */
    .archives-sources__pitch { border-right: 1px solid var(--archives-muted); }
    .archives-sources__contact { padding-left: var(--space-4); }
}

/* ---- Premium editorial pitch (shared by the department + town pages) ---- */
.archives-premium__headline { margin-bottom: var(--space-1-5); }
.archives-premium__intro { margin: 0 0 var(--space-3); font-size: var(--font-size-body1); }
.archives-premium__feature { display: flex; align-items: flex-start; gap: var(--space-2); margin: var(--space-3) 0; }
.archives-premium__icon { flex: 0 0 auto; width: var(--space-8); height: auto; }
.archives-premium__body { min-width: 0; }
.archives-premium__body h4 { margin-top: 0; }
.archives-premium__body p { margin: var(--space-0-5) 0 0; }
/* Indented to line up with the feature body text (icon width + the feature gap). */
.archives-premium__all { margin-top: var(--space-1-25); padding-left: calc(var(--space-8) + var(--space-2)); font-weight: var(--font-weight-bold); }
/* Town page only: two feature columns (feat1/feat2 | feat3/feat4) from md; one column below. */
.archives-premium__features--two-col { display: grid; grid-template-columns: 1fr; gap: 0 var(--space-5); }
@media (min-width: 976px) { /* --bp-md */
    .archives-premium__features--two-col { grid-template-columns: 1fr 1fr; }
}
.archives-premium__cta { margin: var(--space-4) 0; }
.archives-premium__cta p { margin: var(--space-1-5) 0 0; }
.archives-premium__testimonial { margin-top: var(--space-5); font-size: var(--font-size-body1); }
.archives-premium__quote { font-style: italic; font-size: var(--font-size-subtitle1); color: var(--clr-secondary-main); }
/* Responsive 16:9 wrapper for the testimonial video (department page only). */
.archives-premium__video { position: relative; width: 100%; margin-top: var(--space-1-5); aspect-ratio: 16 / 9; }
.archives-premium__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Commune / town: act counts + map ---- */
.archives-town { padding: var(--space-4) 0 var(--space-1); }
.archives-town__eyebrow { margin: 0 0 var(--space-1); color: var(--clr-secondary-main); font-weight: var(--font-weight-bold); font-size: var(--font-size-body1); letter-spacing: 0.02em; }
.archives-town h3 { margin: 0 0 var(--space-1); font-size: var(--font-size-h5-desktop); font-weight: var(--font-weight-regular); }
.archives-town__acts { text-align: center; }
.archives-town__count { margin: var(--space-1) 0 var(--space-0-5); font-size: var(--font-size-h1-mobile); line-height: 1.1; color: var(--clr-secondary-main); font-weight: var(--font-weight-bold); }
.archives-town__acts a { display: inline-block; padding-block: var(--space-0-5); font-size: var(--font-size-body1); }
.archives-town__rule { height: 1px; border: none; margin: var(--space-1) 0 var(--space-3); background-color: var(--clr-secondary-main); }
/* Commune map spans the full page width (rendered outside .archives-container). */
.archives-map { height: 400px; margin: 0; }

/* ---- Bottom decorative band ---- */
.archives-backdrop img { display: block; width: 100%; height: auto; }

/* ---- 404 page (same look as the SPA's error view) ---- */
.archives-notfound { display: flex; flex-direction: column; align-items: center; max-width: var(--archives-container); margin: 3rem auto 0; padding: 0 var(--space-2); text-align: center; }
.archives-notfound h1 { margin: 0.75rem 0; color: var(--clr-secondary-main); font-size: 1.6rem; }
.archives-notfound p { margin: 0 0 1rem; font-weight: 700; font-size: 1.1rem; }
.archives-notfound__links a { font-weight: 400; }
.archives-notfound img { width: min(80%, 40rem); height: auto; margin: 2.5rem auto 5rem; border: 5px solid var(--clr-common-white); box-shadow: 5px 5px 5px 0 var(--clr-text-secondary); transform: rotate(-2deg); }
