/*
 * Banner cookie e pannello "Preferenze cookie" con la grafica di soimm.com
 * (porting di src/styles/consent.css di soimm.com, classi .ck-* -> .p2wc-*, come il componente
 * /var/backups/2pweb-temi/_consenso). Colori del brand SOIMM e font di soimm.com (DM Sans e
 * Barlow Condensed 700, licenza SIL OFL 1.1, file in assets/fonts/consenso/): si scaricano solo
 * quando il banner o il pannello sono visibili.
 * Tutto e' dentro #p2w-consent, con un reset mirato: gli stili del tema (button, h2, p, a...)
 * non li alterano.
 *
 * @package 2pweb-base
 */

@font-face { font-family: 'P2WC DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url(../fonts/consenso/dmsans-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'P2WC DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url(../fonts/consenso/dmsans-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'P2WC Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/consenso/barlowcondensed-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'P2WC Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/consenso/barlowcondensed-700-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

#p2w-consent {
	--p2wc-primario: #7B5B3A;        /* brand-brown di soimm.com */
	--p2wc-primario-scuro: #5a3e26;  /* brand-brown-dark */
	--p2wc-accento: #A68038;         /* brand-gold */
	--p2wc-titoli: #18120a;          /* brand-dark */
	--p2wc-testo: #2d1f14;           /* brand-text */
	--p2wc-tenue: #6b5745;           /* brand-muted */
	--p2wc-bordo: #e9e3dc;           /* brand-border */
	--p2wc-crema: #f8f7f5;           /* brand-cream */
	--p2wc-sfondo: #fff;
	--p2wc-font: 'P2WC DM Sans', 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	--p2wc-font-titoli: 'P2WC Barlow Condensed', 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
	--p2wc-z: 100000;                /* sopra chat SOIMM, WhatsApp e "torna su" */
}

/* ── Reset mirato: niente stili del tema dentro banner e pannello ── */
#p2w-consent, #p2w-consent *, #p2w-consent *::before, #p2w-consent *::after { box-sizing: border-box; }
#p2w-consent :where(div, p, h2, ul, li, a, button, span, strong, details, summary) {
	margin: 0; padding: 0; border: 0 solid; background: none; box-shadow: none; text-shadow: none;
	font: inherit; color: inherit; letter-spacing: normal; word-spacing: normal; text-transform: none;
	text-decoration: none; text-align: inherit; text-indent: 0; line-height: inherit; float: none;
	width: auto; min-width: auto; max-width: none; height: auto; min-height: auto; max-height: none;
	opacity: 1; transform: none; filter: none; outline: 0; border-radius: 0; vertical-align: baseline;
}
#p2w-consent :where(ul) { list-style: none; }
#p2w-consent :where(li)::before, #p2w-consent :where(li)::after, #p2w-consent :where(a)::before, #p2w-consent :where(a)::after,
#p2w-consent :where(button)::before { content: none; display: none; }
#p2w-consent :where(button) { cursor: pointer; -webkit-appearance: none; appearance: none; }
#p2w-consent svg { display: block; flex-shrink: 0; overflow: visible; }
#p2w-consent { position: static; font-family: var(--p2wc-font); font-size: 16px; line-height: 1.5; color: var(--p2wc-testo); -webkit-font-smoothing: antialiased; text-align: left; }
#p2w-consent [hidden] { display: none !important; }

/* ═══ Banner ═══ */
#p2w-consent .p2wc-banner {
	position: fixed;
	z-index: var(--p2wc-z);
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--p2wc-sfondo);
	color: var(--p2wc-testo);
	font-family: var(--p2wc-font);
	border-top: 1px solid var(--p2wc-bordo);
	border-radius: 18px 18px 0 0;
	box-shadow: 0 -10px 40px rgba(24, 18, 10, 0.18);
	outline: none;
	animation: p2wc-in 0.35s cubic-bezier(0.32, 0.72, 0.37, 1);
}
@media (min-width: 640px) {
	#p2w-consent .p2wc-banner {
		left: 24px;
		right: auto;
		bottom: 24px;
		width: min(580px, calc(100vw - 48px));
		border: 1px solid var(--p2wc-bordo);
		border-radius: 18px;
		box-shadow: 0 18px 60px rgba(24, 18, 10, 0.26);
	}
}
#p2w-consent .p2wc-banner-inner {
	position: relative;
	max-height: min(80vh, 640px);
	overflow-y: auto;
	padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
	#p2w-consent .p2wc-banner-inner { padding: 26px 28px 24px; }
}

#p2w-consent .p2wc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 44px 10px 0;
	color: var(--p2wc-accento);
}
#p2w-consent .p2wc-title {
	display: block;
	font-family: var(--p2wc-font-titoli);
	font-size: 23px;
	font-weight: 700;
	font-style: normal;
	line-height: 1.15;
	color: var(--p2wc-titoli);
	margin: 0;
}
#p2w-consent .p2wc-text {
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--p2wc-testo);
	margin: 0 0 8px;
}
#p2w-consent .p2wc-links {
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--p2wc-tenue);
	margin: 6px 0 0;
}
#p2w-consent .p2wc-links a {
	color: var(--p2wc-primario);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}
#p2w-consent .p2wc-links a:hover { color: var(--p2wc-primario-scuro); }

#p2w-consent .p2wc-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 18px;
}
#p2w-consent .p2wc-btn-wide { grid-column: 1 / -1; }
#p2w-consent .p2wc-btn-only { grid-column: 1 / -1; } /* unico pulsante (avviso informativo) */

