磁力で浮くCTAボタンMagnetic CTA
/* ホバーで「浮く→光沢が横切る→矢印が押し出される」の3段。押下時だけ潰して(scale 1.03/.94)
物としての重みを出す。厚み影を同時に縮めて浮遊感を支える */
.cg-hv-magnet {
position: relative;
display: inline-flex;
align-items: center;
gap: 10px;
padding: 15px 24px;
border: 0;
border-radius: 999px;
overflow: hidden;
cursor: pointer;
color: #FFF6EE;
background: #E8590C;
font: 700 15px/1 "M PLUS 1", system-ui, sans-serif;
box-shadow: 0 6px 0 -1px rgba(120, 44, 0, .55), 0 12px 18px -10px rgba(27, 26, 23, .6);
transition:
transform .44s cubic-bezier(.34, 1.56, .64, 1),
box-shadow .44s cubic-bezier(.34, 1.56, .64, 1),
background-color .3s ease;
}
.cg-hv-magnet-label {
position: relative;
transition: transform .44s cubic-bezier(.34, 1.56, .64, 1);
}
.cg-hv-magnet-arrow {
position: relative;
display: inline-flex;
transition: transform .44s cubic-bezier(.34, 1.56, .64, 1);
}
.cg-hv-magnet-gloss {
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(104deg, transparent 34%, rgba(255, 255, 255, .5) 50%, transparent 66%);
transform: translateX(-120%);
transition: transform .62s cubic-bezier(.22, .61, .36, 1);
}
.cg-hv-magnet:is(:hover, :focus-visible) {
transform: translateY(-4px) scale(1.03);
background-color: #F4761F;
box-shadow: 0 10px 0 -1px rgba(120, 44, 0, .4), 0 22px 26px -14px rgba(27, 26, 23, .6);
}
.cg-hv-magnet:is(:hover, :focus-visible) .cg-hv-magnet-gloss { transform: translateX(120%); }
.cg-hv-magnet:is(:hover, :focus-visible) .cg-hv-magnet-label { transform: translateX(-3px); }
.cg-hv-magnet:is(:hover, :focus-visible) .cg-hv-magnet-arrow { transform: translateX(5px); }
.cg-hv-magnet:active {
transform: translateY(1px) scale(1.03, .94);
transition-duration: .12s;
}
.cg-hv-magnet:focus-visible {
outline: 3px solid #1B1A17;
outline-offset: 3px;
}
/* 静止形: 動かさず、色と矢印位置だけで押せることを伝える */
@media (prefers-reduced-motion: reduce) {
.cg-hv-magnet,
.cg-hv-magnet-label,
.cg-hv-magnet-arrow,
.cg-hv-magnet-gloss { transition: none; }
.cg-hv-magnet:is(:hover, :focus-visible, :active) {
transform: none;
box-shadow: 0 6px 0 -1px rgba(120, 44, 0, .55), 0 12px 18px -10px rgba(27, 26, 23, .6);
}
.cg-hv-magnet:is(:hover, :focus-visible) .cg-hv-magnet-gloss { transform: translateX(-120%); }
.cg-hv-magnet:is(:hover, :focus-visible) .cg-hv-magnet-label { transform: none; }
}
<button type="button" class="cg-hv-magnet">
<span class="cg-hv-magnet-gloss" aria-hidden="true"></span>
<span class="cg-hv-magnet-label">出荷を確定する</span>
<span class="cg-hv-magnet-arrow" aria-hidden="true">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h13"/><path d="M11 6l6 6-6 6"/></svg>
</span>
</button>