/*
Theme Name: Sommeil Tranquille
Theme URI: https://sommeil-tranquille.com
Author: VDL
Description: Thème éditorial sur mesure pour Sommeil Tranquille — insomnie, routines du soir, solutions naturelles, décryptages des idées reçues sur le sommeil.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: sommeil-tranquille
*/

/* ==========================================================================
   0. Variables & reset
   Construit mobile-first : les règles de base ci-dessous ciblent le mobile,
   les media queries (min-width) ajoutent/adaptent pour tablette/desktop.
   ========================================================================== */

:root {
	--navy-950: #070c1c;
	--navy-900: #0d1730;
	--navy-800: #142242;
	--navy-700: #1c2f57;
	--navy-600: #28407a;
	--amber-500: #d9a441;
	--amber-600: #b9822a;
	--amber-100: #f3e3bd;
	--cream-50: #f8f5ef;
	--cream-100: #efe8d9;
	--ink-900: #14181f;
	--ink-700: #3d4250;
	--ink-500: #6b7080;
	--white: #ffffff;
	--border: #e4ddca;
	--radius-md: 10px;
	--radius-lg: 16px;
	--shadow-sm: 0 1px 2px rgba(7, 12, 28, 0.08);
	--shadow-md: 0 10px 28px rgba(7, 12, 28, 0.14);
	--font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--container-w: 1120px;
	--meta-font-size: 0.85rem;
}

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

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

body {
	margin: 0;
	font-family: var(--font-base);
	font-size: 16px;
	line-height: 1.65;
	color: var(--ink-900);
	background: var(--cream-50);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* Sticky footer : le footer reste colle en bas de l ecran meme quand le
   contenu est court (site tout juste lance, peu d articles) - evite un
   bandeau de fond visible entre le footer et le bas du viewport. */
.site-main {
	flex: 1 0 auto;
}

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

a {
	color: var(--navy-700);
	text-decoration: none;
}

a:hover {
	color: var(--amber-600);
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Reset explicite des marges par défaut des <p> dans les blocs à
   espacement calculé au pixel (piège documenté : ~1.2em invisible sinon). */
.hero p,
.focus-block p,
.post-card p,
.footer-col p,
.empty-state p,
.author-bio p,
.entry-sources p,
.table-of-contents p,
.not-found p {
	margin: 0;
}

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

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1000;
	background: var(--amber-500);
	color: var(--navy-950);
	padding: 0.6rem 1rem;
}

.skip-link:focus {
	left: 0.5rem;
	top: 0.5rem;
	width: auto;
	height: auto;
	clip: auto;
}

.container {
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 0 1rem;
}

.button {
	display: inline-block;
	padding: 0.7rem 1.3rem;
	border-radius: var(--radius-md);
	font-weight: 600;
	font-size: 0.95rem;
	border: 2px solid transparent;
	cursor: pointer;
}

.button--accent {
	background: var(--amber-500);
	color: var(--navy-950);
}

.button--accent:hover {
	background: var(--amber-600);
	color: var(--navy-950);
}

.button--outline {
	background: transparent;
	border-color: var(--navy-700);
	color: var(--navy-700);
}

.button--outline:hover {
	background: var(--navy-700);
	color: var(--white);
}

/* ==========================================================================
   1. Header
   ========================================================================== */

.site-header {
	background: var(--navy-950);
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: var(--shadow-sm);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 0.6rem 1rem;
}

.site-branding__link {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
}

.site-branding__logo {
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}

.site-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--white);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.menu-toggle {
	background: transparent;
	border: none;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	cursor: pointer;
}

