/*
Theme Name: FPP Theme
Theme URI:
Description: Thème classique brand-agnostic pour la suite FPP (Folder Pages Publisher + plugins satellites). Fournit les jetons de couleurs --fpp-* lus par le personnalisateur FPP, les deux gabarits FPP obligatoires et une hiérarchie de gabarits accessible (WCAG 2.1 AA). Le SEO et l'internationalisation restent gérés par la suite FPP.
Version: 0.1.0
Author: FPP Theme
Author URI:
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fpp-theme
Tags: classic, accessibility-ready, translation-ready
*/

/* --------------------------------------------------------------------------
   Jetons de design — variables lues par FPP_UI_Customizer_Renderer::get_theme_colors().
   Contrat strict : un seul bloc de variables racine, sans accolade interne ni
   commentaire à accolade à l'intérieur (le parseur FPP s'arrête à la première
   accolade fermante rencontrée). Chaque variable finit par un point-virgule,
   valeurs non vides. Les 23 noms sont verbatim. Important : ne PAS reproduire
   le motif d'analyse FPP dans ce commentaire — le parseur scanne le fichier
   entier, commentaires inclus. Palette neutre/pro, ajustable via le
   personnalisateur FPP.
   -------------------------------------------------------------------------- */
:root {
  --fpp-primary: #2563EB;
  --fpp-primary-hover: #1D4ED8;
  --fpp-primary-light: #DBEAFE;
  --fpp-accent: #0D9488;
  --fpp-accent-hover: #0F766E;
  --fpp-surface: #F8FAFC;
  --fpp-heading: #0F172A;
  --fpp-body: #334155;
  --fpp-muted: #64748B;
  --fpp-border: #E2E8F0;
  --fpp-bg: #FFFFFF;
  --fpp-white: #FFFFFF;
  --fpp-error: #DC2626;
  --fpp-error-light: #FEE2E2;
  --fpp-success: #16A34A;
  --fpp-success-light: #DCFCE7;
  --fpp-warning: #D97706;
  --fpp-warning-light: #FEF3C7;
  --fpp-header-bg: #FFFFFF;
  --fpp-header-border: #E2E8F0;
  --fpp-footer-bg: #0F172A;
  --fpp-footer-text: #CBD5E1;
  --fpp-footer-link: #93C5FD;
}

/* --------------------------------------------------------------------------
   Typographie de base.
   La règle de typographie du corps de page est dédiée et place la pile de
   polices en première propriété (contrat parseur FPP « font_body »). Pile
   littérale (pas de var()) pour que le personnalisateur FPP affiche une
   valeur lisible. Ne pas écrire le motif d'analyse FPP dans ce commentaire.
   -------------------------------------------------------------------------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  color: var(--fpp-body);
  background-color: var(--fpp-bg);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Première règle de titres de la feuille : la pile de polices y est la
   première propriété (contrat parseur FPP « font_heading »). Aucun jeton de
   titre ni motif d'analyse FPP ne doit apparaître plus haut (commentaires
   inclus) afin que le parseur s'ancre bien sur cette règle. */
h1, h2, h3, h4, h5, h6 {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fpp-heading);
  line-height: 1.25;
  margin: 0 0 0.5em;
  font-weight: 650;
}

