/* Pegadito a ti – Subida y encuadre de fotos */
.pat-fotos {
	--pat-fondo: #FFF8F1;
	--pat-principal: #FFD3B8;
	--pat-principal-oscuro: #F5AE88;
	--pat-acento: #A65A33;
	--pat-borde: #F0E2D2;
	--pat-texto: #4A3A30;
	--pat-suave: #7B6A5E;
	width: 100%;
	margin: 8px 0 24px;
	padding: 20px;
	background: #fff;
	border: 1.5px solid var(--pat-borde);
	border-radius: 20px;
	font-family: Nunito, system-ui, sans-serif;
	color: var(--pat-texto);
	box-sizing: border-box;
	clear: both;
}
.pat-fotos__cab { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.pat-fotos__titulo { margin: 0; font-family: Fredoka, sans-serif; font-weight: 500; font-size: 20px; color: var(--pat-texto); }
.pat-fotos__contador { margin: 0; font-weight: 700; font-size: 14px; color: var(--pat-acento); white-space: nowrap; }
.pat-fotos--completo .pat-fotos__contador { color: #3F7E64; }
.pat-fotos__ayuda { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--pat-suave); }
.pat-fotos__varias {
	background: none; border: 0; padding: 0; font: inherit; font-weight: 700;
	color: var(--pat-acento); text-decoration: underline; cursor: pointer;
}
.pat-fotos__varias:hover, .pat-fotos__varias:focus-visible { color: var(--pat-texto); }
.pat-fotos__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 12px; }
/* Fotos apaisadas (calendario): huecos más anchos */
.pat-fotos--apaisada .pat-fotos__grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.pat-fotos__aviso {
	margin: 14px 0 0; padding: 10px 14px; border-radius: 12px;
	background: #FFF0C9; color: var(--pat-texto); font-size: 14px; line-height: 1.45;
}

