/*
Theme Name: Point G Magazine
Description: Thème bloc léger et sans dépendance pour Point G Magazine.
Version: 1.2.0
Requires at least: 6.5
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: pointg
Update URI: false
*/

/* ---------- Header ---------- */
.pg-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--paper);
	position: sticky;
	top: 0;
	z-index: 50;
}
.admin-bar .pg-header { top: 32px; }
.pg-header__inner { padding-block: 1.1rem; gap: 1rem; }
.pg-logo {
	margin: 0;
	font-family: var(--wp--preset--font-family--serif);
	font-size: 1.75rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}
.pg-logo a { text-decoration: none; color: var(--wp--preset--color--ink); }
.pg-nav { position: relative; }
.pg-menu-toggle { position: absolute; opacity: 0; pointer-events: none; }
.pg-burger { display: none; }
.pg-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.8rem;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.pg-menu li { position: relative; margin: 0; }
.pg-menu a { display: block; padding: 0.4rem 0; text-decoration: none; }
.pg-menu a:hover,
.pg-menu .current-menu-item > a,
.pg-menu .current-menu-parent > a { color: var(--wp--preset--color--accent); }

/* Sous-menus */
.pg-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: -1rem;
	min-width: 220px;
	margin: 0;
	padding: 0.6rem 1rem;
	list-style: none;
	background: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 6px;
	box-shadow: 0 10px 30px rgba(0,0,0,.08);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s;
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.9rem;
}
.pg-menu li:hover > .sub-menu,
.pg-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; }

/* Mobile : bouton burger sans JavaScript */
@media (max-width: 781px) {
	.pg-burger {
		display: grid;
		place-items: center;
		width: 42px;
		height: 42px;
		cursor: pointer;
	}
	.pg-burger span,
	.pg-burger span::before,
	.pg-burger span::after {
		display: block;
		width: 22px;
		height: 2px;
		background: var(--wp--preset--color--ink);
		position: relative;
		transition: transform .2s, background .2s;
	}
	.pg-burger span::before,
	.pg-burger span::after { content: ""; position: absolute; left: 0; }
	.pg-burger span::before { top: -7px; }
	.pg-burger span::after { top: 7px; }
	.pg-menu-toggle:checked + .pg-burger span { background: transparent; }
	.pg-menu-toggle:checked + .pg-burger span::before { transform: translateY(7px) rotate(45deg); }
	.pg-menu-toggle:checked + .pg-burger span::after { transform: translateY(-7px) rotate(-45deg); }
	.pg-menu-toggle:focus-visible + .pg-burger { outline: 2px solid var(--wp--preset--color--accent); }

	.pg-menu {
		display: none;
		position: absolute;
		right: 0;
		top: calc(100% + 0.6rem);
		width: min(80vw, 300px);
		flex-direction: column;
		gap: 0;
		padding: 0.8rem 1.2rem;
		background: var(--wp--preset--color--paper);
		border: 1px solid var(--wp--preset--color--line);
		border-radius: 6px;
		box-shadow: 0 10px 30px rgba(0,0,0,.1);
	}
	.pg-menu-toggle:checked ~ .pg-menu { display: flex; }
	.pg-menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		border: 0;
		box-shadow: none;
		padding: 0 0 0 1rem;
		min-width: 0;
	}
}

/* ---------- Hero ---------- */
.pg-hero {
	padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem);
	text-align: center;
}
.pg-hero__kicker {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
}
.pg-hero__title {
	margin: 0.6rem auto 0.8rem;
	max-width: 18ch;
	font-size: var(--wp--preset--font-size--xx-large);
}
.pg-hero__lead {
	margin: 0 auto;
	max-width: 46ch;
	color: var(--wp--preset--color--muted);
	font-size: 1.15rem;
}

/* Catégories en pastilles */
.pg-pills.wp-block-categories,
.pg-pills .wp-block-categories {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6rem;
	padding: 0;
	margin: 1.8rem 0 0;
}
.pg-pills li { margin: 0; }
.pg-pills a {
	display: inline-block;
	padding: 0.5rem 1.1rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	background: var(--wp--preset--color--paper);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
	transition: background .2s, color .2s, border-color .2s;
}
.pg-pills a:hover {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* ---------- Titres de section ---------- */
.pg-section-title {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-top: clamp(2.5rem, 5vw, 4rem);
	margin-bottom: 1.5rem;
	font-size: var(--wp--preset--font-size--x-large);
}
.pg-section-title::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--wp--preset--color--line);
}

/* ---------- Article à la une ---------- */
.pg-lead-list { list-style: none; padding: 0; margin: 0; }
.pg-lead {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: center;
}
.pg-lead > * { margin: 0 !important; }
.pg-lead .wp-block-post-featured-image { grid-row: span 4; }
.pg-lead .wp-block-post-featured-image img { border-radius: 6px; }
.pg-lead__title { font-size: var(--wp--preset--font-size--x-large); }
.pg-lead__title a { text-decoration: none; }
.pg-lead .wp-block-post-excerpt { color: var(--wp--preset--color--muted); }
.pg-lead .wp-block-post-excerpt p { margin: 0; }
@media (max-width: 781px) {
	.pg-lead { grid-template-columns: 1fr; }
	.pg-lead .wp-block-post-featured-image { grid-row: auto; }
}

