/*
 * OLDSTRAIN 3D studio
 * Idea grafica: le linee di strato della stampa 3D.
 * Il motivo compare in tre punti soltanto: l'animazione del titolo in home,
 * l'hover sulle schede dei progetti e le fasce di separazione.
 */

:root {
	--os-charcoal: var(--wp--preset--color--charcoal, #33373a);
	--os-offwhite: var(--wp--preset--color--offwhite, #f5f3e9);
	--os-sand: var(--wp--preset--color--sand, #e8e6da);
	--os-stone: var(--wp--preset--color--stone, #cfcdc1);
	--os-testo-2: var(--wp--preset--color--charcoal-soft, #4a4f53);
	--os-sage: var(--wp--preset--color--sage, #8fa98e);
	--os-sage-dark: var(--wp--preset--color--sage-dark, #4f6b4e);
	--os-mono: var(--wp--preset--font-family--mono, ui-monospace, monospace);
	--os-display: var(--wp--preset--font-family--display, system-ui, sans-serif);
}

/* ---------- Base ---------- */

html {
	scroll-behavior: smooth;
}

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

::selection {
	background: var(--os-sage);
	color: var(--os-charcoal);
}

a {
	text-decoration-color: var(--os-sage);
	text-decoration-thickness: 0.14em;
	text-underline-offset: 0.22em;
}

a:hover {
	text-decoration-thickness: 0.28em;
}

:focus-visible {
	outline: 3px solid var(--os-sage-dark);
	outline-offset: 3px;
}

.has-charcoal-background-color :focus-visible {
	outline-color: var(--os-sage);
}

.has-charcoal-background-color {
	color: var(--os-offwhite);
}

.has-charcoal-background-color :where(h1, h2, h3, h4, h5, h6, a) {
	color: var(--os-offwhite);
}

.has-charcoal-background-color a {
	text-decoration-color: var(--os-sage);
}

.has-sage-background-color :where(h1, h2, h3, h4, h5, h6, p, a) {
	color: var(--os-charcoal);
}

.has-sage-background-color a:not(.wp-block-button__link) {
	text-decoration-color: var(--os-charcoal);
}

.has-sage-background-color :focus-visible {
	outline-color: var(--os-charcoal);
}

/* Testi secondari e dati tecnici */
.os-meta {
	font-family: var(--os-mono);
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--os-testo-2);
	letter-spacing: 0;
}

.has-charcoal-background-color .os-meta {
	color: var(--os-stone);
}

.os-lead {
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.5;
	max-width: 38rem;
}

/* ---------- Fasce a strati ---------- */

.os-strata-divider {
	height: 1.75rem;
	margin: 0;
	background-image: repeating-linear-gradient(
		to bottom,
		var(--os-charcoal) 0,
		var(--os-charcoal) 1px,
		transparent 1px,
		transparent 7px
	);
}

/* Le linee si infittiscono verso il basso, come gli strati di una stampa */
.os-strata-fade {
	height: 5rem;
	margin: 0;
	background-image: repeating-linear-gradient(
		to bottom,
		var(--os-charcoal) 0,
		var(--os-charcoal) 1px,
		transparent 1px,
		transparent 9px
	);
	-webkit-mask-image: linear-gradient(to bottom, transparent, #000);
	mask-image: linear-gradient(to bottom, transparent, #000);
}

/* ---------- Header ---------- */

.os-header {
	border-bottom: 1.5px solid var(--os-charcoal);
	padding-top: var(--wp--preset--spacing--30);
	padding-bottom: var(--wp--preset--spacing--30);
}

.os-wordmark {
	margin: 0;
	line-height: 1;
}

.os-wordmark a {
	display: inline-flex;
	align-items: baseline;
	gap: 0.6rem;
	text-decoration: none;
	color: inherit;
	font-family: var(--os-display);
	font-size: 1.5rem;
	font-weight: 900;
	letter-spacing: -0.01em;
}

.os-wordmark span {
	font-family: var(--os-mono);
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0;
	color: var(--os-testo-2);
}

.os-nav {
	font-weight: 400;
}

.os-nav a {
	text-decoration: none;
}

.os-nav .wp-block-navigation-item__content:hover {
	text-decoration: underline;
	text-decoration-color: var(--os-sage);
	text-decoration-thickness: 0.14em;
	text-underline-offset: 0.3em;
}

.os-nav .os-nav-cta .wp-block-navigation-item__content {
	background: var(--os-sage);
	color: var(--os-charcoal);
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	padding: 0.5rem 1rem;
	font-weight: 400;
}

.os-nav .os-nav-cta .wp-block-navigation-item__content:hover {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
	text-decoration: none;
}

.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--os-offwhite);
	color: var(--os-charcoal);
}

/* ---------- Home: titolo che si costruisce strato dopo strato ---------- */

.os-hero {
	position: relative;
	overflow: hidden;
}

.os-hero-title {
	font-size: var(--wp--preset--font-size--display);
	line-height: 0.95;
	letter-spacing: -0.035em;
	font-weight: 900;
	max-width: 14ch;
	padding-bottom: 0.08em;
	animation: os-build 1.5s steps(16, end) 0.15s both;
}

@keyframes os-build {
	from {
		clip-path: inset(100% -0.1em -0.1em -0.1em);
	}
	to {
		clip-path: inset(-0.1em -0.1em -0.1em -0.1em);
	}
}

/* ---------- Schede progetto ---------- */

.os-projects .wp-block-post-template {
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

.os-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.os-card > * {
	margin-block: 0;
}

.os-card .wp-block-post-featured-image {
	position: relative;
	margin-bottom: 0.4rem;
	overflow: hidden;
	background-color: var(--os-sand);
}

.os-card .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto;
}

/* Al passaggio del mouse le linee di strato risalgono sull'immagine */
.os-card .wp-block-post-featured-image::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image: repeating-linear-gradient(
		to bottom,
		transparent 0,
		transparent 6px,
		var(--os-sage) 6px,
		var(--os-sage) 7px
	);
	clip-path: inset(100% 0 0 0);
	transition: clip-path 0.5s steps(8, end);
}

.os-card:hover .wp-block-post-featured-image::after,
.os-card:focus-within .wp-block-post-featured-image::after {
	clip-path: inset(0 0 0 0);
}

/* L'intera scheda è cliccabile dal titolo */
.os-card .wp-block-post-title a::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.os-card .wp-block-post-title a {
	text-decoration: none;
}

.os-card:hover .wp-block-post-title a {
	text-decoration: underline;
	text-decoration-color: var(--os-sage);
	text-decoration-thickness: 0.14em;
}

.os-card .wp-block-post-excerpt {
	color: var(--os-testo-2);
	font-size: 0.9375rem;
}

.os-card .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.os-committente:empty {
	display: none;
}

.os-committente::before {
	content: "Committente: ";
	color: var(--os-testo-2);
}

.has-charcoal-background-color .os-committente::before {
	color: var(--os-stone);
}

/* Filtri per settore */
.os-filtri ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.os-filtri a {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	font-size: 0.9375rem;
	font-weight: 400;
	text-decoration: none;
}

.os-filtri a:hover {
	background: var(--os-sand);
}

.os-filtri a[aria-current="page"] {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
}

/* Scheda singola */
.single-progetto .wp-block-post-content .wp-block-gallery {
	gap: 1rem;
}

.single-progetto .wp-block-post-content figure img {
	height: auto;
}

.os-project-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	align-items: baseline;
}

.os-project-meta > * {
	margin: 0;
}

.os-project-meta .wp-block-post-terms a {
	text-decoration: none;
	border-bottom: 1px solid var(--os-sage);
}

/* ---------- Servizi e processo ---------- */

.os-service {
	border-top: 2px solid var(--os-charcoal);
	padding-top: var(--wp--preset--spacing--30);
}

.os-service > * {
	margin-block: 0;
}

.os-service h3 {
	margin-bottom: 0.6rem;
}

.os-step {
	border-top: 1px solid var(--os-stone);
	padding-top: var(--wp--preset--spacing--30);
}

.os-step > * {
	margin-block: 0;
}

.os-step__n {
	font-family: var(--os-display);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 900;
	line-height: 1;
	color: var(--os-sage);
	margin-bottom: 0.75rem;
}

.os-step p:not(.os-step__n) {
	color: #cfcdc1;
}

/* ---------- Footer ---------- */

.os-footer {
	margin-top: 0;
}

.os-footer .os-wordmark a {
	font-size: 2rem;
}

.os-footer .os-wordmark span {
	color: var(--os-stone);
}

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

.os-footer li + li {
	margin-top: 0.4rem;
}

.os-footer a {
	text-decoration: none;
}

.os-footer a:hover {
	text-decoration: underline;
	text-decoration-color: var(--os-sage);
}

.os-footer .os-legal {
	border-top: 1px solid #4a4f53;
	padding-top: var(--wp--preset--spacing--30);
}

/* ---------- Pulsanti ---------- */

.wp-block-button.is-style-outline .wp-block-button__link,
.wp-block-button .wp-block-button__link.is-style-outline {
	background: transparent;
	color: inherit;
	border: 1.5px solid currentColor;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
	border-color: var(--os-charcoal);
}

.has-charcoal-background-color .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--os-offwhite);
	color: var(--os-charcoal);
	border-color: var(--os-offwhite);
}

.has-sage-background-color .wp-block-button__link:not(.is-style-outline) {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
}

.has-sage-background-color .wp-block-button__link:not(.is-style-outline):hover {
	background: var(--os-offwhite);
	color: var(--os-charcoal);
}

/* ---------- Modulo preventivo e campi in genere ---------- */

.os-form,
.os-form p {
	margin-block: 0;
}

.os-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	max-width: 46rem;
}

.os-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 1.25rem;
}