.menu-toggle__bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--white);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(2) {
	opacity: 0;
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.primary-navigation {
	flex-basis: 100%;
	display: none;
}

.primary-navigation.is-open {
	display: block;
}

.primary-menu li + li {
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-menu a {
	display: block;
	padding: 0.75rem 0.25rem;
	color: var(--white);
	font-size: 0.98rem;
}

.primary-menu a:hover {
	color: var(--amber-500);
}

/* Palier étroit supplémentaire (iPhone SE et en dessous) : logo/titre
   encore réduits pour ne jamais passer à la ligne. */
@media (max-width: 350px) {
	.site-header__inner {
		padding: 0.5rem 0.65rem;
	}
	.site-title {
		font-size: 0.92rem;
	}
	.site-branding__logo {
		width: 22px;
		height: 22px;
	}
	.menu-toggle {
		width: 34px;
	}
}

@media (min-width: 900px) {
	.menu-toggle {
		display: none;
	}
	.primary-navigation {
		display: block !important;
		flex-basis: auto;
	}
	.primary-menu {
		display: flex;
		gap: 1.5rem;
	}
	.primary-menu li + li {
		border-top: none;
	}
	.primary-menu a {
		padding: 0.4rem 0;
	}
}

/* ==========================================================================
   2. Empty state (accueil, aucun article publié)
   ========================================================================== */

.empty-state {
	padding: 3.5rem 1rem;
	background: linear-gradient(160deg, var(--navy-950), var(--navy-800));
}

.empty-state__inner {
	max-width: 520px;
	margin: 0 auto;
	text-align: center;
	color: var(--white);
}

.empty-state__icon {
	width: 40px;
	height: 40px;
	margin-bottom: 1rem;
}

.empty-state__title {
	font-size: 1.5rem;
	margin: 0 0 0.75rem;
}

.empty-state__text {
	color: rgba(255, 255, 255, 0.82);
	font-size: 1rem;
}

/* ==========================================================================
   3. Hero (accueil, article à la une)
   PIÈGE ÉVITÉ : pas de background-size en % sur un bloc à hauteur variable
   — l'image est un <img> à part (object-fit: cover), jamais un
   background-image posé sur toute la section .hero dont la hauteur suit le
   texte.
   ========================================================================== */

.hero {
	padding: 1.5rem 1rem 0;
}

.hero__inner {
	max-width: var(--container-w);
	margin: 0 auto;
	background: var(--navy-950);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.hero__media {
	display: block;
	height: 220px;
	overflow: hidden;
}

.hero__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero__content {
	padding: 1.5rem;
	color: var(--white);
}

.hero__category {
	display: inline-block;
	background: var(--amber-500);
	color: var(--navy-950);
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 0.25rem 0.6rem;
	border-radius: 999px;
	margin-bottom: 0.75rem;
}

.hero__title {
	font-size: 1.5rem;
	line-height: 1.3;
	margin: 0 0 0.75rem;
}

.hero__title a {
	color: var(--white);
}

.hero__excerpt {
	color: rgba(255, 255, 255, 0.82);
	margin-bottom: 3rem;
}

@media (min-width: 700px) {
	.hero__inner {
		display: flex;
		align-items: stretch;
	}
	.hero__media {
		width: 45%;
		height: auto;
		flex-shrink: 0;
	}
	.hero__content {
		padding: 2.25rem;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
	.hero__title {
		font-size: 1.9rem;
	}
}

/* ==========================================================================
   4. Blocs Focus (par catégorie)
   ========================================================================== */

.focus-sections {
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 2.5rem 1rem 0;
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
}

.focus-block__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--border);
	margin-bottom: 1.25rem;
}

.focus-block__title {
	font-size: 1.25rem;
	margin: 0;
	color: var(--navy-900);
}

.focus-block__all {
	font-size: 0.9rem;
	font-weight: 600;
	white-space: nowrap;
}

.focus-block__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

.focus-block__empty {
	background: var(--cream-100);
	border: 1px dashed var(--border);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	text-align: center;
}

.focus-block__empty p {
	margin: 0 0 0.9rem;
	color: var(--ink-700);
}

@media (min-width: 700px) {
	.focus-block__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ==========================================================================
   5. Cartes article (post-card) — réutilisées homepage + archives + liés
   PIÈGE ÉVITÉ : le lien de recouvrement est un enfant direct de .post-card
   (jamais niché dans le titre), position absolute + z-index !important.
   ========================================================================== */

.post-card {
	position: relative;
	background: var(--white);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
}

.post-card__link {
	position: absolute !important;
	inset: 0;
	z-index: 5 !important;
}

.post-card__media {
	height: 170px;
	background: var(--cream-100);
}

.post-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.post-card__media-fallback {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--navy-800), var(--navy-950));
}

.post-card__body {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.post-card__category {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--amber-600);
}

.post-card__title {
	font-size: 1.05rem;
	margin: 0;
	color: var(--navy-900);
	line-height: 1.35;
}

.post-card__excerpt {
	font-size: 0.9rem;
	color: var(--ink-700);
}

/* ==========================================================================
   6. Flux de contenu unifié (accueil)
   ========================================================================== */

.content-stream {
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 2.5rem 1rem 3rem;
}

.content-stream__title {
	font-size: 1.25rem;
	color: var(--navy-900);
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--border);
	margin: 0 0 1.25rem;
}

