/* =========================================================================
   ParoisseHub — Tokens de marque
   Direction A+E « Le Registre & l'Appel » · Phase 6/7
   Référence : docs/BRAND-DIRECTION.md, docs/BRAND-STRATEGY.md

   Ce fichier est la SEULE définition de la marque dans le produit.
   Il se charge APRÈS honu/assets/css/app.min.css et surcharge ses variables.
   Aucun composant du thème n'est touché : tout passe par --theme-*.

   Ne pas dupliquer ces valeurs ailleurs. Si une couleur manque, on l'ajoute ici.
   ========================================================================= */

:root {
  /* ---- marque ------------------------------------------------------- */
  --ph-navy:        #16233B;  /* texte principal, fonds sombres, le socle      */
  --ph-navy-deep:   #0E1728;  /* fonds très sombres. Jamais de texte dessus    */
  --ph-navy-soft:   #243453;  /* élévation sur fond sombre                     */

  --ph-or:          #C9A227;  /* traits, filets, signes. JAMAIS du texte
                                 sur fond clair : 2,3:1, non conforme          */
  --ph-or-vif:      #E8C44A;  /* l'or sur fond navy uniquement                 */
  --ph-or-profond:  #7A5E10;  /* le seul or lisible en texte sur clair (5,8:1) */
  --ph-or-pale:     #EFE3BE;  /* fonds d'accent légers, états sélectionnés     */

  --ph-creme:       #EFEAE0;  /* texte et symbole sur fond navy                */
  --ph-parchemin:   #FAF8F3;  /* fond de référence des documents               */

  /* ---- neutres (biaisés chaud : un gris pur salit le parchemin) ------ */
  --ph-stone-100:   #F5F2EB;
  --ph-stone-200:   #E9E4D9;
  --ph-stone-300:   #E2DDD0;
  --ph-stone-400:   #C7C0AE;
  --ph-stone-600:   #8A93A6;
  --ph-stone-700:   #6B7488;
  --ph-stone-800:   #55607A;
  --ph-stone-900:   #2A3550;

  /* ---- fonctionnelles (toutes AA sur parchemin, aucune proche de l'or) */
  --ph-success:     #1F6B45;  /* 6,1:1 — don confirmé, intention transmise     */
  --ph-warning:     #9A5B0E;  /* 5,1:1 — paiement en cours, crédit bas         */
  --ph-danger:      #A32B1E;  /* 6,8:1 — échec, champ invalide                 */
  --ph-info:        #16233B;  /* pas de couleur dédiée : l'info prend le navy  */

  --ph-success-bg:  #E4F0EA;
  --ph-warning-bg:  #F6EAD7;
  --ph-danger-bg:   #F7E3E0;

  /* ---- formes : dérivées du symbole, pas choisies --------------------- */
  /* rayons = la progression des arcs (10 · 20 · 30 ramenée à l'échelle UI) */
  --ph-radius-sm:   4px;
  --ph-radius-md:   10px;
  --ph-radius-lg:   20px;   /* = le demi-cercle. Un bouton plein rond est un arc */
  --ph-radius-pill: 999px;

  /* filets : le 3px or est le trait du logo, à l'échelle du document */
  --ph-rule:        1px;
  --ph-rule-strong: 2px;
  --ph-rule-brand:  3px;

  /* espacement : même progression additive que les rayons */
  --ph-space-1: 4px;
  --ph-space-2: 8px;
  --ph-space-3: 12px;
  --ph-space-4: 20px;
  --ph-space-5: 32px;

  /* ---- typographie ---------------------------------------------------- */
  --ph-font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ph-base-app: 16px;    /* lisibilité : 12.8px (zoom 80 %) donnait un corps de texte de ~11px */
  --ph-base-web: 16px;

  /* ---- motion --------------------------------------------------------- */
  --ph-t-state: 120ms;   /* hover, focus, actif — doit paraître instantané    */
  --ph-t-ui:    250ms;   /* transition d'interface — valeur déjà en place     */
  --ph-t-enter: 400ms;   /* entrée de contenu, un élément à la fois           */
  --ph-t-appel: 3400ms;  /* l'appel. Moments rares. Jamais en écran de travail */
  --ph-ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* =========================================================================
   Branchement sur le thème Honu — clair
   ========================================================================= */

:root,
[data-bs-theme="light"] {
  --theme-font-sans-serif: var(--ph-font);

  --theme-primary:     var(--ph-navy);
  --theme-primary-rgb: 22, 35, 59;

  --theme-body-bg:     var(--ph-stone-100);
  --theme-body-color:  var(--ph-stone-800);
  --theme-emphasis-color: var(--ph-navy);
  --theme-heading-color:  var(--ph-navy);

  --theme-secondary-bg: #FFFFFF;
  --theme-tertiary-bg:  var(--ph-parchemin);

  --theme-border-color: var(--ph-stone-300);
  --theme-border-color-translucent: var(--ph-stone-200);

  --theme-success: var(--ph-success);
  --theme-warning: var(--ph-warning);
  --theme-danger:  var(--ph-danger);
  --theme-info:    var(--ph-info);

  --theme-link-color:       var(--ph-navy);
  --theme-link-hover-color: var(--ph-or-profond);

  --theme-border-radius:     var(--ph-radius-md);
  --theme-border-radius-sm:  var(--ph-radius-sm);
  --theme-border-radius-lg:  var(--ph-radius-lg);
  --theme-border-radius-pill: var(--ph-radius-pill);
}

/* =========================================================================
   Branchement sur le thème Honu — sombre
   Le navy profond devient le fond ; l'or passe en or vif, plus lisible.
   ========================================================================= */

[data-bs-theme="dark"] {
  --theme-font-sans-serif: var(--ph-font);

  --theme-primary:     var(--ph-or-vif);
  --theme-primary-rgb: 232, 196, 74;

  --theme-body-bg:     var(--ph-navy-deep);
  --theme-body-color:  #A9B3C6;
  --theme-emphasis-color: var(--ph-creme);
  --theme-heading-color:  var(--ph-creme);

  --theme-secondary-bg: var(--ph-navy);
  --theme-tertiary-bg:  var(--ph-navy-soft);

  --theme-border-color: #27334C;
  --theme-border-color-translucent: #1E2942;

  --theme-link-color:       var(--ph-or-vif);
  --theme-link-hover-color: #F3E3AE;
}

/* =========================================================================
   Base
   ========================================================================= */

/* La densité n'est PAS globale : seul le dashboard portait `zoom: 80%`.
   Les layouts minimaux (admin, doyenné) n'en avaient pas et gardent 16 px.
   La classe est posée sur <html> par layouts/app-v2.blade.php. */
html.ph-density-app {
  font-size: var(--ph-base-app);
}

/* Planchers de lisibilité. Honu fixe xxs/xs/base en px ou rem selon le skin ;
   on garantit qu'aucun texte d'interface ne descend sous 13 px, et que le
   corps de texte fait au moins 14 px. */
:root,
[data-bs-theme] {
  --theme-font-size-xxs: 13px;
  --theme-font-size-xs:  13px;
  --theme-font-size-base: 0.9rem;   /* 14.4 px à 16 px de base */
  --theme-body-font-size: 0.9rem;
}

body {
  line-height: 1.55;
}

.small, small, .fs-6, .text-muted, .form-text, .badge, .table th, .table td,
.sidenav-menu .menu-link, .breadcrumb, .dropdown-item {
  font-size: max(13px, 0.875em);
}

body {
  font-family: var(--ph-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--ph-font);
  letter-spacing: -0.02em;
}

/* La donnée prime sur le décor : tout chiffre aligné est tabulaire. */
table td,
table th,
.ph-amount,
.text-end {
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Utilitaires de marque
   Le trait or souligne, il ne remplit jamais : aucun aplat de marque
   ne passe derrière un montant (valeur Fiabilité, BRAND-STRATEGY §06).
   ========================================================================= */

/* Le filet du logo, à l'échelle du document. En-tête de page, de reçu, de PDF. */
.ph-rule-brand {
  border-bottom: var(--ph-rule-brand) solid var(--ph-or);
}

.ph-doc-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ph-space-3);
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--ph-space-3);
  border-bottom: var(--ph-rule-brand) solid var(--ph-or);
}