.os-form label,
.os-file > label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 400;
}

.os-req {
	font-weight: 400;
	font-size: 0.8125rem;
	color: var(--os-testo-2);
}

.os-form input[type="text"],
.os-form input[type="email"],
.os-form input[type="tel"],
.os-form input[type="number"],
.os-form select,
.os-form textarea,
.woocommerce input[type="text"],
.woocommerce input[type="email"],
.woocommerce input[type="tel"],
.woocommerce input[type="number"],
.woocommerce select,
.woocommerce textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 0.7rem 0.85rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	background: #fff;
	color: var(--os-charcoal);
	font: inherit;
}

.os-form textarea {
	resize: vertical;
	min-height: 9rem;
}

.os-hint {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	color: var(--os-testo-2);
}

.os-file {
	padding: 1rem;
	border: 1.5px dashed var(--os-charcoal);
	background: var(--os-sand);
}

.os-file input[type="file"] {
	display: block;
	max-width: 100%;
	font: inherit;
	font-size: 0.9375rem;
}

.os-file input[type="file"]::file-selector-button {
	margin-right: 0.85rem;
	padding: 0.5rem 1rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	background: var(--os-charcoal);
	color: var(--os-offwhite);
	font: inherit;
	font-weight: 400;
	cursor: pointer;
}

