Files
loyalyweb/src/components/MagicBento.css

175 lines
3.8 KiB
CSS

.card-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-rows: minmax(120px, auto);
gap: clamp(10px, 1.4vw, 16px);
width: 100%;
max-width: 100%;
font-family: 'Sora', sans-serif;
}
/* Asymmetric bento layout for exactly 5 cards, desktop only */
@media (min-width: 900px) {
.card-grid > *:nth-child(1) { grid-column: 1; grid-row: 1; }
.card-grid > *:nth-child(2) { grid-column: 2; grid-row: 1; }
.card-grid > *:nth-child(3) { grid-column: 3 / span 2; grid-row: 1 / span 2; }
.card-grid > *:nth-child(4) { grid-column: 1 / span 2; grid-row: 2 / span 2; }
.card-grid > *:nth-child(5) { grid-column: 3 / span 2; grid-row: 3; }
}
.magic-bento-card {
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
min-height: 170px;
width: 100%;
max-width: 100%;
padding: clamp(22px, 2.4vw, 32px);
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.14);
background: rgba(255, 255, 255, 0.015);
font-weight: 300;
overflow: hidden;
transition: box-shadow 0.3s ease, border-color 0.3s ease;
--glow-x: 50%;
--glow-y: 50%;
--glow-intensity: 0;
--glow-radius: 200px;
}
.magic-bento-card:hover {
border-color: rgba(255, 255, 255, 0.24);
}
.magic-bento-card__header,
.magic-bento-card__content {
display: flex;
position: relative;
z-index: 2;
}
.magic-bento-card__header {
justify-content: flex-start;
}
.magic-bento-card__content {
flex-direction: column;
}
.magic-bento-card__icon {
width: 22px;
height: 22px;
display: flex;
align-items: center;
justify-content: center;
color: rgb(var(--glow-color));
}
.magic-bento-card__title {
font-weight: 700;
font-size: 1.15rem;
letter-spacing: -0.01em;
color: #ffffff;
margin: 0 0 6px;
}
.magic-bento-card__description {
font-size: 0.85rem;
line-height: 1.5;
color: rgba(255, 255, 255, 0.5);
margin: 0;
}
.magic-bento-card--text-autohide .magic-bento-card__title,
.magic-bento-card--text-autohide .magic-bento-card__description {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.magic-bento-card--text-autohide .magic-bento-card__title {
-webkit-line-clamp: 1;
line-clamp: 1;
}
.magic-bento-card--text-autohide .magic-bento-card__description {
-webkit-line-clamp: 3;
line-clamp: 3;
}
@media (max-width: 899px) {
.card-grid {
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
grid-auto-rows: auto;
}
}
@media (max-width: 480px) {
.card-grid {
grid-template-columns: 1fr;
}
}
/* Border glow effect, follows the cursor */
.magic-bento-card--border-glow::after {
content: '';
position: absolute;
inset: 0;
padding: 1.5px;
background: radial-gradient(
var(--glow-radius) circle at var(--glow-x) var(--glow-y),
rgba(var(--glow-color), calc(var(--glow-intensity) * 0.9)) 0%,
rgba(var(--glow-color), calc(var(--glow-intensity) * 0.45)) 30%,
transparent 60%
);
border-radius: inherit;
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
mask-composite: exclude;
pointer-events: none;
opacity: 1;
transition: opacity 0.3s ease;
z-index: 1;
}
.magic-bento-card--border-glow:hover {
box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(var(--glow-color), 0.25);
}
.particle-container {
position: relative;
overflow: hidden;
}
.particle::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: rgba(var(--glow-color), 0.2);
border-radius: 50%;
z-index: -1;
}
.global-spotlight {
mix-blend-mode: screen;
will-change: transform, opacity;
z-index: 200 !important;
pointer-events: none;
}
.bento-section {
position: relative;
user-select: none;
}