/**
 * eBoots — Size sheet (sketch 007, variante A "Compatta").
 *
 * Sticky size-bar (solo home) + bottom-sheet di selezione taglia.
 * Caricato solo sulla home (vedi inc/enqueue.php). Markup:
 * templates/parts/size-sheet.php. Logica: assets/js/size-sheet.js.
 * Dipende dai token del design system (tokens.css).
 */

/* ------------------------------------------------------------------ */
/* Sticky size-bar                                                     */
/* ------------------------------------------------------------------ */
.eb-sizebar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 120;
	padding: 0 12px calc(12px + env(safe-area-inset-bottom));
	pointer-events: none; /* solo il bottone interno è cliccabile */
}

/* Nascosta quando il footer entra in viewport (IntersectionObserver). */
.eb-sizebar.is-hidden {
	pointer-events: none;
	opacity: 0;
	transform: translateY(120%);
}
.eb-sizebar {
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.eb-sizebar__btn {
	pointer-events: auto;
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	background: rgba(14, 14, 14, 0.92);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-pill);
	padding: 0.7rem 0.7rem 0.7rem 1rem;
	color: var(--txt);
	cursor: pointer;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
	transition: transform 0.15s ease, border-color 0.15s ease;
}
.eb-sizebar__btn:hover,
.eb-sizebar__btn:focus-visible {
	border-color: var(--volt);
}
.eb-sizebar__btn:active {
	transform: scale(0.99);
}

.eb-sizebar__ico {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--surface-2);
	border: 1px solid var(--line);
}
.eb-sizebar__ico svg {
	width: 16px;
	height: 16px;
	color: var(--volt);
}

.eb-sizebar__tx {
	flex: 1;
	min-width: 0;
	text-align: left;
}
.eb-sizebar__k {
	display: block;
	font-family: var(--font-ui);
	font-size: 0.625rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 700;
}
.eb-sizebar__v {
	display: block;
	font-family: var(--font-d);
	font-weight: 800;
	font-size: 1rem;
	line-height: 1.1;
}
.eb-sizebar__v em {
	color: var(--volt);
	font-style: normal;
}

.eb-sizebar__cta {
	flex: none;
	font-family: var(--font-ui);
	font-weight: 800;
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bg);
	background: var(--volt);
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-pill);
}
.eb-sizebar.is-set .eb-sizebar__cta {
	background: transparent;
	color: var(--volt);
	padding: 0.5rem 0.4rem;
}

/* Spazio extra in fondo (home e shop) così la bar non copre l'ultima sezione. */
.eb-home.has-sizebar,
.eb-shop.has-sizebar {
	padding-bottom: 5.5rem;
}

/* ------------------------------------------------------------------ */
/* Bottom sheet                                                        */
/* ------------------------------------------------------------------ */
.eb-sheet {
	position: fixed;
	inset: 0;
	z-index: 200;
	visibility: hidden;
	transition: visibility 0s linear 0.34s;
}
.eb-sheet.is-open {
	visibility: visible;
	transition-delay: 0s;
}

.eb-sheet__scrim {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	opacity: 0;
	transition: opacity 0.3s ease;
}
.eb-sheet.is-open .eb-sheet__scrim {
	opacity: 1;
}

.eb-sheet__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0 auto;
	max-width: 560px;
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-bottom: 0;
	border-radius: 22px 22px 0 0;
	padding: 0.5rem 1.15rem calc(1.15rem + env(safe-area-inset-bottom));
	transform: translateY(102%);
	transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
	box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.5);
}
.eb-sheet.is-open .eb-sheet__panel {
	transform: translateY(0);
}

.eb-sheet__grab {
	display: block;
	width: 38px;
	height: 4px;
	border-radius: 3px;
	background: var(--line-strong);
	margin: 0.4rem auto 0.9rem;
}
.eb-sheet__close {
	position: absolute;
	top: 0.9rem;
	right: 1rem;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--muted);
	font-size: 1.1rem;
	line-height: 1;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: color 0.15s ease;
}
.eb-sheet__close:hover {
	color: var(--txt);
}