h1 { font-size: clamp(1.85rem, 1.4rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--fpp-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover,
a:focus { color: var(--fpp-primary-hover); }

img, svg, video { max-width: 100%; height: auto; }

*, *::before, *::after { box-sizing: border-box; }

/* --------------------------------------------------------------------------
   Accessibilité — utilitaires (WCAG 2.1 AA).
   -------------------------------------------------------------------------- */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  position: absolute !important;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--fpp-white);
  clip: auto;
  clip-path: none;
  color: var(--fpp-heading);
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  height: auto;
  left: 8px;
  line-height: normal;
  padding: 12px 20px;
  text-decoration: none;
  top: 8px;
  width: auto;
  z-index: 100000;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  padding: 12px 20px;
  background-color: var(--fpp-primary);
  color: var(--fpp-white);
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

/* Réassertion au :focus — .screen-reader-text:focus (0,0,2,0) bat le
   background de .skip-link (0,0,1,0). On remet background + color à
   spécificité égale (0,0,2,0) ici, défini en dernier => gagne les deux.
   Évite le skip-link blanc sur blanc (contraste WCAG AA). */
.skip-link:focus {
  left: 0;
  background-color: var(--fpp-primary);
  color: var(--fpp-white);
  text-decoration: none;
  outline: 3px solid var(--fpp-accent);
  outline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--fpp-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Mise en page — conteneur, en-tête, contenu, pied de page.
   Le thème ne stylise PAS les sorties de shortcodes FPP (.fpps-*, etc.) :
   il fournit uniquement l'ossature autour.
   -------------------------------------------------------------------------- */
.fpp-container {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.fpp-site-header {
  background-color: var(--fpp-header-bg);
  border-bottom: 1px solid var(--fpp-header-border);
}

.fpp-site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 1rem;
}

.fpp-site-branding {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.fpp-site-branding a {
  color: var(--fpp-heading);
  text-decoration: none;
}

.fpp-site-description {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--fpp-muted);
}

.fpp-primary-nav ul,
.fpp-footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.fpp-primary-nav a {
  color: var(--fpp-body);
  text-decoration: none;
  padding: 0.4rem 0.25rem;
  display: inline-block;
}

.fpp-primary-nav a:hover,
.fpp-primary-nav a:focus,
.fpp-primary-nav .current-menu-item > a {
  color: var(--fpp-primary);
}

.fpp-site-main {
  display: block;
  padding-block: clamp(1.5rem, 5vw, 3.5rem);
}

.fpp-template-content {
  display: block;
}

.fpp-entry__title { margin-top: 0; }

.fpp-entry + .fpp-entry {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--fpp-border);
}

.fpp-empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--fpp-muted);
}

.fpp-pagination {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fpp-pagination .page-numbers {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--fpp-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--fpp-body);
}

.fpp-pagination .page-numbers.current {
  background-color: var(--fpp-primary);
  border-color: var(--fpp-primary);
  color: var(--fpp-white);
}

.fpp-site-footer {
  background-color: var(--fpp-footer-bg);
  color: var(--fpp-footer-text);
  padding-block: 2.5rem;
  margin-top: auto;
}

.fpp-site-footer a {
  color: var(--fpp-footer-link);
}

.fpp-footer-nav {
  margin-bottom: 1rem;
}

.fpp-footer-nav a {
  color: var(--fpp-footer-text);
  text-decoration: none;
}

.fpp-footer-nav a:hover,
.fpp-footer-nav a:focus {
  color: var(--fpp-footer-link);
  text-decoration: underline;
}

.fpp-site-footer__credit {
  margin: 0;
  font-size: 0.85rem;
  color: var(--fpp-footer-text);
}

/* Ossature pleine hauteur pour coller le pied de page en bas. */
html { min-height: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.fpp-blank-template {
  display: block;
  min-height: auto;
}

/* --------------------------------------------------------------------------
   Réduction des animations — respect des préférences utilisateur.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Mode sombre (optionnel, non bloquant v1).
   Redéclare un bloc :root distinct DANS @media — le parseur FPP a déjà
   capturé le :root clair (preg_match non global, première occurrence).
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fpp-primary: #60A5FA;
    --fpp-primary-hover: #93C5FD;
    --fpp-primary-light: #1E3A5F;
    --fpp-accent: #2DD4BF;
    --fpp-accent-hover: #5EEAD4;
    --fpp-surface: #1E293B;
    --fpp-heading: #F1F5F9;
    --fpp-body: #CBD5E1;
    --fpp-muted: #94A3B8;
    --fpp-border: #334155;
    --fpp-bg: #0F172A;
    --fpp-white: #1E293B;
    --fpp-error: #F87171;
    --fpp-error-light: #4C1D1D;
    --fpp-success: #4ADE80;
    --fpp-success-light: #14331F;
    --fpp-warning: #FBBF24;
    --fpp-warning-light: #422006;
    --fpp-header-bg: #0F172A;
    --fpp-header-border: #334155;
    --fpp-footer-bg: #020617;
    --fpp-footer-text: #CBD5E1;
    --fpp-footer-link: #93C5FD;
  }
}

/* --------------------------------------------------------------------------
   Responsive — pile la navigation sur petits écrans.
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .fpp-site-header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .fpp-primary-nav ul {
    gap: 0.25rem 1rem;
  }
}
