/* =================================================================
   Primes & Subventions — page d'accueil
   Variables reprises de direction/tokens.css (kit de création)
   ================================================================= */
:root {
  --ps-ink: #183a45;
  --ps-brand: #187568;
  --ps-brand-dark: #125a50;
  --ps-paper: #f6f4ed;
  --ps-surface: #ffffff;
  --ps-sand: #ebdcc3;
  --ps-muted: #52656c;
  --ps-ochre: #c68d49; /* décoration uniquement */
  --ps-line: #d8ded9;
  --ps-focus: #183a45;
  --ps-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --ps-fs-small: 0.875rem;
  --ps-fs-lead: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
  --ps-fs-h1: clamp(2.25rem, 1.45rem + 3.3vw, 4.25rem);
  --ps-fs-h2: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
  --ps-fs-h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --ps-space-section: clamp(3.5rem, 6vw, 6rem);
  --ps-gutter: clamp(1.25rem, 4vw, 3rem);
  --ps-max: 74rem;
  --ps-r-control: 0.625rem;
  --ps-r-card: 1.125rem;
  --ps-r-feature: 1.75rem;
  --ps-shadow: 0 8px 30px rgb(24 58 69 / 0.055);
  --ps-shadow-hover: 0 12px 32px rgb(24 58 69 / 0.1);
  --ps-duration: 160ms;
  --ps-ease: cubic-bezier(0.2, 0.6, 0.3, 1);
  --ps-header-h: 5rem;
}
@media (prefers-reduced-motion: reduce) { :root { --ps-duration: 0ms; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--ps-header-h) + 1rem); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; font-family: var(--ps-font); font-size: 1.0625rem; line-height: 1.65;
  color: var(--ps-ink); background: var(--ps-paper); -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: -0.035em; }