#p2w-consent .p2wc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 10px 16px;
	border: 1.5px solid var(--p2wc-primario);
	border-radius: 10px;
	font-family: var(--p2wc-font);
	font-size: 14.5px;
	font-weight: 600;
	font-style: normal;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
#p2w-consent .p2wc-btn-solid { background: var(--p2wc-primario); color: #fff; }
#p2w-consent .p2wc-btn-solid:hover { background: var(--p2wc-primario-scuro); border-color: var(--p2wc-primario-scuro); color: #fff; }
#p2w-consent .p2wc-btn-outline { background: var(--p2wc-sfondo); color: var(--p2wc-primario); }
#p2w-consent .p2wc-btn-outline:hover { background: var(--p2wc-crema); color: var(--p2wc-primario); }

#p2w-consent .p2wc-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--p2wc-tenue);
	cursor: pointer;
}
#p2w-consent .p2wc-close:hover { background: var(--p2wc-crema); color: var(--p2wc-titoli); }

#p2w-consent .p2wc-btn:focus-visible,
#p2w-consent .p2wc-close:focus-visible,
#p2w-consent .p2wc-switch:focus-visible,
#p2w-consent .p2wc-links a:focus-visible,
#p2w-consent .p2wc-services summary:focus-visible {
	outline: 3px solid var(--p2wc-accento);
	outline-offset: 2px;
}

@keyframes p2wc-in {
	from { transform: translateY(24px); opacity: 0; }
	to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	#p2w-consent .p2wc-banner, #p2w-consent .p2wc-modal { animation: none; }
}

/* ── Pannello preferenze ── */
#p2w-consent .p2wc-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--p2wc-z) + 10);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: rgba(24, 18, 10, 0.5);
}
@media (min-width: 640px) {
	#p2w-consent .p2wc-overlay { align-items: center; padding: 24px; }
}
#p2w-consent .p2wc-modal {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 680px;
	max-height: 92vh;
	background: var(--p2wc-sfondo);
	color: var(--p2wc-testo);
	font-family: var(--p2wc-font);
	border-radius: 18px 18px 0 0;
	box-shadow: 0 24px 64px rgba(24, 18, 10, 0.3);
	outline: none;
	animation: p2wc-in 0.3s cubic-bezier(0.32, 0.72, 0.37, 1);
}
@media (min-width: 640px) {
	#p2w-consent .p2wc-modal { max-height: min(88vh, 820px); border-radius: 18px; }
}
#p2w-consent .p2wc-modal-head {
	position: relative;
	padding: 22px 64px 14px 22px;
	border-bottom: 1px solid var(--p2wc-bordo);
}
#p2w-consent .p2wc-modal-head .p2wc-text { margin: 8px 0 0; }
#p2w-consent .p2wc-modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 22px;
}
#p2w-consent .p2wc-modal-foot {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--p2wc-bordo);
}
@media (min-width: 640px) {
	#p2w-consent .p2wc-modal-foot { grid-template-columns: 1fr 1fr 1fr; padding-bottom: 18px; }
	#p2w-consent .p2wc-modal-foot .p2wc-btn-wide { grid-column: auto; }
	#p2w-consent .p2wc-modal-foot .p2wc-btn-only { grid-column: 1 / -1; }
}

#p2w-consent .p2wc-cat {
	border: 1px solid var(--p2wc-bordo);
	border-radius: 12px;
	padding: 16px 18px;
	margin-bottom: 12px;
}
#p2w-consent .p2wc-cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
#p2w-consent .p2wc-cat-name {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--p2wc-titoli);
}
#p2w-consent .p2wc-cat-desc {
	margin: 8px 0 0;
	font-size: 14px;
	line-height: 1.6;
}
#p2w-consent .p2wc-always {
	flex-shrink: 0;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.5;
	color: #2d6a2d;
	background: #eaf4ea;
	padding: 5px 10px;
	border-radius: 999px;
}

#p2w-consent .p2wc-switch {
	position: relative;
	display: block;
	flex-shrink: 0;
	width: 52px;
	height: 30px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #b9aea3;
	cursor: pointer;
	transition: background-color 0.2s;
}
#p2w-consent .p2wc-switch::after {
	content: '';
	display: block;
	position: absolute;
	top: 4px;
	left: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s;
}
#p2w-consent .p2wc-switch[aria-checked='true'] { background: var(--p2wc-primario); }
#p2w-consent .p2wc-switch[aria-checked='true']::after { transform: translateX(22px); }
@media (prefers-reduced-motion: reduce) {
	#p2w-consent .p2wc-switch, #p2w-consent .p2wc-switch::after { transition: none; }
}

#p2w-consent .p2wc-services { display: block; margin-top: 10px; font-size: 13.5px; line-height: 1.55; }
#p2w-consent .p2wc-services summary {
	display: list-item;
	list-style: disclosure-closed inside;
	cursor: pointer;
	width: fit-content;
	color: var(--p2wc-primario);
	font-weight: 600;
	border-radius: 4px;
}
#p2w-consent .p2wc-services[open] summary { list-style-type: disclosure-open; }
#p2w-consent .p2wc-services ul { margin: 8px 0 0; padding: 0; list-style: none; }
#p2w-consent .p2wc-services li { padding: 10px 0 0; margin-top: 10px; border-top: 1px dashed var(--p2wc-bordo); }
#p2w-consent .p2wc-services strong { font-weight: 700; }

@media print {
	#p2w-consent { display: none !important; }
}
