/*
Theme Name: Woolberry Cottage Theme
Theme URI: https://woolberrycottage.it
Author: Woolberry Cottage
Description: Block theme per Woolberry Cottage. Completamente editabile in Gutenberg, compatibile con WooCommerce. Include la facciata cottage "Nuovi arrivi", pattern di marca e varianti stagionali.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: woolberrycottage-theme
Tags: block-patterns, full-site-editing, e-commerce, style-variations, wide-blocks, editor-style
*/

/* Only what theme.json cannot express lives here.
 * No !important: core global styles are wrapped in :root :where() (specificity
 * 0,1,0), so one extra class wins. Where core itself uses higher specificity
 * the selector says so in a comment.
 * WooCommerce rules: assets/css/woocommerce.css. */
:root {
	--wbct-ease: cubic-bezier(0.33, 0, 0.2, 1);
	--wbct-header-h: 104px;
}

body {
	text-rendering: optimizelegibility;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
li {
	text-wrap: pretty;
}

h1,
h2 {
	text-wrap: balance;
}

:where(a, button, input, select, textarea, summary):focus-visible {
	border-radius: 6px;
	outline: 3px solid rgba(177, 171, 139, 0.6);
	outline-offset: 2px;
}

.wp-element-button,
.wp-block-button__link {
	transition:
		background-color 140ms var(--wbct-ease),
		color 140ms var(--wbct-ease);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(1px);
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

a:hover {
	text-decoration-thickness: 2px;
}

.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
}

/* Eyebrow + leaf divider */
.wbct-eyebrow {
	color: var(--wp--preset--color--salvia-scuro);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.wbct-divider img {
	width: 200px;
	height: auto;
	margin-inline: auto;
	border-radius: 0;
}

/* beats .is-layout-flex > :is(*, div) (0,1,1) and the flow/constrained
 * block gap */
.wp-block-image.wbct-divider {
	margin-block: 4px;
}

/* ----------
 * Header: fixed with divider; transparent at top of the home so the cottage
 * roof shows through
 * ---------- */
header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 50;
}

.wbct-header-bar {
	min-height: var(--wbct-header-h);
	border-bottom: 1px solid var(--wp--preset--color--bordo);
	background-color: var(--wp--preset--color--panna);
	transition:
		background-color 240ms var(--wbct-ease),
		border-color 240ms var(--wbct-ease);
}

body.home:not(.wbct-scrolled) .wbct-header-bar {
	border-bottom-color: transparent;
	background-color: transparent;
}

.wbct-header-bar .wp-block-site-logo img {
	width: auto;
	height: 64px;
}

.wbct-header-bar .wp-block-navigation-item__content:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
}

.wbct-header-icons .wp-block-search__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--wp--preset--color--corteccia);
	background-color: transparent;
	transition: background-color 140ms var(--wbct-ease);
}

.wbct-header-icons .wp-block-search__button:hover {
	color: var(--wp--preset--color--corteccia);
	background-color: var(--wp--preset--color--panna-scuro);
}

.wbct-header-icons .wp-block-search__button svg {
	width: 22px;
	min-width: 0;
	height: 22px;
	min-height: 0;
	fill: currentcolor;
}

/* Collapse the menu earlier than WP's 600px so it never collides with the
 * roof */
@media (min-width: 600px) and (max-width: 1179px) {

	.wbct-header-bar .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.wbct-header-bar .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

/* Overlay colours come from the Navigation block (overlayBackgroundColor /
 * overlayTextColor); core padding is (0,3,0) */
.wbct-header-bar .wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open {
	padding: 32px;
}

.wbct-header-bar .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--display);
	font-size: 32px;
}

/* ---------- Trama gomitoli (block style, also on the cottage façade) -------
 * Background image only: the tile is transparent, so the background colour
 * picked in the editor (or the façade's banda) shows through. On Cover the
 * tile goes on the overlay, so the block's overlay opacity controls it. */
.is-style-wbct-trama:not(.wp-block-cover),
.wp-block-cover.is-style-wbct-trama > .wp-block-cover__background,
.is-style-wbct-cottage {
	background-image: url(assets/images/trama-gomitoli-bottoni.webp);
	background-repeat: repeat;
	background-position: center top;
	background-size: 224px 112px;
}