.content-stream__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 700px) {
	.content-stream__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ==========================================================================
   7. Article (single.php)
   ========================================================================== */

.entry {
	max-width: 760px;
	margin: 0 auto;
	padding: 1.75rem 1rem 3rem;
}

.entry-header {
	margin-bottom: 1.25rem;
}

.entry-category {
	display: inline-block;
	font-size: var(--meta-font-size);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--amber-600);
	margin-bottom: 0.5rem;
}

.entry-title {
	font-size: 1.6rem;
	line-height: 1.3;
	color: var(--navy-950);
	margin: 0 0 0.6rem;
}

/* Réglage documenté : label catégorie et date à la même taille de police. */
.entry-header .content-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	font-size: var(--meta-font-size);
	color: var(--ink-500);
}

.author-bio {
	display: flex;
	gap: 0.9rem;
	align-items: flex-start;
	background: var(--cream-100);
	border-radius: var(--radius-md);
	padding: 1rem;
	margin-bottom: 1.5rem;
}

.author-bio__avatar {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--navy-900);
	display: flex;
	align-items: center;
	justify-content: center;
}

.author-bio__avatar svg {
	width: 26px;
	height: 26px;
}

.author-bio__name {
	font-weight: 700;
	color: var(--navy-900);
	margin: 0 0 0.25rem;
}

.author-bio p {
	font-size: 0.92rem;
	color: var(--ink-700);
}

.entry-thumbnail {
	margin-bottom: 1.5rem;
	border-radius: var(--radius-md);
	overflow: hidden;
}

.entry-content {
	font-size: 1.05rem;
	line-height: 1.75;
}

.entry-content h2 {
	font-size: 1.3rem;
	color: var(--navy-950);
	margin: 2rem 0 0.75rem;
}

.entry-content h3 {
	font-size: 1.1rem;
	color: var(--navy-900);
	margin: 1.5rem 0 0.6rem;
}

.entry-content p {
	margin: 0 0 1.1rem;
}

.entry-content ul,
.entry-content ol {
	margin: 0 0 1.1rem;
	padding-left: 1.25rem;
	list-style: revert;
}

.entry-content a {
	text-decoration: underline;
}

/* Sommaire cliquable */
.table-of-contents {
	background: var(--white);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	margin: 0 0 1.75rem;
}

.table-of-contents__title {
	font-weight: 700;
	color: var(--navy-900);
	margin: 0 0 0.5rem;
}

.table-of-contents ul {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.table-of-contents a {
	text-decoration: none;
	font-size: 0.95rem;
}

/* Sources en encadré distinct */
.entry-sources {
	background: var(--navy-950);
	color: var(--white);
	border-radius: var(--radius-md);
	padding: 1.25rem 1.5rem;
	margin: 1.75rem 0;
}

.entry-sources h2,
.entry-sources h3,
.entry-sources h4 {
	color: var(--amber-500) !important;
	margin-top: 0 !important;
}

.entry-sources a {
	color: var(--amber-100);
}

.entry-sources ul,
.entry-sources ol {
	margin-bottom: 0;
}

/* Disclaimer médical */
.disclaimer-medical {
	background: var(--cream-100);
	border-left: 4px solid var(--amber-500);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	padding: 1rem 1.25rem;
	margin: 2rem 0;
	font-size: 0.92rem;
	color: var(--ink-700);
}

.disclaimer-medical p {
	margin: 0;
}

/* Articles similaires */
.related-posts {
	margin-top: 2.5rem;
}

.related-posts__title {
	font-size: 1.2rem;
	color: var(--navy-900);
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--border);
	margin: 0 0 1.25rem;
}

