/*
Theme Name: Wiegert
Theme URI: https://wiegert.fr
Author: Richard Wiegert
Description: Thème de blog responsive (ordinateur, tablette, téléphone) avec bandeau qui change automatiquement selon la catégorie, puces et icônes animées.
Version: 1.3.1
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wiegert
Tags: blog, custom-colors, custom-logo, featured-images, threaded-comments, translation-ready, two-columns
*/

/* ==========================================================================
   Variables et base
   ========================================================================== */
:root {
	--accent: #1f6f9a;
	--ink: #1d2433;
	--muted: #5b6475;
	--bg: #f5f6f8;
	--card: #ffffff;
	--line: #e2e5ea;
	--radius: 14px;
	--shadow: 0 6px 24px rgba(20, 30, 50, .08);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--wrap: 1180px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 1.0625rem;
	line-height: 1.7;
	color: var(--ink);
	background: var(--bg);
}

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

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .6em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }

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

.skip-link {
	position: absolute; left: -999px; top: 8px;
	background: #fff; color: var(--ink);
	padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

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

/* ==========================================================================
   En-tête et navigation
   ========================================================================== */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }

.header-inner {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; min-height: 64px;
}

.site-title {
	font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em;
	color: var(--ink); text-decoration: none;
}
.custom-logo { max-height: 44px; width: auto; }