/* ---------- Cottage façade ("Nuovi arrivi") ---------- */
.is-style-wbct-cottage {
	position: relative;
	z-index: 1;
	margin-block-start: 120px;

	/* 13px: the eave lines drawn below the box by box-shadow. */
	margin-block-end: calc(13px + var(--wp--preset--spacing--70));
	color: var(--wp--preset--color--banda-testo);
	background-color: var(--wp--preset--color--banda);
	box-shadow:
		0 -11px 0 0 var(--wp--preset--color--panna),
		0 -13px 0 0 var(--wp--preset--color--banda-linea),
		0 11px 0 0 var(--wp--preset--color--panna),
		0 13px 0 0 var(--wp--preset--color--banda-linea);

	/* The 420px roof is wider than a phone: without clipping the page
	 * scrolls sideways and mobile browsers let the viewport drift, dragging
	 * the sticky header. clip (not hidden) keeps the roof visible above. */
	overflow-x: clip;
}

.wbct-home > .is-style-wbct-cottage:first-child {
	margin-block-start: 0;
}

/* Where the roof would cover the logo and the menu button (the roof is
 * centred, the header's left group is fixed): start below the header. */
@media (max-width: 699px) {

	.wbct-home > .is-style-wbct-cottage:first-child {
		margin-block-start: var(--wbct-header-h);
	}
}

/* Roof drawn with palette colours, so every style variation recolours it with
 * no extra CSS.
 * Geometry of the original 420px gable: slopes at 30.63deg, apex rounded
 * (radius 23.67px, centre 210px 42.51px). Three nested shapes, each a disc
 * (rounded apex) + a wedge (slopes): facade colour, 11px panna band, 2px
 * outline. The horizontal eaves are the facade's own box-shadow. */
.is-style-wbct-cottage::before {
	content: "";
	position: absolute;
	top: -105px;
	left: 50%;
	z-index: 0;
	width: 420px;
	height: 107px;

	/* Gradients wrap after commas to stay within 120 columns. */
	/* stylelint-disable @stylistic/function-comma-space-after */
	background:
		radial-gradient(circle at 210px 42.51px,
		var(--wp--preset--color--banda) 23.17px,
		transparent 24.17px),
		conic-gradient(from 120.455deg at 210px -7.14px,
		transparent 0deg,
		var(--wp--preset--color--banda) 0.35deg 118.74deg,
		transparent 119.09deg) 0 22.14px / 100% 84.86px,
		radial-gradient(circle at 210px 42.51px,
		var(--wp--preset--color--panna) 34.17px,
		transparent 35.17px),
		conic-gradient(from 120.455deg at 210px -10.46px,
		transparent 0deg,
		var(--wp--preset--color--panna) 0.35deg 118.74deg,
		transparent 119.09deg) 0 12.67px / 100% 92.33px,
		radial-gradient(circle at 210px 42.51px,
		var(--wp--preset--color--banda-linea) 36.17px,
		transparent 37.17px),
		conic-gradient(from 120.455deg at 210px -11.06px,
		transparent 0deg,
		var(--wp--preset--color--banda-linea) 0.35deg 118.74deg,
		transparent 119.09deg) 0 10.95px / 100% 83.05px;
	/* stylelint-enable @stylistic/function-comma-space-after */
	background-repeat: no-repeat;
	transform: translateX(-50%);
	pointer-events: none;
}

/* nowrap comes from the block's "Stack on mobile: off" setting
 * (core .is-not-stacked-on-mobile) */
.is-style-wbct-cottage > .wp-block-columns {
	align-items: flex-start;
	gap: 40px;
	position: relative;
	z-index: 1;
	max-width: 1320px;
	min-height: 340px;
	margin-block: 0;
	margin-inline: auto;
}

/* Window and door columns are size containers: the arches use 50cqi (half
 * the column width) for the top radii. With 999px the sum of the radii on one
 * side exceeds the box, and CSS then scales every corner down by the same
 * factor (~0.12 here), which turned the 8px bottom corners into ~1px. */
.is-style-wbct-cottage .wbct-window {
	position: relative;
	min-width: 0;
	padding-top: 38px;
	container-type: inline-size;
}

/* Core makes the image link inline-block (`.wp-block-image > a`), so it
 * shrinks to the arch (fixed height, width from the 5:6 ratio): centre it. */
.is-style-wbct-cottage .wbct-window .wp-block-image {
	margin: 0 0 12px;
	text-align: center;
}

.is-style-wbct-cottage .is-style-wbct-arch img {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 206px;
	border: 3px solid var(--wp--preset--color--cipria);
	border-radius: 50cqi 50cqi 8px 8px;
	object-fit: cover;
	transition:
		transform 240ms var(--wbct-ease),
		box-shadow 240ms var(--wbct-ease);
}

