/*
Theme Name: DEVFAC — Devis, factures et prix
Theme URI: https://www.devis-factures.com/
Description: Thème bloc sur mesure : obligations légales de facturation, choix d'un logiciel, méthodes de fixation des prix et analyse de la concurrence. Newsreader + Public Sans / Roboto Mono, marine, rouge d'obligation et vert de prix.
Author: devis-factures.com
Version: 1.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: devfac
Tags: block-theme, full-site-editing, one-column, custom-colors, custom-menu
*/

:root {
  --df-encre:   var(--wp--preset--color--contrast, #0F1621);
  --df-gris:    var(--wp--preset--color--muted,    #59616F);
  --df-filet:   var(--wp--preset--color--line,     #DCE0E7);
  --df-papier:  var(--wp--preset--color--surface,  #F4F5F7);
  --df-blanc:   var(--wp--preset--color--base,     #FFFFFF);
  --df-marine:  var(--wp--preset--color--primary,  #172C4A);
  --df-rouge:   var(--wp--preset--color--legal,    #B0392C);
  --df-vert:    var(--wp--preset--color--prix,     #166B57);
  --df-rouge-fond: #FCF2F0;
  --df-vert-fond:  #EFF6F3;
  /* Texte posé sur un aplat de marine (en-têtes de tableau) : bascule avec le
     thème, car la marine s'éclaircit en sombre. */
  --df-sur-marine: #FFFFFF;
}

/* Thème sombre : on ne redéfinit que les jetons de palette. */
@media (prefers-color-scheme: dark) {
  :root {
    --wp--preset--color--base:     #0D1219;
    --wp--preset--color--surface:  #151C26;
    --wp--preset--color--line:     #26303D;
    --wp--preset--color--muted:    #9AA3B2;
    --wp--preset--color--contrast: #EAEEF4;
    --wp--preset--color--primary:  #8FB2E0;
    --wp--preset--color--legal:    #E58572;
    --wp--preset--color--prix:     #5CBFA4;
    --df-rouge-fond: #241614;
    --df-vert-fond:  #10211C;
    --df-sur-marine: #0D1219;
  }
  body { background: var(--wp--preset--color--base); }
  img, .wp-block-image img { filter: brightness(0.94); }
}

/* ------------------------------------------------------------------ socle */

body {
  background: var(--df-blanc);
  color: var(--df-encre);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { text-wrap: balance; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--df-marine);
  outline-offset: 3px;
  border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------- en-tête / pied */

.df-header {
  border-bottom: 2px solid var(--df-marine);
  background: var(--df-blanc);
}

.df-header .wp-block-navigation { font-size: 0.94rem; font-weight: 500; }
.df-header .wp-block-navigation a { text-decoration: none; }
.df-header .wp-block-navigation a:hover { text-decoration: underline; text-underline-offset: 4px; }

.df-baseline {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--df-gris);
  margin: 0.2rem 0 0;
}

.df-footer {
  border-top: 1px solid var(--df-filet);
  background: var(--df-papier);
  color: var(--df-gris);
  font-size: 0.92rem;
}

.df-footer a { color: var(--df-gris); }

.df-footer h2, .df-footer h3 {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--df-encre);
  margin-bottom: 0.6rem;
}

.df-mentions { font-size: 0.83rem; line-height: 1.6; color: var(--df-gris); }

/* --------------------------------------------------- corps éditorial */

.entry-content > * + * { margin-top: 1.15rem; }
.entry-content p { max-width: 68ch; }

/* Le repère de section : le titre, puis un filet qui court jusqu'à la marge —
   la ligne d'un formulaire à remplir. */
.entry-content > h2 {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-top: 3.2rem;
}

.entry-content > h2::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--df-filet);
  transform: translateY(-0.28em);
}

.entry-content > h3 { margin-top: 2.1rem; }

.entry-content > h3::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  vertical-align: 0.15em;
  margin-right: 0.55rem;
  background: var(--df-marine);
}

.entry-content > p:first-child,
.entry-content .has-large-font-size:first-child {
  color: var(--df-gris);
  line-height: 1.55;
}

.entry-content ul, .entry-content ol { max-width: 68ch; padding-left: 1.15rem; }
.entry-content li + li { margin-top: 0.5rem; }
.entry-content li::marker { color: var(--df-marine); }
.entry-content strong { font-weight: 600; }

.entry-content blockquote {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--df-marine);
  color: var(--df-gris);
  font-style: normal;
}

/* --------------------------------------------------------- étiquettes */

.df-label {
  display: block;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--df-marine);
  margin-bottom: 0.35rem;
}

/* display:table — l'étiquette se réduit à son contenu tout en occupant sa
   propre ligne, y compris lorsqu'elle est le premier enfant d'un paragraphe. */
.df-tampon {
  display: table;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  margin-bottom: 0.7rem;
  border: 1px solid currentColor;
}

/* -------------------------------------- obligation légale (rouge, réservé) */

.df-obligation {
  border: 1px solid var(--df-rouge);
  border-top: 4px double var(--df-rouge);
  background: var(--df-rouge-fond);
  padding: 1.15rem 1.35rem;
  font-size: 0.97rem;
}

.df-obligation .df-tampon { color: var(--df-rouge); }
.df-obligation > :last-child { margin-bottom: 0; }
.df-obligation strong { color: var(--df-rouge); }

/* --------------------------------------------- prix et marge (vert, réservé) */

.df-prix {
  border: 1px solid var(--df-vert);
  background: var(--df-vert-fond);
  padding: 1.15rem 1.35rem;
  font-size: 0.97rem;
}

.df-prix .df-tampon { color: var(--df-vert); }
.df-prix > :last-child { margin-bottom: 0; }

.df-formule {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
  background: var(--df-papier);
  border-left: 3px solid var(--df-vert);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* --------------------------------------------------------------- encarts */

.df-note {
  border: 1px solid var(--df-filet);
  border-top: 3px solid var(--df-marine);
  background: var(--df-papier);
  padding: 1.1rem 1.3rem;
  font-size: 0.96rem;
}

.df-note > :first-child { margin-top: 0; }
.df-note > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- fiches */

.df-card {
  border: 1px solid var(--df-filet);
  background: var(--df-blanc);
  border-left: 3px solid var(--df-marine);
  padding: 1.15rem 1.35rem;
  margin-top: 1rem;
}

.df-card h3 { margin-top: 0; }
.df-card h3::before { content: none; }
.df-card > :last-child { margin-bottom: 0; }

.df-card .df-usage {
  display: block;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--df-filet);
  font-size: 0.9rem;
  color: var(--df-gris);
}

.df-card .df-usage strong {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--df-marine);
}

/* ------------------------------------------------------------ tableaux */

.entry-content .wp-block-table { overflow-x: auto; }

.entry-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.entry-content th {
  background: var(--df-marine);
  color: var(--df-sur-marine);
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.6rem 0.8rem;
}

.entry-content td {
  border-bottom: 1px solid var(--df-filet);
  padding: 0.6rem 0.8rem;
  vertical-align: top;
}

.entry-content tbody tr:nth-child(even) td { background: var(--df-papier); }

.entry-content .wp-block-table figcaption {
  font-size: 0.85rem;
  color: var(--df-gris);
  margin-top: 0.5rem;
}

/* Colonnes de chiffres alignées à droite. */
.entry-content .df-chiffres td:not(:first-child),
.entry-content .df-chiffres th:not(:first-child) { text-align: right; }

/* --------------------------------------------------------------- FAQ */

.entry-content details {
  border-bottom: 1px solid var(--df-filet);
  padding: 0.85rem 0;
}

.entry-content details summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-family: var(--wp--preset--font-family--display);
  position: relative;
  padding-right: 1.8rem;
}

