/* Mode nuit : surcharges isolées, les règles du mode clair restent intactes. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000;
  --bg-soft: #111;
  --paper: #000;
  --ink: #fff;
  --muted: #bbb;
  --line: rgba(255,255,255,.2);
  --agf2-black: #000;
  --agf2-white: #fff;
}

/* Fonds de page et grandes sections, y compris les anciens aplats orange. */
html[data-theme="dark"] body :is(
  .agf2-content, .agf2-section, .agf2-about, .agf2-proof, .agf2-directions, .agf2-latest,
  .packs-page, .packs-booking, .web-page, .web-value, .web-faq, .web-ribbon,
  .studio-page, .about-story, .about-career, .about-approach,
  .key-definition, .key-actions, .key-stakes, .key-questions,
  .standard-page, .standard-page__article, .standard-page__hero,
  .site-footer, .site-footer-cta, .agf2-footer
) {
  background: #000;
  color: #fff;
}
html[data-theme="dark"] body :is(.packs-hero, .web-hero, .about-hero, .key-hero, .studio-contact) {
  background-color: #000;
  color: #fff;
}
/* Garder les halos sur une base noire, même après les surcharges des sections. */
html[data-theme="dark"] body .packs-hero {
  background-image: radial-gradient(ellipse at 95% 40%,#ff4b1b22,transparent 55%);
}
html[data-theme="dark"] body .about-hero {
  background-image: radial-gradient(ellipse at 75% 30%,#ff4b1b20,transparent 55%);
}
html[data-theme="dark"] body .key-hero {
  background-image: radial-gradient(ellipse at 85% 40%,rgba(var(--key-rgb),.13),transparent 55%);
}
html[data-theme="dark"] body .studio-contact {
  background-image: radial-gradient(ellipse at 0 15%,#ff4b1b15,transparent 50%);
}
html[data-theme="dark"] .web-page { --web-black: #000; }
html[data-theme="dark"] .site-header { background: rgba(0,0,0,.96); }
html[data-theme="dark"] .agf2-scene { background-color: #000; }
html[data-theme="dark"] .agf2-loader { background: #000; }

/* Cartes et aperçus : surfaces discrètes, sans blanc ni crème. */
html[data-theme="dark"] body :is(
  .pack-card, .contact-paper, .key-practical, .web-browser, .web-demo,
  .expertise-phone, .expertise-result, .web-offer, .skip-link
) {
  background: #111;
  color: #fff;
}
html[data-theme="dark"] .key-page { --key-ink: var(--key-accent); }
html[data-theme="dark"] body :is(.agf2-section h2, .agf2-about__lead,
  .web-offer .web-offer__price, .pack-link, .key-definition h2 > span,
  .key-stakes .key-source, .web-faq summary span) { color: #fff; }
html[data-theme="dark"] .text-dark { color: #fff !important; }
html[data-theme="dark"] .text-dark::before { background: #fff; }
html[data-theme="dark"] .agf2-about__copy:after { color: #1b1b1b; }
html[data-theme="dark"] body :is(
  .agf2-about__copy p:not(.agf2-about__lead), .about-bio,
  .career-heading > p:not(.studio-kicker), .career-entry p,
  .web-section__head > p, .web-offer p:not(.web-kicker), .web-steps p,
  .web-value__grid > div > p:not(.web-kicker), .web-faq details p,
  .pack-card__price span, .pack-delay span, .pack-delay small,
  .pack-card__summary p, .pack-card__lead, .key-scope, .key-stakes article p,
  .key-practical-before > span, .key-practical-after > span, .key-practical-before p,
  .expertise-result small, .expertise-result p, .prose-content p, .prose-content li,
  .contact-form-heading > span, .contact-label > span, .contact-privacy,
  .contact-note, [data-message-count]
) { color: #bbb; }
html[data-theme="dark"] .career-entry .career-date { color: #ff754f; }

/* Titres détourés : contour clair sur les nouvelles surfaces noires. */
html[data-theme="dark"] body :is(
  .agf2-section#expertises h2 span, .agf2-about h2 span,
  .about-career .studio-outline, .about-approach .studio-outline,
  .key-stakes .studio-outline, .key-actions h2 .studio-outline,
  .packs-booking h2 span, .web-faq h2 span
) { -webkit-text-stroke-color: #fff; }
html[data-theme="dark"] body :is(
  .agf2-directions .agf2-kicker, .about-approach .studio-kicker,
  .web-page .web-faq .web-kicker, .packs-page .packs-booking .eyebrow
) { color: #ff4b1b; }
html[data-theme="dark"] .key-page .key-questions :is(.studio-kicker, h2 > span) {
  color: var(--key-accent);
}

/* Séparateurs visibles sur fond sombre, sans toucher aux bordures d'accent. */
html[data-theme="dark"] body :is(
  .pack-card:not(.pack-card--featured), .pack-card__price, .pack-details summary,
  .pack-features li, .web-offer, .web-offer li, .web-faq details,
  .key-practical-top, .key-stakes article, .key-scope, .key-discuss,
  .key-example, .key-checklist details, .career-entry, .about-signature,
  .contact-form-heading, .contact-services label > span, .post-card, .post-list,
  .agf2-directions a
) { border-color: #444; }
html[data-theme="dark"] .career-timeline li:not(:last-child)::before { background: #444; }
html[data-theme="dark"] .web-steps li:not(:last-child)::after { border-color: #555; }
html[data-theme="dark"] .web-steps__icon span { border-color: #000; }

/* Champs, sélection et erreurs du formulaire. */
html[data-theme="dark"] .contact-paper :is(
  input:not([type=radio]):not([type=checkbox]):not([type=hidden]), textarea, select
) { background: #111; color: #fff; border-bottom-color: #777; }
html[data-theme="dark"] .contact-paper :is(input, textarea)::placeholder { color: #aaa; }
html[data-theme="dark"] .contact-paper option { background: #111; color: #fff; }
html[data-theme="dark"] .contact-services input:checked + span {
  background: #242424;
  border-color: #ff4b1b;
  color: #fff;
}
html[data-theme="dark"] .contact-services label:hover > span { border-color: #ff4b1b; }
html[data-theme="dark"] .field-error { color: #ff947a; }
html[data-theme="dark"] .contact-paper [aria-invalid=true] { border-color: #ff947a !important; }

/* Aucun bouton blanc au repos, au survol ou au clavier. */
html[data-theme="dark"] body :is(.web-btn--light, .web-demo__button) {
  background: #222;
  color: #fff;
  border-color: #777;
}
html[data-theme="dark"] body :is(.packs-page .btn, .key-page .studio-button,
  .web-btn--light, .web-demo__button):is(:hover, :focus-visible) {
  background: #242424;
  color: #fff;
}
html[data-theme="dark"] .pack-link:is(:hover, :focus-visible) { color: #ff4b1b; }
html[data-theme="dark"] .key-page .key-questions :is(a, summary):focus-visible {
  outline-color: var(--key-accent);
}

/* Blocs Gutenberg avec couleurs explicites dans les pages éditoriales. */
html[data-theme="dark"] :is(.prose-content, .content-page__body) .has-background {
  background-color: #111 !important;
  background-image: none !important;
  color: #fff !important;
}
html[data-theme="dark"] :is(.prose-content, .content-page__body) .has-text-color {
  color: #fff !important;
}

/* Safari iOS emploie une ombre plutôt qu'un contour de texte. */
@supports (-webkit-touch-callout: none) {
  html[data-theme="dark"] body :is(
    .agf2-section#expertises h2 span, .agf2-about h2 span, .web-faq h2 span
  ) {
    color: #000 !important;
    -webkit-text-fill-color: #000;
    -webkit-text-stroke: 0;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
  }
  html[data-theme="dark"] .web-page :is(.web-method, .web-offers) h2 span {
    color: #000 !important;
  }
}