.site-nav .menu {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; gap: 4px;
}
.site-nav a {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 12px; border-radius: 999px;
	color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
	transition: background .2s, color .2s;
}
.site-nav a:hover { background: #eef1f5; }
.site-nav .current-menu-item > a,
.site-nav .current-cat > a,
.site-nav .current-menu-ancestor > a {
	background: var(--ink); color: #fff;
}

.nav-icon { display: inline-block; transition: transform .3s; }
.site-nav a:hover .nav-icon { animation: wobble .7s ease; }
.current-menu-item .nav-icon { animation: float 3s ease-in-out infinite; }

/* Bouton menu (mobile) */
.nav-toggle {
	display: none;
	width: 44px; height: 44px; border: 0; border-radius: 10px;
	background: #eef1f5; cursor: pointer; position: relative;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: ""; position: absolute; left: 11px; right: 11px;
	height: 3px; border-radius: 3px; background: var(--ink);
	transition: transform .25s, top .25s, opacity .2s;
}
.nav-toggle__bars { top: 20px; }
.nav-toggle__bars::before { top: -8px; left: 0; right: 0; }
.nav-toggle__bars::after { top: 8px; left: 0; right: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { top: 0; transform: rotate(-45deg); }

/* ==========================================================================
   Bandeau (change selon la catégorie)
   ========================================================================== */
.banner {
	--bc: #1f6f9a;
	position: relative; overflow: hidden; color: #fff;
	background: linear-gradient(120deg,
		color-mix(in srgb, var(--bc) 85%, #000),
		var(--bc),
		color-mix(in srgb, var(--bc) 55%, #000));
	background-color: var(--bc);
	background-size: 220% 220%;
	animation: bannerShift 16s ease infinite;
	transition: background-color .4s;
}
.banner.has-images { animation: none; }
.banner.has-images .bubble { display: none; }

.banner__bg { position: absolute; inset: 0; z-index: 0; }
.bg-layer {
	position: absolute; inset: 0;
	background-size: cover; background-position: center;
	opacity: 0; transition: opacity 1.6s ease;
}
.bg-layer.is-on { opacity: 1; }

/* Voile sombre teinté de la couleur de la catégorie, pour garder le titre lisible */
.banner.has-images::after {
	content: ""; position: absolute; inset: 0; z-index: 1;
	background:
		linear-gradient(100deg, rgba(0, 0, 0, .62), rgba(0, 0, 0, .2) 65%, rgba(0, 0, 0, .1)),
		color-mix(in srgb, var(--bc) 22%, transparent);
}

.icon-svg { display: inline-block; vertical-align: -.14em; }

.banner__inner {
	position: relative; z-index: 2;
	display: flex; align-items: center; justify-content: space-between; gap: 24px;
	padding-block: clamp(36px, 7vw, 84px);
}
.banner__text { max-width: 720px; }

.banner__kicker {
	margin: 0 0 6px; font-size: .8rem; font-weight: 700;
	letter-spacing: .14em; text-transform: uppercase; opacity: .9;
}
.banner__title {
	margin: 0; font-size: clamp(1.9rem, 5.5vw, 3.4rem);
	font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
	text-shadow: 0 2px 14px rgba(0, 0, 0, .25);
	animation: slideUp .6s ease both;
}
.banner__desc {
	margin: 12px 0 0; font-size: clamp(1rem, 2.2vw, 1.2rem); opacity: .95;
	max-width: 56ch; animation: slideUp .7s .1s ease both;
}
.banner__icon {
	font-size: clamp(3.5rem, 11vw, 7.5rem); line-height: 1;
	filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .3));
	animation: float 4s ease-in-out infinite;
}

.bubble {
	position: absolute; z-index: 1; border-radius: 50%;
	background: rgba(255, 255, 255, .13);
	animation: drift 12s ease-in-out infinite;
}
.b1 { width: 160px; height: 160px; left: -40px; top: -60px; }
.b2 { width: 90px; height: 90px; left: 38%; bottom: -30px; animation-delay: -4s; animation-duration: 14s; }
.b3 { width: 220px; height: 220px; right: 8%; top: -110px; animation-delay: -7s; }
.b4 { width: 60px; height: 60px; right: 30%; bottom: 20px; animation-delay: -2s; animation-duration: 10s; }

/* ==========================================================================
   Mise en page
   ========================================================================== */
.layout {
	display: grid; grid-template-columns: minmax(0, 1fr);
	gap: 40px; padding-block: 40px 56px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

/* Cartes d'articles */
.card {
	display: flex; flex-direction: column;
	background: var(--card); border-radius: var(--radius);
	box-shadow: var(--shadow); overflow: hidden;
	transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(20, 30, 50, .14); }

.card__media { display: block; overflow: hidden; aspect-ratio: 16 / 10; background: var(--line); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card__media img { transform: scale(1.05); }

.card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card__title { margin: 10px 0 6px; font-size: 1.25rem; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--accent); }
.card__meta { margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.card__excerpt { color: #3b4357; flex: 1; }
.card__excerpt p { margin: 0 0 14px; }

.more { font-weight: 700; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.more__arrow { display: inline-block; transition: transform .25s; }
.more:hover .more__arrow { transform: translateX(6px); }

/* Pastilles de catégories */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
	--chip: #1f6f9a;
	display: inline-flex; align-items: center; gap: 5px;
	padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700;
	text-decoration: none; color: #fff; background: var(--chip);
	transition: transform .2s, filter .2s;
}
.chip:hover { transform: scale(1.06); filter: brightness(1.08); }
.chip span { display: inline-block; }
.chip:hover span { animation: wobble .7s ease; }

/* Apparition au défilement (activée par le JS) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s, transform .6s; }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Pagination */
.pagination { margin-top: 36px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.page-numbers {
	min-width: 42px; padding: 8px 14px; text-align: center;
	background: var(--card); border-radius: 999px; color: var(--ink);
	text-decoration: none; font-weight: 700; box-shadow: var(--shadow);
}
.page-numbers.current, a.page-numbers:hover { background: var(--ink); color: #fff; }

.notice { background: var(--card); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ==========================================================================
   Article seul
   ========================================================================== */
.entry { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 44px); }
.entry-title { margin: 12px 0 8px; font-size: clamp(1.7rem, 4.5vw, 2.5rem); letter-spacing: -.02em; }
.entry-meta { color: var(--muted); font-size: .9rem; margin: 0 0 20px; }
.entry-thumb { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; }
.entry-thumb img { width: 100%; }

.entry-content { overflow-wrap: break-word; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content img { border-radius: 10px; }
.entry-content blockquote {
	margin: 1.5em 0; padding: 4px 0 4px 20px;
	border-left: 4px solid var(--accent); color: #3b4357; font-style: italic;
}
.entry-content figure { margin: 1.5em 0; }
.entry-content figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: 6px; }
.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 12px; }
.alignwide { max-width: 100%; }
.alignleft { float: left; margin: 0 1.2em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.2em; }
.aligncenter { margin-inline: auto; }

.tags a { display: inline-block; background: #eef1f5; border-radius: 999px; padding: 2px 12px; margin: 2px; font-size: .85rem; text-decoration: none; }

.post-navigation .nav-links { justify-content: space-between; margin-top: 28px; }
.post-navigation a { display: block; max-width: 48%; background: var(--card); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); text-decoration: none; font-weight: 700; }

/* ==========================================================================
   Puces animées (contenu des articles, widgets)
   ========================================================================== */
.entry-content ul, .widget ul:not(.cat-list):not(.menu) { list-style: none; padding-left: 0; }
.entry-content ul li, .widget ul:not(.cat-list):not(.menu) li {
	position: relative; padding-left: 1.7rem; margin: .45em 0;
}
.entry-content ul li::before, .widget ul:not(.cat-list):not(.menu) li::before {
	content: ""; position: absolute; left: .25rem; top: .62em;
	width: .62rem; height: .62rem; border-radius: 50%;
	background: var(--accent);
	animation: pulse 2.4s ease-in-out infinite;
}
.entry-content ul ul li::before { border-radius: 2px; transform: rotate(45deg); animation-name: pulseDiamond; }
.entry-content li:nth-child(2n)::before { animation-delay: .4s; }
.entry-content li:nth-child(3n)::before { animation-delay: .8s; }

.entry-content ol { list-style: none; counter-reset: wg; padding-left: 0; }
.entry-content ol > li { counter-increment: wg; position: relative; padding-left: 2.4rem; margin: .6em 0; }
.entry-content ol > li::before {
	content: counter(wg); position: absolute; left: 0; top: .1em;
	width: 1.7rem; height: 1.7rem; border-radius: 50%;
	display: grid; place-items: center;
	background: var(--accent); color: #fff; font-size: .85rem; font-weight: 700;
	animation: pop 3s ease-in-out infinite;
}

/* ==========================================================================
   Colonne latérale
   ========================================================================== */
.widget { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.widget-title { margin: 0 0 12px; font-size: 1.05rem; }
.widget ul { margin: 0; padding: 0; }
.widget a { text-decoration: none; }
.widget a:hover { text-decoration: underline; }

.cat-list { list-style: none; }
.cat-list li { margin: 2px 0; }
.cat-list a {
	display: flex; align-items: center; gap: 10px;
	padding: 7px 10px; border-radius: 10px; color: var(--ink); font-weight: 600;
	transition: background .2s, transform .2s;
}
.cat-list a:hover { background: #eef1f5; transform: translateX(4px); text-decoration: none; }
.cat-list .is-current a { background: var(--ink); color: #fff; }
.cat-icon { display: inline-block; }
.cat-list a:hover .cat-icon { animation: wobble .7s ease; }
.cat-count { margin-left: auto; font-size: .78rem; opacity: .7; }

/* Recherche */
.search-form { display: flex; gap: 8px; }
.search-field {
	flex: 1; min-width: 0; padding: 10px 14px; font: inherit;
	border: 1px solid var(--line); border-radius: 999px; background: #fff;
}
.search-submit { border: 0; border-radius: 999px; padding: 0 16px; background: var(--ink); cursor: pointer; font-size: 1rem; }

/* ==========================================================================
   Commentaires
   ========================================================================== */
.comments { margin-top: 32px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 36px); }
.comments-title, .comment-reply-title { margin-top: 0; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 20px; border-left: 2px solid var(--line); }
.comment-body { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-author .avatar { float: left; margin-right: 12px; border-radius: 50%; }
.comment-metadata { font-size: .8rem; color: var(--muted); }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; padding: 10px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px;
}
.comment-form .submit, .button {
	background: var(--ink); color: #fff; border: 0; border-radius: 999px;
	padding: 11px 24px; font: inherit; font-weight: 700; cursor: pointer;
}
.comment-form .submit:hover { background: var(--accent); }

/* ==========================================================================
   Pied de page
   ========================================================================== */
.site-footer { background: var(--ink); color: #cfd5e0; padding-block: 28px; font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-inner p { margin: 0; }
.to-top { color: #fff; text-decoration: none; font-weight: 700; }
.to-top span { display: inline-block; animation: float 2.5s ease-in-out infinite; }

/* ==========================================================================
   Responsive : ordinateur / tablette / téléphone
   ========================================================================== */
@media (min-width: 981px) {
	.layout { grid-template-columns: minmax(0, 1fr) 320px; }
	.sidebar { position: sticky; top: 90px; align-self: start; }
}

@media (max-width: 860px) {
	.nav-toggle { display: block; }
	.site-nav {
		position: absolute; left: 0; right: 0; top: 100%;
		background: #fff; border-bottom: 1px solid var(--line);
		box-shadow: 0 16px 24px rgba(20, 30, 50, .1);
		max-height: 0; overflow: hidden; visibility: hidden;
		transition: max-height .35s ease, visibility 0s .35s;
	}
	.site-nav.is-open { max-height: 80vh; overflow-y: auto; visibility: visible; transition: max-height .35s ease; }
	.site-nav .menu { flex-direction: column; padding: 12px 20px 18px; }
	.site-nav a { display: flex; border-radius: 12px; padding: 12px 14px; }
	.banner__icon { font-size: 4.2rem; }
}

@media (max-width: 600px) {
	body { font-size: 1rem; }
	.wrap { padding-inline: 16px; }
	.grid { grid-template-columns: 1fr; }
	.banner__inner { gap: 12px; }
	.post-navigation a { max-width: 100%; margin-bottom: 8px; }
	.post-navigation .nav-links { flex-direction: column; }
	.admin-bar .site-header { top: 46px; }
}

@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes bannerShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(24px, -18px) scale(1.08); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .65; } }
@keyframes pulseDiamond { 0%, 100% { transform: rotate(45deg) scale(1); } 50% { transform: rotate(135deg) scale(1.3); } }
@keyframes pop { 0%, 85%, 100% { transform: scale(1); } 92% { transform: scale(1.18); } }
@keyframes wobble {
	0% { transform: rotate(0); } 20% { transform: rotate(-14deg) scale(1.15); }
	40% { transform: rotate(10deg) scale(1.15); } 60% { transform: rotate(-6deg); }
	80% { transform: rotate(4deg); } 100% { transform: rotate(0); }
}

/* Respect des préférences : on coupe les animations si demandé */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
	.js .reveal { opacity: 1; transform: none; }
}
