/*
Theme Name: Demost
Theme URI: https://demost.cat
Author: Celler Demost
Description: Tema de blocs del Celler Demost. Blanc, minimalista i lleuger: colors i tipografies de la marca, perfil de Montserrat, plantilla en blanc per a l'etiqueta electrònica (/info-) i patrons del relat. Sense constructor de pàgines.
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 7.4
Version: 0.5.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: demost
Tags: block-patterns, full-site-editing, wide-blocks, translation-ready
*/

/* Només el que theme.json no pot fer. */

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

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

/* Etiqueta petita en majúscules espaiades (classe "is-style-etiqueta" o a qualsevol paràgraf) */
.is-style-etiqueta,
.demost-etiqueta {
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.26em;
	text-transform: uppercase;
	line-height: 1.5;
}

/* Perfil de Montserrat */
.demost-skyline { display: block; width: 100%; line-height: 0; }
.demost-skyline svg, .wp-block-image.demost-skyline img { display: block; width: 100%; height: clamp(70px, 10vw, 150px); object-fit: fill; }
.demost-skyline--peu svg, .wp-block-image.demost-skyline--peu img { height: clamp(36px, 5vw, 70px); }
.demost-skyline + .wp-block-group { margin-top: 0; }

/* Botó de WhatsApp flotant */
.demost-whatsapp {
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 50;
	margin: 0 !important;
}
.demost-whatsapp .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 20px 0 16px;
	border-radius: 999px;
	background: #1F7A4D;
	color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
	letter-spacing: 0.08em;
}
.demost-whatsapp .wp-block-button__link::before {
	content: "";
	width: 22px;
	height: 22px;
	flex: 0 0 22px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2c-1.5 0-3-.4-4.3-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.2-.4.7-1.3.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.7 11.8 11.8 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.2-1.2-.1-.1-.3-.2-.5-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2c-1.5 0-3-.4-4.3-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.2-.4.7-1.3.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.7 11.8 11.8 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.2-1.2-.1-.1-.3-.2-.5-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 600px) {
	.demost-whatsapp .wp-block-button__link { padding: 0; width: 56px; height: 56px; justify-content: center; font-size: 0; }
}

/* Taula nutricional */
.demost-nutricio table { border-collapse: collapse; width: 100%; }
.demost-nutricio thead th { font-weight: 400; font-size: var(--wp--preset--font-size--x-small); letter-spacing: 0.14em; text-transform: uppercase; color: var(--wp--preset--color--gris); }
.demost-nutricio td, .demost-nutricio th { border: 0; border-bottom: 1px solid var(--wp--preset--color--linia); padding: 0.6em 0; text-align: left; }
.demost-nutricio td:last-child, .demost-nutricio th:last-child { text-align: right; white-space: nowrap; }
.demost-nutricio tbody tr:first-child td { font-weight: 700; border-top: 2px solid var(--wp--preset--color--grafit); }
.demost-nutricio tbody tr:last-child td { border-bottom: 2px solid var(--wp--preset--color--grafit); }
/* Files 3 i 5 = «dels quals saturats» i «dels quals sucres» */
.demost-nutricio tbody tr:nth-child(3) td,
.demost-nutricio tbody tr:nth-child(5) td { color: var(--wp--preset--color--gris); }
.demost-nutricio tbody tr:nth-child(3) td:first-child,
.demost-nutricio tbody tr:nth-child(5) td:first-child { padding-left: 1.2em; }
.demost-nutricio figcaption { text-align: left; }

/* Veremes: anys desplegables */
.wp-block-details > summary {
	font-family: var(--wp--preset--font-family--playfair);
	font-weight: 800;
	font-size: var(--wp--preset--font-size--large);
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 44px;
}
.wp-block-details > summary::-webkit-details-marker { display: none; }
.wp-block-details > summary::after { content: "+"; font-family: var(--wp--preset--font-family--montserrat); font-weight: 400; }
.wp-block-details[open] > summary::after { content: "−"; }
.wp-block-details[open] > summary { margin-bottom: 1.25rem; }

/* Xifra gran (dades) */
.demost-xifra { font-family: var(--wp--preset--font-family--playfair); font-weight: 800; line-height: 1; }

/* Targeta */
.demost-aviat { border-style: dashed !important; }

/* Fitxa tècnica */
.demost-fitxa table { border-collapse: collapse; width: 100%; }
.demost-fitxa td { border: 0; border-bottom: 1px solid var(--wp--preset--color--linia); padding: 0.6em 0; vertical-align: top; }
.demost-fitxa tr:first-child td { border-top: 2px solid var(--wp--preset--color--grafit); }
.demost-fitxa td:first-child { width: 45%; font-size: var(--wp--preset--font-size--x-small); letter-spacing: 0.16em; text-transform: uppercase; color: var(--wp--preset--color--gris); padding-right: 1rem; }

/* Medalla */
.demost-medalla .wp-block-image img { width: 88px !important; height: auto; }
.demost-medalla { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: 1rem; }
.demost-medalla .wp-block-image { flex: 0 0 88px; margin: 0; }
.demost-medalla > p { flex: 1 1 auto; margin: 0; }

/* Enllaç per saltar al contingut (accessibilitat) */
.skip-link:focus { z-index: 100000; }

/* Botó amb contorn dins la secció verda */
.is-style-seccio-verda .wp-block-button.is-style-outline > .wp-block-button__link { color: #fff; border-color: #fff; }

/* Índex de capítols */
.demost-capitols a { text-decoration: none; display: block; }
.demost-capitols a:hover strong, .demost-capitols a:focus-visible strong { text-decoration: underline; text-underline-offset: 4px; }
.demost-capitols .is-style-etiqueta { font-family: var(--wp--preset--font-family--montserrat); color: var(--wp--preset--color--ocre-tinta); }

/* Textos legals */
.demost-legal mark { background: #F9EEDA; color: inherit; padding: 0 0.2em; }
.demost-legal-taula table { border-collapse: collapse; width: 100%; font-size: var(--wp--preset--font-size--small); }
.demost-legal-taula th { font-weight: 400; font-size: var(--wp--preset--font-size--x-small); letter-spacing: 0.14em; text-transform: uppercase; color: var(--wp--preset--color--gris); }
.demost-legal-taula td, .demost-legal-taula th { border: 0; border-bottom: 1px solid var(--wp--preset--color--linia); padding: 0.6em 0.75em 0.6em 0; text-align: left; vertical-align: top; }
.demost-legal-taula thead th { border-bottom: 2px solid var(--wp--preset--color--grafit); }
