/*
Theme Name: Ninakwarell
Author: Edwin Kocher
Description: Thème de blocs pour artiste : boutique (WooCommerce, SureCart ou Ecwid), couleurs et typographies réglables dans Apparence → Éditeur → Styles.
Version: 2.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: ninakwarell0
Tags: full-site-editing, block-patterns, e-commerce, custom-colors, custom-logo
*/

/* Le design (couleurs, polices, tailles, boutons) est dans theme.json.
   Ici : seulement ce que theme.json ne sait pas faire. */

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

/* ---------- En-tête collant ---------- */
.wp-site-blocks > header.wp-block-template-part,
.site-header-sticky {
	position: sticky;
	top: 0;
	z-index: 50;
}
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 32px; }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 0; } }

.site-header { border-bottom: 1px solid #eee; }
.site-header .wp-block-site-logo img { border-radius: 50%; }
.header-inner:has(.wp-block-site-logo img) .wp-block-site-title { display: none; }
.site-header .wp-block-site-title { font-family: var(--wp--preset--font-family--bungee); font-size: 22px; }
.site-header .wp-block-site-title a { text-decoration: none; }

/* Mobile : burger à gauche, logo, icônes à droite (comme le modèle) */
@media (max-width: 899px) {
	.header-inner .wp-block-navigation { order: -1; }
	.header-inner .wp-block-site-logo { margin-right: auto; }
}
.header-icons { gap: 4px !important; }
.header-icons .wp-block-search__button { background: none; color: currentColor; padding: 8px; border: 0; }
.header-icons .wp-block-search__button svg { width: 26px; height: 26px; }

/* Panier */
.ninak-cart { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: inherit; }
.ninak-cart svg { width: 26px; height: 26px; }
.ninak-cart-count {
	position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px;
	border-radius: 9px; background: var(--wp--preset--color--black); color: var(--wp--preset--color--white);
	font-size: 11px; line-height: 18px; text-align: center;
}
.ninak-cart-count[hidden] { display: none; }
/* SureCart ajoute son propre panier dans les menus : on garde celui du thème */
.wp-block-navigation .wp-block-surecart-cart-menu-icon-button,
.wp-block-navigation li:has(> .wp-block-surecart-cart-menu-icon-button) { display: none; }

/* ---------- Sections pleine largeur ---------- */
.ninak-section { padding-top: clamp(40px, 6vw, 64px); padding-bottom: clamp(40px, 6vw, 64px); }
.ninak-section:not(:has(*)) { display: none; } /* section boutique vide (pas encore de produits) */
.wp-block-post-content > .alignfull:first-child { margin-top: 0; }
main.wp-block-group { margin-top: 0; }

/* Hero */
.ninak-hero .wp-block-heading { color: #fff; text-shadow: 0 2px 16px rgba(0, 0, 0, .45); }
.ninak-hero p { color: #fff; letter-spacing: .08em; text-transform: uppercase; }

/* Tuiles (cover avec titre-lien) : toute la tuile est cliquable */
.ninak-tile { position: relative; overflow: hidden; }
.ninak-tile img.wp-block-cover__image-background { transition: transform .4s; }
.ninak-tile:hover img.wp-block-cover__image-background { transform: scale(1.05); }
.ninak-tile a { color: #fff; text-decoration: none; }
.ninak-tile a::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.ninak-tile .wp-block-heading { text-shadow: 0 2px 10px rgba(0, 0, 0, .55); }

/* Grilles produits / catégories (shortcodes du thème) */
.ninak-product-grid, .ninak-cat-grid { list-style: none; margin: 0 0 32px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 16px; }
@media (min-width: 900px) { .ninak-product-grid { grid-template-columns: repeat(4, 1fr); gap: 40px 24px; } }
.ninak-product-grid a, .ninak-cat-grid a { text-decoration: none; color: inherit; display: block; }
.ninak-product-img { display: block; aspect-ratio: 1; overflow: hidden; background: #ccc; margin-bottom: 12px; }
.ninak-product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.ninak-product-grid a:hover img { transform: scale(1.04); }
.ninak-product-name { display: block; font-size: 15px; margin-bottom: 8px; }
.ninak-product-price { display: block; }
.ninak-cat-grid { gap: 12px; }
.ninak-cat-grid a { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; overflow: hidden; background: #bbb; }
.ninak-cat-grid img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.ninak-cat-grid a:hover img { transform: scale(1.05); }
.ninak-cat-grid span {
	position: relative; padding: 8px; color: #fff; text-align: center; text-transform: uppercase;
	font-family: var(--wp--preset--font-family--bungee); font-size: clamp(18px, 4vw, 40px); line-height: 1.15;
	text-shadow: 0 2px 10px rgba(0, 0, 0, .55); overflow-wrap: anywhere;
}
.ninak-arrow-link a, a.ninak-arrow-link { text-decoration: none; }
.ninak-arrow-link a::after, a.ninak-arrow-link::after { content: " \2192"; }

/* Galeries : vignettes carrées */
.wp-block-gallery.is-cropped .wp-block-image img { aspect-ratio: 1; object-fit: cover; }

/* Détails (anciennes FAQ / fenêtres Spectra) */
.wp-block-details { border-bottom: 1px solid rgba(0, 0, 0, .15); padding: 12px 0; }
.wp-block-details summary { cursor: pointer; font-weight: 700; }
.wp-block-details.is-style-ninak-button { border: 0; padding: 0; }
.wp-block-details.is-style-ninak-button > summary {
	display: inline-block; list-style: none; background: var(--wp--preset--color--black); color: var(--wp--preset--color--white);
	padding: 14px 24px; margin-bottom: 16px;
}
.wp-block-details.is-style-ninak-button > summary::-webkit-details-marker { display: none; }

/* Formulaires (Contact Form 7…) */
.wp-block-post-content input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.wp-block-post-content textarea,
.wp-block-post-content select { border: 1px solid #ccc; border-radius: 0; padding: 10px 12px; width: 100%; max-width: 100%; font: inherit; }
.wpcf7-submit, .wp-block-post-content input[type="submit"] {
	background: var(--wp--preset--color--black); color: var(--wp--preset--color--white); border: 0; border-radius: 0; padding: 14px 24px; font-weight: 700; cursor: pointer;
}

/* WooCommerce */
.woocommerce ul.products { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 16px; }
@media (min-width: 900px) { .woocommerce ul.products { grid-template-columns: repeat(4, 1fr); } }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none; }
.woocommerce ul.products li.product { width: auto !important; margin: 0 !important; float: none !important; }
.woocommerce ul.products li.product img { aspect-ratio: 1; object-fit: cover; }
.woocommerce span.onsale { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--black); }