.entry-content details summary::-webkit-details-marker { display: none; }

.entry-content details summary::after {
  content: "+";
  position: absolute;
  right: 0.2rem;
  top: -0.1rem;
  font-family: var(--wp--preset--font-family--mono);
  color: var(--df-marine);
}

.entry-content details[open] summary::after { content: "\2212"; }
.entry-content details > :not(summary) { margin-top: 0.7rem; }

/* -------------------------------------------------- listes d'articles */

.df-liste .wp-block-post-title { font-size: 1.15rem; margin: 0 0 0.3rem; }
.df-liste .wp-block-post-title a { text-decoration: none; color: var(--df-encre); }
.df-liste .wp-block-post-title a:hover { text-decoration: underline; }

.df-liste .wp-block-post-excerpt__excerpt {
  color: var(--df-gris);
  font-size: 0.96rem;
  margin: 0;
}

.df-liste li, .df-liste .wp-block-post {
  border-top: 1px solid var(--df-filet);
  padding-top: 1.1rem;
  margin-top: 1.1rem;
}

.df-liste .wp-block-post-date {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.72rem;
  color: var(--df-gris);
}

/* ------------------------------------------------------------- accueil */

.df-hero {
  border-bottom: 1px solid var(--df-filet);
  background: var(--df-papier);
}

.df-hero h1 { max-width: 21ch; }

.df-hero .df-chapo {
  max-width: 58ch;
  color: var(--df-gris);
  font-size: 1.2rem;
  line-height: 1.55;
}

.df-grid-2, .df-grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }

@media (min-width: 700px) {
  .df-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .df-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------- divers */

.df-mono {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

.entry-content > .wp-block-buttons { margin-top: 1.9rem; }
.wp-block-post-title { text-wrap: balance; }