.os-file input[type="file"]::file-selector-button:hover {
	background: var(--os-sage);
	color: var(--os-charcoal);
}

.os-file__names {
	display: block;
	margin-top: 0.5rem;
	font-family: var(--os-mono);
	font-size: 0.8125rem;
	word-break: break-word;
}

.os-check {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.75rem;
	align-items: start;
}

.os-check input {
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.2rem;
	accent-color: var(--os-sage);
}

.os-check label {
	margin: 0;
	font-weight: 400;
}

.os-submit {
	padding: 0.95rem 1.75rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	background: var(--os-sage);
	color: var(--os-charcoal);
	font: inherit;
	font-weight: 400;
	cursor: pointer;
}

.os-submit:hover {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
}

.os-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.os-notice,
.os-form__error {
	margin: 0 0 1.5rem;
	padding: 1rem 1.25rem;
	border-left: 4px solid var(--os-charcoal);
	background: var(--os-sand);
}

.os-form__error {
	margin-bottom: 0;
}

.os-form__error[hidden] {
	display: none;
}

.os-notice p {
	margin: 0;
}

.os-notice--ok,
.os-form__error {
	border-left-color: var(--os-sage);
}

/* ---------- WooCommerce ---------- */

.woocommerce .price,
.woocommerce-Price-amount,
.wc-block-components-product-price,
.wc-block-formatted-money-amount {
	font-family: var(--os-mono);
	font-weight: 400;
}

/* Griglia prodotti (shortcode e archivio classico) */
.woocommerce ul.products,
ul.products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
	display: none;
}

.woocommerce ul.products[class*="columns-"] li.product,
ul.products li.product {
	float: none;
	width: auto;
	margin: 0;
}

.woocommerce ul.products li.product a img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 0 0.75rem;
	background: var(--os-sand);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	padding: 0;
	font-family: var(--os-display);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 900;
	line-height: 1.2;
}

.woocommerce ul.products li.product a {
	text-decoration: none;
}

.woocommerce ul.products li.product .price {
	display: block;
	margin: 0.35rem 0 0.75rem;
	color: var(--os-charcoal);
}

/* Blocchi prodotto */
.wc-block-grid__product-image img,
.wp-block-woocommerce-product-image img,
.wp-block-post-featured-image img {
	background: var(--os-sand);
}

.wc-block-components-product-name,
.wp-block-post-title a {
	text-decoration: none;
}

/* Pulsanti */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.wc-block-components-button:not(.is-link),
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.wp-block-woocommerce-product-button .wp-block-button__link {
	padding: 0.85rem 1.5rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	background: var(--os-sage);
	color: var(--os-charcoal);
	font-family: var(--wp--preset--font-family--text);
	font-size: var(--wp--preset--font-size--base);
	font-weight: 400;
	text-decoration: none;
	line-height: 1.2;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.wc-block-components-button:not(.is-link):hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover,
.wp-block-woocommerce-product-button .wp-block-button__link:hover {
	background: var(--os-charcoal);
	color: var(--os-offwhite);
}

.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: var(--os-sage);
	color: var(--os-charcoal);
}

