/*
Theme Name: Just a Kid
Theme URI: https://justakid.fr
Description: Thème enfant de Twenty Twenty-Five pour la boutique Just a Kid : fond papier froissé, gribouillis, articles épuisés raturés.
Author: Just a Kid
Template: twentytwentyfive
Version: 1.1.0
Requires at least: 6.7
Requires PHP: 7.4
Text Domain: just-a-kid
Domain Path: /languages
License: GNU General Public License v2 or later
*/

/* ------------------------------------------------------------------
   Réglages rapides
   Les images viennent de functions.php (variables --jak-img-*).
   ------------------------------------------------------------------ */
:root {
	--jak-encre: #141414;
	--jak-papier-couleur: #ededed; /* teinte moyenne du papier, visible le temps que l'image charge */
	--jak-papier-opacite: 1;      /* baisser si les vêtements ressortent mal */
	--jak-texte: Athelas, Spectral, Georgia, serif;           /* titres, catégories, descriptions, tout le reste */
	--jak-manuscrit: "Kindergarten Cam", "Comic Sans MS", cursive; /* phrases d'accroche uniquement */
	--jak-gouttiere: clamp(16px, 4vw, 48px);
}

/* ------------------------------------------------------------------
   Fond papier froissé, partout (pages, menu plein écran, panneau panier).
   Image : assets/images/papier.webp (remplaçable par assets/perso/papier.*).
   Le papier reste fixe, le contenu défile par-dessus.
   ------------------------------------------------------------------ */
body {
	background-color: var(--jak-papier-couleur);
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: var(--jak-img-papier) center / cover no-repeat;
	opacity: var(--jak-papier-opacite);
}

/* Menu plein écran et panneau du panier : même papier */
.wp-block-navigation__responsive-container.is-menu-open,
.wc-block-components-drawer,
.wc-block-mini-cart__drawer .components-modal__frame {
	background: var(--jak-img-papier) center / cover no-repeat, var(--jak-papier-couleur) !important;
}

/* ------------------------------------------------------------------
   Polices
   - Athelas partout : pages, panier, commande, compte client. Athelas est
     installée sur Mac et iPhone ; ailleurs, Spectral (très proche) prend
     le relais. Certains blocs WooCommerce et les champs de formulaire
     imposent leur propre police, on les ramène à celle du site.
   - Écriture manuscrite (Kindergarten Cam) : phrases d'accroche seulement,
     style « Accroche » dans l'éditeur (classe is-style-accroche).
   ------------------------------------------------------------------ */
body,
body :where(button, input, select, textarea, optgroup, .wp-element-button,
	[class*="wc-block-"], .woocommerce, .woocommerce-page, .wc-block-components-text-input,
	.wc-block-components-button, .wc-block-components-totals-item, .wc-block-components-product-name) {
	font-family: var(--jak-texte) !important;
}

body .is-style-accroche,
body .jak-accroche {
	font-family: var(--jak-manuscrit) !important;
	font-size: clamp(1.25rem, 2.6vw, 1.75rem);
	line-height: 1.3;
}

/* ------------------------------------------------------------------
   En-tête : burger à gauche, logo au centre, panier à droite
   ------------------------------------------------------------------ */
.jak-entete {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	padding: 1.5rem var(--jak-gouttiere);
}

/* Places fixes : même si WooCommerce ajoute des blocs, le logo reste au centre */
.jak-entete > * { grid-row: 1; margin: 0 !important; }
.jak-entete > .wp-block-navigation { grid-column: 1; justify-self: start; }
.jak-entete > .jak-logo { grid-column: 2; }
.jak-entete > .jak-entete-droite { grid-column: 3; justify-self: end; }

