/* Ambiance « automne » : sous-bois d'octobre a l'heure doree. Classe .mpc-automne posee sur <body> par mpc-site
   (meta mpc_ambiance de l'article, includes/ambiance.php). Le decor est en CSS ; les feuilles et les titres : automne.js. */

.mpc-automne {
  --mpc-bois-1: #12130E;
  --mpc-bois-2: #1A1811;
  --mpc-bois-3: #2A1F14;
  --mpc-soleil: #E9A24A;
  --mpc-or: #F2DDB4;
  background: var(--mpc-bois-2);
}

/* Le sous-bois : un soleil bas a gauche, une brume froide en haut a droite. Calque fixe, compose une fois. */
.mpc-automne::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(70% 60% at 0% 92%, color-mix(in srgb, var(--mpc-soleil) 38%, transparent), transparent 64%),
    radial-gradient(40% 30% at 6% 86%, color-mix(in srgb, #F7D08A 26%, transparent), transparent 70%),
    radial-gradient(70% 45% at 100% 0%, color-mix(in srgb, #7E8A6C 20%, transparent), transparent 72%),
    linear-gradient(180deg, var(--mpc-bois-1) 0%, var(--mpc-bois-2) 50%, var(--mpc-bois-3) 100%);
}
/* Les rais de lumiere qui traversent les branches, depuis le soleil : fixes, a peine visibles */
.mpc-automne::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .5;
  background: repeating-conic-gradient(from 18deg at -8% 104%,
    transparent 0deg 3.2deg, rgb(247 208 138 / .07) 3.6deg 4.4deg, transparent 5deg 7.4deg,
    rgb(247 208 138 / .04) 7.8deg 8.3deg, transparent 8.8deg 12deg);
  -webkit-mask: radial-gradient(85% 85% at 0% 100%, #000 10%, transparent 75%);
          mask: radial-gradient(85% 85% at 0% 100%, #000 10%, transparent 75%);
}

/* Les feuilles qui tombent : derriere le texte, devant le sous-bois */
.mpc-feuilles-toile { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; transition: opacity 1.2s var(--mpc-souple); }
.mpc-feuilles-toile.is-eteinte { opacity: 0; }

/* Tete et corps de l'article : couleurs du sous-bois. La suite (cartes creme) et la barre gardent les leurs. */
.mpc-automne .mpc-article-tete,
.mpc-automne .mpc-article-corps {
  --mpc-titre: #F6EBDA;
  --mpc-texte: #DDD1BF;
  --mpc-filet: rgb(255 240 215 / .14);
  --mpc-carte: rgb(255 240 215 / .045);
  --mpc-terre: #F0A868;
  --mpc-terre-fonce: #F7D2A0;
  --mpc-fond: var(--mpc-bois-2);
  color: var(--mpc-texte);
}
/* Sans image a la une, la tete descend sous la barre */
.mpc-automne main:not(:has(.mpc-article-figure img, .wp-block-post-featured-image img)) .mpc-article-tete { padding-top: clamp(140px, 10vw + 80px, 200px); }

/* Le H1 qui murit : du vert tendre a l'or, de gauche a droite. Jamais transparent a l'oeil (element LCP) :
   le texte est peint par son degrade des le premier affichage. */
.mpc-automne .mpc-article-titre {
  color: var(--mpc-or);
  background: linear-gradient(100deg, #F2DDB4 0%, #F4E6C8 18%, #E9BE78 34%, #DE8F55 44%, #C9A35A 52%, #A7AE6A 62%, #8FA060 100%) 0 0 / 300% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  background-position: 0% 0;
  animation: mpc-murir 3.6s cubic-bezier(.45, 0, .2, 1) .4s both;
}
@keyframes mpc-murir { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* Les H2 en or pale : la lumiere basse. Taille optique automatique (le canvas des feuilles posees ignore l'opsz 72). */
.mpc-automne .mpc-article-texte h2 { position: relative; color: #EBC98C; font-variation-settings: normal; }
.mpc-automne .mpc-article-texte a { color: var(--mpc-terre); }
.mpc-automne .mpc-article-texte a:hover { color: var(--mpc-terre-fonce); }
.mpc-automne .mpc-teinte { --mpc-l1: #F6C76B; --mpc-l2: #D9774A; --mpc-l3: #FBE3B0; }
.mpc-automne .mpc-suite-titre { color: #F6EBDA; }
/* Les titres H3 a H6 prennent le preset « titre » des styles globaux, pas le token : on les rebranche */
.mpc-automne .mpc-article-texte :is(h3, h4, h5, h6) { color: var(--mpc-titre); }
/* Surfaces a fond clair fixe (encadre, Sources) : tokens de jour, comme sur Noel */
.mpc-automne :is(.is-style-mpc-encart, .is-style-mpc-sources) {
  --mpc-terre: var(--wp--preset--color--primary); --mpc-terre-fonce: var(--wp--preset--color--accent);
  --mpc-texte: var(--wp--preset--color--basecolor); --mpc-titre: var(--wp--preset--color--titre);
  --mpc-filet: var(--wp--preset--color--lightborder); color: var(--mpc-texte);
}
/* Appels de note et pastille de rubrique : fond clair, encre sombre */
.mpc-automne .wp-block-post-content sup a[href^="#source-"],
.mpc-automne .wp-block-post-content sup a[href^="#source-"]:hover { color: var(--mpc-bois-2); }
.mpc-automne .mpc-pastille:not(.mpc-pastille--bleue) { --mpc-p-texte: var(--wp--preset--color--titre); }

/* La feuille posee sur un H2 (toile calculee par automne.js) */
.mpc-feuille-posee { position: absolute; left: 0; pointer-events: none; }

/* Interrupteur des feuilles */
.mpc-feuilles-bouton {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px 10px; border: 0; border-radius: 999px;
  background: rgb(255 240 215 / .10); color: #F6EBDA; backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgb(255 240 215 / .18);
  font-family: var(--mpc-mono); font-size: var(--mpc-fs-mono); letter-spacing: .04em; cursor: pointer;
  transition: background var(--mpc-survol);
}
.mpc-feuilles-bouton:hover { background: rgb(255 240 215 / .18); }
.mpc-feuilles-bouton svg { width: 15px; height: 15px; }

@media (prefers-reduced-motion: reduce) {
  .mpc-automne .mpc-article-titre { animation: none; background-position: 0% 0; }
}
