/* ==========================================================================
   SOLUM — page des programmes
   S'appuie sur styles.css. Les graphiques reposent sur une surface claire
   (#ecebe4), sur laquelle la palette des programmes a été validée.
   ========================================================================== */

/* Le haut de page n'a pas de limite d'horizon au-dessus de lui */
.pg-hero::before { display: none; }
.pg-detail { padding-top: clamp(2rem, 4vw, 3rem); }
.pg-detail::before { display: none; }

/* --------------------------------------------------------------- Héros */

.pg-hero { padding-top: clamp(7rem, 14vw, 10rem); }

.pg-back { margin-bottom: 2.4rem; font-size: .98rem; }
.pg-back a { display: inline-flex; align-items: center; min-height: 44px; text-decoration-thickness: 1px; text-underline-offset: 3px; opacity: .9; }
.pg-back a:hover { opacity: 1; }

.pg-hero h1 {
  font-size: clamp(2.4rem, 8.4vw, 7.4rem);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  line-height: .9;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
  max-width: 12ch;
}

.pg-hero__figure {
  margin: clamp(2.5rem, 5vw, 4rem) 0 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(238, 233, 223, .3);
}
.pg-hero__label { margin: 0 0 .4rem; font-size: 1rem; opacity: .8; }
.pg-hero__value {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 118;
  font-size: clamp(2.4rem, 12.5vw, 7rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.pg-warning {
  max-width: 40em;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(238, 233, 223, .35);
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1.5;
}
.pg-warning strong { font-family: var(--display); font-weight: 700; }

/* ----------------------------------------------------------- Synthèse */

.pg-figure { margin: 0 0 clamp(3.5rem, 7vw, 5rem); }
.pg-figure figcaption { margin-bottom: 1.4rem; }
.pg-figure figcaption h3 { font-size: var(--fs-2); margin-bottom: .4rem; }
.pg-figure figcaption p { margin: 0; font-size: 1rem; opacity: .75; }

/* Barre de répartition : 2 px d'écart entre segments, extrémités arrondies */
.share {
  display: flex;
  gap: 2px;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.4rem;
}
.share__seg {
  min-width: 3px;
  flex-basis: 0;
  cursor: default;
  transition: opacity .2s ease;
}
.share:hover .share__seg:not(:hover) { opacity: .45; }
.share__seg:focus-visible { outline-offset: 2px; }

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  column-gap: 2rem;
  border-top: 1px solid rgba(29, 24, 19, .2);
}
.legend a {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 3.4rem;
  gap: .7rem;
  align-items: baseline;
  padding: .7rem 0;
  border-bottom: 1px solid rgba(29, 24, 19, .2);
  text-decoration: none;
}
.legend a:hover .legend__name { text-decoration: underline; text-underline-offset: 3px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; align-self: center; }
.legend__name { font-family: var(--display); font-weight: 600; font-variation-settings: "wdth" 104; font-size: 1rem; }
.legend__value, .legend__pct {
  font-family: var(--display);
  font-feature-settings: "tnum";
  font-size: .98rem;
  text-align: right;
}
.legend__value { font-weight: 700; }
.legend__pct { opacity: .65; }

/* Graphique en marches */
.pg-flow, .pg-mini__chart { position: relative; width: 100%; }
.pg-flow svg, .pg-mini__chart svg { display: block; overflow: visible; }

.viz-grid { stroke: rgba(29, 24, 19, .14); stroke-width: 1; }
.viz-tick {
  fill: rgba(29, 24, 19, .72);
  font-family: var(--display);
  font-size: 12px;
  font-feature-settings: "tnum";
}
.viz-period {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
}
.viz-cap {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 700;
}
.viz-col path { transition: opacity .2s ease; }
.is-hovering .viz-col:not(.is-active) path { opacity: .4; }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:focus-visible { stroke: var(--ink); stroke-width: 2; }

/* Infobulle : la valeur d'abord, le nom ensuite, une clé en trait */
.viz-tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 90;
  min-width: 220px;
  max-width: 320px;
  padding: .75rem .9rem .8rem;
  background: var(--ink);
  color: var(--mycelium);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  font-size: .9rem;
  line-height: 1.35;
  pointer-events: none;
}
.viz-tip[hidden] { display: none; }
.viz-tip__title {
  margin: 0 0 .5rem;
  font-family: var(--display);
  font-size: .8rem;
  opacity: .75;
}
.viz-tip__row {
  display: grid;
  grid-template-columns: 14px auto minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  margin: .2rem 0 0;
}
.viz-tip__row strong {
  font-family: var(--display);
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.viz-tip__row span:last-child { opacity: .78; }
.viz-tip__key { width: 14px; height: 3px; border-radius: 2px; }
.viz-tip__row:not(:has(.viz-tip__key)) { grid-template-columns: auto minmax(0, 1fr); }

/* Tableau */
.pg-data { margin-bottom: clamp(4rem, 8vw, 6rem); }
.pg-data summary {
  min-height: 44px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  padding: .6rem 0;
}
.pg-table-wrap { overflow-x: auto; margin-top: 1rem; }
.pg-table-wrap table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: .95rem;
}
.pg-table-wrap th, .pg-table-wrap td {
  padding: .6rem .8rem .6rem 0;
  border-bottom: 1px solid rgba(29, 24, 19, .2);
  text-align: right;
  vertical-align: bottom;
}
.pg-table-wrap th:first-child { text-align: left; }
.pg-table-wrap thead th {
  font-family: var(--display);
  font-weight: 600;
  font-size: .88rem;
  border-bottom: 2px solid var(--ink);
}
.pg-table-wrap thead small { display: block; font-weight: 400; opacity: .7; }
.pg-table-wrap td { font-family: var(--display); font-feature-settings: "tnum"; }
.pg-table-wrap tbody th { font-family: var(--display); font-weight: 600; }
.pg-table-wrap .is-total td, .pg-table-wrap td.is-total { font-weight: 700; }
.pg-table-wrap tr.is-total th, .pg-table-wrap tr.is-total td { border-top: 2px solid var(--ink); }

