/* کانتینر اصلی دکمه */
.container-button {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas: "bt-1 bt-2 bt-3"
"bt-4 bt-5 bt-6";
position: relative;
perspective: 800px;
padding: 0;
width: 135px;
height: 47px;
transition: all 0.3s ease-in-out;
margin: auto; /* برای وسط چین شدن */
}
.container-button:active {
transform: scale(0.95);
}
/* شبکه مخفی برای تشخیص جهت موس */
.hover {
position: absolute;
width: 100%;
height: 100%;
z-index: 200;
}
.bt-1 { grid-area: bt-1; }
.bt-2 { grid-area: bt-2; }
.bt-3 { grid-area: bt-3; }
.bt-4 { grid-area: bt-4; }
.bt-5 { grid-area: bt-5; }
.bt-6 { grid-area: bt-6; }
/* تنظیمات دکمه با خنثیسازی استایلهای قالب */
.click-btn {
all: unset;
position: absolute;
padding: 0;
width: 135px;
height: 47px;
background: transparent;
font-size: 16px; /* سایز فونت */
font-weight: 900;
border: 3px solid #f39923; /* رنگ حاشیه */
border-radius: 12px;
transition: all 0.3s ease-in-out;
font-family: inherit; /* ارثبری فونت سایت */
cursor: pointer;
box-sizing: border-box; /* جلوگیری از بهم ریختگی سایز */
}
/* پسزمینه دکمه */
.click-btn::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: #f5ae51; /* رنگ پسزمینه */
border-radius: 9px;
transition: all 0.3s ease-in-out;
z-index: -1;
}
/* متن حالت عادی (Hover Me) */
.click-btn::after {
content: "کلیک کنید"; /* متن پیشفرض */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: transparent;
font-size: 16px;
font-weight: 900;
line-height: 47px; /* باید هماندازه ارتفاع دکمه باشد */
color: #ffffff;
border: none;
border-radius: 12px;
transition: all 0.3s ease-in-out;
z-index: 2;
text-align: center;
pointer-events: none;
}
/* انیمیشنهای چرخش ۳ بعدی */
.bt-1:hover ~ .click-btn {
transform: rotateX(15deg) rotateY(-15deg) rotateZ(0deg);
box-shadow: -2px -2px #18181888;
}
.bt-1:hover ~ .click-btn::after {
animation: shake 0.5s ease-in-out 0.3s;
text-shadow: -2px -2px #18181888;
}
.bt-3:hover ~ .click-btn {
transform: rotateX(15deg) rotateY(15deg) rotateZ(0deg);
box-shadow: 2px -2px #18181888;
}
.bt-3:hover ~ .click-btn::after {
animation: shake 0.5s ease-in-out 0.3s;
text-shadow: 2px -2px #18181888;
}
.bt-4:hover ~ .click-btn {
transform: rotateX(-15deg) rotateY(-15deg) rotateZ(0deg);
box-shadow: -2px 2px #18181888;
}
.bt-4:hover ~ .click-btn::after {
animation: shake 0.5s ease-in-out 0.3s;
text-shadow: -2px 2px #18181888;
}
.bt-6:hover ~ .click-btn {
transform: rotateX(-15deg) rotateY(15deg) rotateZ(0deg);
box-shadow: 2px 2px #18181888;
}
.bt-6:hover ~ .click-btn::after {
animation: shake 0.5s ease-in-out 0.3s;
text-shadow: 2px 2px #18181888;
}
/* تغییر ظاهر هنگام هاور */
.hover:hover ~ .click-btn::before {
background: transparent;
}
.hover:hover ~ .click-btn::after {
content: "مشاهده"; /* متن ثانویه هنگام هاور */
top: -150%;
transform: translate(-50%, 0);
font-size: 24px;
color: #f19c2b;
}
/* تعریف انیمیشن لرزش */
@keyframes shake {
0% { left: 45%; }
25% { left: 54%; }
50% { left: 48%; }
75% { left: 52%; }
100% { left: 50%; }
}