.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: var(--os-charcoal);
	color: var(--os-offwhite);
}

/* Scheda prodotto */
.single-product div.product .product_title {
	font-size: var(--wp--preset--font-size--xx-large);
}

.single-product div.product p.price,
.single-product div.product span.price {
	font-size: var(--wp--preset--font-size--large);
	color: var(--os-charcoal);
}

.woocommerce div.product form.cart {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
}

.woocommerce div.product form.cart .os-file {
	flex: 1 1 100%;
}

.woocommerce .quantity .qty {
	width: 5rem;
	padding: 0.7rem 0.5rem;
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	text-align: center;
	background: #fff;
}

.woocommerce-tabs ul.tabs li.active a {
	border-bottom: 3px solid var(--os-sage);
}

/* Messaggi */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
	border: 0;
	border-left: 4px solid var(--os-sage);
	border-radius: 0;
	background: var(--os-sand);
	color: var(--os-charcoal);
}

.woocommerce-message::before,
.woocommerce-info::before {
	color: var(--os-sage-dark);
}

/* Carrello e checkout */
.wc-block-components-text-input input,
.wc-block-components-textarea textarea,
.wc-blocks-components-select__select {
	border: 1.5px solid var(--os-charcoal);
	border-radius: 2px;
	background: #fff;
}

.wc-block-cart-items th,
.wc-block-components-totals-item__label {
	font-weight: 400;
}

.wc-block-components-sidebar-layout .wc-block-components-main,
.wc-block-components-sidebar-layout .wc-block-components-sidebar {
	min-width: 0;
}

.wc-block-components-order-summary,
.wc-block-cart__totals-title {
	font-family: var(--os-display);
}

/* Mini carrello in header */
.wc-block-mini-cart__button {
	color: inherit;
}

.wc-block-mini-cart__badge {
	background: var(--os-sage);
	color: var(--os-charcoal);
	font-family: var(--os-mono);
	font-weight: 400;
}

/* ---------- Movimento ridotto ---------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.os-hero-title {
		animation: none;
	}

	.os-card .wp-block-post-featured-image::after {
		transition: none;
	}
}

/* ---------- Schermi piccoli ---------- */

@media (max-width: 600px) {
	.os-wordmark a {
		font-size: 1.25rem;
	}

	.os-wordmark span {
		display: none;
	}
}

/* ---------- Logo ---------- */
.os-wordmark a {
	display: inline-block;
	line-height: 0;
}

.os-wordmark img {
	display: block;
	width: clamp(9rem, 16vw, 13rem);
	height: auto;
}

.os-footer .os-wordmark img {
	width: clamp(11rem, 20vw, 16rem);
}

.os-badge {
	display: block;
	width: min(100%, 20rem);
	height: auto;
	margin-inline: auto;
}

/* ---------- Carosello home ---------- */
.os-slider {
	position: relative;
	margin: 0;
}

.os-slides {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	scroll-behavior: smooth;
	gap: 0;
}

.os-slides::-webkit-scrollbar {
	display: none;
}

.os-slides > .os-slide {
	flex: 0 0 100%;
	min-width: 100%;
	scroll-snap-align: start;
	margin: 0;
}

.os-slide-title {
	font-size: var(--wp--preset--font-size--display);
	max-width: 14ch;
	margin-bottom: var(--wp--preset--spacing--40);
}

.os-slide .os-lead {
	max-width: 36rem;
}

.os-slide .wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--os-offwhite);
	border-color: var(--os-offwhite);
}

.os-slide .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--os-offwhite);
	color: var(--os-charcoal);
}

.os-slider-nav {
	position: absolute;
	left: 0;
	right: 0;
	bottom: var(--wp--preset--spacing--40);
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.6rem;
}

.os-slider-dot,
.os-slider-arrow {
	appearance: none;
	cursor: pointer;
	border: 1.5px solid var(--os-offwhite);
	background: transparent;
	color: var(--os-offwhite);
	font: inherit;
}

.os-slider-dot {
	width: 0.8rem;
	height: 0.8rem;
	padding: 0;
	border-radius: 50%;
}

.os-slider-dot[aria-current="true"] {
	background: var(--os-sage);
	border-color: var(--os-sage);
}

.os-slider-arrow {
	width: 2.4rem;
	height: 2.4rem;
	border-radius: 50%;
	line-height: 1;
}

.os-slider-arrow:hover {
	background: var(--os-offwhite);
	color: var(--os-charcoal);
}

@media (prefers-reduced-motion: reduce) {
	.os-slides {
		scroll-behavior: auto;
	}
}