/* Sources de financement */
.pg-sources h3 { font-size: var(--fs-3); margin-bottom: 1.4rem; }
.pg-sources dl {
  margin: 0 0 1.6rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem 2rem;
}
.pg-sources dl > div { padding-top: .9rem; border-top: 2px solid var(--ink); }
.pg-sources dt { font-family: var(--display); font-weight: 700; font-variation-settings: "wdth" 106; margin-bottom: .3rem; }
.pg-sources dd { margin: 0; font-size: 1rem; line-height: 1.5; }
.pg-sources > p { font-size: 1.05rem; max-width: 40em; }

/* ----------------------------------------------------- Fiches programme */

.pg-index {
  position: sticky;
  top: 62px;
  z-index: 40;
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding: .8rem 0;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  background: #ecebe4;
  border-bottom: 1px solid rgba(29, 24, 19, .15);
  scrollbar-width: none;
}
.pg-index::-webkit-scrollbar { display: none; }
.pg-index a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .85rem;
  border: 1px solid rgba(29, 24, 19, .3);
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  white-space: nowrap;
}
.pg-index a::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.pg-index a:hover { border-color: var(--ink); }

.pg-prog {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem);
  border-top: 2px solid var(--ink);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  scroll-margin-top: 8.5rem;
}
.pg-prog:first-child { margin-top: 2rem; }

.pg-prog__head { max-width: 52rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.pg-prog__domain {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 1rem;
}
.pg-prog__domain .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.pg-prog h2 { font-size: var(--fs-5); margin-bottom: 1.2rem; max-width: 20ch; }

.pg-prog__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}