/* Hueco de cada imán */
.pat-hueco {
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	padding: 0; margin: 0; background: none; border: 0; cursor: pointer;
	font: inherit; color: var(--pat-texto); min-width: 0;
}
.pat-hueco__foto {
	position: relative; display: block; width: 100%; aspect-ratio: var(--pat-ratio, 1);
	border-radius: 12px; overflow: hidden; background: var(--pat-fondo);
	border: 2px dashed var(--pat-principal-oscuro);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.pat-hueco:hover .pat-hueco__foto,
.pat-hueco:focus-visible .pat-hueco__foto { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(74, 58, 48, .14); border-color: var(--pat-acento); }
.pat-hueco:focus-visible { outline: none; }
.pat-hueco:focus-visible .pat-hueco__foto { outline: 3px solid var(--pat-acento); outline-offset: 2px; }
.pat-hueco--ok .pat-hueco__foto,
.pat-hueco--subiendo .pat-hueco__foto { border: 3px solid #fff; box-shadow: 0 3px 10px rgba(74, 58, 48, .16); }
.pat-hueco--error .pat-hueco__foto { border: 2px solid #C0392B; }
.pat-hueco__foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pat-hueco__mas {
	position: absolute; inset: 0; display: grid; place-items: center;
	font-family: Fredoka, sans-serif; font-size: 30px; color: var(--pat-principal-oscuro);
}
.pat-hueco__etiqueta { font-size: 12px; font-weight: 700; color: var(--pat-suave); line-height: 1.2; text-align: center; }
.pat-hueco__check, .pat-hueco__baja {
	position: absolute; top: 4px; width: 20px; height: 20px; border-radius: 50%;
	display: grid; place-items: center; font-size: 12px; font-weight: 800; line-height: 1;
}
.pat-hueco__check { right: 4px; background: #3F7E64; color: #fff; }
.pat-hueco__baja { left: 4px; background: #FFF0C9; color: var(--pat-acento); border: 1.5px solid var(--pat-acento); }
.pat-hueco__cargando {
	position: absolute; inset: 0; background: rgba(255, 248, 241, .6);
}
.pat-hueco__cargando::after {
	content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px;
	border: 3px solid var(--pat-principal); border-top-color: var(--pat-acento); border-radius: 50%;
	animation: patGira .8s linear infinite;
}
@keyframes patGira { to { transform: rotate(360deg); } }

/* Botón de añadir al carrito mientras faltan fotos */
.single_add_to_cart_button.pat-bloqueado { opacity: .55; cursor: not-allowed; }

/* Botón en el listado de la tienda */
.pat-fotos-boton { border-radius: 999px !important; }

/* Editor de encuadre */
html.pat-ed-abierto { overflow: hidden; }
.pat-ed {
	position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
	padding: 16px; background: rgba(74, 58, 48, .55); box-sizing: border-box;
	font-family: Nunito, system-ui, sans-serif; color: #4A3A30;
}
.pat-ed[hidden] { display: none; }
.pat-ed__caja {
	width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto;
	background: #FFF8F1; border-radius: 24px; padding: 20px; box-sizing: border-box;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.pat-ed__titulo { margin: 0 0 14px; font-family: Fredoka, sans-serif; font-weight: 500; font-size: 20px; }
.pat-ed__titulo span { color: #A65A33; }
.pat-ed__visor {
	position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; max-height: 60vh;
	background: #fff; touch-action: none; cursor: grab; user-select: none;
}
.pat-ed__visor:active { cursor: grabbing; }
.pat-ed__visor:focus-visible { outline: 3px solid #A65A33; outline-offset: 3px; }
.pat-ed__visor canvas { display: block; width: 100%; height: 100%; }
.pat-ed__marco {
	position: absolute; inset: 0; pointer-events: none; border-radius: 14px;
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .9);
	background:
		linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 33.33% 0 / 1px 100% no-repeat,
		linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 66.66% 0 / 1px 100% no-repeat,
		linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 0 33.33% / 100% 1px no-repeat,
		linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 0 66.66% / 100% 1px no-repeat;
}
.pat-ed__aviso { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #FFF0C9; font-size: 14px; line-height: 1.45; }
.pat-ed__controles { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.pat-ed__controles input[type=range] { flex: 1; accent-color: #A65A33; min-width: 0; }
.pat-ed button {
	font: 700 15px/1 Nunito, system-ui, sans-serif; color: #4A3A30; cursor: pointer;
	border-radius: 999px; border: 0; padding: 12px 18px; background: #fff;
	box-shadow: inset 0 0 0 1.5px #F0E2D2; transition: background .15s, box-shadow .15s;
}
.pat-ed button:hover { background: #F4E8D8; }
.pat-ed button:focus-visible { outline: 3px solid #A65A33; outline-offset: 2px; }
.pat-ed .pat-ed__icono { width: 40px; height: 40px; padding: 0; font-size: 20px; flex: 0 0 auto; }
.pat-ed__tip { margin: 10px 0 0; font-size: 13px; color: #7B6A5E; text-align: center; }
.pat-ed__acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.pat-ed__hueco { flex: 1; }
.pat-ed .pat-ed__cambiar { background: none; box-shadow: none; padding-left: 0; text-decoration: underline; color: #A65A33; }
.pat-ed .pat-ed__guardar { background: #FFD3B8; box-shadow: none; }
.pat-ed .pat-ed__guardar:hover { background: #F5AE88; }

@media (max-width: 480px) {
	.pat-fotos { padding: 16px; border-radius: 16px; }
	.pat-fotos__grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
	.pat-fotos--apaisada .pat-fotos__grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.pat-hueco__etiqueta { font-size: 11px; }
	.pat-ed { padding: 10px; align-items: flex-end; }
	.pat-ed__caja { padding: 16px; border-radius: 20px; }
	.pat-ed__acciones { justify-content: flex-end; }
	.pat-ed__cambiar { width: 100%; text-align: left; }
	.pat-ed__hueco { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.pat-hueco__foto { transition: none; }
	.pat-hueco__cargando::after { animation-duration: 2s; }
}