.eb-sheet__head {
	margin-bottom: 0.9rem;
}
.eb-sheet__brand {
	display: block;
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: 0.6875rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--muted);
	min-height: 0.9rem;
}
.eb-sheet__title {
	margin: 0.1rem 0 0.25rem;
	font-family: var(--font-d);
	font-weight: 800;
	line-height: 0.98;
	text-transform: uppercase;
}
.eb-sheet__title-lead {
	display: block;
	font-size: 1.05rem;
	color: var(--muted);
	letter-spacing: 0.02em;
}
.eb-sheet__title-coll {
	display: block;
	font-size: 1.9rem;
	color: var(--volt);
}
.eb-sheet__title-coll:empty {
	display: none;
}
/* Modalità globale (aperta dalla sticky bar): niente nome collezione, il lead
   diventa il titolo principale. */
.eb-sheet--global .eb-sheet__title-lead {
	font-size: 1.9rem;
	color: var(--txt);
}

.eb-sheet__models {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--font-ui);
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--txt);
}
.eb-sheet__models svg {
	width: 14px;
	height: 14px;
	color: var(--mint);
}

.eb-sheet__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 1rem 0 0.7rem;
}
.eb-sheet__lbl {
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Unit toggle (segmented EU / CM) */
.eb-unit {
	display: inline-flex;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	padding: 3px;
}
.eb-unit__btn {
	background: transparent;
	border: 0;
	color: var(--muted);
	cursor: pointer;
	font-family: var(--font-ui);
	font-weight: 800;
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	padding: 0.3rem 0.9rem;
	border-radius: var(--radius-pill);
	transition: background 0.15s ease, color 0.15s ease;
}
.eb-unit__btn.is-active {
	background: var(--txt);
	color: var(--bg);
}

/* Griglia taglie — 4 colonne compatte, solo unità attiva visibile */
.eb-size-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 7px;
}
.eb-sz {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 0.92;
	border: 1px solid var(--line);
	background: var(--surface-2);
	border-radius: var(--radius-md);
	color: var(--txt);
	cursor: pointer;
	font-family: var(--font-d);
	font-weight: 800;
	font-size: 1.0625rem;
	line-height: 1;
	transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.eb-sz:hover {
	border-color: var(--line-strong);
}
.eb-sz__cm {
	display: none;
}
.eb-size-grid.is-cm .eb-sz__eu {
	display: none;
}
.eb-size-grid.is-cm .eb-sz__cm {
	display: inline;
}
.eb-sz.is-selected {
	background: var(--volt);
	border-color: var(--volt);
	color: var(--bg);
}
.eb-sz.is-selected::after {
	content: "✓";
	position: absolute;
	top: 3px;
	right: 6px;
	font-family: var(--font-ui);
	font-weight: 800;
	font-size: 0.625rem;
}

/* CTA */
.eb-sheet__cta {
	width: 100%;
	margin-top: 1rem;
	border: 0;
	cursor: pointer;
	background: var(--volt);
	color: var(--bg);
	border-radius: var(--radius-pill);
	font-family: var(--font-d);
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 1rem;
	padding: 0.95rem 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	transition: filter 0.15s ease, transform 0.1s ease;
}
.eb-sheet__cta:disabled {
	background: var(--surface-2);
	color: var(--muted);
	cursor: not-allowed;
}
.eb-sheet__cta:not(:disabled):hover {
	filter: brightness(1.06);
}
.eb-sheet__cta:not(:disabled):active {
	transform: translateY(1px);
}

.eb-sheet__lock {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0.8rem 0 0;
	font-family: var(--font-ui);
	font-size: 0.6875rem;
	line-height: 1.4;
	color: var(--muted);
}
.eb-sheet__lock svg {
	flex: none;
	width: 13px;
	height: 13px;
	margin-top: 1px;
	color: var(--mint);
}

/* ------------------------------------------------------------------ */
/* Badge taglia sulle card collezione (quando una taglia è salvata)    */
/* ------------------------------------------------------------------ */
.eb-line-card__size {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	background: var(--volt);
	color: var(--bg);
	font-family: var(--font-d);
	font-weight: 800;
	font-size: 0.75rem;
	line-height: 1;
	padding: 0.2rem 0.5rem;
	border-radius: var(--radius-pill);
}

@media (min-width: 768px) {
	.eb-sheet__title-coll {
		font-size: 2.2rem;
	}
	.eb-size-grid {
		grid-template-columns: repeat(6, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.eb-sheet,
	.eb-sheet__scrim,
	.eb-sheet__panel,
	.eb-sizebar,
	.eb-sizebar__btn {
		transition: none;
	}
}