.is-style-wbct-cottage .wbct-window a:hover img,
.is-style-wbct-cottage .wbct-window:has(.wbct-window-title a:hover) img {
	box-shadow: var(--wp--preset--shadow--md);
	transform: translateY(-3px);
}

.is-style-wbct-cottage .wbct-window p {
	margin: 0;
	color: inherit;
	font-size: 17px;
	font-weight: 600;
	text-align: center;
}

.is-style-wbct-cottage .wbct-window .wbct-window-title {
	margin: 0 0 2px;
	font-family: var(--wp--preset--font-family--display);
	font-size: 19px;
	font-weight: 400;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.is-style-wbct-cottage .wbct-window-title a {
	color: inherit;
	text-decoration: none;
}

.is-style-wbct-cottage .wbct-window-title a:hover {
	text-decoration: underline;
}

/* The whole window links to the product: the title link is stretched over
 * the column, so the photo is clickable too (images picked in the Site
 * Editor are unlinked) with one link per window. Front end only: in the
 * editor canvas (body.editor-styles-wrapper) it would cover the image. */
body:not(.editor-styles-wrapper) .is-style-wbct-cottage .wbct-window-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

.is-style-wbct-cottage .wbct-door-col {
	flex-shrink: 0;
	position: relative;
	container-type: inline-size;
}

.wbct-door-col > .is-style-wbct-door {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	position: relative;
	box-sizing: border-box;
	min-height: 352px;
	margin-top: -30px;
	padding: 92px 20px 30px;
	border-radius: 50cqi 50cqi 8px 8px;
	color: var(--wp--preset--color--corteccia-testo);
	background-color: var(--wp--preset--color--panna);
	text-align: center;
}

.is-style-wbct-door > .wp-block-buttons {
	position: relative;
	z-index: 1;
	margin-top: auto;
}

.is-style-wbct-door .wbct-door-title {
	width: 100%;
	margin: 10px 0 0;
	padding-inline: 6px;
	color: var(--wp--preset--color--corteccia);
	font-family: var(--wp--preset--font-family--display);
	font-size: 46px;
	font-weight: 400;
	letter-spacing: -0.01em;
	line-height: 0.95;
	text-align: right;
}

.is-style-wbct-door .wbct-door-title strong {
	display: block;
	font-size: 50px;
	font-weight: 700;
	text-align: left;
}

.is-style-wbct-door .wbct-door-vine {
	position: absolute;
	right: -26px;
	bottom: -18px;
	width: 128px;
	margin: 0;
	pointer-events: none;
}

.is-style-wbct-door .wbct-door-vine img {
	border-radius: 0;
	transform: scaleY(-1);
}

/* Dots added by assets/js/cottage-carousel.js, used below desktop only. */
.wbct-cottage-dots {
	display: none;
}

/* Below desktop the façade is a carousel (scroll snap): the door is the first
 * slide, centred under the roof by the inline padding, and the windows follow
 * in their desktop order. */
@media (max-width: 1039px) {

	/* flow-root: the track's negative margin would otherwise collapse into
	 * the façade's and move the whole façade up. */
	.is-style-wbct-cottage {
		display: flow-root;
	}

	/* The vertical padding keeps the door (margin-top: -30px) and its vine
	 * (bottom: -18px) inside the scroll box, which would clip them. */
	.is-style-wbct-cottage > .wp-block-columns {
		gap: 28px;
		margin-top: -30px;
		padding: 30px calc(50% - 120px) 18px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	/* core .is-not-stacked-on-mobile > .wp-block-column is (0,3,0) */
	.is-style-wbct-cottage > .wp-block-columns.is-not-stacked-on-mobile > .wp-block-column {
		flex: 0 0 240px;
		scroll-snap-align: center;
	}

	.is-style-wbct-cottage .wbct-door-col {
		order: -1;
	}

	.wbct-cottage-dots {
		display: flex;
		justify-content: center;
		gap: 4px;
		position: relative;
		z-index: 1;
		padding-bottom: 14px;
	}

	/* 24px buttons (WCAG target size) around an 8px dot */
	.wbct-cottage-dots button {
		width: 24px;
		height: 24px;
		padding: 0;
		border: 0;
		background-color: transparent;
		cursor: pointer;
	}

	.wbct-cottage-dots button::before {
		content: "";
		display: block;
		box-sizing: border-box;
		width: 8px;
		height: 8px;
		margin: auto;
		border: 1px solid currentcolor;
		border-radius: 50%;
		color: var(--wp--preset--color--banda-testo);
	}

	.wbct-cottage-dots button[aria-current="true"]::before {
		background-color: currentcolor;
	}
}

@media (max-width: 1039px) and (prefers-reduced-motion: no-preference) {

	.is-style-wbct-cottage > .wp-block-columns {
		scroll-behavior: smooth;
	}
}

/* ---------- Vine-corner hero ---------- */
.wbct-vine-hero {
	--wbct-vine-w: clamp(120px, 16vw, 220px);
	position: relative;
	overflow: hidden;
}

.wbct-vine-hero .wbct-vine {
	position: absolute;
	top: 24px;
	width: var(--wbct-vine-w);
	margin: 0;
	pointer-events: none;
}

.wbct-vine-hero .wbct-vine img {
	border-radius: 0;
}

.wbct-vine-hero .wbct-vine--left {
	left: 24px;
}

.wbct-vine-hero .wbct-vine--left img {
	transform: scaleX(-1);
}

.wbct-vine-hero .wbct-vine--right {
	right: 24px;
}

.wbct-vine-hero > :not(.wbct-vine) {
	position: relative;
}

/* The eyebrow sits beside the vertical stems, which fill the outer fifth of
 * each vine (the vines' 24px inset equals the root padding): on phones the
 * wrapped text would run over them. */
.wbct-vine-hero > .wbct-eyebrow {
	padding-inline: calc(var(--wbct-vine-w) / 5 + 8px);
}

/* ---------- Creazioni (showcase cards) ---------- */
.wbct-creazioni .wp-block-post-featured-image {
	margin: 0;
	border-radius: 22px;
	overflow: hidden;
	background-color: var(--wp--preset--color--panna-scuro);
	transition:
		transform 240ms var(--wbct-ease),
		box-shadow 240ms var(--wbct-ease);
}

.wbct-creazioni .wp-block-post:hover .wp-block-post-featured-image {
	box-shadow: var(--wp--preset--shadow--md);
	transform: translateY(-3px);
}

.wbct-creazioni .wp-block-post-title {
	margin-block: 14px 4px;
	font-size: 22px;
}

.wbct-prezzo {
	margin-block-start: 0;
	color: var(--wp--preset--color--corteccia-testo);
	font-weight: 600;
}

.wbct-prezzo:empty {
	display: none;
}

/* Creazione gallery (wbct/galleria): four thumbnails per row at every width,
 * never stretched to fill the row. Core sizes gallery items with
 * `figure.wp-block-image:not(#individual-image)` (1,3,1) and drops to two
 * columns below 600px; this selector is (1,4,1). */
.wp-block-wbct-galleria .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) {
	flex-grow: 0;
	width: calc(25% - var(--wp--style--unstable-gallery-gap, 16px) * 0.75);
}

/* ---------- Form fields (search, comments) ---------- */
.wp-block-search .wp-block-search__input,
.wp-block-post-comments-form .comment-form :is(input[type="text"],
input[type="email"],
input[type="url"],
textarea
) {
	border: 1px solid var(--wp--preset--color--bordo-forte);
	border-radius: 14px;
	background-color: var(--wp--preset--color--panna-chiaro);
}

/* ---------- Story panel, FAQ, footer ---------- */
.wbct-panel {
	border-radius: 32px;
}

.wp-block-details summary {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	color: var(--wp--preset--color--corteccia);
	font-family: var(--wp--preset--font-family--display);
	font-size: 25px;
	list-style: none;
	cursor: pointer;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "";
	flex: 0 0 12px;
	height: 12px;
	margin-top: 10px;
	border-right: 1.5px solid currentcolor;
	border-bottom: 1.5px solid currentcolor;
	transform: rotate(45deg);
	transition: transform 240ms var(--wbct-ease);
}

.wp-block-details[open] summary::after {
	margin-top: 16px;
	transform: rotate(-135deg);
}

.wp-block-details > :not(summary) {
	margin-top: 12px;
}

.wbct-footer a {
	color: var(--wp--preset--color--corteccia-testo);
	text-decoration: none;
}

.wbct-footer a:hover {
	text-decoration: underline;
}

.wbct-footer .wbct-footer-logo img {
	border-radius: 0;
}

.wp-block-post-featured-image img {
	border-radius: 22px;
}