.jak-entete-droite {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.jak-entete-droite > * { margin: 0 !important; }

.jak-logo {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

/* Tant qu'aucun logo n'est téléversé, on affiche le titre du site */
.jak-logo .wp-block-site-logo + .wp-block-site-title { display: none; }

.jak-logo .wp-block-site-title {
	margin: 0;
	font-size: clamp(1.8rem, 5vw, 2.6rem);
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0;
}

.jak-logo .wp-block-site-title a {
	color: var(--jak-encre);
	text-decoration: none;
}

.jak-logo .wp-block-site-logo img {
	width: clamp(140px, 22vw, 220px);
	height: auto;
}

/* Menu (y compris le menu plein écran) */
.jak-entete .wp-block-navigation {
	font-size: 1.4rem;
	line-height: 1.2;
}

.jak-entete .wp-block-navigation-item__content { text-decoration: none; }

.jak-entete .wp-block-navigation__responsive-container-open svg,
.jak-entete .wc-block-mini-cart__icon {
	width: 22px;
	height: 22px;
}

/* ------------------------------------------------------------------
   Grille produits (style Rue de Sèvres)
   ------------------------------------------------------------------ */
.jak-grille {
	padding-inline: var(--jak-gouttiere);
}

.jak-grille ul.wc-block-product-template {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	gap: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 4vw, 3.5rem) !important;
	max-width: 1100px;
	margin-inline: auto;
	padding: 0;
}

.jak-grille ul.wc-block-product-template > li {
	width: auto !important;
	margin: 0 !important;
	list-style: none;
}

@media (max-width: 700px) {
	.jak-grille ul.wc-block-product-template {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

/* « rien pour l'instant… » quand il n'y a aucun article */
.jak-grille .wp-block-woocommerce-product-collection-no-results {
	font-size: 1.3rem;
	font-style: italic;
	text-align: center;
}

.jak-grille .wc-block-components-product-image img {
	aspect-ratio: 1;
	object-fit: contain;
	background: transparent;
}

.jak-carte-infos {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

.jak-carte-infos .wp-block-post-title,
.jak-carte-infos .wc-block-components-product-price {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 400;
	line-height: 1.3;
	text-align: left;
}

.jak-carte-infos .wp-block-post-title a {
	color: var(--jak-encre);
	text-decoration: none;
}

.jak-carte-infos .wc-block-components-product-price { white-space: nowrap; }

/* ------------------------------------------------------------------
   Article épuisé : titre raturé + « (gone) » / « (plus là) »
   ------------------------------------------------------------------ */
li.outofstock .wp-block-post-title,
.jak-epuise .jak-produit-titre {
	position: relative;
	display: inline-block;
}

li.outofstock .wp-block-post-title::after,
.jak-epuise .jak-produit-titre::after {
	content: "";
	position: absolute;
	inset: 0 -8%;
	background: var(--jak-img-rature) center / 100% 1.1em repeat-y;
	pointer-events: none;
}

/* « (gone) » sous le nom dans la grille (sur la fiche, c'est le texte de stock) */
li.outofstock .jak-carte-infos { flex-wrap: wrap; }

li.outofstock .jak-carte-infos::after {
	content: var(--jak-txt-epuise, "(gone)");
	flex-basis: 100%;
	font-size: 1rem;
	font-style: italic;
	line-height: 1.2;
}

li.outofstock .wc-block-components-product-price { opacity: 0.35; }
li.outofstock .wc-block-components-product-image img { opacity: 0.6; }

/* ------------------------------------------------------------------
   Fiche produit
   ------------------------------------------------------------------ */
.jak-produit {
	padding-inline: var(--jak-gouttiere);
}

.jak-produit-image {
	max-width: 720px;
	margin: 0 auto clamp(2rem, 6vw, 4rem);
}

.jak-produit-image img { background: transparent; }

.jak-produit-bas {
	display: grid;
	grid-template-columns: 1fr minmax(0, 360px);
	gap: clamp(2rem, 6vw, 6rem);
	max-width: 1000px;
	margin-inline: auto;
	align-items: start;
}

@media (max-width: 760px) {
	.jak-produit-bas { grid-template-columns: 1fr; }
}

.jak-produit-titre {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 400;
}

/* La description */
.jak-description {
	margin-top: 1.5rem;
	font-size: 1.1rem;
	line-height: 1.55;
}

.jak-description p { margin: 0 0 0.7em; }

/* Mots barrés au crayon (texte barré dans l'éditeur) */
.jak-description s,
.jak-description del,
.jak-description strike {
	text-decoration: none;
	background: var(--jak-img-trait) left 55% / 100% 0.5em no-repeat;
	padding-inline: 0.1em;
}

.jak-achat {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.jak-achat .wc-block-components-product-price {
	text-align: right;
	font-size: 0.9rem;
}

.jak-achat .wp-block-add-to-cart-form .variations {
	width: 100%;
	margin-bottom: 0.75rem;
}

.jak-achat .wp-block-add-to-cart-form select {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid var(--jak-encre);
	background: transparent;
	font: inherit;
}

.jak-achat .single_add_to_cart_button,
.jak-achat .wp-element-button {
	width: 100%;
	border-radius: 0;
	background: var(--jak-encre);
	color: #fff;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: lowercase;
}

.jak-achat .stock.out-of-stock {
	font-size: 1.2rem;
	font-style: italic;
	color: var(--jak-encre);
}

.jak-retour a {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	background: var(--jak-encre);
	color: #fff;
	font-size: 0.8rem;
	text-decoration: none;
}

/* Sections dépliables : Taille & tissu, Livraison… */
.jak-achat .wp-block-details {
	border-top: 1px solid var(--jak-encre);
	padding: 0.7rem 0;
	font-size: 0.85rem;
}

.jak-achat .wp-block-details:last-of-type { border-bottom: 1px solid var(--jak-encre); }

.jak-achat .wp-block-details summary {
	display: flex;
	justify-content: space-between;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}

.jak-achat .wp-block-details summary::-webkit-details-marker { display: none; }
.jak-achat .wp-block-details summary::after { content: "+"; font-weight: 400; }
.jak-achat .wp-block-details[open] summary::after { content: "–"; }

.jak-achat .wp-block-details > :not(summary) { margin-top: 0.6rem; }

.jak-infos {
	width: 100%;
	border-collapse: collapse;
}

.jak-infos th,
.jak-infos td {
	padding: 0.25rem 0;
	text-align: left;
	vertical-align: top;
	border: 0;
}

.jak-infos th { width: 40%; font-weight: 400; opacity: 0.7; }
.jak-infos p { margin: 0; }

/* ------------------------------------------------------------------
   Pied de page : liens, puis bande de gribouillis tout en bas.
   La page fait au moins la hauteur de l'écran et le pied de page est
   poussé vers le bas : même sur une page courte (panier vide, blog sans
   post), les gribouillis touchent le bas de l'écran.
   ------------------------------------------------------------------ */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 0px));
}

.wp-site-blocks > * { flex-shrink: 0; }

.wp-site-blocks > footer {
	margin-top: auto !important;
	margin-bottom: 0 !important;
}

.jak-pied {
	margin-top: clamp(4rem, 10vw, 8rem);
}

.jak-pied .jak-pied-liens { padding-bottom: 0.5rem; }

.jak-gribouillis {
	height: clamp(160px, 24vw, 320px);
	margin: 0 !important;
	background: var(--jak-img-gribouillis-bas) center bottom / auto 100% repeat-x;
}

.jak-pied-liens {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.5rem;
	padding: 1.25rem var(--jak-gouttiere) 2rem;
	font-size: 1rem;
}

.jak-pied-liens p { margin: 0; }
.jak-pied-liens a { color: var(--jak-encre); }

/* ------------------------------------------------------------------
   Page d'accueil : titre, liens, visage, phrase d'accroche
   (pas d'en-tête ni de gribouillis, comme sur la maquette)
   ------------------------------------------------------------------ */
.jak-accueil {
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 0px));
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: clamp(3rem, 9vh, 7rem) var(--jak-gouttiere) 0;
}

