/*
Theme Name: Cayenne Land Vintage
Theme URI: https://www.cayenneland.org/
Description: Thème "historique" du site Cayenne Land : bandeau, menu ovale vert, colonne ocre et fond crème du site SPIP d'origine, avec photos en lightbox.
Author: Cayenne Land
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: cayenneland-vintage
*/

:root {
	--cl-fond: #fff6d9;
	--cl-texte: #003300;
	--cl-lien: #009900;
	--cl-lien-hover: #00cc00;
	--cl-vert: #1a674e;
	--cl-ocre: #d18c3f;
	--cl-menu-w: 150px;
}

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

body {
	margin: 0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1rem;
	line-height: 1.5;
	background: var(--cl-fond);
	color: var(--cl-texte);
}

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

/* ---------- bandeau ---------- */
/* le bandeau se répète sur toute la largeur comme sur l'ancien site ; l'image du lien recouvre exactement la première tuile */
.site-header { background: var(--cl-vert) url("assets/bandeau.jpg") repeat-x left top; }
.site-header a { display: block; }
.site-banner {
	display: block;
	width: 100%;
	max-width: 800px;
	height: auto;
	aspect-ratio: 8 / 1;
	object-fit: cover;
}

/* ---------- mise en page : colonne ocre + contenu ---------- */
.site-layout {
	display: flex;
	align-items: stretch;
	min-height: 70vh;
}
.site-sidebar {
	flex: 0 0 var(--cl-menu-w);
	width: var(--cl-menu-w);
	background: #d6903f url("assets/fond.jpg") repeat-y left top;
	padding-top: 10px;
}
.site-content {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 1.2rem 2rem;
	/* pleine largeur de l'écran, comme l'ancien site (pas de largeur maximale) */
}

/* ---------- recherche ---------- */
.search-form { padding: 0 6px 12px; }
.search-form label { display: block; font-size: .75rem; color: var(--cl-fond); }
.search-form input[type="search"] {
	width: 100%;
	font-size: .8rem;
	padding: 2px 4px;
	border: 1px solid #7a5222;
	background: #fff;
}
.search-form button { margin-top: 4px; font-size: .75rem; }

/* ---------- menu : boutons ovales ---------- */
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 140px;
	height: 73px;
	margin: 0 auto 7px;
	background: url("assets/bouton.gif") no-repeat center center;
	color: var(--cl-fond);
	font-weight: bold;
	font-size: 1.05rem;
	text-align: center;
	line-height: 1.1;
	text-decoration: none;
	padding: 0 14px;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav .current-cat > a,