/* Le seul or admissible en texte sur fond clair. */
.ph-or-text { color: var(--ph-or-profond); }

/* Surface parchemin — documents, reçus, aperçus imprimables. */
.ph-parchment {
  background: var(--ph-parchemin);
  color: var(--ph-navy);
}

/* États : la forme porte l'information autant que la couleur. */
.ph-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--ph-space-1);
  padding: 2px 10px;
  border-radius: var(--ph-radius-pill);
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.6;
}
.ph-badge--ok   { background: var(--ph-success-bg); color: var(--ph-success); }
.ph-badge--wait { background: var(--ph-warning-bg); color: var(--ph-warning); }
.ph-badge--fail { background: var(--ph-danger-bg);  color: var(--ph-danger); }

[data-bs-theme="dark"] .ph-badge--ok   { background: rgba(31,107,69,.22);  color: #5FBE8C; }
[data-bs-theme="dark"] .ph-badge--wait { background: rgba(154,91,14,.22);  color: #D79A3C; }
[data-bs-theme="dark"] .ph-badge--fail { background: rgba(163,43,30,.22);  color: #E4785F; }

/* =========================================================================
   Motion
   Le dedans est immobile : un chiffre qui bouge est un chiffre dont on doute.
   ========================================================================= */

a, .btn, .form-control, .form-select, .card {
  transition-duration: var(--ph-t-state);
  transition-timing-function: var(--ph-ease);
}

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

/* =========================================================================
   NOTE DE MIGRATION — la densité

   `zoom: 80%` a d'abord été remplacé par `html { font-size: 12.8px }`.
   Résultat : corps de texte ~11 px, pénible à lire. Base remontée à 16 px
   + planchers 13 px / 14 px sur les variables Honu. Si l'interface paraît
   trop aérée, baisser --ph-base-app (15px minimum), ne pas remettre de zoom.
   ========================================================================= */

/* =========================================================================
   Le logo dans l'interface
   Les fichiers SVG définitifs sont utilisés directement pour conserver le
   dessin et le wordmark approuvés à toutes les tailles.
   ========================================================================= */

.ph-logo {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.ph-logo__lockup {
  display: block;
  flex: none;
  height: 1.9em;
  width: auto;
}

.ph-logo--sm .ph-logo__lockup { height: 1.7em; }

/* Les écrans d'authentification donnent au lockup sa taille de repère. */
.auth-brand .ph-logo--lg .ph-logo__lockup { height: 3.5em; }