/* ---------- Grille d'articles ---------- */
.pg-grid.pg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
	gap: 2.5rem 2rem;
	list-style: none;
	padding: 0;
}
.pg-card { display: flex; flex-direction: column; gap: 0.5rem; height: 100%; }
.pg-card > * { margin: 0 !important; }
.pg-card .wp-block-post-featured-image {
	overflow: hidden;
	border-radius: 6px;
	margin-bottom: 0.4rem !important;
}
.pg-card .wp-block-post-featured-image img { transition: transform .4s ease; }
.pg-card:hover .wp-block-post-featured-image img { transform: scale(1.04); }

/* Article sans image : visuel de remplacement */
.pg-card:not(:has(.wp-block-post-featured-image))::before {
	content: "Point G";
	display: grid;
	place-items: center;
	aspect-ratio: 3 / 2;
	margin-bottom: 0.4rem;
	border-radius: 6px;
	background: linear-gradient(135deg, var(--wp--preset--color--soft), var(--wp--preset--color--line));
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--serif);
	font-size: 1.6rem;
	font-style: italic;
}
.pg-card__title { font-size: var(--wp--preset--font-size--large); line-height: 1.3; }
.pg-card__title a { text-decoration: none; }

.pg-kicker {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}
.pg-kicker a { color: var(--wp--preset--color--accent); text-decoration: none; }
.pg-meta { font-size: 0.82rem; color: var(--wp--preset--color--muted); }

/* ---------- Pagination ---------- */
.wp-block-query-pagination { margin-top: 3rem; gap: 0.4rem; font-weight: 600; }
.wp-block-query-pagination a,
.wp-block-query-pagination .current {
	padding: 0.4rem 0.8rem;
	border-radius: 4px;
	text-decoration: none;
}
.wp-block-query-pagination .current { background: var(--wp--preset--color--ink); color: var(--wp--preset--color--paper); }

/* ---------- Article ---------- */
.pg-single-header { text-align: center; padding-top: clamp(2rem, 5vw, 3.5rem); }
.pg-single-header .pg-kicker,
.pg-single-header .pg-meta { justify-content: center; }
.pg-single-title { font-size: var(--wp--preset--font-size--xx-large); margin-block: 0.6rem; }
.pg-single-image img { border-radius: 6px; }
.pg-content { font-size: 1.125rem; }
.pg-content h2 { margin-top: 2.5rem; font-size: var(--wp--preset--font-size--x-large); }
.pg-content h3 { margin-top: 2rem; }
.pg-content a { color: var(--wp--preset--color--accent); }
.pg-content img { border-radius: 4px; }

/* ---------- Archive ---------- */
.pg-archive-header { padding-top: clamp(2rem, 5vw, 3.5rem); text-align: center; }
.pg-archive-header .wp-block-query-title { font-size: var(--wp--preset--font-size--xx-large); margin: 0.4rem 0; }
.pg-archive-header .wp-block-term-description { color: var(--wp--preset--color--muted); max-width: 60ch; margin-inline: auto; }

/* ---------- Footer ---------- */
.pg-footer {
	margin-top: clamp(3rem, 7vw, 5rem);
	padding-block: 3rem 2rem;
	background: var(--wp--preset--color--ink);
	color: #c9ccd3;
}
.pg-footer a { color: #fff; text-decoration: none; }
.pg-footer a:hover { color: var(--wp--preset--color--accent); }
.pg-footer .pg-logo a { color: #fff; }
.pg-footer .wp-block-site-tagline { margin-top: 0.3rem; font-size: 0.9rem; }
.pg-footer .pg-pills a { background: transparent; border-color: #3a3e48; color: #fff; }
.pg-footer .pg-pills a:hover { background: #fff; color: var(--wp--preset--color--ink); }
.pg-footer .pg-pills.wp-block-categories { justify-content: flex-start; margin-top: 0; }
.pg-footer__copy { margin-top: 2rem !important; padding-top: 1.5rem; border-top: 1px solid #2c3039; font-size: 0.8rem; }

@media (max-width: 600px) {
	.pg-logo { font-size: 1.4rem; }
	.admin-bar .pg-header { top: 0; position: relative; }
}

/* ---------- Correctifs 1.2.0 ---------- */
/* Cartes alignées : on annule l'espacement vertical ajouté par WordPress */
.pg-grid > li,
.pg-lead-list > li { margin: 0 !important; }

/* Article à la une sans image : visuel de remplacement */
.pg-lead:not(:has(.wp-block-post-featured-image img))::before {
	content: "Point G";
	grid-row: span 4;
	display: grid;
	place-items: center;
	aspect-ratio: 16 / 10;
	border-radius: 6px;
	background: linear-gradient(135deg, var(--wp--preset--color--soft), var(--wp--preset--color--line));
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--serif);
	font-size: 2.2rem;
	font-style: italic;
}
.pg-lead:not(:has(.wp-block-post-featured-image img)) .wp-block-post-featured-image { display: none; }

/* Carte dont l'image est vide */
.pg-card:has(.wp-block-post-featured-image:not(:has(img)))::before {
	content: "Point G";
	display: grid;
	place-items: center;
	aspect-ratio: 3 / 2;
	margin-bottom: 0.4rem;
	border-radius: 6px;
	background: linear-gradient(135deg, var(--wp--preset--color--soft), var(--wp--preset--color--line));
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--serif);
	font-size: 1.6rem;
	font-style: italic;
}
.pg-card .wp-block-post-featured-image:not(:has(img)) { display: none; }
@media (max-width: 781px) {
	.pg-lead:not(:has(.wp-block-post-featured-image img))::before { grid-row: auto; }
}