.site-nav a[aria-current="page"] { color: #fff; text-decoration: underline; }

/* ---------- titres et blocs d'origine ---------- */
.titre-rubrique {
	font-size: 1.5em;
	font-weight: bolder;
	text-align: center;
	background: var(--cl-vert);
	color: var(--cl-fond);
	padding: 5px;
	border: medium dotted var(--cl-ocre);
	margin: 0 0 .5rem;
}
.titre-rubrique a { color: var(--cl-fond); }
.page-title-home {
	font-size: 1.5em;
	font-weight: bolder;
	text-align: center;
	margin: .5rem 0 1.5rem;
}
.navigation {
	font-size: .8rem;
	color: var(--cl-fond);
	background: var(--cl-ocre);
	padding: 1px 4px;
	border: thin solid #000;
	margin-bottom: .8rem;
}
.navigation a { color: var(--cl-fond); }
.date { font-size: .8rem; color: var(--cl-ocre); }
.titre-article { font-size: 1.2em; font-weight: bold; margin-top: 1rem; }
.descriptif-article {
	font-size: .8rem;
	border: thin dashed #999;
	padding: 2px 4px;
	margin-bottom: 10px;
}
.texte-rubrique {
	margin: 0 0 10px 10px;
	padding: 5px;
	border-left: thin solid #000;
}

/* ---------- liens ---------- */
.site-content a { color: var(--cl-lien); text-decoration: underline; }
.site-content a:hover, .site-content a:focus-visible { color: var(--cl-lien-hover); text-decoration: none; }
.titre-rubrique a, .navigation a { color: var(--cl-fond) !important; }

/* ---------- contenu des articles ---------- */
.entry-content { font-size: 1rem; }
.entry-content h2 { font-size: 1.35rem; margin: 1.6rem 0 .6rem; }
.entry-content h3 { font-size: 1.15rem; }
.entry-content table { border-collapse: collapse; font-size: .9rem; }
.entry-content th, .entry-content td { border: 1px solid #bba978; padding: 2px 6px; }
.entry-content hr { border: 0; border-top: 1px solid var(--cl-ocre); margin: 1.5rem 0; }
.entry-content figure { margin: 1rem 0; }
.entry-content .wp-block-media-text { margin: 1rem 0; align-items: center; }
.entry-content .wp-block-image img,
.entry-content .wp-block-media-text__media img { border: 1px solid #bba978; padding: 3px; background: #fff; }
.entry-content .wp-block-media-text__media img[src$=".png"] { border: 0; padding: 0; background: transparent; } /* les PNG (logos, montages) peuvent être transparents : pas de cadre ni de fond blanc */
.entry-content .wp-block-gallery { margin: 1rem 0; }
.entry-content iframe { max-width: 100%; }
.entry-footer { margin-top: 2rem; }
.same-folder ul { margin: .3rem 0 0; padding-left: 1.2rem; font-size: .85rem; }

.folder-list { list-style: none; padding: 0; }
.folder-list li { margin: .35rem 0; }

.site-footer {
	text-align: center;
	font-size: .75rem;
	padding: 1rem;
	background: var(--cl-vert);
	color: var(--cl-fond);
}
.site-footer a { color: var(--cl-fond); }

.screen-reader-text {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- lightbox ---------- */
.cl-lightbox {
	position: fixed; inset: 0; z-index: 99999;
	background: rgba(0, 20, 10, .93);
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 1rem;
}
.cl-lightbox[hidden] { display: none; }
.cl-lightbox img { max-width: 96vw; max-height: 84vh; object-fit: contain; background: #fff; padding: 4px; }
.cl-lightbox .cl-count { color: var(--cl-fond); font-size: .85rem; margin-top: .6rem; }
.cl-lightbox button {
	position: absolute; background: var(--cl-vert); color: var(--cl-fond);
	border: 2px solid var(--cl-ocre); border-radius: 50%; width: 2.8rem; height: 2.8rem;
	font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.cl-lightbox button:hover, .cl-lightbox button:focus-visible { background: var(--cl-ocre); }
.cl-lightbox .cl-close { top: 1rem; right: 1rem; }
.cl-lightbox .cl-prev { left: .6rem; top: 50%; }
.cl-lightbox .cl-next { right: .6rem; top: 50%; }

/* ---------- téléphones ---------- */
@media (max-width: 700px) {
	.site-layout { flex-direction: column; }
	.site-sidebar { flex: none; width: 100%; background: #d6903f; padding: 8px 0 0; }
	.site-nav ul { display: flex; flex-wrap: wrap; justify-content: center; }
	.site-nav a { margin: 0 4px 6px; }
	.search-form { max-width: 280px; margin: 0 auto; }
	.site-content { padding: 10px .8rem 2rem; }
}

/* ---------- vidéos intégrées (YouTube…) : 16/9 adaptatif ---------- */
.cl-video { width: 100%; max-width: 800px; margin: 1rem 0; background: #000; border: 1px solid #bba978; }
.cl-video iframe { display: block; width: 100%; height: 100%; border: 0; }
.entry-content .wp-block-video video { max-width: 100%; height: auto; }

/* ---------- cartes des pistes (Leaflet / OpenStreetMap) ---------- */
.cl-map { width: 100%; max-width: 900px; height: 420px; margin: 1rem 0; border: 1px solid #bba978; background: #e9e3cf; z-index: 0; }
.cl-map-links { font-size: .85rem; margin: -.4rem 0 1rem; }
.cl-map-err { padding: 1rem; margin: 0; }
@media (max-width: 700px) { .cl-map { height: 320px; } }

/*
 * Contributions des membres (média + commentaire). L'article ne contient QUE le fond : une suite d'éléments « .cl-element » rangés par jour
 * (« .cl-jour »). La présentation est choisie ici, par le thème : un autre thème peut afficher la même chose autrement (grille, une colonne…).
 * Thème « vintage » : deux colonnes, média à DROITE sur le 1er élément de chaque jour, puis alternance ; une seule colonne sur téléphone.
 */
/* Éléments « média + texte » : dans les contributions (groupes « cl-jour ») et dans les anciens articles convertis (groupes « cl-serie »).
   Le fond (média, texte, ordre) est dans l'article ; la disposition (deux colonnes, alternance, mobile) est décidée ICI, par le thème. */
:root { --cl-media-largeur: min(38%, 360px); }   /* largeur des photos dans les rangées « photo + texte » (au lieu de 50 %) */
.cl-contributions { margin: 1.5em 0; }
:is(.cl-jour, .cl-serie) .cl-element { display: flex; align-items: center; gap: 1.5em; margin: .9em 0; }
/* WordPress enveloppe le contenu d'un groupe dans un conteneur interne : il ne doit pas compter dans la mise en page */
:is(.cl-jour, .cl-serie) .cl-element > .wp-block-group__inner-container { display: contents; }
:is(.cl-jour, .cl-serie) .cl-element figure { flex: 0 0 var(--cl-media-largeur); max-width: var(--cl-media-largeur); margin: 0; }
:is(.cl-jour, .cl-serie) .cl-element figure img, :is(.cl-jour, .cl-serie) .cl-element figure video { width: 100%; height: auto; display: block; }
:is(.cl-jour, .cl-serie) .cl-element .cl-texte { flex: 1 1 0; min-width: 0; }
:is(.cl-jour, .cl-serie) .cl-element .cl-texte > .wp-block-group__inner-container > :first-child { margin-top: 0; }
:is(.cl-jour, .cl-serie) .cl-element .cl-texte > .wp-block-group__inner-container > :last-child { margin-bottom: 0; }
:is(.cl-jour, .cl-serie) .cl-element:nth-of-type(odd) { flex-direction: row-reverse; }
@media (max-width: 700px) {
	:is(.cl-jour, .cl-serie) .cl-element, :is(.cl-jour, .cl-serie) .cl-element:nth-of-type(odd) { flex-direction: column; align-items: stretch; gap: .6em; }
	:is(.cl-jour, .cl-serie) .cl-element figure { flex-basis: auto; max-width: 100%; }
}

/* Crédit « Photo : pseudo » des médias proposés par les membres via l'application */
.cl-credit { font-size: .85em; color: #4d6a5a; margin-top: .3em; }

/* Icônes des réseaux sociaux dans le pied de page : simples liens (aucun script ni suivi), même couleur que le texte */
.site-footer .reseau { display: inline-block; vertical-align: middle; line-height: 0; margin: 0 .15em; }
.site-footer .reseau svg { width: 1.5em; height: 1.5em; fill: currentColor; opacity: .85; transition: opacity .15s; }
.site-footer .reseau:hover svg, .site-footer .reseau:focus svg { opacity: 1; }

/* Rangées « photo + texte » des articles non convertis (bloc Média et texte de WordPress) : même largeur de photo que ci-dessus (sur ordinateur) */
@media (min-width: 601px) {
	.entry-content .wp-block-media-text { grid-template-columns: var(--cl-media-largeur) 1fr; }
	.entry-content .wp-block-media-text.has-media-on-the-right { grid-template-columns: 1fr var(--cl-media-largeur); }
}

/* Vidéos hébergées sur le site : taille naturelle, plafonnée à 640 px et à la largeur de la page (jamais pleine largeur : les vidéos d'origine sont de petite définition) */
.entry-content .wp-block-video { max-width: 640px; margin-left: 0; margin-right: 0; }
.entry-content .wp-block-video video, .entry-content video { width: auto; max-width: 100%; height: auto; }
.cl-element .wp-block-video, .cl-element figure.wp-block-video { max-width: none; }
.cl-element figure video { width: 100%; }
