/* v51.css — gabarit V5.1 « outil en premier écran » (spec § 5.6). Identité brutal-2026, chargé sur body.v51 seulement ;
   grille 8 px, transitions 0,2 s ; mode sombre écran seulement, jamais sur les pubs ni les bannières. */
body.v51 { --v51-primary: #C44200; --v51-accent: #004E89; --v51-bg: #FAFAFA; --v51-ink: #1A1A1A; --v51-surface: #FFFFFF; --v51-err: #B00020; --v51-err-bg: #FFF5F5; --v51-sticky-offset: 0px; }

/* H1 casse normale, 2e partie en sous-titre ; titres de l'outil */
body.v51 h1 { text-transform: none; font-size: clamp(1.5rem, 1rem + 2.6vw, 2.6rem); line-height: 1.15; margin: 16px 0; overflow-wrap: anywhere; }
body.v51 h1.v51-h1-long { font-size: clamp(1.25rem, 0.9rem + 1.6vw, 2.2rem); }
body.v51 .v51-h1-sub { display: block; margin-top: 8px; font-size: clamp(1rem, 0.9rem + 0.6vw, 1.25rem); font-weight: 600; line-height: 1.35; text-transform: none; }
body.v51 .v51-tool :is(h2, h3) { text-transform: none !important; font-size: clamp(1.1rem, 1rem + 1vw, 1.5rem) !important; line-height: 1.25; }

/* Fil d'Ariane sur une ligne */
body.v51 .breadcrumb ol { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
body.v51 .breadcrumb li { flex: 0 0 auto; }

/* Carte résultat */
body.v51 .v51-tool { scroll-margin-top: 16px; }
body.v51 .v51-result { scroll-margin: 16px; transition: box-shadow 0.2s, transform 0.2s; }
body.v51 .v51-result.v51-error { visibility: hidden; height: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; }
body.v51 .v51-primary { display: block; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem) !important; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
body.v51 .v51-note { margin: 16px 0 0; padding: 16px; border: 3px dashed var(--v51-ink); background: var(--v51-surface); color: var(--v51-ink); font-weight: 600; line-height: 1.5; }
body.v51 .v51-note.v51-error-msg { border-style: solid; border-color: var(--v51-err); background: var(--v51-err-bg); color: var(--v51-err); box-shadow: 4px 4px 0 var(--v51-err); }
body.v51 :is(.v51-note, .v51-actions, .v51-field-msg)[hidden] { display: none; }

/* Actions, « Reprendre », erreurs de saisie, focus */
body.v51 .v51-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
body.v51 .v51-btn { min-height: 44px; padding: 8px 16px; border: 3px solid var(--v51-ink); background: var(--v51-surface); color: var(--v51-ink); font: inherit; font-size: 0.9375rem; font-weight: 700; text-transform: none; box-shadow: 4px 4px 0 var(--v51-ink); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
body.v51 .v51-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--v51-ink); }
body.v51 .v51-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--v51-ink); }
body.v51 :is(.v51-tool, main, .breadcrumb) :focus-visible { outline: 3px solid var(--v51-accent); outline-offset: 2px; }
body.v51 .v51-restore { display: block; margin: 8px 0 16px; background: #FFE66D; color: #1A1A1A; }
body.v51 .v51-field-msg { display: block; margin-top: 8px; color: var(--v51-err); font-size: 0.875rem; font-weight: 600; }
body.v51 .v51-tool [aria-invalid="true"] { border-color: var(--v51-err) !important; }

/* Barre collante mobile (après la 1re interaction, bouton d'origine hors écran, au-dessus de l'ancre Mediavine) ;
   sa place réservée en fin d'outil évite qu'un champ reste dessous */
body.v51 .v51-sticky { display: none; }
@media (max-width: 767px) {
  body.v51 .v51-tool.v51-sticky-on .v51-sticky { display: block; position: sticky; bottom: var(--v51-sticky-offset, 0px); z-index: 20; padding: 8px 0; background: var(--v51-surface); border-top: 3px solid var(--v51-ink); visibility: hidden; opacity: 0; transition: opacity 0.2s, visibility 0.2s; }
  body.v51 .v51-tool.v51-sticky-on .v51-sticky.v51-show { visibility: visible; opacity: 1; }
  body.v51 .v51-sticky .v51-btn { width: 100%; background: #FFE66D; color: #1A1A1A; font-weight: 900; }
  body.v51 .v51-tool.v51-sticky-on :is(input, select, textarea) { scroll-margin-bottom: calc(var(--v51-sticky-offset, 0px) + 80px); }
}
@media (max-width: 600px) {
  body.v51 .breadcrumb { padding-top: 4px; padding-bottom: 4px; }
  body.v51 .breadcrumb a { padding: 4px 8px; }
  body.v51 .affiliate-disclosure { font-size: 0.8rem !important; padding: 8px 12px !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.v51 :is(.v51-btn, .v51-result) { transition: none; }
  body.v51 .v51-btn:is(:hover, :active) { transform: none; }
}

/* Contrastes préexistants (couleur seule) : en-têtes de tableau, verts, rouges, boutons et bannières */
body.v51 .formula-box:not([style]):not(:has(*)) { background-color: #1A1A2E; color: #FFD700; }
body.v51 tr[style*="background" i] > th { background: inherit; color: inherit; }
body.v51 .mini-table tr:nth-child(even) td { color: #1A1A1A; }
body.v51 [style*="color:#059669" i]:not([style*="background" i]) { color: #047857 !important; }
body.v51 [style*="color:#16a34a" i]:not([style*="background" i]) { color: #15803D !important; }
body.v51 [style*="color:#0284c7" i]:not([style*="background" i]) { color: #0369A1 !important; }
body.v51 .mc-erreurs-list strong { color: #B91C1C; }
body.v51 .mc-ymyl strong { color: #BE123C; }
body.v51 :is([style*="background:#10b981" i], [style*="background:#059669" i]):is([style*="color:#fff" i], [style*="color:white" i]), body.v51 .mc-v5-btn-share { background-color: #047857 !important; }
body.v51 [style*="background:#3b82f6" i]:is([style*="color:#fff" i], [style*="color:white" i]) { background-color: #1D4ED8 !important; }
body.v51 :is([style*="background:#d97706" i], [style*="background:#f59e0b" i]):is([style*="color:#fff" i], [style*="color:white" i]) { background-color: #B45309 !important; }
body.v51 .v51-tool button.btn:not(:hover) { background-color: #C44200; }
body.v51 .banner-brutal a:not([style]) { background-color: transparent; }
body.v51 p[style*="opacity:0.6"] { opacity: 0.75 !important; }
body.v51 [id^="slider-"] span { color: #595959; }
body.v51 footer :is(p, [style*="color:#64748b" i]) { color: #B8C2CC; }
body.v51 footer a[style*="#0088cc" i] { color: #33AAEE !important; }

/* Mode sombre (écran) : jetons brutal inversés ; pubs et bannières gardent les jetons clairs */
@media screen and (prefers-color-scheme: dark) {
  body.v51 { --black: #EDEDED; --white: #1E1E1E; --gray-light: #121212; --gray-mid: #3A3A3A; --v51-ink: #EDEDED; --v51-surface: #1E1E1E; --v51-accent: #8EC5FF; --v51-err: #FF8A80; --v51-err-bg: #2A1414; background: #121212 !important; color: #EDEDED; }
  body.v51 :is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle) { --black: #1A1A1A; --white: #FFFFFF; --gray-light: #F7F7F7; --gray-mid: #E0E0E0; }
  body.v51 :is([data-banner-position], .brutal-offer, .banner-brutal, .banner-contextuelle) { color: #1A1A1A; background-color: #FFFFFF; }
  body.v51 a:not([style*="background" i]):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle)):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle) a) { color: #8EC5FF !important; }
  body.v51 .breadcrumb [aria-current="page"] { color: #FFA270; }
  body.v51 .logo-brutal :is(.logo-text, .logo-text a) { text-shadow: 2px 2px 0 rgba(237, 237, 237, 0.2) !important; }
  body.v51 .mobile-menu-toggle span:not(#v51) { background: #EDEDED !important; }
  body.v51 button[style*="background:none" i]:not(#v51) { color: #EDEDED !important; }
  body.v51 :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) { background: #1E1E1E !important; color: #EDEDED !important; border-color: #BDBDBD !important; }
  /* aplat : tout élément sans fond en ligne (hors liens, boutons, champs, médias, pubs, bannières) devient transparent à texte clair */
  body.v51 *:not(a, button, input, select, textarea, img, video, svg, svg *, [style*="background" i], .v51-note,.v51-sticky,.v51-actions,.v51-restore,.v51-field-msg,.v51-btn):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle)):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle) *) { background-color: transparent !important; color: #EDEDED !important; }
  /* fonds clairs en ligne (valeurs complètes) et carte résultat → une seule surface sombre */
  body.v51 :is([style*="background:#fff;" i],[style$="background:#fff" i],[style*="background: #fff;" i],[style*="background-color:#fff;" i],[style*="background:white;" i],[style$="background:white" i],[style*="background: white;" i],[style*="background-color:white;" i],[style*="background:#ffffff" i],[style*="background:#f9f9f9" i],[style*="background:#f0f9ff" i],[style*="background:#fff9c4" i],[style*="background:#f5f5f5" i],[style*="background:#fff3cd" i],[style*="background:#e8f5e9" i],[style*="background:#f0f4ff" i],[style*="background:#fafafa" i],[style*="background:#fff7ed" i],[style*="background:#f0fdf4" i],[style*="background:#f8f9fa" i],[style*="background:#f7f7f7" i],[style*="background:#dbeafe" i],[style*="background:#fffbeb" i],[style*="background:#f8fafc" i],[style*="background:#f0f0f0" i],[style*="background:#eff6ff" i],[style*="background:#dcfce7" i],[style*="background:#fef3c7" i],[style*="background:#ecfdf5" i],[style*="background:#fff9f5" i],[style*="background:#fff3e0" i],[style*="background:#e5e7eb" i],[style*="background:#fff8e1" i],[style*="background:#f9fafb" i],[style*="background:#f2f2f2" i],[style*="background:#e6f3ff" i],[style*="background:#fff5f5" i],[style*="background:#fff9f0" i],[style*="background:#f8f9ff" i],[style*="background:linear-gradient(135deg,#eff6ff" i],[style*="background:linear-gradient(135deg,#fff8e1" i],[style*="background:linear-gradient(135deg,#f0f9ff" i],[style*="background:linear-gradient(135deg,#ecfdf5" i],[style*="background:linear-gradient(135deg,#f0fdfa" i],[style*="background:linear-gradient(135deg,#eef2ff" i],.v51-result,.related-card,.mc-related-list a):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle)):not(:is(iframe,ins,[data-mv-create-ad-slot],.mv-ad-box,[id^="mv-"],[class*="adunit"],[data-banner-position],.brutal-offer,.banner-brutal,.banner-contextuelle) *) { background: #1E1E1E !important; color: #EDEDED !important; border-color: #8A8A8A !important; }
  /* îlots clairs conservés (jaune et vert charte) : encre */
  body.v51 :is(.btn-brutal.primary,[style*="#ffe66d" i],[style*="#06ffa5" i],.v51-restore):not(#v51), body.v51 :is(.btn-brutal.primary,[style*="#ffe66d" i],[style*="#06ffa5" i],.v51-restore) :not(#v51) { color: #1A1A1A !important; }
}

/* Impression : H1, outil et carte résultat seulement, encre #1A1A1A sur fond blanc */
@media print {
  body.v51 { background: #FFFFFF !important; color: #1A1A1A !important; }
  body.v51 :not(:has(h1, .v51-tool)):not(h1, h1 *, .v51-tool, .v51-tool *) { display: none !important; }
  body.v51 .v51-tool :is(button, .v51-actions, .v51-restore, .v51-note, .v51-sticky) { display: none !important; }
  body.v51 :is(h1, h1 *, .v51-tool, .v51-tool *) { color: #1A1A1A !important; background: #FFFFFF !important; box-shadow: none !important; }
  body.v51 .v51-tool { break-inside: avoid; }
}
