Pages Hard
E-commerce Shop
Mini e-commerce experience with filterable product grid, FLIP animations, cart interactions, and View Transition detail pages.
gsapfliplenisview-transitions-apiscrolltrigger
Targets: JS HTML
Code
/* ═══════════════════════════════════════════════════════════════════
E-commerce Shop — styles.css
Light-themed mini shop with product grid, detail view, and cart
═══════════════════════════════════════════════════════════════════ */
/* ── Tokens ───────────────────────────────────────────────────────── */
:root {
--page-bg: #fafaf8;
--page-surface: #ffffff;
--page-border: #e5e5e0;
--page-text: #1a1a1a;
--page-muted: #6b6b65;
--page-accent: #e85d3a;
--page-accent-dark: #c04828;
--page-accent-light: #fff0ec;
--page-cart: #2a2a2a;
--page-success: #22c55e;
--page-badge: #ef4444;
--font: 'SF Pro Display', 'Inter', system-ui, -apple-system, sans-serif;
--radius: 12px;
--radius-sm: 8px;
--radius-pill: 999px;
--header-h: 120px;
--shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
--shadow-md: 0 4px 16px rgba(0,0,0,0.08);
--shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
}
/* ── Reset ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: var(--font);
background: var(--page-bg);
color: var(--page-text);
line-height: 1.6;
overflow-x: hidden;
min-height: 100vh;
}
button {
font-family: inherit;
cursor: pointer;
border: none;
background: none;
}
a {
text-decoration: none;
color: inherit;
}
/* ── Demo Shell Overrides (light theme) ───────────────────────────── */
.demo-shell-back {
background: rgba(255, 255, 255, 0.85) !important;
border-color: rgba(0, 0, 0, 0.12) !important;
color: var(--page-accent) !important;
}
.demo-shell-info {
background: rgba(250, 250, 248, 0.95) !important;
border-top-color: rgba(0, 0, 0, 0.08) !important;
color: var(--page-muted) !important;
}
.demo-shell-info .demo-title {
color: var(--page-text) !important;
}
.demo-shell-info .demo-tag {
background: rgba(232, 93, 58, 0.1) !important;
border-color: rgba(232, 93, 58, 0.2) !important;
color: var(--page-accent) !important;
}
.motion-toggle {
background: rgba(255, 255, 255, 0.85) !important;
border-color: rgba(0, 0, 0, 0.12) !important;
color: var(--page-accent) !important;
}
/* ═══════════════════════════════════════════════════════════════════
STORE HEADER
═══════════════════════════════════════════════════════════════════ */
.store-header {
position: sticky;
top: 0;
z-index: 100;
background: rgba(250, 250, 248, 0.92);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid var(--page-border);
}
.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 1200px;
margin: 0 auto;
padding: 16px 24px;
}
.brand {
font-size: 1.5rem;
font-weight: 700;
letter-spacing: -0.03em;
color: var(--page-text);
}
/* Cart trigger */
.cart-trigger {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
border-radius: var(--radius-sm);
color: var(--page-text);
transition: background 0.2s, color 0.2s;
}
.cart-trigger:hover {
background: var(--page-accent-light);
color: var(--page-accent);
}
.cart-badge {
position: absolute;
top: 4px;
right: 2px;
min-width: 18px;
height: 18px;
border-radius: 9px;
background: var(--page-badge);
color: #fff;
font-size: 0.65rem;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
padding: 0 4px;
pointer-events: none;
opacity: 0;
transform: scale(0);
transition: opacity 0.2s, transform 0.2s;
}
.cart-badge.visible {
opacity: 1;
transform: scale(1);
}
/* Filter Nav */
.filter-nav {
display: flex;
gap: 8px;
max-width: 1200px;
margin: 0 auto;
padding: 0 24px 14px;
flex-wrap: wrap;
}
.filter-pill {
padding: 7px 18px;
border-radius: var(--radius-pill);
font-size: 0.82rem;
font-weight: 500;
color: var(--page-muted);
border: 1px solid var(--page-border);
background: var(--page-surface);
transition: all 0.25s ease;
white-space: nowrap;
}
.filter-pill:hover {
border-color: var(--page-accent);
color: var(--page-accent);
}
.filter-pill.active {
background: var(--page-accent);
border-color: var(--page-accent);
color: #fff;
}
/* ═══════════════════════════════════════════════════════════════════
HERO SECTION
═══════════════════════════════════════════════════════════════════ */
.hero-section {
max-width: 1200px;
margin: 0 auto;
padding: 56px 24px 24px;
}
.hero-headline {
font-size: clamp(2.2rem, 5vw, 3.8rem);
font-weight: 700;
letter-spacing: -0.04em;
line-height: 1.1;
color: var(--page-text);
}
.hero-headline .word {
display: inline-block;
opacity: 0;
transform: translateY(20px);
}
.hero-sub {
margin-top: 12px;
font-size: 1.05rem;
color: var(--page-muted);
font-weight: 400;
}
/* ═══════════════════════════════════════════════════════════════════
PRODUCT GRID
═══════════════════════════════════════════════════════════════════ */
.grid-section {
max-width: 1200px;
margin: 0 auto;
padding: 32px 24px 80px;
}
.product-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
}
/* ── Product Card ─────────────────────────────────────────────────── */
.product-card {
background: var(--page-surface);
border-radius: var(--radius);
border: 1px solid var(--page-border);
overflow: hidden;
display: flex;
flex-direction: column;
transition: box-shadow 0.3s ease, transform 0.3s ease;
cursor: pointer;
/* for GSAP Flip */
position: relative;
}
.product-card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-4px);
}
/* Card image area */
.card-image {
aspect-ratio: 1 / 1;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.card-image .shape-inner {
position: absolute;
width: 50%;
height: 50%;
opacity: 0.35;
}
/* Shape variations */
.shape-circle .shape-inner {
border-radius: 50%;
background: rgba(255, 255, 255, 0.5);
box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}
.shape-rounded-sq .shape-inner {
border-radius: 20%;
background: rgba(255, 255, 255, 0.45);
transform: rotate(15deg);
box-shadow: 0 0 40px rgba(255, 255, 255, 0.25);
}
.shape-abstract-a .shape-inner {
clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
background: rgba(255, 255, 255, 0.45);
}
.shape-abstract-b .shape-inner {
clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
background: rgba(255, 255, 255, 0.45);
transform: rotate(-5deg);
}
/* Product gradients */
.grad-merino { background: linear-gradient(145deg, #d4b896, #7a5c3e); }
.grad-canvas { background: linear-gradient(145deg, #8b9a6b, #2d4a2e); }
.grad-ceramic { background: linear-gradient(145deg, #f5e6d3, #c4623a); }
.grad-linen { background: linear-gradient(145deg, #9bb5cb, #2b3f5c); }
.grad-leather { background: linear-gradient(145deg, #c9a87c, #4a2c12); }
.grad-stoneware { background: linear-gradient(145deg, #a8a8a0, #3a3a38); }
.grad-organic { background: linear-gradient(145deg, #9ab896, #2a4f28); }
.grad-brass { background: linear-gradient(145deg, #d4b04a, #7a5f1e); }
.grad-runner { background: linear-gradient(145deg, #d6ccb8, #a89272); }
/* Additional inner shapes using ::after for more visual interest */
.card-image::after {
content: '';
position: absolute;
opacity: 0.12;
pointer-events: none;
}
.shape-circle::after {
width: 30%;
height: 30%;
border-radius: 50%;
border: 2px solid rgba(255,255,255,0.6);
bottom: 20%;
right: 18%;
}
.shape-rounded-sq::after {
width: 25%;
height: 25%;
border-radius: 8px;
background: rgba(255,255,255,0.4);
top: 15%;
left: 15%;
transform: rotate(-10deg);
}
.shape-abstract-a::after {
width: 20%;
height: 20%;
border-radius: 50%;
border: 2px solid rgba(255,255,255,0.5);
top: 20%;
right: 22%;
}
.shape-abstract-b::after {
width: 35%;
height: 2px;
background: rgba(255,255,255,0.5);
bottom: 30%;
left: 15%;
transform: rotate(-15deg);
}
/* Card body */
.card-body {
padding: 16px 16px 8px;
display: flex;
justify-content: space-between;
align-items: baseline;
}
.card-title {
font-size: 0.95rem;
font-weight: 600;
color: var(--page-text);
letter-spacing: -0.01em;
}
.card-price {
font-size: 0.92rem;
font-weight: 600;
color: var(--page-muted);
}
/* Add to cart button */
.btn-add {
margin: 8px 16px 16px;
padding: 10px 0;
border-radius: var(--radius-sm);
border: 1.5px solid var(--page-accent);
color: var(--page-accent);
font-size: 0.82rem;
font-weight: 600;
letter-spacing: 0.02em;
text-transform: uppercase;
transition: background 0.25s, color 0.25s;
}
.btn-add:hover {
background: var(--page-accent);
color: #fff;
}
/* ═══════════════════════════════════════════════════════════════════
PRODUCT DETAIL OVERLAY
═══════════════════════════════════════════════════════════════════ */
.detail-overlay {
position: fixed;
inset: 0;
z-index: 200;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
opacity: 0;
visibility: hidden;
transition: opacity 0.35s ease, visibility 0.35s ease;
}
.detail-overlay.open {
pointer-events: auto;
opacity: 1;
visibility: visible;
}
.detail-backdrop {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
}
.detail-panel {
position: relative;
width: 90%;
max-width: 800px;
max-height: 90vh;
overflow-y: auto;
background: var(--page-surface);
border-radius: var(--radius);
box-shadow: var(--shadow-lg);
display: grid;
grid-template-columns: 1fr 1fr;
z-index: 1;
}
.detail-close {
position: absolute;
top: 16px;
right: 16px;
z-index: 5;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: var(--page-bg);
border: 1px solid var(--page-border);
color: var(--page-text);
transition: background 0.2s, color 0.2s;
}
.detail-close:hover {
background: var(--page-accent-light);
color: var(--page-accent);
}
/* Detail image */
.detail-image {
aspect-ratio: 4 / 3;
position: relative;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--radius) 0 0 var(--radius);
overflow: hidden;
min-height: 300px;
}
.detail-image .shape-inner {
position: absolute;
width: 40%;
height: 40%;
opacity: 0.35;
}
/* Detail info */
.detail-info {
padding: 40px 32px;
display: flex;
flex-direction: column;
gap: 12px;
}
.detail-title {
font-size: 1.6rem;
font-weight: 700;
letter-spacing: -0.03em;
line-height: 1.2;
color: var(--page-text);
view-transition-name: product-title;
}
.detail-category {
font-size: 0.78rem;
text-transform: uppercase;
letter-spacing: 0.08em;
font-weight: 600;
color: var(--page-accent);
}
.detail-desc {
font-size: 0.92rem;
color: var(--page-muted);
line-height: 1.7;
}
.detail-price {
font-size: 1.4rem;
font-weight: 700;
color: var(--page-text);
margin-top: 4px;
}
/* Quantity selector */
.qty-selector {
display: flex;
align-items: center;
gap: 0;
margin-top: 8px;
width: fit-content;
border: 1px solid var(--page-border);
border-radius: var(--radius-sm);
overflow: hidden;
}
.qty-btn {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.1rem;
font-weight: 500;
color: var(--page-text);
background: var(--page-bg);
transition: background 0.2s, color 0.2s;
}
.qty-btn:hover {
background: var(--page-accent-light);
color: var(--page-accent);
}
.qty-value {
width: 44px;
text-align: center;
font-size: 0.95rem;
font-weight: 600;
color: var(--page-text);
border-left: 1px solid var(--page-border);
border-right: 1px solid var(--page-border);
line-height: 40px;
}
/* Large add button */
.btn-add-large {
margin-top: 12px;
padding: 14px 0;
border-radius: var(--radius-sm);
background: var(--page-accent);
color: #fff;
font-size: 0.88rem;
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
transition: background 0.25s;
}
.btn-add-large:hover {
background: var(--page-accent-dark);
}
/* ═══════════════════════════════════════════════════════════════════
CART SIDEBAR
═══════════════════════════════════════════════════════════════════ */
.cart-sidebar {
position: fixed;
inset: 0;
z-index: 300;
pointer-events: none;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cart-sidebar.open {
pointer-events: auto;
opacity: 1;
visibility: visible;
}
.cart-sidebar-backdrop {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.35);
}
.cart-panel {
position: absolute;
top: 0;
right: 0;
width: 380px;
height: 100%;
background: var(--page-surface);
box-shadow: -8px 0 30px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
transform: translateX(100%);
transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.cart-sidebar.open .cart-panel {
transform: translateX(0);
}
.cart-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 24px;
border-bottom: 1px solid var(--page-border);
}
.cart-heading {
font-size: 1.1rem;
font-weight: 700;
letter-spacing: -0.02em;
}
.cart-close {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
color: var(--page-text);
transition: background 0.2s;
}
.cart-close:hover {
background: var(--page-bg);
}
/* Cart items */
.cart-items {
flex: 1;
overflow-y: auto;
padding: 16px 24px;
}
.cart-empty {
color: var(--page-muted);
font-size: 0.9rem;
text-align: center;
padding-top: 40px;
}
.cart-item {
display: flex;
align-items: center;
gap: 14px;
padding: 14px 0;
border-bottom: 1px solid var(--page-border);
}
.cart-item-swatch {
width: 48px;
height: 48px;
border-radius: var(--radius-sm);
flex-shrink: 0;
}
.cart-item-details {
flex: 1;
min-width: 0;
}
.cart-item-name {
font-size: 0.85rem;
font-weight: 600;
color: var(--page-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cart-item-meta {
font-size: 0.78rem;
color: var(--page-muted);
margin-top: 2px;
}
.cart-item-price {
font-size: 0.88rem;
font-weight: 600;
color: var(--page-text);
flex-shrink: 0;
}
.cart-item-remove {
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
font-size: 0.75rem;
color: var(--page-muted);
flex-shrink: 0;
transition: background 0.2s, color 0.2s;
}
.cart-item-remove:hover {
background: rgba(239, 68, 68, 0.1);
color: var(--page-badge);
}
/* Cart footer */
.cart-footer {
padding: 20px 24px;
border-top: 1px solid var(--page-border);
}
.cart-total {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 16px;
font-size: 1rem;
font-weight: 700;
color: var(--page-text);
}
.btn-checkout {
width: 100%;
padding: 14px 0;
border-radius: var(--radius-sm);
background: var(--page-cart);
color: #fff;
font-size: 0.88rem;
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
transition: background 0.25s;
}
.btn-checkout:hover {
background: #111;
}
/* ═══════════════════════════════════════════════════════════════════
VIEW TRANSITION NAMES
═══════════════════════════════════════════════════════════════════ */
.product-card.vt-active .card-image {
view-transition-name: product-hero;
}
.product-card.vt-active .card-title {
view-transition-name: product-title;
}
.detail-overlay.open .detail-image {
view-transition-name: product-hero;
}
/* View Transition animation tuning */
::view-transition-old(product-hero),
::view-transition-new(product-hero) {
animation-duration: 0.4s;
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
::view-transition-old(product-title),
::view-transition-new(product-title) {
animation-duration: 0.35s;
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
/* ═══════════════════════════════════════════════════════════════════
REDUCED MOTION
═══════════════════════════════════════════════════════════════════ */
.reduced-motion .product-card {
opacity: 1 !important;
transform: none !important;
}
.reduced-motion .hero-headline .word {
opacity: 1 !important;
transform: none !important;
}
.reduced-motion .product-card:hover {
transform: none;
}
.reduced-motion .cart-panel {
transition: none;
}
.reduced-motion .detail-overlay {
transition: none;
}
.reduced-motion .cart-sidebar {
transition: none;
}
/* ═══════════════════════════════════════════════════════════════════
RESPONSIVE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
.product-grid {
grid-template-columns: repeat(2, 1fr);
gap: 18px;
}
}
@media (max-width: 600px) {
.product-grid {
grid-template-columns: 1fr;
gap: 16px;
}
.hero-section {
padding: 40px 16px 16px;
}
.grid-section {
padding: 24px 16px 60px;
}
.header-inner {
padding: 14px 16px;
}
.filter-nav {
padding: 0 16px 12px;
gap: 6px;
}
.filter-pill {
padding: 6px 14px;
font-size: 0.78rem;
}
/* Detail panel - stacked layout on mobile */
.detail-panel {
grid-template-columns: 1fr;
width: 95%;
max-height: 85vh;
}
.detail-image {
border-radius: var(--radius) var(--radius) 0 0;
aspect-ratio: 16 / 10;
min-height: 200px;
}
.detail-info {
padding: 24px 20px 32px;
}
/* Cart panel full width on mobile */
.cart-panel {
width: 100%;
}
}
/* ═══════════════════════════════════════════════════════════════════
ENTRANCE ANIMATION HELPERS
═══════════════════════════════════════════════════════════════════ */
.product-card {
opacity: 0;
transform: translateY(30px);
}
.product-card.in-view {
opacity: 1;
transform: translateY(0);
}E-commerce Shop
Mini e-commerce experience with filterable product grid, FLIP animations, cart interactions, and View Transition detail pages.
Source
- Repository:
libs-genclaude - Original demo id:
29-ecommerce-grid
Notes
Mini e-commerce experience with filterable product grid, FLIP animations, cart interactions, and View Transition detail pages.