.pg-prog__total { margin: 0 0 1.6rem; display: grid; gap: .3rem; }
.pg-fig {
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 118;
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.pg-fig__label { font-size: 1rem; opacity: .75; }
.pg-fig__note {
  justify-self: start;
  margin-top: .4rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  font-family: var(--display);
  font-weight: 600;
  font-size: .92rem;
}

.pg-mini { margin: 0; }
.pg-mini figcaption { margin-top: .6rem; font-size: .9rem; opacity: .7; }

.pg-prog__alloc h3 { font-size: 1.3rem; margin-bottom: .5rem; }
.pg-scope { font-size: 1rem; opacity: .8; margin-bottom: 1.2rem; }

.pg-subs { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(29, 24, 19, .2); }
.pg-subs li { padding: 1.05rem 0 1.1rem; border-bottom: 1px solid rgba(29, 24, 19, .2); }
.pg-sub__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: .55rem;
}
.pg-sub__top h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: "wdth" 106;
  font-size: 1.08rem;
  line-height: 1.25;
}
.pg-sub__val {
  margin: 0;
  display: flex;
  gap: .7rem;
  align-items: baseline;
  white-space: nowrap;
  font-family: var(--display);
  font-feature-settings: "tnum";
}
.pg-sub__val strong { font-size: 1.05rem; }
.pg-sub__val span { font-size: .92rem; opacity: .65; min-width: 3.2rem; text-align: right; }
.pg-sub__bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(29, 24, 19, .08);
  margin-bottom: .6rem;
  overflow: hidden;
}
.pg-sub__bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c); }
.pg-sub__desc { margin: 0; font-size: 1rem; line-height: 1.5; max-width: none; }

.pg-blocks {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 1.5rem clamp(1.5rem, 3vw, 2.5rem);
}
.pg-blocks > div { padding-top: 1rem; border-top: 2px solid var(--ink); }
.pg-blocks h3 { font-size: 1.1rem; margin-bottom: .8rem; }
.pg-blocks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.pg-blocks li { position: relative; padding-left: 1.1rem; font-size: 1rem; line-height: 1.45; }
.pg-blocks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .7em;
  width: .55rem;
  height: 2px;
  background: var(--c);
}

.pg-miles { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.pg-miles h3 { font-size: 1.3rem; margin-bottom: 1.2rem; }
.pg-miles ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}
.pg-miles li {
  padding: 1rem 1.1rem 1.2rem;
  background: rgba(29, 24, 19, .05);
  border-top: 3px solid var(--c);
}
.pg-miles p { margin: 0; }
.pg-miles__years { font-family: var(--display); font-size: .85rem; opacity: .7; font-feature-settings: "tnum"; }
.pg-miles__name { font-family: var(--display); font-weight: 700; font-size: 1.02rem; margin-top: .15rem !important; }
.pg-miles__money {
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  font-size: 1.4rem;
  margin: .6rem 0 .5rem !important;
}
.pg-miles__text { font-size: .98rem; line-height: 1.45; }

/* --------------------------------------------------------- Responsive */

@media (max-width: 960px) {
  .pg-sources dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-miles ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .pg-prog__grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pg-sources dl, .pg-miles ol { grid-template-columns: 1fr; }
  .legend a { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .legend__pct { display: none; }
  .pg-sub__top { flex-direction: column; gap: .2rem; }
}

/* Objectif chiffré d'un programme */
.pg-target {
  margin: 1.4rem 0 0;
  padding: .9rem 1.1rem;
  max-width: 40em;
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "wdth" 104;
  font-size: 1.08rem;
  line-height: 1.4;
}

/* Budget hors programme (l'institution) : signalé par un trait discontinu */
.pg-prog--transversal { border-top-style: dashed; }
.pg-index a.is-transversal { border-style: dashed; }

.pg-index a { min-height: 44px; }

/* Très petits écrans : titres ajustés à la largeur, sans césure (voir styles.css) */
@media (max-width: 420px) {
  .pg-hero h1 { font-size: clamp(2rem, 10.8vw, 2.4rem); font-variation-settings: "wdth" 108; }
  .pg-prog h2 { font-size: clamp(2rem, 10.2vw, 2.6rem); font-variation-settings: "wdth" 100; }
}
