/*
Theme Name:   AP'Pro
Description:  Thème enfant de GeneratePress pour l'espace privé AP'Pro : charte Pierre et or, menu latéral des modules et onglets en bas de page.
Author:       [Votre nom]
Template:     generatepress
Version:      0.2.5
Requires at least: 6.4
Requires PHP: 8.0
Text Domain:  appro
*/

/* ============ Charte « Pierre et or » ============
   Les couleurs viennent de la palette globale de GeneratePress
   (Personnaliser › Couleurs) : la charte en est la valeur par défaut,
   et toute modification faite dans la personnalisation s'applique aussi
   à l'en-tête, au menu des modules et aux onglets.
   La largeur reprend « Largeur du conteneur » (Personnaliser › Mise en page). */
:root {
	--oe-fond: var(--base-2, #F6F3EE);
	--oe-texte: var(--contrast, #2F2F2F);
	--oe-principale: var(--contrast-2, #707070);
	--oe-or-fonce: var(--contrast-3, #8A6A2F);
	--oe-surface: var(--base, #EDE8DF);
	--oe-accent: var(--accent, #CA9B52);
	--oe-sur-principale: var(--base-3, #FFFFFF);
	--oe-trait: #DDD5C8;
	--oe-voile: rgba(47, 47, 47, 0.45);
	--oe-titres: 'Josefin Sans', Arial, sans-serif;
	--oe-corps: 'Lora', Georgia, serif;
	--oe-rayon: 6px;
	--oe-colonne: 1200px; /* remplacé par la largeur du conteneur réglée dans la personnalisation */
}

:focus-visible { outline: 2px solid var(--oe-or-fonce); outline-offset: 2px; }
h1, h2, h3, h4, h5, h6 { text-transform: none; }


/* Coins arrondis de la charte sur les boutons et champs (les couleurs restent celles de la personnalisation) */
button, .button, input[type="submit"], input[type="button"], .wp-block-button__link,
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], select, textarea { border-radius: var(--oe-rayon); }
button, .button, input[type="submit"], input[type="button"], .wp-block-button__link { min-height: 44px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], select { min-height: 46px; }

/* Tableaux (GeneratePress ne les règle pas) */
.entry-content table { border-collapse: collapse; width: 100%; border: none; }
.entry-content th { background: var(--oe-principale); color: var(--oe-sur-principale); text-align: left; }
.entry-content th, .entry-content td { padding: 10px 14px; border: none; }
.entry-content tbody tr:nth-child(even) { background: var(--oe-surface); }
.entry-content tr.oe-important td { background: var(--oe-accent); color: var(--oe-texte); }

/* Classes utilitaires pour les pages */
.oe-carte { padding: 14px 16px; background: var(--oe-surface); border-radius: var(--oe-rayon); }
.oe-alerte { padding: 14px 16px; background: var(--oe-accent); color: var(--oe-texte); border-radius: var(--oe-rayon); }
.oe-alerte a { color: var(--oe-texte); font-weight: 600; }
.oe-bouton {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: var(--oe-rayon);
	background: var(--oe-accent);
	color: var(--oe-texte);
	font-weight: 700;
	text-decoration: none;
}
.oe-bouton--contour { background: transparent; border: 1px solid var(--oe-principale); }

/* ============ En-tête collant ============ */
.oe-entete {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--oe-fond);
	border-bottom: 1px solid var(--oe-trait);
}
.admin-bar .oe-entete { top: 32px; }
.oe-entete__inner {
	max-width: var(--oe-colonne);
	margin: 0 auto;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}
.oe-entete__titres { flex: 1; min-width: 0; }
.oe-entete__titre {
	margin: 0;
	font-family: var(--oe-titres);
	font-weight: 700;
	line-height: 1.1;
	overflow-wrap: anywhere;
}
/* Couleur : « Titre du site » dans Personnaliser › Couleurs (règle .main-title a de GeneratePress) */
:where(.oe-entete__titre) a { color: var(--oe-principale); text-decoration: none; }
.oe-entete__sous-titre { margin: 4px 0 0; font-size: 14px; }
.oe-icone-bouton {
	width: 44px;
	height: 44px;
	min-height: 44px;
	flex: none;
	display: grid;
	place-items: center;
	padding: 0;
	border: 1px solid var(--oe-principale);
	border-radius: var(--oe-rayon);
	background: var(--oe-surface);
	color: var(--oe-texte);
}
.oe-icone-bouton:hover { background: var(--oe-surface); color: var(--oe-texte); filter: none; }
.oe-logo { flex: none; display: flex; align-items: center; max-width: 45%; }
/* Largeur : « Largeur du logo » de la personnalisation ; à défaut, 40 px de haut. */
.oe-logo__image {
	display: block;
	width: var(--oe-logo-largeur, auto);
	height: auto;
	max-width: 100%;
}
.oe-tiroir__tete .oe-logo__image { width: auto; height: auto; max-width: 140px; max-height: 44px; }

/* ============ Menu latéral des modules ============ */
.oe-tiroir { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.oe-tiroir.est-ouvert { visibility: visible; }
.oe-tiroir__voile {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 0;
	padding: 0;
	border: none;
	border-radius: 0;
	background: var(--oe-voile);
	opacity: 0;
	transition: opacity .2s;
}
.oe-tiroir__voile:hover { background: var(--oe-voile); filter: none; }
.oe-tiroir.est-ouvert .oe-tiroir__voile { opacity: 1; }
.oe-tiroir__panneau {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 300px;
	max-width: 86vw;
	background: var(--oe-fond);
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	transform: translateX(-100%);
	transition: transform .2s;
}
.oe-tiroir.est-ouvert .oe-tiroir__panneau { transform: none; }
@media (prefers-reduced-motion: reduce) {
	.oe-tiroir__voile, .oe-tiroir__panneau { transition: none; }
}
.oe-tiroir__tete {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--oe-trait);
}
.oe-tiroir__nom { flex: 1; font-family: var(--oe-titres); font-weight: 700; font-size: 18px; color: var(--oe-principale); }
.oe-tiroir__fermer { border: none; background: transparent; }
.oe-tiroir__fermer:hover { background: var(--oe-surface); }
.oe-modules { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; }
.oe-module {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: var(--oe-rayon);
	color: var(--oe-texte);
	text-decoration: none;
}
.oe-module:hover, .oe-module[aria-current="page"] { background: var(--oe-surface); color: var(--oe-texte); }
.oe-module svg { flex: none; color: var(--oe-or-fonce); }
.oe-module__texte { display: flex; flex-direction: column; }
.oe-module__nom { font-family: var(--oe-titres); font-weight: 700; }
.oe-module__resume { font-size: 13px; }
.oe-tiroir__pied {
	margin-top: auto;
	padding: 14px 16px;
	border-top: 1px solid var(--oe-trait);
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-size: 14px;
}
.oe-tiroir__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.oe-tiroir__actions a {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--oe-principale);
	border-radius: var(--oe-rayon);
	color: var(--oe-texte);
	text-decoration: none;
}
body.oe-menu-ouvert { overflow: hidden; }

/* ============ Onglets du module, en bas ============ */
.oe-onglets {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 40;
	background: var(--oe-fond);
	border-top: 1px solid var(--oe-trait);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
.oe-onglets__inner {
	max-width: var(--oe-colonne);
	margin: 0 auto;
	padding: 8px 16px;
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 8px;
}
.oe-onglet {
	display: grid;
	place-items: center;
	min-height: 48px;
	padding: 0 6px;
	border-radius: var(--oe-rayon);
	color: var(--oe-texte);
	text-align: center;
	text-decoration: none;
	font-family: var(--oe-titres);
	font-weight: 600;
	line-height: 1.2;
}
.oe-onglet:hover { background: var(--oe-surface); color: var(--oe-texte); }
.oe-onglet[aria-current="page"] { background: var(--oe-principale); color: var(--oe-sur-principale); font-weight: 700; }
body.oe-avec-onglets .site-footer { padding-bottom: 72px; }

/* ============ Page de connexion (wp-login.php) ============ */
body.login { background: var(--oe-fond); font-family: var(--oe-corps); }
.login form { background: var(--oe-surface); border: none; border-radius: var(--oe-rayon); box-shadow: none; }
.login label { font-family: var(--oe-titres); font-weight: 600; color: var(--oe-texte); }
.login .button-primary {
	background: var(--oe-accent) !important;
	border: none !important;
	color: var(--oe-texte) !important;
	font-family: var(--oe-titres);
	font-weight: 700;
	text-shadow: none;
	box-shadow: none;
	min-height: 44px;
	border-radius: var(--oe-rayon);
}
.login #nav a, .login #backtoblog a { color: var(--oe-or-fonce) !important; }
.login .message, .login .notice, .login #login_error { border-left-color: var(--oe-or-fonce); box-shadow: none; border-radius: var(--oe-rayon); }
.login h1 a {
	background-image: var(--oe-logo-connexion, none);
	background-size: contain;
	background-position: center;
	width: var(--oe-logo-connexion-l, 80px);
	height: var(--oe-logo-connexion-h, 80px);
	max-width: 100%;
}
.oe-connexion-titre { text-align: center; font-family: var(--oe-titres); font-weight: 700; font-size: 24px; color: var(--oe-principale); margin: 8px 0 4px; }
.oe-connexion-sous-titre { text-align: center; margin: 0 0 16px; color: var(--oe-texte); }
.oe-connexion-note { max-width: 320px; margin: 16px auto 0; font-size: 14px; text-align: center; color: var(--oe-texte); }


/* ===== Display Posts : cartes flexibles ===== */
.dp-grid {
  --dp-bg: #FFFFFF;
  --dp-page: #F6F3EE;
  --dp-text: #2F2F2F;
  --dp-muted: #707070;
  --dp-accent: #CA9B52;
  --dp-accent-dark: #8A6A2F;
  --dp-gap: 24px;
  --dp-radius: 12px;

  display: flex;
  flex-wrap: wrap;
  gap: var(--dp-gap);
  margin: 1.5em 0;
}

/* Largeur des cartes selon le nombre de colonnes */
.dp-cols-1 .listing-item { flex: 1 1 100%; }
.dp-cols-2 .listing-item { flex: 1 1 calc((100% - var(--dp-gap)) / 2);     max-width: calc((100% - var(--dp-gap)) / 2); }
.dp-cols-3 .listing-item { flex: 1 1 calc((100% - 2 * var(--dp-gap)) / 3); max-width: calc((100% - 2 * var(--dp-gap)) / 3); }
.dp-cols-4 .listing-item { flex: 1 1 calc((100% - 3 * var(--dp-gap)) / 4); max-width: calc((100% - 3 * var(--dp-gap)) / 4); }

/* Carte */
.dp-grid .listing-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--dp-bg);
  border-radius: var(--dp-radius);
  overflow: hidden;
  padding: 0 0 20px;
  box-shadow: 0 2px 10px rgba(47, 47, 47, .08);
  border-bottom: 3px solid transparent;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.dp-grid .listing-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(47, 47, 47, .15);
  border-bottom-color: var(--dp-accent);
}

/* Image toujours au-dessus */
.dp-grid .listing-item .image {
  order: -1;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--dp-page);
  margin-bottom: 6px;
}
.dp-grid .listing-item .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}
.dp-grid .listing-item:hover .image img { transform: scale(1.06); }

/* Textes (marges latérales) */
.dp-grid .listing-item .category-display,
.dp-grid .listing-item .title,
.dp-grid .listing-item .date,
.dp-grid .listing-item .excerpt {
  padding: 0 20px;
}

/* Badge catégorie */
.dp-grid .listing-item .category-display {
  align-self: flex-start;
  margin-left: 20px;
  padding: 3px 10px;
  font-family: "Josefin Sans", sans-serif;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dp-accent-dark);
  background: rgba(202, 155, 82, .15);
  border-radius: 999px;
}
.dp-grid .listing-item .category-display a { color: inherit; text-decoration: none; }

/* Titre */
.dp-grid .listing-item .title {
  font-family: "Josefin Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--dp-text);
  text-decoration: none;
}
.dp-grid .listing-item .title:hover { color: var(--dp-accent-dark); }

/* Date */
.dp-grid .listing-item .date {
  font-size: .8rem;
  color: var(--dp-muted);
}

/* Extrait */
.dp-grid .listing-item .excerpt {
  font-family: "Lora", serif;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--dp-muted);
}
.dp-grid .listing-item .excerpt a {
  color: var(--dp-accent-dark);
  font-weight: 600;
  text-decoration: none;
}
.dp-grid .listing-item .excerpt a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 900px) {
  .dp-cols-3 .listing-item,
  .dp-cols-4 .listing-item { flex-basis: calc((100% - var(--dp-gap)) / 2); max-width: calc((100% - var(--dp-gap)) / 2); }
}
@media (max-width: 560px) {
  .dp-grid .listing-item { flex-basis: 100%; max-width: 100%; }
}