h2 { font-size: var(--ps-fs-h2); line-height: 1.12; letter-spacing: -0.03em; }
h3 { font-size: var(--ps-fs-h3); line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--ps-brand); text-underline-offset: 0.18em; }
a:hover { color: var(--ps-brand-dark); }
:focus-visible { outline: 3px solid var(--ps-focus); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--ps-max); margin-inline: auto; padding-inline: var(--ps-gutter); }
.section { padding-block: var(--ps-space-section); }
.eyebrow { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ps-brand); margin-bottom: 0.75rem; }
.lead { font-size: var(--ps-fs-lead); color: var(--ps-muted); line-height: 1.6; max-width: 38em; }
.muted { color: var(--ps-muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.75rem 1rem; background: var(--ps-ink); color: var(--ps-paper); border-radius: var(--ps-r-control); }
.skip-link:focus { top: 1rem; color: var(--ps-paper); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; min-height: 3rem;
  padding: 0.75rem 1.4rem; border-radius: var(--ps-r-control); border: 2px solid transparent;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  background: var(--ps-brand); color: #fff; transition: background var(--ps-duration) var(--ps-ease), box-shadow var(--ps-duration) var(--ps-ease);
}
.btn:hover { background: var(--ps-brand-dark); color: #fff; box-shadow: var(--ps-shadow-hover); }
.btn svg { width: 1.1rem; height: 1.1rem; flex: none; }
.btn--small { min-height: 2.75rem; padding: 0.55rem 1rem; font-size: 0.9375rem; }
.btn--ghost { background: transparent; color: var(--ps-ink); border-color: var(--ps-line); }
.btn--ghost:hover { background: var(--ps-surface); color: var(--ps-ink); box-shadow: none; }
.link-strong { font-weight: 700; color: var(--ps-ink); }

/* ---------- En-tête ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgb(246 244 237 / 0.94); border-bottom: 1px solid var(--ps-line); backdrop-filter: saturate(140%) blur(8px); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: var(--ps-header-h); }
.brand { display: inline-flex; flex: none; }
.brand img { width: 11.5rem; height: auto; }
.nav { display: flex; align-items: center; gap: 1.75rem; }
.nav__list { display: flex; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.nav__list a { color: var(--ps-ink); font-weight: 600; text-decoration: none; padding: 0.4rem 0; }
.nav__list a:hover { text-decoration: underline; }
.menu-toggle { display: none; }

@media (max-width: 959px) {
  .js .menu-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.5rem 0.9rem;
    font: inherit; font-weight: 700; color: var(--ps-ink); background: var(--ps-surface);
    border: 1px solid var(--ps-line); border-radius: var(--ps-r-control); cursor: pointer;
  }
  .menu-toggle svg { width: 1.25rem; height: 1.25rem; }
  .js .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 1rem;
    padding: 1rem var(--ps-gutter) 1.5rem; background: var(--ps-paper); border-bottom: 1px solid var(--ps-line); box-shadow: var(--ps-shadow);
  }
  .js .nav.is-open { display: flex; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__list a { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--ps-line); }
  /* sans JavaScript : la navigation reste visible sous le logo */
  html:not(.js) .site-header__inner { flex-wrap: wrap; padding-block: 0.75rem; }
  html:not(.js) .nav { flex-wrap: wrap; gap: 0.75rem; }
  html:not(.js) .nav__list { flex-direction: row; flex-wrap: wrap; gap: 0.25rem 1rem; }
  html:not(.js) .nav__list a { border: 0; padding: 0.25rem 0; }
}

/* ---------- Introduction ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem); }
.hero__grid { display: grid; gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
@media (min-width: 960px) { .hero__grid { grid-template-columns: 52fr 48fr; } }
.hero h1 { font-size: var(--ps-fs-h1); font-weight: 800; max-width: 12ch; margin-bottom: 1.25rem; }
.hero h1 em { font-style: normal; color: var(--ps-brand); }
.hero__text p + p { margin-top: 0.75rem; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.75rem; }
.hero__note { margin-top: 1rem; font-size: var(--ps-fs-small); color: var(--ps-muted); }
.hero__media img { width: 100%; max-height: 34rem; aspect-ratio: 1; object-fit: contain; border-radius: var(--ps-r-feature); background: #f3e9d9; }
@media (max-width: 959px) { .hero__media img { max-height: 22rem; } }

.profiles { display: grid; gap: 0.5rem 1.5rem; align-items: center; margin-top: clamp(2rem, 4vw, 3rem); padding-block: 1.1rem; border-block: 1px solid var(--ps-line); }
.profiles p { font-size: 0.9375rem; color: var(--ps-muted); }
.profiles ul { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; padding: 0; list-style: none; font-weight: 700; }
@media (min-width: 960px) { .profiles { grid-template-columns: auto 1fr; } .profiles ul { justify-content: space-around; } }

/* ---------- Catégories ---------- */
.section-head { display: grid; gap: 1rem; margin-bottom: 2rem; }
@media (min-width: 960px) { .section-head { grid-template-columns: 1.4fr 1fr; align-items: end; } }
.section-head p { color: var(--ps-muted); }

.search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 1.75rem; }
.search[hidden] { display: none; }
.search__field { display: flex; flex-direction: column; gap: 0.35rem; flex: 1 1 18rem; max-width: 28rem; }
.search label { font-weight: 700; font-size: 0.9375rem; }
.search input {
  min-height: 3rem; padding: 0.65rem 0.9rem; font: inherit; color: var(--ps-ink); background: var(--ps-surface);
  border: 1px solid var(--ps-muted); border-radius: var(--ps-r-control);
}
.search__status { width: 100%; font-size: 0.9375rem; color: var(--ps-muted); min-height: 1.5em; }
.search__empty { padding: 1.5rem; border-radius: var(--ps-r-card); background: var(--ps-surface); border: 1px dashed var(--ps-muted); }
.search__empty[hidden] { display: none; }

.cards { display: grid; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(6, 1fr); }
  .cards > li { grid-column: span 2; }
  .cards > li:nth-child(4):nth-last-child(2) { grid-column: 2 / span 2; }
}
.cards > li[hidden] { display: none; }
.card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--ps-surface);
  border: 1px solid var(--ps-line); border-radius: var(--ps-r-card); box-shadow: var(--ps-shadow);
  transition: box-shadow var(--ps-duration) var(--ps-ease);
}
.card:hover { box-shadow: var(--ps-shadow-hover); }
.card__media { background: #f3e9d9; }
.card__media img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; }
.card__body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; padding: 1.5rem; }
.card__tag { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ps-brand); }
.card__tag svg { width: 1.15rem; height: 1.15rem; }
.card__body p { color: var(--ps-muted); font-size: 1rem; }
.card__link { margin-top: auto; padding-top: 0.75rem; display: inline-flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9375rem; }
.card__link svg { width: 1.1rem; height: 1.1rem; flex: none; }