.related-posts__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 700px) {
	.related-posts__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ==========================================================================
   8. Pages génériques (À propos, Contact, Mentions légales)
   ========================================================================== */

.page-entry {
	max-width: 760px;
	margin: 0 auto;
	padding: 1.75rem 1rem 3rem;
}

.page-entry__title {
	font-size: 1.6rem;
	color: var(--navy-950);
	margin: 0 0 1.25rem;
}

.page-content {
	font-size: 1.05rem;
	line-height: 1.75;
}

.page-content p {
	margin: 0 0 1.1rem;
}

/* Formulaire de contact (Contact Form 7) */
.page-contact .wpcf7-form p {
	margin: 0 0 1rem;
}

.page-contact .wpcf7-form label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
	color: var(--navy-900);
}

.page-contact .wpcf7-form input[type="text"],
.page-contact .wpcf7-form input[type="email"],
.page-contact .wpcf7-form textarea {
	width: 100%;
	padding: 0.65rem 0.8rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	font-family: inherit;
	font-size: 1rem;
}

.page-contact .wpcf7-form textarea {
	min-height: 140px;
	resize: vertical;
}

.page-contact .wpcf7-form input[type="submit"] {
	background: var(--amber-500);
	color: var(--navy-950);
	border: none;
	border-radius: var(--radius-md);
	padding: 0.7rem 1.4rem;
	font-weight: 700;
	font-size: 0.95rem;
	cursor: pointer;
}

.page-contact .wpcf7-form input[type="submit"]:hover {
	background: var(--amber-600);
}

.page-contact .wpcf7-response-output {
	border-radius: var(--radius-md);
	padding: 0.75rem 1rem;
	margin-top: 1rem;
}

/* Plan du site */
.sitemap__section {
	margin-bottom: 1.75rem;
}

.sitemap__section h2 {
	font-size: 1.15rem;
	color: var(--navy-900);
	margin: 0 0 0.6rem;
}

.sitemap__section ul {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.sitemap__empty {
	color: var(--ink-500);
	font-style: italic;
}

/* ==========================================================================
   9. Archives (category.php / archive.php)
   ========================================================================== */

.archive-header {
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 2rem 1rem 1rem;
}

.archive-header__title {
	font-size: 1.5rem;
	color: var(--navy-950);
	margin: 0;
}

.archive-header__description {
	color: var(--ink-700);
	margin-top: 0.5rem;
}

.content-stream__grid,
.pagination {
	max-width: var(--container-w);
	margin: 0 auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

.pagination {
	display: flex;
	justify-content: space-between;
	padding-top: 1rem;
	padding-bottom: 3rem;
}

/* ==========================================================================
   10. 404
   ========================================================================== */

.not-found {
	padding: 3rem 1rem;
}

.not-found__inner {
	max-width: 520px;
	margin: 0 auto;
	text-align: center;
}

.not-found__title {
	font-size: 1.4rem;
	color: var(--navy-950);
	margin: 0 0 0.75rem;
}

.not-found__categories {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.not-found__categories a {
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--border);
	border-radius: 999px;
}

/* ==========================================================================
   11. Footer
   ========================================================================== */

.site-footer {
	background: var(--navy-950);
	color: rgba(255, 255, 255, 0.85);
	margin-top: 2rem;
}

.site-footer__columns {
	max-width: var(--container-w);
	margin: 0 auto;
	padding: 2.5rem 1rem 1.5rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
}

.footer-col__title {
	font-size: 1rem;
	color: var(--white);
	margin: 0 0 0.9rem;
}

.footer-col p {
	font-size: 0.9rem;
	line-height: 1.6;
	margin-bottom: 0.75rem;
}

.footer-col__link {
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--amber-500);
}

.footer-col ul {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.footer-col ul a {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.85);
}

.footer-col ul a:hover {
	color: var(--amber-500);
}

.footer-col__empty {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.5);
	font-style: italic;
}

.site-footer__bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	padding: 1.25rem 1rem;
	max-width: var(--container-w);
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	font-size: 0.85rem;
}

.site-footer__copyright {
	margin: 0;
	color: rgba(255, 255, 255, 0.6);
}

.site-footer__nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.site-footer__nav a {
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.85rem;
}

.site-footer__nav a:hover {
	color: var(--amber-500);
}

@media (min-width: 700px) {
	.site-footer__columns {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {
	.site-footer__columns {
		grid-template-columns: repeat(4, 1fr);
	}
	.site-footer__bottom {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}