.jak-accueil > * { margin-block: 0 !important; }

.jak-accueil-titre {
	font-size: clamp(3.4rem, 10vw, 7.5rem);
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0;
	text-wrap: balance;
}

.jak-accueil-liens {
	list-style: none;
	padding: 0;
	margin-top: clamp(1.5rem, 5vh, 3.5rem) !important;
	font-size: clamp(1.6rem, 3.6vw, 2.4rem);
	line-height: 1.3;
}

.jak-accueil-liens li::before { content: "- "; }

.jak-accueil-liens a {
	color: var(--jak-encre);
	text-decoration: none;
}

.jak-accueil-liens a:hover,
.jak-accueil-liens a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.15em;
	text-decoration-thickness: 1px;
}

/* Le visage descend en bas de l'écran et tient dans la hauteur visible */
.jak-visage {
	margin-top: auto !important;
	padding-top: clamp(2rem, 7vh, 5rem);
}

.jak-visage img {
	display: block;
	width: min(88vw, 820px, calc(56vh * 1.19));
	max-width: 100%;
	height: auto;
	margin-inline: auto;
}

.jak-accueil .is-style-accroche {
	margin-top: clamp(1rem, 3vh, 2rem) !important;
	font-size: clamp(1.4rem, 3.2vw, 2.2rem);
}

.jak-accueil .jak-pied-liens {
	margin-top: clamp(3rem, 10vh, 6rem) !important;
	opacity: 0.7;
}

/* ------------------------------------------------------------------
   Blog (page des articles + article seul) : photos et vidéos
   ------------------------------------------------------------------ */
.jak-blog {
	box-sizing: border-box;
	width: 100%; /* la page est en colonne flexible : sans ça, le blog se rétrécirait */
	max-width: 720px;
	margin-inline: auto;
	padding-inline: var(--jak-gouttiere);
}

.jak-blog-liste {
	display: grid;
	gap: clamp(4rem, 10vw, 7rem);
	padding: 0;
	list-style: none;
}

.jak-post {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.jak-post-titre {
	margin: 0;
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	font-weight: 400;
	line-height: 1.15;
	text-wrap: balance;
}

.jak-post-titre a { color: var(--jak-encre); text-decoration: none; }

.jak-post-date {
	font-size: 0.9rem;
	font-style: italic;
	opacity: 0.6;
}

.jak-post-contenu { margin-top: 1rem; }

/* Vidéos et photos : jamais plus hautes que l'écran (vidéos verticales de téléphone) */
.jak-post-contenu .wp-block-video video,
.jak-post-contenu .wp-block-image img {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 85vh;
	margin-inline: auto;
	background: transparent;
}

.jak-post-contenu .wp-block-video,
.jak-post-contenu .wp-block-image { margin-block: 1.5rem; }

.jak-post-contenu figcaption {
	text-align: center;
	font-size: 0.9rem;
	font-style: italic;
}

.jak-post-precedent,
.jak-post-suivant,
.jak-pagination {
	margin-top: 3rem;
	font-style: italic;
}

.jak-post-suivant { text-align: right; }