/* ---------- Détails des rubriques ---------- */
.details { display: grid; gap: 1.25rem; margin-top: clamp(2.5rem, 5vw, 4rem); }
.detail {
  display: grid; gap: 0.75rem; padding: clamp(1.5rem, 3vw, 2rem); background: var(--ps-surface);
  border: 1px solid var(--ps-line); border-radius: var(--ps-r-card); scroll-margin-top: calc(var(--ps-header-h) + 1rem);
}
.detail:target { border-color: var(--ps-brand); box-shadow: 0 0 0 3px rgb(24 117 104 / 0.18); }
.detail__head { display: flex; align-items: center; gap: 0.75rem; }
.detail__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: none; border-radius: 0.75rem; background: rgb(24 117 104 / 0.1); color: var(--ps-brand); }
.detail__icon svg { width: 1.4rem; height: 1.4rem; }
.detail p { max-width: 46em; }
.detail__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.detail__pages { margin-top: 0.25rem; padding-top: 1rem; border-top: 1px solid var(--ps-line); }
.detail__pages h4 { margin: 0 0 0.5rem; font-size: 0.9375rem; color: var(--ps-muted); }
.detail__pages ul { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 600px) { .detail__pages ul { grid-template-columns: repeat(2, 1fr); } }
.detail__pages a { font-weight: 600; }
.ext::after { content: " ↗"; }

/* ---------- Publics ---------- */
.section--alt { background: var(--ps-surface); border-block: 1px solid var(--ps-line); }
.audiences { display: grid; gap: 1rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
@media (min-width: 600px) { .audiences { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .audiences { grid-template-columns: repeat(4, 1fr); } }
.audience { padding: 1.5rem; border-radius: var(--ps-r-card); background: var(--ps-paper); border: 1px solid var(--ps-line); }
.audience h3 { font-size: 1.1875rem; margin-bottom: 0.4rem; }
.audience p { color: var(--ps-muted); font-size: 1rem; }

/* ---------- Démarches ---------- */
.steps { display: grid; gap: 1.25rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
@media (min-width: 960px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { padding: 1.5rem; border-radius: var(--ps-r-card); background: var(--ps-surface); border: 1px solid var(--ps-line); }
.step__n { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; margin-bottom: 0.9rem; border-radius: 50%; background: var(--ps-ink); color: var(--ps-paper); font-weight: 800; }
.step h3 { font-size: 1.1875rem; margin-bottom: 0.4rem; }
.step p { color: var(--ps-muted); font-size: 1rem; }
.notice { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 1.5rem; padding: 1.25rem 1.5rem; border-radius: var(--ps-r-card); background: var(--ps-sand); color: var(--ps-ink); }
.notice svg { width: 1.4rem; height: 1.4rem; flex: none; margin-top: 0.15rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 50rem; display: grid; gap: 0.75rem; }
.faq details { background: var(--ps-surface); border: 1px solid var(--ps-line); border-radius: var(--ps-r-card); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem;
  font-weight: 700; font-size: 1.0625rem; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 0.6rem; height: 0.6rem; border-right: 2px solid var(--ps-brand); border-bottom: 2px solid var(--ps-brand); transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--ps-duration) var(--ps-ease); }
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq details > div { padding: 0 1.4rem 1.25rem; color: var(--ps-muted); }

/* ---------- Invitation finale ---------- */
.cta-final { text-align: center; }
.cta-final .lead { margin: 1rem auto 1.75rem; }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--ps-ink); color: var(--ps-paper); padding-block: 3rem 2rem; }
.site-footer a { color: var(--ps-paper); }
.site-footer :focus-visible { outline-color: var(--ps-paper); }
.footer__grid { display: grid; gap: 2rem; }
@media (min-width: 960px) { .footer__grid { grid-template-columns: 1fr 1.3fr; } }
.footer__brand img { width: 11.5rem; height: auto; }
.footer__brand p { margin-top: 0.75rem; opacity: 0.9; }
.footer__text p + p { margin-top: 0.75rem; }
.footer__text { font-size: 0.9375rem; opacity: 0.92; }
.footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 2rem 0 0; padding: 1.5rem 0 0; list-style: none; border-top: 1px solid rgb(246 244 237 / 0.2); font-size: 0.9375rem; }
