پیشنمایش زنده
کد HTML
<div class="post888-mecha">
<input id="post888-toggle" class="post888-mecha__toggle" type="checkbox" />
<label
class="post888-mecha__frame"
for="post888-toggle"
aria-label="Mechanischer Button"
>
<div class="post888-mecha__arm">
<div class="post888-mecha__arm-base"></div>
<div class="post888-mecha__arm-joint"></div>
<div class="post888-mecha__arm-fore"></div>
<div class="post888-mecha__claw">
<div
class="post888-mecha__claw-finger post888-mecha__claw-finger--top"
></div>
<div
class="post888-mecha__claw-finger post888-mecha__claw-finger--bottom"
></div>
</div>
</div>
<div class="post888-mecha__button">
<div class="post888-mecha__button-face">
<span class="post888-mecha__text post888-mecha__text--on"
>ACTIVATED</span
>
<span class="post888-mecha__text post888-mecha__text--off"
>ACTIVATE</span
>
</div>
</div>
<div class="post888-mecha__led"></div>
</label>
</div>
کد CSS
.post888-mecha {
display: inline-block;
font-family: system-ui, sans-serif;
}
/* unsichtbarer Toggle */
.post888-mecha__toggle {
position: absolute;
opacity: 0;
pointer-events: none;
}
/* Rahmen / Bühne */
.post888-mecha__frame {
position: relative;
display: inline-block;
padding: 24px 28px 26px 28px;
border-radius: 18px;
background: linear-gradient(180deg, #0a0e19, #05060a);
box-shadow:
0 12px 32px rgba(0, 0, 0, 0.65),
inset 0 0 0 1px rgba(125, 249, 255, 0.08);
cursor: pointer;
user-select: none;
}
/* ---------------- BUTTON ---------------- */
.post888-mecha__button {
position: relative;
width: 210px;
height: 64px;
border-radius: 14px;
background: linear-gradient(180deg, #1b2134, #0e1324);
box-shadow:
inset 0 2px 0 rgba(255, 255, 255, 0.06),
inset 0 -8px 14px rgba(0, 0, 0, 0.9),
0 10px 0 #03040a,
0 18px 26px rgba(0, 0, 0, 0.7);
transform: translateY(0);
transition:
transform 0.18s ease,
box-shadow 0.18s ease,
filter 0.18s ease;
}
.post888-mecha__button-face {
position: absolute;
inset: 6px;
border-radius: 10px;
background: radial-gradient(
120px circle at 20% 20%,
rgba(125, 249, 255, 0.18),
transparent 50%
),
linear-gradient(180deg, #11162b, #0a0f1f);
box-shadow:
inset 0 0 0 1px rgba(125, 249, 255, 0.18),
inset 0 0 18px rgba(88, 199, 255, 0.12);
display: grid;
place-items: center;
overflow: hidden;
}
/* Textzustände */
.post888-mecha__text {
position: absolute;
font-weight: 700;
letter-spacing: 0.22em;
font-size: 0.9rem;
text-transform: uppercase;
transition:
opacity 0.2s ease,
transform 0.2s ease;
}
.post888-mecha__text--off {
opacity: 1;
transform: translateY(0);
color: #dbeafe;
text-shadow: 0 0 10px rgba(125, 249, 255, 0.35);
}
.post888-mecha__text--on {
opacity: 0;
transform: translateY(8px);
color: #a7f3d0;
text-shadow: 0 0 12px rgba(34, 197, 94, 0.55);
}
/* Hover: leichter Druck, bevor Arm greift */
.post888-mecha__frame:hover .post888-mecha__button {
filter: brightness(1.05);
}
/* ---------------- ARM ---------------- */
.post888-mecha__arm {
position: absolute;
left: -3px;
top: -2px;
width: 140px;
height: 110px;
transform-origin: 24px 24px;
transform: rotate(-17deg);
transition: transform 0.35s ease;
pointer-events: none;
}
/* Basis */
.post888-mecha__arm-base {
position: absolute;
left: 10px;
top: 14px;
width: 36px;
height: 36px;
border-radius: 10px;
background: linear-gradient(180deg, #1d2438, #0b1020);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.06),
0 6px 12px rgba(0, 0, 0, 0.6);
}
/* Gelenk */
.post888-mecha__arm-joint {
position: absolute;
left: 36px;
top: 28px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle, #9fb3d9, #1b243b);
box-shadow: 0 0 8px rgba(125, 249, 255, 0.25);
}
/* Vorderarm */
.post888-mecha__arm-fore {
position: absolute;
left: 44px;
top: 32px;
width: 62px;
height: 12px;
border-radius: 999px;
background: linear-gradient(90deg, #232b44, #0f162b);
box-shadow:
inset 0 0 0 1px rgba(125, 249, 255, 0.12),
0 4px 8px rgba(0, 0, 0, 0.6);
}
/* Klaue */
.post888-mecha__claw {
position: absolute;
left: 96px;
top: 20px;
width: 34px;
height: 34px;
transform-origin: 0 50%;
transition: transform 0.25s ease;
}
/* Finger */
.post888-mecha__claw-finger {
position: absolute;
width: 28px;
height: 8px;
border-radius: 999px;
background: linear-gradient(180deg, #2a3552, #10172c);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
transform-origin: 2px 50%;
transition: transform 0.25s ease;
}
.post888-mecha__claw-finger--top {
top: 5px;
transform: rotate(22deg);
}
.post888-mecha__claw-finger--bottom {
bottom: 4px;
transform: rotate(-20deg);
}
/* ---------------- LED ---------------- */
.post888-mecha__led {
position: absolute;
right: 14px;
top: 12px;
width: 10px;
height: 10px;
border-radius: 50%;
background: radial-gradient(circle, #334155, #0b1020);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
transition:
background 0.2s ease,
box-shadow 0.2s ease;
}
/* ---------------- INTERACTION ---------------- */
/* Hover: Arm nähert sich + Klaue öffnet */
.post888-mecha__frame:hover .post888-mecha__arm {
transform: rotate(2deg) translateX(6px);
}
.post888-mecha__frame:hover .post888-mecha__claw {
transform: translateX(6px);
}
.post888-mecha__frame:hover .post888-mecha__claw-finger--top {
transform: rotate(6deg);
}
.post888-mecha__frame:hover .post888-mecha__claw-finger--bottom {
transform: rotate(-6deg);
}
/* Toggle an: Arm greift + Button gedrückt */
.post888-mecha__toggle:checked + .post888-mecha__frame .post888-mecha__arm {
transform: rotate(10deg) translateX(12px) translateY(6px);
}
.post888-mecha__toggle:checked
+ .post888-mecha__frame
.post888-mecha__claw-finger--top {
transform: rotate(34deg);
}
.post888-mecha__toggle:checked
+ .post888-mecha__frame
.post888-mecha__claw-finger--bottom {
transform: rotate(-34deg);
}
.post888-mecha__toggle:checked + .post888-mecha__frame .post888-mecha__button {
transform: translateY(6px);
box-shadow:
inset 0 2px 0 rgba(255, 255, 255, 0.04),
inset 0 -6px 10px rgba(0, 0, 0, 0.9),
0 4px 0 #03040a,
0 10px 18px rgba(0, 0, 0, 0.8);
}
/* Text switch */
.post888-mecha__toggle:checked
+ .post888-mecha__frame
.post888-mecha__text--off {
opacity: 0;
transform: translateY(-8px);
}
.post888-mecha__toggle:checked
+ .post888-mecha__frame
.post888-mecha__text--on {
opacity: 1;
transform: translateY(0);
}
/* LED an */
.post888-mecha__toggle:checked + .post888-mecha__frame .post888-mecha__led {
background: radial-gradient(circle, #86efac, #16a34a);
box-shadow:
0 0 8px rgba(34, 197, 94, 0.9),
0 0 16px rgba(34, 197, 94, 0.55);
}
/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
.post888-mecha__button,
.post888-mecha__arm,
.post888-mecha__claw,
.post888-mecha__claw-finger,
.post888-mecha__text,
.post888-mecha__led {
transition: none;
}
}