Build an online store for "Kova" sneakers: product grid with
A sneaker store with filters, product details, a working cart and checkout
Build an online store for "Kova" sneakers: product grid with filters (size, color, price), product page popup with size picker, working shopping cart with totals, and a checkout form. Clean, premium e-commerce designBuild this with Ergo →
Live result
Open full screen ↗How Ergo built it
Ergo made a plan first, then worked through it step by step:
- Inspect the storefront markup and JavaScript for broken controls
- Fix navigation and product-action event handling
- Verify the main shopping interactions end to end
Ergo's answer
The main links were relying on default anchor behavior, and “New arrivals” only changed sorting instead of actually showing new products. I’m replacing that with explicit navigation handlers and real Shop/New arrivals/Best sellers views, plus feedback for footer links.
I’ve added distinct collection filtering so New arrivals and Best sellers now show different product sets. I’m finishing the direct click handlers so navigation, hero CTAs, and footer actions all respond reliably even in embedded previews.
I’ll trace the navigation and button handlers, fix the broken interactions, and test the main shopping flow.
The main navigation and collection buttons are now wired. I’m cleaning up the remaining dead links (story, footer, and checkout brand) and checking modal layering so one fix doesn’t break the cart or product popup.
The main navigation is working now. I’m removing the remaining dead links and adding a small initialization safeguard so one missing element can’t disable the rest of the storefront.
I found the issue: several controls were still plain placeholder links, and the navigation handlers depended on a single script path. I’m making the buttons use explicit, guarded handlers and adding a native-link fallback so they still work if JavaScript is delayed or unavailable.
The navigation fixes are in place. I’m doing the final pass now: checking product modal → size selection → add to bag → cart quantity/totals → checkout, plus filters and mobile menu behavior.
I’m checking the exact click paths now. I found one remaining mobile-menu issue: its open handler was registered twice, so it toggled open and closed on the same tap. I’m removing the duplicate and tightening the last navigation behavior.
I’ve narrowed this down to two things: the navigation was doing more work than necessary, and the scroll method can be unreliable inside the Preview iframe. I’m switching to native scrollIntoView, making the handlers null-safe, and adding a lightweight fallback so the main navigation still responds if the full storefront script hits an error.
The controls are now wired through both the main store script and a fallback path. I’m validating the final files and checking that the fixes didn’t introduce syntax or duplicate-binding problems.
The main interactions now check out: collection navigation, product opening, size selection, add-to-bag, quantity controls, cart drawer, and checkout entry all have working handlers. I’m finishing two small convenience fixes, then I’ll mark this done.
Fixed the unresponsive buttons and navigation.
- Shop, New arrivals, Our story, hero CTAs, footer links, and mobile menu now respond correctly.
- New arrivals now filters to actual new products instead of only changing the sort order.
- Added working Best sellers and Sale collection views.
- Removed duplicate mobile-menu handling that caused it to toggle twice.
- Verified the product popup → size selection → add to bag → cart → checkout interaction path.
Reload the Preview or hard-refresh the page to ensure the updated script.js loads.
Files
index.html271 lines
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Kova — thoughtfully designed sneakers for every day in motion.">
<title>Kova — Move Your Way</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./style.css">
</head>
<body id="top">
<div class="announcement">
<p>Complimentary express shipping on orders over $150</p>
<button class="announcement-close" aria-label="Dismiss announcement">×</button>
</div>
<header class="site-header">
<a class="brand" href="#top" data-home-link aria-label="Kova home">KOVA<span>®</span></a>
<nav class="main-nav" aria-label="Main navigation">
<a href="#shop" data-collection-link="all">Shop</a>
<a href="#shop" data-collection-link="new">New arrivals</a>
<a href="#story" data-scroll-link>Our story</a>
</nav>
<div class="header-actions">
<button class="icon-button search-trigger" aria-label="Search products">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"></circle><path d="m20 20-3.5-3.5"></path></svg>
</button>
<button class="icon-button account-trigger" aria-label="Account">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"></circle><path d="M4 21c.7-4.5 3.3-7 8-7s7.3 2.5 8 7"></path></svg>
</button>
<button class="cart-trigger" aria-label="Open shopping bag">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 8h14l-1 13H6L5 8Z"></path><path d="M9 9V6a3 3 0 0 1 6 0v3"></path></svg>
<span>Bag</span><span class="cart-count">0</span>
</button>
<button class="icon-button menu-trigger" aria-label="Open menu">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"></path></svg>
</button>
</div>
</header>
<div class="search-panel" aria-hidden="true">
<div class="search-panel-inner">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"></circle><path d="m20 20-3.5-3.5"></path></svg>
<input id="product-search" type="search" placeholder="What are you looking for?" autocomplete="off">
<button class="search-close">Close</button>
</div>
</div>
<main>
<section class="hero">
<div class="hero-copy">
<div class="eyebrow"><span></span> The new Form 02 collection</div>
<h1>Your everyday,<br><em>reimagined.</em></h1>
<p>Premium materials. Considered design. Uncompromising comfort. Made for wherever the day takes you.</p>
<div class="hero-actions">
<a class="button button-dark" href="#shop" data-collection-link="all">Shop the collection <span>↗</span></a>
<a class="text-link" href="#story" data-scroll-link>Discover our story <span>→</span></a>
</div>
<div class="hero-proof">
<div class="avatar-stack" aria-hidden="true">
<span>JM</span><span>AK</span><span>SL</span>
</div>
<div><div class="stars">★★★★★</div><p>Loved by 12,000+ movers</p></div>
</div>
</div>
<div class="hero-visual">
<div class="hero-image-wrap">
<img src="https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=1400&q=90" alt="Red Kova performance sneaker" class="hero-shoe">
<div class="hero-image-shade"></div>
<div class="hero-product-tag">
<span>Just landed</span>
<strong>Form 02 — Ember</strong>
<button data-open-product="form-02">Explore the shoe <b>↗</b></button>
</div>
</div>
<div class="hero-stat"><strong>4.9</strong><span>Average rating</span></div>
<div class="hero-vertical">Designed to move · Built to last</div>
</div>
</section>
<section class="benefit-bar" aria-label="Store benefits">
<div><svg viewBox="0 0 24 24"><path d="M3 7h11v10H3zM14 10h4l3 3v4h-7z"></path><circle cx="7" cy="18" r="2"></circle><circle cx="18" cy="18" r="2"></circle></svg><span><strong>Free shipping</strong>On orders over $150</span></div>
<div><svg viewBox="0 0 24 24"><path d="M4 12a8 8 0 1 0 2-5.3L4 9"></path><path d="M4 4v5h5"></path></svg><span><strong>30-day returns</strong>Easy, no-stress returns</span></div>
<div><svg viewBox="0 0 24 24"><path d="m12 3 8 4v5c0 5-3.5 8-8 9-4.5-1-8-4-8-9V7l8-4Z"></path><path d="m8 12 3 3 5-6"></path></svg><span><strong>Secure checkout</strong>Your data stays protected</span></div>
<div><svg viewBox="0 0 24 24"><path d="M4 18v-6a8 8 0 0 1 16 0v6"></path><path d="M4 14h3v6H5a1 1 0 0 1-1-1v-5ZM20 14h-3v6h2a1 1 0 0 0 1-1v-5Z"></path></svg><span><strong>Here to help</strong>Real support, 7 days a week</span></div>
</section>
<section class="shop-section" id="shop">
<div class="section-heading">
<div><p class="eyebrow"><span></span> <span id="collection-eyebrow">Find your pair</span></p><h2 id="collection-title">The collection</h2></div>
<p>Everyday icons and fresh silhouettes.<br>Designed in-house, made for real life.</p>
</div>
<div class="shop-toolbar">
<button class="filter-toggle">Filters <span class="filter-count">0</span><svg viewBox="0 0 24 24"><path d="M4 7h16M4 12h16M4 17h16"></path></svg></button>
<p class="result-count" aria-live="polite"></p>
<div class="toolbar-right">
<button class="clear-filters">Clear all</button>
<label class="sort-control">Sort by
<select id="sort-products">
<option value="featured">Featured</option>
<option value="newest">New arrivals</option>
<option value="price-low">Price: low to high</option>
<option value="price-high">Price: high to low</option>
<option value="rating">Top rated</option>
</select>
</label>
</div>
</div>
<div class="shop-layout">
<aside class="filters" aria-label="Product filters">
<div class="filters-head"><h3>Filters</h3><button class="filters-close" aria-label="Close filters">×</button></div>
<div class="filter-group">
<button class="filter-title" aria-expanded="true">Size <span>−</span></button>
<div class="filter-content size-filter">
<button data-size="6">6</button><button data-size="7">7</button><button data-size="8">8</button>
<button data-size="9">9</button><button data-size="10">10</button><button data-size="11">11</button>
<button data-size="12">12</button><button data-size="13">13</button>
</div>
</div>
<div class="filter-group">
<button class="filter-title" aria-expanded="true">Color <span>−</span></button>
<div class="filter-content color-filter">
<button data-color="White"><i style="--swatch:#f5f4ef"></i>White</button>
<button data-color="Black"><i style="--swatch:#222222"></i>Black</button>
<button data-color="Red"><i style="--swatch:#c94b3c"></i>Red</button>
<button data-color="Blue"><i style="--swatch:#627c91"></i>Blue</button>
<button data-color="Green"><i style="--swatch:#71806a"></i>Green</button>
<button data-color="Sand"><i style="--swatch:#c7b79e"></i>Sand</button>
</div>
</div>
<div class="filter-group">
<button class="filter-title" aria-expanded="true">Price <span>−</span></button>
<div class="filter-content price-filter">
<div class="price-labels"><span>$100</span><strong id="price-value">$200</strong></div>
<input id="price-range" type="range" min="100" max="200" value="200" step="10" aria-label="Maximum price">
<p>Show styles up to <span id="price-caption">$200</span></p>
</div>
</div>
<div class="filter-note"><span>✦</span><p><strong>Not sure where to start?</strong><br>Our Form 01 is a customer favorite.</p></div>
</aside>
<div class="catalog-wrap">
<div class="active-filters" aria-live="polite"></div>
<div class="product-grid" id="product-grid"></div>
<div class="empty-state" hidden>
<div>⌕</div><h3>No shoes found</h3><p>Try removing a filter or increasing your price range.</p>
<button class="button button-dark reset-filters">Reset filters</button>
</div>
</div>
</div>
</section>
<section class="story-section" id="story">
<div class="story-image">
<img src="https://images.unsplash.com/photo-1552346154-21d32810aba3?auto=format&fit=crop&w=1200&q=85" alt="Person wearing sneakers outdoors">
<span>Kova / Field notes 001</span>
</div>
<div class="story-copy">
<p class="eyebrow"><span></span> Less, but better</p>
<h2>Made for the long way home.</h2>
<p>We believe the best things don’t shout. They fit into your life, get better with age, and quietly go the distance.</p>
<p>Every Kova pair is built around three simple ideas: honest materials, all-day comfort, and a silhouette that feels like you.</p>
<a class="text-link" href="#shop" data-collection-link="all">Find your everyday pair <span>→</span></a>
</div>
</section>
<section class="newsletter">
<div><p class="eyebrow"><span></span> Stay in the loop</p><h2>Good things, straight to your inbox.</h2></div>
<form id="newsletter-form"><label for="newsletter-email">Email address</label><div><input id="newsletter-email" type="email" placeholder="you@example.com" required><button aria-label="Subscribe">→</button></div><p>New drops, stories, and 10% off your first order.</p></form>
</section>
</main>
<footer class="site-footer">
<div class="footer-top">
<div class="footer-brand"><a class="brand" href="#top" data-home-link>KOVA<span>®</span></a><p>Considered sneakers for<br>unscripted days.</p></div>
<div><h3>Shop</h3><a href="#shop" data-collection-link="all">All sneakers</a><a href="#shop" data-collection-link="new">New arrivals</a><a href="#shop" data-collection-link="best">Best sellers</a><a href="#shop" data-collection-link="sale">Sale</a></div>
<div><h3>Help</h3><a href="#size-guide-details" data-footer-action="size">Size guide</a><a href="#story" data-footer-action="shipping">Shipping & returns</a><a href="mailto:hello@kova.example">Contact us</a><a href="#shop" data-footer-action="faq">FAQ</a></div>
<div><h3>Follow</h3><a href="#" data-social="Instagram">Instagram</a><a href="#" data-social="Pinterest">Pinterest</a><a href="#" data-social="TikTok">TikTok</a></div>
</div>
<div class="footer-bottom"><p>© 2026 Kova Footwear. All rights reserved.</p><div><a href="#" data-legal="Privacy">Privacy</a><a href="#" data-legal="Terms">Terms</a><span>USD / English</span></div></div>
</footer>
<div class="overlay" hidden></div>
<aside class="cart-drawer" aria-label="Shopping bag" aria-hidden="true">
<div class="drawer-header"><div><p class="mini-eyebrow">Your selection</p><h2>Shopping bag <span class="drawer-count">0</span></h2></div><button class="drawer-close icon-button" aria-label="Close shopping bag">×</button></div>
<div class="shipping-progress"><p id="shipping-message"></p><div><span></span></div><small>Free express shipping on orders over $150</small></div>
<div class="cart-items"></div>
<div class="cart-empty"><div class="empty-bag-icon">◇</div><h3>Your bag is taking it easy.</h3><p>Fill it with a pair worth moving in.</p><button class="button button-dark continue-shopping">Explore the collection</button></div>
<div class="cart-footer">
<div class="cart-subtotal"><span>Subtotal</span><strong id="cart-subtotal">$0.00</strong></div>
<p>Taxes and shipping calculated at checkout.</p>
<button class="button button-dark checkout-button">Checkout securely <span>→</span></button>
<button class="continue-link">Continue shopping</button>
</div>
</aside>
<div class="product-modal" role="dialog" aria-modal="true" aria-label="Product details" aria-hidden="true">
<button class="modal-close product-modal-close" aria-label="Close product details">×</button>
<div class="product-modal-content"></div>
</div>
<div class="checkout-modal" role="dialog" aria-modal="true" aria-label="Checkout" aria-hidden="true">
<div class="checkout-shell">
<div class="checkout-header"><a class="brand" href="#shop" data-home-link>KOVA<span>®</span></a><div class="secure-label"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="11" rx="2"></rect><path d="M8 10V7a4 4 0 0 1 8 0v3"></path></svg>Secure checkout</div><button class="modal-close checkout-close" aria-label="Close checkout">×</button></div>
<div class="checkout-body">
<div class="checkout-main">
<div class="checkout-steps"><span class="active">Information</span><i></i><span>Payment</span><i></i><span>Confirmation</span></div>
<form id="checkout-form" novalidate>
<section class="checkout-section">
<div class="checkout-section-title"><span>1</span><div><h2>Where should we send it?</h2><p>Enter your delivery details below.</p></div></div>
<div class="form-field full"><label for="checkout-email">Email address</label><input id="checkout-email" name="email" type="email" autocomplete="email" placeholder="you@example.com" required><small class="field-error"></small></div>
<div class="form-grid">
<div class="form-field"><label for="first-name">First name</label><input id="first-name" name="firstName" autocomplete="given-name" required><small class="field-error"></small></div>
<div class="form-field"><label for="last-name">Last name</label><input id="last-name" name="lastName" autocomplete="family-name" required><small class="field-error"></small></div>
<div class="form-field full"><label for="address">Street address</label><input id="address" name="address" autocomplete="street-address" placeholder="123 Spring Street" required><small class="field-error"></small></div>
<div class="form-field"><label for="city">City</label><input id="city" name="city" autocomplete="address-level2" required><small class="field-error"></small></div>
<div class="form-field"><label for="postal">ZIP / Postal code</label><input id="postal" name="postal" autocomplete="postal-code" required><small class="field-error"></small></div>
<div class="form-field full"><label for="country">Country</label><select id="country" name="country" autocomplete="country-name"><option>United States</option><option>Canada</option><option>United Kingdom</option><option>Australia</option><option>Germany</option><option>France</option></select></div>
</div>
</section>
<section class="checkout-section payment-section">
<div class="checkout-section-title"><span>2</span><div><h2>Payment details</h2><p>All transactions are secure and encrypted.</p></div></div>
<div class="payment-card-logos"><span>VISA</span><span>MC</span><span>AMEX</span></div>
<div class="form-grid">
<div class="form-field full"><label for="card-name">Name on card</label><input id="card-name" name="cardName" autocomplete="cc-name" required><small class="field-error"></small></div>
<div class="form-field full"><label for="card-number">Card number</label><div class="card-input"><input id="card-number" name="cardNumber" inputmode="numeric" autocomplete="cc-number" placeholder="1234 5678 9012 3456" maxlength="19" required><span>▣</span></div><small class="field-error"></small></div>
<div class="form-field"><label for="expiry">Expiry date</label><input id="expiry" name="expiry" inputmode="numeric" autocomplete="cc-exp" placeholder="MM / YY" maxlength="7" required><small class="field-error"></small></div>
<div class="form-field"><label for="cvc">Security code</label><input id="cvc" name="cvc" inputmode="numeric" autocomplete="cc-csc" placeholder="CVC" maxlength="4" required><small class="field-error"></small></div>
</div>
<label class="checkbox-label"><input type="checkbox" checked><span></span>Billing address is the same as shipping</label>
</section>
<button class="button button-dark place-order" type="submit">Place order <span id="place-order-total">$0.00</span></button>
<p class="checkout-fineprint">By placing your order, you agree to Kova’s Terms and Privacy Policy.</p>
</form>
</div>
<aside class="order-summary">
<h3>Order summary <span id="summary-count">0 items</span></h3>
<div class="summary-items"></div>
<div class="promo-form"><input id="promo-code" placeholder="Gift card or discount code" aria-label="Discount code"><button id="apply-promo">Apply</button></div>
<p class="promo-message" aria-live="polite"></p>
<div class="summary-totals">
<div><span>Subtotal</span><span id="summary-subtotal">$0.00</span></div>
<div id="discount-row" hidden><span>Discount (KOVA10)</span><span id="summary-discount">−$0.00</span></div>
<div><span>Shipping</span><span id="summary-shipping">Free</span></div>
<div><span>Estimated tax</span><span id="summary-tax">$0.00</span></div>
<div class="summary-total"><span>Total</span><strong id="summary-total">$0.00</strong></div>
</div>
<div class="summary-assurance"><span>↺</span><p><strong>Changed your mind?</strong><br>Free returns within 30 days.</p></div>
</aside>
</div>
</div>
</div>
<div class="success-modal" role="dialog" aria-modal="true" aria-label="Order confirmed" aria-hidden="true">
<div class="success-icon">✓</div><p class="mini-eyebrow">Order confirmed</p><h2>You’re all set.</h2>
<p>Thanks for choosing Kova. Your order <strong id="order-number"></strong> is being prepared and a confirmation is on its way to <span id="success-email"></span>.</p>
<div class="success-detail"><span>Estimated arrival</span><strong>3–5 business days</strong></div>
<button class="button button-dark success-close">Back to Kova</button>
</div>
<div class="toast" role="status" aria-live="polite"></div>
<div class="cart-announcer" role="status" aria-live="polite"></div>
<script src="./script.js"></script>
</body>
</html>style.css517 lines
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');
:root {
--ink: #191a17;
--muted: #72736d;
--paper: #f7f6f2;
--white: #fff;
--line: #deded7;
--soft-line: #e9e8e2;
--accent: #d95236;
--accent-dark: #b94029;
--sage: #74816c;
--serif: Georgia, 'Times New Roman', serif;
--sans: 'DM Sans', Arial, sans-serif;
--display: 'Manrope', Arial, sans-serif;
--shadow: 0 24px 80px rgba(22, 23, 19, .16);
--page-pad: clamp(22px, 4vw, 68px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.announcement {
min-height: 34px;
padding: 7px 44px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
color: #fff;
background: var(--ink);
font-size: 11px;
letter-spacing: .08em;
text-transform: uppercase;
}
.announcement p { margin: 0; }
.announcement-close { position: absolute; right: 18px; top: 4px; color: #fff; font-size: 21px; opacity: .75; }
.site-header {
height: 78px;
padding: 0 var(--page-pad);
display: flex;
align-items: center;
justify-content: space-between;
position: sticky;
top: 0;
z-index: 30;
background: rgba(247, 246, 242, .94);
border-bottom: 1px solid var(--line);
backdrop-filter: blur(14px);
}
.brand { font-family: var(--display); font-size: 28px; line-height: 1; font-weight: 800; letter-spacing: .16em; }
.brand span { display: inline-block; margin-left: 4px; vertical-align: top; font-family: var(--sans); font-size: 8px; font-weight: 500; letter-spacing: 0; }
.main-nav { display: flex; align-items: center; gap: 36px; margin-left: 70px; }
.main-nav a { position: relative; font-size: 13px; font-weight: 500; }
.main-nav a::after { content: ''; height: 1px; position: absolute; left: 0; right: 100%; bottom: -7px; background: var(--ink); transition: right .25s; }
.main-nav a:hover::after { right: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; position: relative; border-radius: 50%; transition: background .2s; }
.icon-button:hover { background: #ebeae4; }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cart-trigger { height: 40px; padding: 0 4px 0 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cart-trigger svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.cart-count, .drawer-count { min-width: 23px; height: 23px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 20px; color: #fff; background: var(--ink); font-size: 11px; }
.menu-trigger { display: none; }
.search-panel { max-height: 0; overflow: hidden; position: relative; z-index: 25; background: var(--white); border-bottom: 1px solid transparent; transition: max-height .3s, border-color .3s; }
.search-panel.open { max-height: 90px; border-color: var(--line); }
.search-panel-inner { max-width: 900px; margin: auto; padding: 23px var(--page-pad); display: flex; align-items: center; gap: 15px; }
.search-panel-inner svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.search-panel input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 19px; }
.search-close { color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.hero { min-height: 660px; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; padding: 0 var(--page-pad); gap: clamp(40px, 6vw, 100px); overflow: hidden; }
.hero-copy { max-width: 650px; padding: clamp(70px, 8vw, 120px) 0 65px; align-self: center; justify-self: end; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 10px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow > span { width: 26px; height: 1px; display: inline-block; background: var(--accent); }
.hero h1 { margin-bottom: 27px; font-family: var(--display); font-size: clamp(54px, 5.4vw, 88px); line-height: .99; letter-spacing: -.065em; font-weight: 600; }
.hero h1 em { font-family: var(--serif); font-weight: 400; letter-spacing: -.055em; }
.hero-copy > p { max-width: 480px; margin-bottom: 33px; color: var(--muted); font-size: 16px; line-height: 1.75; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; }
.button { min-height: 50px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; gap: 28px; border: 1px solid var(--ink); font-size: 12px; font-weight: 600; letter-spacing: .02em; transition: background .2s, color .2s, transform .2s; }
.button:hover { transform: translateY(-2px); }
.button-dark { color: #fff; background: var(--ink); }
.button-dark:hover { background: #34352f; }
.button span { font-size: 17px; font-weight: 400; }
.text-link { display: inline-flex; align-items: center; gap: 16px; padding-bottom: 4px; border-bottom: 1px solid #a7a79f; font-size: 12px; font-weight: 600; }
.text-link span { transition: transform .2s; }
.text-link:hover span { transform: translateX(4px); }
.hero-proof { display: flex; align-items: center; gap: 14px; margin-top: 50px; }
.avatar-stack { display: flex; }
.avatar-stack span { width: 31px; height: 31px; display: flex; align-items: center; justify-content: center; margin-left: -7px; border: 2px solid var(--paper); border-radius: 50%; color: #fff; background: #8b8172; font-size: 8px; }
.avatar-stack span:first-child { margin-left: 0; background: #ab8068; }
.avatar-stack span:nth-child(2) { background: #626f69; }
.avatar-stack span:nth-child(3) { background: #9a927e; }
.stars { height: 14px; color: var(--accent); font-size: 10px; letter-spacing: 2px; }
.hero-proof p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.hero-visual { min-width: 0; min-height: 620px; padding: 26px 0 32px; position: relative; display: flex; }
.hero-image-wrap { width: 100%; min-height: 590px; position: relative; overflow: hidden; background: #b63d2c; }
.hero-shoe { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center 52%; transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.hero-visual:hover .hero-shoe { transform: scale(1.025); }
.hero-image-shade { position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(19, 11, 8, .5)); pointer-events: none; }
.hero-product-tag { position: absolute; left: 32px; bottom: 32px; color: #fff; }
.hero-product-tag > span { display: block; margin-bottom: 8px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.hero-product-tag strong { display: block; margin-bottom: 13px; font-family: var(--display); font-size: 20px; font-weight: 500; }
.hero-product-tag button { padding: 0 0 4px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.55); font-size: 11px; }
.hero-product-tag button b { margin-left: 15px; font-weight: 400; }
.hero-stat { position: absolute; top: 67px; right: -20px; width: 105px; padding: 17px 19px; background: var(--paper); box-shadow: 0 8px 30px rgba(30,20,10,.09); }
.hero-stat strong { display: block; font-family: var(--display); font-size: 29px; letter-spacing: -.06em; }
.hero-stat span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.hero-vertical { position: absolute; right: -33px; bottom: 90px; transform: rotate(90deg); transform-origin: right top; color: var(--muted); font-size: 8px; letter-spacing: .18em; text-transform: uppercase; }
.benefit-bar { margin: 0 var(--page-pad); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.benefit-bar > div { min-height: 106px; padding: 26px clamp(14px, 2vw, 34px); display: flex; align-items: center; justify-content: center; gap: 14px; border-right: 1px solid var(--line); }
.benefit-bar > div:last-child { border-right: 0; }
.benefit-bar svg { width: 25px; height: 25px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.benefit-bar strong, .benefit-bar span { display: block; }
.benefit-bar strong { margin-bottom: 3px; font-size: 12px; font-weight: 600; }
.benefit-bar span { color: var(--muted); font-size: 10px; }
.shop-section { max-width: 1660px; margin: auto; padding: 100px var(--page-pad) 120px; scroll-margin-top: 70px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 55px; }
.section-heading .eyebrow { margin-bottom: 13px; }
.section-heading h2, .story-copy h2, .newsletter h2 { margin: 0; font-family: var(--display); font-size: clamp(35px, 3.4vw, 51px); line-height: 1.1; letter-spacing: -.05em; font-weight: 500; }
.section-heading > p { margin: 0 0 4px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.shop-toolbar { min-height: 54px; display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filter-toggle { display: none; align-items: center; gap: 8px; font-size: 12px; }
.filter-toggle svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.filter-count { min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 9px; }
.result-count { margin: 0; color: var(--muted); font-size: 11px; }
.toolbar-right { margin-left: auto; align-self: stretch; display: flex; align-items: center; gap: 24px; }
.clear-filters { display: none; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.clear-filters.visible { display: block; }
.sort-control { height: 100%; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.sort-control select { padding: 7px 24px 7px 5px; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 11px; font-weight: 600; cursor: pointer; }
.shop-layout { display: grid; grid-template-columns: 215px minmax(0, 1fr); gap: clamp(28px, 3.5vw, 58px); padding-top: 34px; }
.filters { align-self: start; position: sticky; top: 108px; }
.filters-head { display: none; }
.filter-group { padding: 4px 0 24px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.filter-title { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; font-size: 12px; font-weight: 600; }
.filter-title span { font-size: 17px; font-weight: 400; }
.size-filter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.size-filter button { height: 35px; border: 1px solid var(--line); background: transparent; font-size: 11px; transition: border-color .2s, background .2s, color .2s; }
.size-filter button:hover { border-color: var(--ink); }
.size-filter button.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.color-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; }
.color-filter button { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; text-align: left; }
.color-filter button i { width: 15px; height: 15px; display: block; border: 1px solid rgba(0,0,0,.13); border-radius: 50%; background: var(--swatch); }
.color-filter button.active { color: var(--ink); font-weight: 700; }
.color-filter button.active i { outline: 1px solid var(--ink); outline-offset: 2px; }
.price-labels { display: flex; justify-content: space-between; margin-bottom: 13px; color: var(--muted); font-size: 10px; }
.price-labels strong { color: var(--ink); font-size: 11px; }
#price-range { width: 100%; height: 2px; display: block; appearance: none; background: #cecec6; outline: none; }
#price-range::-webkit-slider-thumb { width: 15px; height: 15px; appearance: none; border: 3px solid var(--paper); border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px var(--ink); cursor: pointer; }
#price-range::-moz-range-thumb { width: 10px; height: 10px; border: 3px solid var(--paper); border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px var(--ink); cursor: pointer; }
.price-filter p { margin: 12px 0 0; color: var(--muted); font-size: 10px; }
.filter-note { padding: 16px; display: flex; gap: 10px; background: #eeece4; }
.filter-note > span { color: var(--accent); }
.filter-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.filter-note strong { color: var(--ink); font-weight: 600; }
.catalog-wrap { min-width: 0; }
.active-filters { display: none; flex-wrap: wrap; gap: 7px; margin: -10px 0 22px; }
.active-filters.visible { display: flex; }
.active-filter { padding: 6px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; font-size: 10px; }
.active-filter button { color: var(--muted); font-size: 14px; line-height: 1; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 42px 18px; }
.product-card { min-width: 0; }
.product-media { aspect-ratio: .88; position: relative; overflow: hidden; background: #e8e7e1; cursor: pointer; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.65,.25,1), opacity .35s; }
.product-card:hover .product-media img { transform: scale(1.035); }
.product-badge { position: absolute; top: 12px; left: 12px; padding: 5px 8px; color: var(--ink); background: rgba(247,246,242,.94); font-size: 8px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.product-badge.sale { color: #fff; background: var(--accent); }
.wishlist { width: 31px; height: 31px; display: flex; align-items: center; justify-content: center; position: absolute; top: 10px; right: 10px; border-radius: 50%; background: rgba(255,255,255,.88); transition: transform .2s, color .2s; }
.wishlist:hover { transform: scale(1.08); }
.wishlist svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.wishlist.active { color: var(--accent); }
.wishlist.active svg { fill: currentColor; }
.quick-add { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 42px; color: #fff; background: rgba(25,26,23,.94); font-size: 11px; font-weight: 600; transform: translateY(58px); transition: transform .25s, background .2s; }
.product-media:hover .quick-add, .quick-add:focus-visible { transform: translateY(0); }
.quick-add:hover { background: var(--accent); }
.product-info { padding: 14px 2px 0; }
.product-info-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product-info h3 { margin: 0 0 4px; font-family: var(--display); font-size: 13px; font-weight: 700; cursor: pointer; }
.product-info h3:hover { text-decoration: underline; text-underline-offset: 3px; }
.product-price { white-space: nowrap; font-size: 12px; font-weight: 600; }
.product-price del { margin-right: 5px; color: #999; font-weight: 400; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-meta > span { color: var(--muted); font-size: 10px; }
.product-colors { display: flex; gap: 5px; }
.product-colors i { width: 8px; height: 8px; display: block; border: 1px solid rgba(0,0,0,.15); border-radius: 50%; background: var(--swatch); }
.empty-state { padding: 80px 20px; text-align: center; border: 1px solid var(--line); }
.empty-state > div { font-size: 45px; font-weight: 300; }
.empty-state h3 { margin: 10px 0; font-family: var(--display); font-size: 23px; }
.empty-state p { color: var(--muted); font-size: 12px; }
.empty-state .button { margin-top: 12px; }
.story-section { display: grid; grid-template-columns: 1.08fr 1fr; background: #e8e5dc; }
.story-image { min-height: 590px; position: relative; overflow: hidden; }
.story-image img { width: 100%; height: 100%; position: absolute; object-fit: cover; }
.story-image > span { position: absolute; left: 24px; bottom: 22px; padding: 6px 9px; color: #fff; background: rgba(20,20,20,.45); backdrop-filter: blur(7px); font-size: 8px; letter-spacing: .13em; text-transform: uppercase; }
.story-copy { max-width: 610px; padding: clamp(65px, 8vw, 120px) clamp(40px, 7vw, 110px); align-self: center; }
.story-copy h2 { margin-bottom: 28px; }
.story-copy > p:not(.eyebrow) { color: #696a63; font-size: 14px; line-height: 1.85; }
.story-copy .text-link { margin-top: 17px; }
.newsletter { max-width: 1660px; margin: auto; padding: 80px var(--page-pad); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 60px; }
.newsletter .eyebrow { margin-bottom: 12px; }
.newsletter h2 { font-size: clamp(29px, 2.7vw, 40px); }
.newsletter form { max-width: 480px; width: 100%; justify-self: end; }
.newsletter label { display: block; margin-bottom: 9px; font-size: 10px; font-weight: 600; }
.newsletter form > div { display: flex; border-bottom: 1px solid var(--ink); }
.newsletter input { flex: 1; min-width: 0; padding: 12px 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.newsletter button { width: 45px; font-size: 22px; }
.newsletter form > p { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.site-footer { padding: 65px var(--page-pad) 24px; color: #e9e8e2; background: #1b1c19; }
.footer-top { max-width: 1500px; margin: auto; display: grid; grid-template-columns: 2.2fr repeat(3, 1fr); gap: 40px; padding-bottom: 60px; }
.footer-brand p { margin: 19px 0 0; color: #91928b; font-size: 12px; line-height: 1.8; }
.footer-top h3 { margin: 5px 0 18px; color: #85867f; font-size: 9px; letter-spacing: .15em; text-transform: uppercase; }
.footer-top > div:not(.footer-brand) { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.footer-top > div:not(.footer-brand) a { color: #c5c5be; font-size: 11px; }
.footer-top a:hover { color: #fff; }
.footer-bottom { max-width: 1500px; margin: auto; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid #353630; color: #777970; font-size: 9px; }
.footer-bottom p { margin: 0; }
.footer-bottom div { display: flex; gap: 24px; }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15,16,14,.48); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.overlay.visible { opacity: 1; }
.cart-drawer { width: min(460px, 100%); height: 100dvh; display: flex; flex-direction: column; position: fixed; top: 0; right: 0; z-index: 70; background: var(--paper); box-shadow: var(--shadow); transform: translateX(102%); transition: transform .35s cubic-bezier(.25,.75,.25,1); }
.cart-drawer.open { transform: translateX(0); }
.drawer-header { min-height: 92px; padding: 22px 25px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.mini-eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.drawer-header h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--display); font-size: 21px; font-weight: 600; letter-spacing: -.03em; }
.drawer-count { color: var(--ink); background: #e5e3da; }
.drawer-close { font-size: 28px; font-weight: 300; }
.shipping-progress { padding: 17px 25px; border-bottom: 1px solid var(--line); }
.shipping-progress p { margin: 0 0 9px; font-size: 10px; }
.shipping-progress > div { height: 3px; overflow: hidden; background: #deddd5; }
.shipping-progress > div span { width: 0; height: 100%; display: block; background: var(--sage); transition: width .35s; }
.shipping-progress small { display: block; margin-top: 7px; color: var(--muted); font-size: 8px; }
.cart-items { flex: 1; overflow-y: auto; padding: 5px 25px; overscroll-behavior: contain; }
.cart-item { display: grid; grid-template-columns: 91px 1fr; gap: 15px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.cart-item-image { width: 91px; height: 108px; overflow: hidden; background: #e7e6e0; cursor: pointer; }
.cart-item-image img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { min-width: 0; }
.cart-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cart-item-head h3 { margin: 0; font-family: var(--display); font-size: 12px; }
.cart-item-head strong { font-size: 11px; }
.cart-item-variant { margin: 4px 0 13px; color: var(--muted); font-size: 9px; }
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; }
.quantity-control { height: 29px; display: inline-flex; align-items: center; border: 1px solid var(--line); }
.quantity-control button { width: 28px; height: 100%; font-size: 15px; }
.quantity-control span { min-width: 20px; text-align: center; font-size: 10px; }
.remove-item { color: var(--muted); font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }
.remove-item:hover { color: var(--accent); }
.cart-empty { display: none; flex: 1; padding: 70px 35px; text-align: center; }
.cart-empty.visible { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.empty-bag-icon { width: 66px; height: 66px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 50%; font-size: 30px; font-weight: 300; }
.cart-empty h3 { margin-bottom: 8px; font-family: var(--display); font-size: 20px; }
.cart-empty p { margin-bottom: 24px; color: var(--muted); font-size: 11px; }
.cart-footer { padding: 20px 25px 24px; border-top: 1px solid var(--line); background: #fff; }
.cart-subtotal { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.cart-subtotal span { font-size: 12px; font-weight: 600; }
.cart-subtotal strong { font-family: var(--display); font-size: 19px; }
.cart-footer > p { margin-bottom: 16px; color: var(--muted); font-size: 9px; }
.checkout-button { width: 100%; }
.continue-link { width: 100%; margin-top: 11px; color: var(--muted); font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }
.product-modal { width: min(1050px, calc(100vw - 44px)); max-height: min(760px, calc(100dvh - 44px)); position: fixed; top: 50%; left: 50%; z-index: 80; overflow: auto; background: var(--paper); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, -47%); pointer-events: none; transition: opacity .25s, transform .3s; }
.product-modal.open { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.modal-close { width: 37px; height: 37px; display: flex; align-items: center; justify-content: center; position: absolute; top: 15px; right: 15px; z-index: 3; border-radius: 50%; background: rgba(247,246,242,.92); font-size: 25px; font-weight: 300; }
.product-modal-layout { display: grid; grid-template-columns: 1.08fr 1fr; min-height: 630px; }
.product-gallery { min-height: 630px; position: relative; overflow: hidden; background: #e6e4dd; }
.product-gallery > img { width: 100%; height: 100%; position: absolute; object-fit: cover; }
.product-gallery-badge { position: absolute; left: 20px; top: 20px; padding: 6px 9px; background: var(--paper); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
.product-details { padding: 55px 43px 35px; }
.product-details .mini-eyebrow { margin-bottom: 12px; color: var(--accent); }
.product-details h2 { margin: 0 0 7px; font-family: var(--display); font-size: 31px; line-height: 1.15; letter-spacing: -.045em; }
.product-modal-price { margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.product-modal-price del { margin-left: 7px; color: #999; font-size: 12px; font-weight: 400; }
.rating-line { display: flex; align-items: center; gap: 8px; margin-bottom: 21px; font-size: 10px; }
.rating-line .stars { height: auto; }
.rating-line span:last-child { color: var(--muted); }
.product-description { margin-bottom: 22px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.option-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 10px; font-weight: 600; }
.option-heading button { color: var(--muted); font-size: 9px; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.modal-color-name { margin-bottom: 20px; color: var(--muted); font-size: 10px; }
.modal-color-name strong { color: var(--ink); font-weight: 500; }
.modal-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 8px; }
.modal-sizes button { height: 40px; border: 1px solid var(--line); font-size: 11px; }
.modal-sizes button:hover:not(:disabled) { border-color: var(--ink); }
.modal-sizes button.active { color: #fff; border-color: var(--ink); background: var(--ink); }
.modal-sizes button:disabled { color: #bbb; background: #ecebe6; cursor: not-allowed; text-decoration: line-through; }
.size-error { min-height: 18px; margin: 0 0 8px; color: var(--accent); font-size: 9px; }
.modal-add { width: 100%; height: 52px; }
.modal-add:disabled { opacity: .55; cursor: wait; transform: none; }
.product-perks { margin: 18px 0 21px; display: flex; justify-content: center; gap: 20px; color: var(--muted); font-size: 8px; }
.product-perks span { display: flex; align-items: center; gap: 5px; }
.product-accordion { border-top: 1px solid var(--line); }
.product-accordion details { border-bottom: 1px solid var(--line); }
.product-accordion summary { padding: 14px 0; display: flex; justify-content: space-between; cursor: pointer; list-style: none; font-size: 10px; font-weight: 600; }
.product-accordion summary::-webkit-details-marker { display: none; }
.product-accordion summary::after { content: '+'; font-size: 15px; font-weight: 400; }
.product-accordion details[open] summary::after { content: '−'; }
.product-accordion details p { padding: 0 12px 14px 0; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.size-guide { margin-top: 12px; padding: 16px; background: #ebe9e1; }
.size-guide h4 { margin: 0 0 10px; font-size: 11px; }
.size-guide table { width: 100%; border-collapse: collapse; font-size: 9px; text-align: center; }
.size-guide th, .size-guide td { padding: 6px; border-bottom: 1px solid #d5d2c8; }
.checkout-modal { width: 100%; height: 100dvh; position: fixed; inset: 0; z-index: 100; overflow-y: auto; background: var(--paper); opacity: 0; pointer-events: none; transform: translateY(18px); transition: opacity .25s, transform .3s; }
.checkout-modal.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.checkout-header { height: 78px; padding: 0 max(var(--page-pad), calc((100vw - 1240px)/2)); display: flex; align-items: center; border-bottom: 1px solid var(--line); background: #fff; }
.checkout-header .brand { font-size: 23px; }
.secure-label { margin-left: auto; margin-right: 36px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.secure-label svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.checkout-close { position: static; flex: 0 0 auto; background: transparent; }
.checkout-body { max-width: 1240px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: clamp(45px, 7vw, 95px); padding: 48px var(--page-pad) 80px; }
.checkout-main { max-width: 660px; width: 100%; justify-self: end; }
.checkout-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 42px; color: #aaa; font-size: 9px; }
.checkout-steps .active { color: var(--ink); font-weight: 700; }
.checkout-steps i { width: 27px; height: 1px; background: var(--line); }
.checkout-section { margin-bottom: 37px; }
.checkout-section-title { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 23px; }
.checkout-section-title > span { width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 50%; font-size: 10px; }
.checkout-section-title h2 { margin: 1px 0 3px; font-family: var(--display); font-size: 19px; letter-spacing: -.025em; }
.checkout-section-title p { margin: 0; color: var(--muted); font-size: 10px; }
.payment-card-logos { display: flex; gap: 5px; margin: -5px 0 19px 38px; }
.payment-card-logos span { padding: 3px 6px; border: 1px solid var(--line); border-radius: 2px; background: #fff; font-size: 7px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 13px; }
.form-field { min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { display: block; margin-bottom: 6px; font-size: 9px; font-weight: 600; }
.form-field input, .form-field select { width: 100%; height: 45px; padding: 0 12px; color: var(--ink); border: 1px solid #d7d6ce; border-radius: 0; outline: 0; background: #fff; font-size: 11px; transition: border-color .2s, box-shadow .2s; }
.form-field input:focus, .form-field select:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.form-field input.invalid { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.form-field input::placeholder { color: #aaa; }
.field-error { min-height: 0; display: block; padding-top: 3px; color: var(--accent); font-size: 8px; }
.card-input { position: relative; }
.card-input input { padding-right: 38px; }
.card-input > span { position: absolute; right: 12px; top: 11px; color: #888; font-size: 18px; }
.checkbox-label { margin-top: 19px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; cursor: pointer; }
.checkbox-label input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-label > span { width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; border: 1px solid #aaa; background: #fff; }
.checkbox-label input:checked + span { border-color: var(--ink); background: var(--ink); }
.checkbox-label input:checked + span::after { content: '✓'; color: #fff; font-size: 9px; }
.place-order { width: 100%; justify-content: space-between; height: 55px; padding: 0 20px; }
.place-order span { font-size: 12px; }
.place-order:disabled { opacity: .65; cursor: wait; transform: none; }
.checkout-fineprint { margin: 10px 0 0; color: var(--muted); font-size: 8px; text-align: center; }
.order-summary { padding: 28px; align-self: start; position: sticky; top: 25px; background: #eeede7; }
.order-summary > h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; font-family: var(--display); font-size: 15px; }
.order-summary > h3 span { color: var(--muted); font-family: var(--sans); font-size: 9px; font-weight: 400; }
.summary-items { max-height: 260px; overflow-y: auto; }
.summary-item { display: grid; grid-template-columns: 55px 1fr auto; align-items: center; gap: 11px; margin-bottom: 13px; }
.summary-item-image { width: 55px; height: 62px; position: relative; background: #ddd; }
.summary-item-image img { width: 100%; height: 100%; object-fit: cover; }
.summary-item-image > span { min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; position: absolute; top: -6px; right: -6px; border-radius: 50%; color: #fff; background: var(--ink); font-size: 8px; }
.summary-item h4 { margin: 0 0 3px; font-size: 10px; }
.summary-item p { margin: 0; color: var(--muted); font-size: 8px; }
.summary-item > strong { font-size: 9px; }
.promo-form { margin-top: 20px; display: flex; gap: 7px; }
.promo-form input { min-width: 0; flex: 1; height: 38px; padding: 0 10px; border: 1px solid #d4d2c9; outline: 0; background: transparent; font-size: 9px; }
.promo-form button { padding: 0 13px; color: #fff; background: var(--ink); font-size: 9px; }
.promo-message { min-height: 14px; margin: 5px 0 0; color: var(--sage); font-size: 8px; }
.summary-totals { padding-top: 15px; border-top: 1px solid #d4d2ca; }
.summary-totals > div { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 10px; }
.summary-totals .summary-total { margin: 18px 0 0; padding-top: 16px; color: var(--ink); border-top: 1px solid #d4d2ca; font-size: 12px; }
.summary-total strong { font-family: var(--display); font-size: 19px; letter-spacing: -.03em; }
#discount-row { color: var(--sage); }
.summary-assurance { margin-top: 22px; padding-top: 17px; display: flex; gap: 10px; border-top: 1px solid #d4d2ca; }
.summary-assurance > span { font-size: 20px; }
.summary-assurance p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.7; }
.summary-assurance strong { color: var(--ink); font-weight: 600; }
.success-modal { width: min(500px, calc(100vw - 36px)); padding: 47px; position: fixed; top: 50%; left: 50%; z-index: 110; background: var(--paper); box-shadow: var(--shadow); text-align: center; opacity: 0; transform: translate(-50%, -46%); pointer-events: none; transition: opacity .3s, transform .3s; }
.success-modal.open { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.success-icon { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; border-radius: 50%; color: #fff; background: var(--sage); font-size: 25px; }
.success-modal h2 { margin: 5px 0 15px; font-family: var(--display); font-size: 35px; letter-spacing: -.05em; }
.success-modal > p:not(.mini-eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.8; }
.success-modal > p strong { color: var(--ink); }
.success-detail { margin: 24px 0; padding: 17px; display: flex; justify-content: space-between; background: #ebe9e1; font-size: 10px; }
.success-detail span { color: var(--muted); }
.success-detail strong { font-size: 10px; }
.toast { max-width: calc(100vw - 32px); padding: 13px 19px; position: fixed; left: 50%; bottom: 25px; z-index: 150; color: #fff; background: var(--ink); box-shadow: 0 8px 30px rgba(0,0,0,.2); font-size: 11px; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1550px) {
.product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
.main-nav { margin-left: 20px; gap: 24px; }
.hero { gap: 35px; }
.hero-copy { padding-left: 10px; }
.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-stat { right: 12px; }
.hero-vertical { display: none; }
.checkout-body { grid-template-columns: minmax(0, 1fr) 355px; gap: 40px; }
}
@media (max-width: 900px) {
.site-header { height: 68px; }
.main-nav { display: none; }
.menu-trigger { display: inline-flex; }
.main-nav.mobile-open { position: absolute; top: 68px; left: 0; right: 0; margin: 0; padding: 25px var(--page-pad); display: flex; flex-direction: column; align-items: flex-start; gap: 21px; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 12px 20px rgba(0,0,0,.05); }
.hero { min-height: auto; grid-template-columns: 1fr; padding-top: 60px; gap: 20px; }
.hero-copy { max-width: 680px; padding: 20px 0 20px; justify-self: start; }
.hero h1 { font-size: clamp(56px, 10vw, 80px); }
.hero-visual { min-height: 570px; padding: 0 0 25px; }
.hero-image-wrap { min-height: 550px; }
.benefit-bar { grid-template-columns: 1fr 1fr; }
.benefit-bar > div { justify-content: flex-start; border-bottom: 1px solid var(--line); }
.benefit-bar > div:nth-child(2) { border-right: 0; }
.benefit-bar > div:nth-child(3), .benefit-bar > div:nth-child(4) { border-bottom: 0; }
.filter-toggle { display: flex; }
.shop-layout { display: block; }
.filters { width: min(340px, calc(100vw - 40px)); height: 100dvh; padding: 25px; position: fixed; top: 0; left: 0; z-index: 75; overflow-y: auto; background: var(--paper); transform: translateX(-105%); transition: transform .3s; }
.filters.open { transform: translateX(0); }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.filters-head h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.filters-close { font-size: 28px; font-weight: 300; }
.story-section { grid-template-columns: 1fr; }
.story-image { min-height: 500px; }
.story-copy { max-width: none; }
.newsletter { grid-template-columns: 1fr; gap: 35px; }
.newsletter form { justify-self: start; }
.checkout-body { grid-template-columns: 1fr; }
.checkout-main { max-width: none; justify-self: stretch; }
.order-summary { grid-row: 1; position: static; }
.product-modal-layout { grid-template-columns: 1fr; }
.product-gallery { min-height: 480px; }
.product-details { padding: 38px; }
}
@media (max-width: 600px) {
:root { --page-pad: 19px; }
.announcement { padding-right: 35px; font-size: 8px; }
.site-header { padding-right: 10px; }
.brand { font-size: 24px; }
.account-trigger { display: none; }
.header-actions { gap: 1px; }
.cart-trigger { gap: 5px; padding-left: 7px; }
.hero { padding-top: 42px; }
.hero-copy { padding-top: 0; }
.hero h1 { margin-bottom: 22px; font-size: clamp(48px, 14vw, 64px); }
.hero-copy > p { font-size: 13px; }
.hero-actions { gap: 20px; }
.button { padding: 0 18px; gap: 17px; }
.hero-proof { margin-top: 36px; }
.hero-visual, .hero-image-wrap { min-height: 440px; }
.hero-product-tag { left: 21px; bottom: 23px; }
.hero-stat { top: 15px; right: 12px; width: 90px; padding: 13px; }
.hero-stat strong { font-size: 24px; }
.benefit-bar { margin: 0 19px; }
.benefit-bar > div { min-height: 94px; padding: 19px 10px; gap: 9px; }
.benefit-bar strong { font-size: 10px; }
.benefit-bar span { font-size: 8px; }
.benefit-bar svg { width: 21px; }
.shop-section { padding-top: 70px; padding-bottom: 75px; }
.section-heading { align-items: flex-start; margin-bottom: 35px; }
.section-heading > p { display: none; }
.section-heading h2 { font-size: 36px; }
.shop-toolbar { gap: 10px; }
.result-count { margin-left: auto; }
.toolbar-right { margin-left: 0; }
.sort-control { gap: 2px; }
.sort-control > span, .sort-control { font-size: 0; }
.sort-control select { max-width: 116px; font-size: 9px; }
.clear-filters { display: none; }
.product-grid { gap: 30px 10px; }
.product-media { aspect-ratio: .82; }
.product-info { padding-top: 10px; }
.product-info-top { display: block; }
.product-info h3 { font-size: 11px; }
.product-price { margin-bottom: 4px; font-size: 10px; }
.product-meta > span { font-size: 8px; }
.product-colors i { width: 6px; height: 6px; }
.quick-add { display: none; }
.product-badge { top: 8px; left: 8px; padding: 4px 6px; font-size: 6px; }
.wishlist { top: 6px; right: 6px; width: 28px; height: 28px; }
.story-image { min-height: 390px; }
.story-copy { padding: 62px 25px; }
.story-copy > p:not(.eyebrow) { font-size: 12px; }
.newsletter { padding-top: 60px; padding-bottom: 60px; }
.newsletter h2 { font-size: 29px; }
.site-footer { padding-top: 48px; }
.footer-top { grid-template-columns: 1.4fr 1fr 1fr; gap: 35px 20px; }
.footer-brand { grid-column: 1 / -1; }
.footer-bottom { align-items: flex-start; }
.footer-bottom div { gap: 12px; }
.fo
…script.js901 lines
(() => {
'use strict';
const products = [
{
id: 'form-01', name: 'Form 01', subtitle: 'Everyday low-top', price: 140,
color: 'White', colorHex: '#efeee8', category: 'Core collection', badge: 'Best seller',
rating: 4.9, reviews: 328, sizes: [6, 7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1549298916-b41d501d3772?auto=format&fit=crop&w=900&q=85',
description: 'Our original everyday silhouette, refined. The Form 01 pairs a soft, breathable upper with responsive cushioning and a clean profile that works with everything you own.',
details: 'Full-grain leather and recycled mesh upper. Natural rubber outsole. Removable cushioned insole. 100% recycled laces.'
},
{
id: 'form-02', name: 'Form 02', subtitle: 'Sculpted everyday sneaker', price: 165,
color: 'Red', colorHex: '#c94d38', category: 'New collection', badge: 'Just landed',
rating: 4.8, reviews: 84, sizes: [6, 7, 8, 9, 10, 11, 12, 13],
image: 'https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=900&q=85',
description: 'A bolder expression of our design language. Form 02 combines sculpted lines, soft structure, and energetic color for a pair that feels as good as it looks.',
details: 'Premium suede and engineered knit upper. Dual-density foam midsole. Natural rubber outsole. Padded recycled lining.'
},
{
id: 'drift-01', name: 'Drift 01', subtitle: 'Lightweight knit runner', price: 130,
color: 'Blue', colorHex: '#6e8799', category: 'Movement collection', badge: 'New',
rating: 4.7, reviews: 116, sizes: [7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1600269452121-4f2416e55c28?auto=format&fit=crop&w=900&q=85',
description: 'Made for light days and long walks. Drift 01 uses a flexible knit upper and cloud-soft sole to keep every step feeling effortless.',
details: 'Breathable engineered knit upper. Lightweight EVA cushioning. Flexible rubber pods. Weight: 245g in size 9.'
},
{
id: 'court-low', name: 'Court Low', subtitle: 'Classic leather court shoe', price: 120,
color: 'White', colorHex: '#efeee8', category: 'Core collection', badge: '',
rating: 4.8, reviews: 201, sizes: [6, 7, 8, 9, 10, 11], oldPrice: 150,
image: 'https://images.unsplash.com/photo-1525966222134-fcfa99b8ae77?auto=format&fit=crop&w=900&q=85',
description: 'A pared-back court classic with just the right amount of attitude. Easy to style, easy to wear, and made to get better with time.',
details: 'Soft full-grain leather upper. Tonal cupsole. Cushioned footbed. Durable natural rubber outsole.'
},
{
id: 'roam-02', name: 'Roam 02', subtitle: 'All-terrain high-top', price: 175,
color: 'Black', colorHex: '#252525', category: 'Movement collection', badge: 'New color',
rating: 4.9, reviews: 67, sizes: [7, 8, 9, 10, 11, 12, 13],
image: 'https://images.unsplash.com/photo-1608231387042-66d1773070a5?auto=format&fit=crop&w=900&q=85',
description: 'Built for city streets and weekend detours. Roam 02 offers extra support, rugged traction, and a versatile mid-top silhouette.',
details: 'Water-resistant woven upper. Supportive padded collar. High-traction rubber outsole. Recycled OrthoLite insole.'
},
{
id: 'form-01-noir', name: 'Form 01 Noir', subtitle: 'Everyday low-top', price: 145,
color: 'Black', colorHex: '#252525', category: 'Core collection', badge: '',
rating: 4.9, reviews: 189, sizes: [6, 7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1595950653106-6c9ebd614d3a?auto=format&fit=crop&w=900&q=85',
description: 'Our most versatile Form, now in deep noir. A quietly refined everyday pair with soft cushioning and an understated finish.',
details: 'Premium leather and mesh upper. Responsive foam midsole. Natural rubber outsole. Removable cushioned insole.'
},
{
id: 'daybreak', name: 'Daybreak', subtitle: 'Soft-step slip-on', price: 110,
color: 'Sand', colorHex: '#c8b89f', category: 'Core collection', badge: '',
rating: 4.6, reviews: 94, sizes: [6, 7, 8, 9, 10, 11], oldPrice: 135,
image: 'https://images.unsplash.com/photo-1491553895911-0055eca6402d?auto=format&fit=crop&w=900&q=85',
description: 'The pair you reach for without thinking. Daybreak is soft, light, and endlessly easy—made for slow mornings and spontaneous plans.',
details: 'Soft canvas upper. Elastic side panels. Flexible EVA sole. Washable recycled-fiber insole.'
},
{
id: 'tempo', name: 'Tempo', subtitle: 'Retro running silhouette', price: 155,
color: 'Red', colorHex: '#bb4b3c', category: 'Movement collection', badge: 'Limited',
rating: 4.8, reviews: 142, sizes: [7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1539185441755-769473a23570?auto=format&fit=crop&w=900&q=85',
description: 'A nod to heritage running design, rebuilt for today. Tempo brings together layered texture, plush comfort, and just enough retro energy.',
details: 'Suede and nylon upper. Dual-density cushioned midsole. Hard-wearing rubber outsole. Vintage-inspired heel tab.'
},
{
id: 'field-01', name: 'Field 01', subtitle: 'Premium trail-inspired sneaker', price: 180,
color: 'Green', colorHex: '#74806a', category: 'New collection', badge: 'New',
rating: 4.7, reviews: 53, sizes: [7, 8, 9, 10, 11, 12, 13],
image: 'https://images.unsplash.com/photo-1600185365483-26d7a4cc7519?auto=format&fit=crop&w=900&q=85',
description: 'Inspired by time outdoors, designed for daily miles. Field 01 balances durable materials with a soft ride and a grounded, earthy palette.',
details: 'Durable ripstop and suede upper. Deep-lugged rubber outsole. Protective toe bumper. Responsive foam midsole.'
},
{
id: 'studio', name: 'Studio', subtitle: 'Minimalist high-top', price: 150,
color: 'Blue', colorHex: '#61788b', category: 'New collection', badge: '',
rating: 4.7, reviews: 78, sizes: [6, 7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1606107557195-0e29a4b5b4aa?auto=format&fit=crop&w=900&q=85',
description: 'Clean lines meet easy comfort. Studio is a modern high-top with a flexible feel, designed to anchor everything from denim to relaxed tailoring.',
details: 'Soft woven upper. Padded high-top collar. Flexible cupsole. Recycled cotton laces and lining.'
},
{
id: 'cloud-01', name: 'Cloud 01', subtitle: 'Cushioned lifestyle runner', price: 160,
color: 'White', colorHex: '#f3f1e9', category: 'Movement collection', badge: 'Best seller',
rating: 4.9, reviews: 257, sizes: [6, 7, 8, 9, 10, 11, 12, 13],
image: 'https://images.unsplash.com/photo-1605348532760-6753d2c43329?auto=format&fit=crop&w=900&q=85',
description: 'Our softest ride yet. Cloud 01 wraps your foot in breathable comfort and pairs it with a generous sole built for all-day movement.',
details: 'Breathable engineered mesh. Triple-density foam cushioning. Rocker-inspired sole geometry. Natural rubber outsole.'
},
{
id: 'dune', name: 'Dune', subtitle: 'Suede everyday sneaker', price: 135,
color: 'Sand', colorHex: '#bbaa8d', category: 'Core collection', badge: '',
rating: 4.6, reviews: 89, sizes: [6, 7, 8, 9, 10, 11, 12],
image: 'https://images.unsplash.com/photo-1543508282-6319a3e2621f?auto=format&fit=crop&w=900&q=85',
description: 'Warm, tactile, and easy to wear. Dune combines rich suede with a flexible sole for an everyday shoe that only gets better with age.',
details: 'Responsibly sourced suede upper. Soft canvas lining. Flexible natural rubber sole. Recycled laces.'
}
];
const $ = (selector, root = document) => root.querySelector(selector);
const $$ = (selector, root = document) => [...root.querySelectorAll(selector)];
const money = value => new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(value);
const escapeHTML = value => String(value).replace(/[&<>"']/g, character => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[character]);
const getProduct = id => products.find(product => product.id === id);
const state = {
sizes: new Set(), colors: new Set(), maxPrice: 200, sort: 'featured', search: '', collection: 'all',
cart: [], wishlist: new Set(), discount: false, activeProduct: null, activeSize: null
};
try {
const savedCart = JSON.parse(localStorage.getItem('kova-cart') || '[]');
if (Array.isArray(savedCart)) {
state.cart = savedCart.filter(item => item && getProduct(item.id) && Number.isFinite(item.qty) && item.qty > 0).map(item => ({
id: item.id, size: Number(item.size), qty: Math.min(8, Math.max(1, Number(item.qty)))
})).filter(item => getProduct(item.id).sizes.includes(item.size));
}
const savedWishlist = JSON.parse(localStorage.getItem('kova-wishlist') || '[]');
if (Array.isArray(savedWishlist)) state.wishlist = new Set(savedWishlist.filter(id => typeof id === 'string' && getProduct(id)));
state.discount = localStorage.getItem('kova-discount') === 'true';
} catch (_) { /* Storage can be unavailable in private browsing. */ }
const grid = $('#product-grid');
const overlay = $('.overlay');
const cartDrawer = $('.cart-drawer');
const productModal = $('.product-modal');
const checkoutModal = $('.checkout-modal');
const successModal = $('.success-modal');
let lastFocused = null;
let toastTimer;
function saveState() {
try {
localStorage.setItem('kova-cart', JSON.stringify(state.cart));
localStorage.setItem('kova-wishlist', JSON.stringify([...state.wishlist]));
localStorage.setItem('kova-discount', String(state.discount));
} catch (_) { /* Keep the shop functional without persistence. */ }
}
function showToast(message) {
const toast = $('.toast');
const announcer = $('.cart-announcer');
if (announcer && announcer.textContent !== message) announcer.textContent = message;
toast.textContent = message;
toast.classList.add('visible');
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toast.classList.remove('visible'), 2700);
}
function showOverlay() {
overlay.hidden = false;
requestAnimationFrame(() => overlay.classList.add('visible'));
}
function hideOverlay() {
overlay.classList.remove('visible');
setTimeout(() => { if (!overlay.classList.contains('visible')) overlay.hidden = true; }, 300);
}
function lockPage() { document.body.classList.add('no-scroll'); }
function unlockPage() { document.body.classList.remove('no-scroll'); }
function getFilteredProducts() {
const query = state.search.trim().toLowerCase();
const filtered = products.filter(product => {
if (state.collection === 'new' && !['form-02', 'drift-01', 'roam-02', 'field-01'].includes(product.id)) return false;
if (state.collection === 'best' && !['form-01', 'form-01-noir', 'cloud-01', 'roam-02'].includes(product.id)) return false;
if (state.collection === 'sale' && !product.oldPrice) return false;
if (state.sizes.size && !product.sizes.some(size => state.sizes.has(size))) return false;
if (state.colors.size && !state.colors.has(product.color)) return false;
if (product.price > state.maxPrice) return false;
if (query && !`${product.name} ${product.subtitle} ${product.color} ${product.category}`.toLowerCase().includes(query)) return false;
return true;
});
return filtered.sort((a, b) => {
if (state.sort === 'price-low') return a.price - b.price;
if (state.sort === 'price-high') return b.price - a.price;
if (state.sort === 'rating') return b.rating - a.rating || b.reviews - a.reviews;
if (state.sort === 'newest') return Number(b.badge.includes('New') || b.badge === 'Just landed') - Number(a.badge.includes('New') || a.badge === 'Just landed');
return products.indexOf(a) - products.indexOf(b);
});
}
function renderProducts() {
const visible = getFilteredProducts();
const collectionContent = {
all: ['Find your pair', 'The collection'],
new: ['Just landed', 'New arrivals'],
best: ['Most loved', 'Best sellers'],
sale: ['Last chance', 'The sale edit']
};
const [eyebrow, title] = collectionContent[state.collection] || collectionContent.all;
setText('#collection-eyebrow', eyebrow);
setText('#collection-title', title);
$$('[data-collection-link]').forEach(link => {
if (link.dataset.collectionLink === state.collection) link.setAttribute('aria-current', 'page');
else link.removeAttribute('aria-current');
});
$('.result-count').textContent = `${visible.length} ${visible.length === 1 ? 'style' : 'styles'}`;
$('.empty-state').hidden = visible.length !== 0;
grid.hidden = visible.length === 0;
grid.innerHTML = visible.map(product => `
<article class="product-card" data-product-id="${product.id}">
<div class="product-media" data-open-product="${product.id}" tabindex="0" role="button" aria-label="View ${product.name}">
<img src="${product.image}" alt="${product.name} ${product.subtitle} in ${product.color}" loading="lazy">
${product.badge ? `<span class="product-badge ${product.oldPrice ? 'sale' : ''}">${product.oldPrice ? 'Sale' : product.badge}</span>` : ''}
<button class="wishlist ${state.wishlist.has(product.id) ? 'active' : ''}" data-wishlist="${product.id}" aria-label="${state.wishlist.has(product.id) ? 'Remove' : 'Add'} ${product.name} ${state.wishlist.has(product.id) ? 'from' : 'to'} favorites">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1.1-1.1a5.5 5.5 0 0 0-7.8 7.8L12 21l8.8-8.6a5.5 5.5 0 0 0 0-7.8Z"></path></svg>
</button>
<button class="quick-add" data-quick-add="${product.id}">Select size</button>
</div>
<div class="product-info">
<div class="product-info-top">
<h3 data-open-product="${product.id}">${product.name}</h3>
<div class="product-price">${product.oldPrice ? `<del>${money(product.oldPrice)}</del>` : ''}${money(product.price)}</div>
</div>
<div class="product-meta"><span>${product.color} · ${product.subtitle}</span><span class="product-colors"><i style="--swatch:${product.colorHex}" title="${product.color}"></i></span></div>
</div>
</article>`).join('');
$$('[data-size]').forEach(button => {
if (button.closest('.modal-sizes')) return;
button.classList.toggle('active', state.sizes.has(Number(button.dataset.size)));
});
$$('[data-color]').forEach(button => button.classList.toggle('active', state.colors.has(button.dataset.color)));
const count = state.sizes.size + state.colors.size + (state.maxPrice < 200 ? 1 : 0) + (state.search ? 1 : 0);
$('.filter-count').textContent = count;
$('.clear-filters').classList.toggle('visible', count > 0);
const chips = [
...[...state.sizes].map(size => ({ type: 'size', value: size, label: `US ${size}` })),
...[...state.colors].map(color => ({ type: 'color', value: color, label: color })),
...(state.maxPrice < 200 ? [{ type: 'price', value: state.maxPrice, label: `Up to ${money(state.maxPrice)}` }] : []),
...(state.search ? [{ type: 'search', value: state.search, label: `“${state.search}”` }] : [])
];
const active = $('.active-filters');
active.classList.toggle('visible', chips.length > 0);
active.innerHTML = chips.map(chip => `<span class="active-filter">${escapeHTML(chip.label)}<button data-remove-filter="${chip.type}" data-value="${escapeHTML(chip.value)}" aria-label="Remove ${escapeHTML(chip.label)} filter">×</button></span>`).join('');
}
function resetFilters() {
state.sizes.clear();
state.colors.clear();
state.maxPrice = 200;
state.search = '';
$('#price-range').value = 200;
$('#price-value').textContent = '$200';
$('#price-caption').textContent = '$200';
$('#product-search').value = '';
renderProducts();
}
function scrollToTarget(selector) {
const target = document.querySelector(selector);
if (!target) return;
try {
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
} catch (_) {
target.scrollIntoView();
}
}
function setText(selector, value) {
const element = $(selector);
if (element) element.textContent = value;
}
function setValue(selector, value) {
const element = $(selector);
if (element) element.value = value;
}
function closeOpenLayers() {
if (checkoutModal.classList.contains('open')) closeCheckout();
if (successModal.classList.contains('open')) closeSuccess();
closeCart(false);
closeProduct(false);
closeFilters();
$('.main-nav').classList.remove('mobile-open');
}
function navigateToCollection(collection, scroll = true) {
const validCollections = ['all', 'new', 'best', 'sale'];
state.collection = validCollections.includes(collection) ? collection : 'all';
state.sizes.clear();
state.colors.clear();
state.maxPrice = 200;
state.search = '';
state.sort = state.collection === 'new' ? 'newest' : 'featured';
setValue('#price-range', 200);
setText('#price-value', '$200');
setText('#price-caption', '$200');
setValue('#product-search', '');
setValue('#sort-products', state.sort);
$('.search-panel')?.classList.remove('open');
$('.search-panel')?.setAttribute('aria-hidden', 'true');
closeOpenLayers();
renderProducts();
if (scroll) scrollToTarget('#shop');
else scrollToTarget('#top');
}
function navigateToSection(selector) {
closeOpenLayers();
scrollToTarget(selector);
}
function openProduct(id) {
const product = getProduct(id);
if (!product) return;
closeCart(false);
state.activeProduct = id;
state.activeSize = null;
lastFocused = document.activeElement;
$('.product-modal-content').innerHTML = `
<div class="product-modal-layout">
<div class="product-gallery">
<img src="${product.image}" alt="${product.name} in ${product.color}">
${product.badge ? `<span class="product-gallery-badge">${product.badge}</span>` : ''}
</div>
<div class="product-details">
<p class="mini-eyebrow">${product.category}</p>
<h2>${product.name}</h2>
<div class="product-modal-price">${money(product.price)}${product.oldPrice ? `<del>${money(product.oldPrice)}</del>` : ''}</div>
<div class="rating-line"><span class="stars">★★★★★</span><strong>${product.rating}</strong><span>(${product.reviews} reviews)</span></div>
<p class="product-description">${product.description}</p>
<p class="modal-color-name">Color: <strong>${product.color}</strong></p>
<div class="option-heading"><span>Select size <span class="size-required">*</span></span><button data-size-guide>Size guide</button></div>
<div class="modal-sizes">
${[6, 7, 8, 9, 10, 11, 12, 13].map(size => `<button data-modal-size="${size}" ${product.sizes.includes(size) ? '' : 'disabled'} aria-label="US size ${size}">${size}</button>`).join('')}
</div>
<p class="size-error" aria-live="polite"></p>
<button class="button button-dark modal-add">Add to bag <span>${money(product.price)}</span></button>
<div class="product-perks"><span>↺ 30-day returns</span><span>♢ Free shipping $150+</span></div>
<div class="product-accordion">
<details open><summary>Materials & construction</summary><p>${product.details}</p></details>
<details><summary>Shipping & returns</summary><p>Free express shipping on orders over $150. Standard delivery is $12. Returns are free within 30 days of delivery—just make sure your pair is unworn.</p></details>
<details id="size-guide-details"><summary>Fit & size guide</summary><div class="size-guide"><h4>US sizing · Regular fit</h4><table><thead><tr><th>US</th><th>UK</th><th>EU</th><th>CM</th></tr></thead><tbody><tr><td>7</td><td>6</td><td>40</td><td>25</td></tr><tr><td>8</td><td>7</td><td>41</td><td>26</td></tr><tr><td>9</td><td>8</td><td>42</td><td>27</td></tr><tr><td>10</td><td>9</td><td>43</td><td>28</td></tr><tr><td>11</td><td>10</td><td>44</td><td>29</td></tr><tr><td>12</td><td>11</td><td>45</td><td>30</td></tr></tbody></table></div></details>
</div>
</div>
</div>`;
productModal.setAttribute('aria-hidden', 'false');
productModal.classList.add('open');
showOverlay();
lockPage();
setTimeout(() => $('.product-modal-close').focus(), 100);
}
function closeProduct(restore = true) {
productModal.classList.remove('open');
productModal.setAttribute('aria-hidden', 'true');
state.activeProduct = null;
state.activeSize = null;
if (restore && !cartDrawer.classList.contains('open') && !checkoutModal.classList.contains('open')) {
hideOverlay();
unlockPage();
if (lastFocused && document.contains(lastFocused)) lastFocused.focus();
}
}
function getCartSubtotal() {
return state.cart.reduce((sum, item) => sum + getProduct(item.id).price * item.qty, 0);
}
function getCartCount() {
return state.cart.reduce((sum, item) => sum + item.qty, 0);
}
function renderCart() {
const count = getCartCount();
const subtotal = getCartSubtotal();
$('.cart-count').textContent = count;
$('.drawer-count').textContent = count;
$('#cart-subtotal').textContent = money(subtotal);
$('.cart-empty').classList.toggle('visible', count === 0);
$('.cart-items').hidden = count === 0;
$('.cart-footer').hidden = count === 0;
$('.shipping-progress').hidden = count === 0;
const remaining = Math.max(0, 150 - subtotal);
$('#shipping-message').innerHTML = remaining > 0 ? `You’re <strong>${money(remaining)}</strong> away from free express shipping` : '<strong>You’ve unlocked free express shipping.</strong>';
$('.shipping-progress > div span').style.width = `${Math.min(100, subtotal / 150 * 100)}%`;
$('.cart-items').innerHTML = state.cart.map((item, index) => {
const product = getProduct(item.id);
return `<article class="cart-item">
<div class="cart-item-image" data-open-product="${product.id}"><img src="${product.image}" alt="${product.name}"></div>
<div class="cart-item-info">
<div class="cart-item-head"><h3>${product.name}</h3><strong>${money(product.price * item.qty)}</strong></div>
<p class="cart-item-variant">${product.color} · US ${item.size}</p>
<div class="cart-item-bottom">
<div class="quantity-control" aria-label="Quantity for ${product.name}">
<button data-qty="${index}" data-delta="-1" aria-label="Decrease quantity">−</button><span>${item.qty}</span><button data-qty="${index}" data-delta="1" aria-label="Increase quantity">+</button>
</div>
<button class="remove-item" data-remove="${index}">Remove</button>
</div>
</div>
</article>`;
}).join('');
saveState();
if (checkoutModal.classList.contains('open')) renderCheckoutSummary();
}
function openCart() {
closeProduct(false);
closeFilters();
lastFocused = document.activeElement;
cartDrawer.classList.add('open');
cartDrawer.setAttribute('aria-hidden', 'false');
showOverlay();
lockPage();
setTimeout(() => $('.drawer-close').focus(), 100);
}
function closeCart(restore = true) {
cartDrawer.classList.remove('open');
cartDrawer.setAttribute('aria-hidden', 'true');
if (restore && !productModal.classList.contains('open') && !checkoutModal.classList.contains('open')) {
hideOverlay();
unlockPage();
}
}
function addToCart(id, size) {
const existing = state.cart.find(item => item.id === id && item.size === size);
if (existing) existing.qty = Math.min(8, existing.qty + 1);
else state.cart.push({ id, size, qty: 1 });
state.discount = false;
renderCart();
closeProduct(false);
openCart();
showToast(`${getProduct(id).name}, US ${size} added to your bag`);
}
function openFilters() {
$('.filters').classList.add('open');
showOverlay();
lockPage();
}
function closeFilters() {
$('.filters').classList.remove('open');
if (!cartDrawer.classList.contains('open') && !productModal.classList.contains('open') && !checkoutModal.classList.contains('open') && !successModal.classList.contains('open')) {
hideOverlay();
unlockPage();
}
}
function getOrderTotals() {
const subtotal = getCartSubtotal();
const discount = state.discount ? subtotal * 0.10 : 0;
const shipping = subtotal >= 150 || subtotal === 0 ? 0 : 12;
const tax = Math.max(0, (subtotal - discount) * 0.08);
return { subtotal, discount, shipping, tax, total: subtotal - discount + shipping + tax };
}
function renderCheckoutSummary() {
const totals = getOrderTotals();
const count = getCartCount();
$('#summary-count').textContent = `${count} ${count === 1 ? 'item' : 'items'}`;
$('.summary-items').innerHTML = state.cart.map(item => {
const product = getProduct(item.id);
return `<div class="summary-item">
<div class="summary-item-image"><img src="${product.image}" alt=""><span>${item.qty}</span></div>
<div><h4>${product.name}</h4><p>${product.color} · US ${item.size}</p></div><strong>${money(product.price * item.qty)}</strong>
</div>`;
}).join('');
$('#summary-subtotal').textContent = money(totals.subtotal);
$('#summary-discount').textContent = `−${money(totals.discount)}`;
$('#discount-row').hidden = !state.discount;
$('#summary-shipping').textContent = totals.shipping ? money(totals.shipping) : 'Free';
$('#summary-tax').textContent = money(totals.tax);
$('#summary-total').textContent = money(totals.total);
$('#place-order-total').textContent = money(totals.total);
$('#promo-code').value = state.discount ? 'KOVA10' : '';
$('.promo-message').textContent = state.discount ? 'KOVA10 applied — you saved 10%.' : '';
}
function openCheckout() {
if (!state.cart.length) return;
closeCart(false);
closeProduct(false);
renderCheckoutSummary();
checkoutModal.classList.add('open');
checkoutModal.setAttribute('aria-hidden', 'false');
checkoutModal.scrollTop = 0;
showOverlay();
lockPage();
setTimeout(() => $('#checkout-email').focus(), 150);
}
function closeCheckout() {
checkoutModal.classList.remove('open');
checkoutModal.setAttribute('aria-hidden', 'true');
hideOverlay();
unlockPage();
}
function setFieldError(input, message = '') {
input.classList.toggle('invalid', Boolean(message));
input.closest('.form-field').querySelector('.field-error').textContent = message;
}
function validateCheckout() {
let valid = true;
const required = [
['#checkout-email', 'Enter your email address'],
['#first-name', 'Enter your first name'],
['#last-name', 'Enter your last name'],
['#address', 'Enter your street address'],
['#city', 'Enter your city'],
['#postal', 'Enter your postal code'],
['#card-name', 'Enter the name on your card']
];
required.forEach(([selector, message]) => {
const input = $(selector);
const empty = !input.value.trim();
setFieldError(input, empty ? message : '');
if (empty) valid = false;
});
const email = $('#checkout-email');
if (email.value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.value)) {
setFieldError(email, 'Enter a valid email address');
valid = false;
}
const card = $('#card-number');
if (card.value.replace(/\D/g, '').length < 15) {
setFieldError(card, 'Enter a valid card number');
valid = false;
}
const expiry = $('#expiry');
const match = expiry.value.match(/^(0[1-9]|1[0-2])\s*\/\s*(\d{2})$/);
let expiryValid = Boolean(match);
if (match) {
const year = 2000 + Number(match[2]);
const month = Number(match[1]);
const now = new Date();
expiryValid = year > now.getFullYear() || (year === now.getFullYear() && month >= now.getMonth() + 1);
}
setFieldError(expiry, expiryValid ? '' : 'Use a valid future date (MM / YY)');
if (!expiryValid) valid = false;
const cvc = $('#cvc');
if (!/^\d{3,4}$/.test(cvc.value)) {
setFieldError(cvc, 'Enter a 3 or 4 digit code');
valid = false;
}
return valid;
}
function completeOrder() {
const email = $('#checkout-email').value.trim();
const order = `KV${Math.floor(100000 + Math.random() * 900000)}`;
$('#order-number').textContent = `#${order}`;
$('#success-email').textContent = email;
checkoutModal.classList.remove('open');
checkoutModal.setAttribute('aria-hidden', 'true');
successModal.classList.add('open');
successModal.setAttribute('aria-hidden', 'false');
state.cart = [];
state.discount = false;
renderCart();
saveState();
$('#checkout-form').reset();
$$('.form-field input').forEach(input => setFieldError(input));
setTimeout(() => $('.success-close').focus(), 100);
}
function closeSuccess() {
successModal.classList.remove('open');
successModal.setAttribute('aria-hidden', 'true');
hideOverlay();
unlockPage();
}
document.addEventListener('click', event => {
const wishlist = event.target.closest('[data-wishlist]');
if (wishlist) {
event.stopPropagation();
const id = wishlist.dataset.wishlist;
if (state.wishlist.has(id)) {
state.wishlist.delete(id);
showToast('Removed from favorites');
} else {
state.wishlist.add(id);
showToast('Saved to favorites');
}
saveState();
renderProducts();
return;
}
const quickAdd = event.target.closest('[data-quick-add]');
if (quickAdd) {
event.stopPropagation();
openProduct(quickAdd.dataset.quickAdd);
return;
}
const productTrigger = event.target.closest('[data-open-product]');
if (productTrigger) {
event.preventDefault();
openProduct(productTrigger.dataset.openProduct);
return;
}
const sizeButton = event.target.closest('[data-modal-size]');
if (sizeButton && !sizeButton.disabled) {
state.activeSize = Number(sizeButton.dataset.modalSize);
$$('[data-modal-size]').forEach(button => button.classList.toggle('active', button === sizeButton));
$('.size-error').textContent = '';
return;
}
if (event.target.closest('.modal-add')) {
if (!state.activeSize) {
$('.size-error').textContent = 'Please select your size before adding to bag.';
$('.modal-sizes').scrollIntoView({ behavior: 'smooth', block: 'center' });
return;
}
addToCart(state.activeProduct, state.activeSize);
return;
}
if (event.target.closest('[data-size-guide]')) {
const guide = $('#size-guide-details');
guide.open = true;
guide.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
return;
}
const qtyButton = event.target.closest('[data-qty]');
if (qtyButton) {
const index = Number(qtyButton.dataset.qty);
const item = state.cart[index];
if (!item) return;
item.qty += Number(qtyButton.dataset.delta);
if (item.qty > 8) {
item.qty = 8;
showToast('Maximum 8 pairs per style');
}
if (item.qty <= 0) state.cart.splice(index, 1);
renderCart();
return;
}
const removeButton = event.target.closest('[data-remove]');
if (removeButton) {
const index = Number(removeButton.dataset.remove);
const product = getProduct(state.cart[index].id);
state.cart.splice(index, 1);
renderCart();
showToast(`${product.name} removed from your bag`);
return;
}
const removeFilter = event.target.closest('[data-remove-filter]');
if (removeFilter) {
const { removeFilter: type, value } = removeFilter.dataset;
if (type === 'size') state.sizes.delete(Number(value));
if (type === 'color') state.colors.delete(value);
if (type === 'price') {
state.maxPrice = 200;
$('#price-range').value = 200;
$('#price-value').textContent = '$200';
$('#price-caption').textContent = '$200';
}
if (type === 'search') {
state.search = '';
$('#product-search').value = '';
}
renderProducts();
return;
}
if (event.target.closest('.reset-filters') || event.target.closest('.clear-filters')) resetFilters();
});
document.addEventListener('keydown', event => {
if ((event.key === 'Enter' || event.key === ' ') && event.target.matches('.product-media')) {
event.preventDefault();
openProduct(event.target.dataset.openProduct);
}
if (event.key === 'Escape') {
if (successModal.classList.contains('open')) closeSuccess();
else if (checkoutModal.classList.contains('open')) closeCheckout();
else if (productModal.classList.contains('open')) closeProduct();
else if (cartDrawer.classList.contains('open')) closeCart();
else closeFilters();
$('.main-nav').classList.remove('mobile-open');
$('.search-panel').classList.remove('open');
}
});
$$('.size-filter [data-size]').forEach(button => button.addEventListener('click', () => {
const size = Number(button.dataset.size);
state.sizes.has(size) ? state.sizes.delete(size) : state.sizes.add(size);
renderProducts();
}));
$$('.color-filter [data-color]').forEach(button => button.addEventListener('click', () => {
const color = button.dataset.color;
state.colors.has(color) ? state.colors.delete(color) : state.colors.add(color);
renderProducts();
}));
$('#price-range').addEventListener('input', event => {
state.maxPrice = Number(event.target.value);
$('#price-value').textContent = money(state.maxPrice).replace('.00', '');
$('#price-caption').textContent = money(state.maxPrice).replace('.00', '');
renderProducts();
});
$('#sort-products').addEventListener('change', event => {
state.sort = event.target.value;
renderProducts();
});
$$('.filter-title').forEach(button => button.addEventListener('click', () => {
const content = button.nextElementSibling;
const expanded = button.getAttribute('aria-expanded') === 'true';
button.setAttribute('aria-expanded', String(!expanded));
button.querySelector('span').textContent = expanded ? '+' : '−';
content.hidden = expanded;
}));
$('.filter-toggle').addEventListener('click', openFilters);
$('.filters-close').addEventListener('click', closeFilters);
$('.cart-trigger').addEventListener('click', openCart);
$('.drawer-close').addEventListener('click', () => closeCart());
$('.continue-link').addEventListener('click', () => { closeCart(); scrollToTarget('#shop'); });
$('.continue-shopping').addEventListener('click', () => { closeCart(); scrollToTarget('#shop'); });
$('.product-modal-close').addEventListener('click', () => closeProduct());
$('.checkout-button').addEventListener('click', openCheckout);
$('.checkout-close').addEventListener('click', closeCheckout);
$('.success-close').addEventListener('click', closeSuccess);
$$('[data-collection-link]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
navigateToCollection(link.dataset.collectionLink);
}));
$$('[data-scroll-link]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
navigateToSection(link.getAttribute('href'));
}));
$$('[data-home-link]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
navigateToCollection('all', false);
}));
$('.menu-trigger').addEventListener('click', event => {
event.stopPropagation();
const nav = $('.main-nav');
const open = nav.classList.toggle('mobile-open');
event.currentTarget.setAttribute('aria-expanded', String(open));
});
document.addEventListener('click', event => {
if (!event.target.closest('.site-header')) $('.main-nav').classList.remove('mobile-open');
});
$$('[data-social]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
showToast(`${link.dataset.social} is coming soon.`);
}));
$$('[data-legal]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
showToast(`${link.dataset.legal} information is available at hello@kova.example.`);
}));
$$('[data-footer-action]').forEach(link => link.addEventListener('click', event => {
event.preventDefault();
const action = link.dataset.footerAction;
if (action === 'size') {
openProduct('form-01');
setTimeout(() => {
const guide = $('#size-guide-details');
if (guide) {
guide.open = true;
guide.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}, 200);
} else if (action === 'shipping') {
showToast('Free shipping over $150. Easy returns within 30 days.');
} else if (action === 'faq') {
showToast('Questions? Email hello@kova.example and we’ll help.');
}
}));
$('.account-trigger').addEventListener('click', () => showToast('Account sign-in is coming soon.'));
$('.announcement-close').addEventListener('click', event => event.currentTarget.closest('.announcement').remove());
$('.search-trigger').addEventListener('click', () => {
$('.search-panel').classList.add('open');
$('.search-panel').setAttribute('aria-hidden', 'false');
setTimeout(() => $('#product-search').focus(), 150);
});
$('.search-close').addEventListener('click', () => {
$('.search-panel').classList.remove('open');
$('.search-panel').setAttribute('aria-hidden', 'true');
state.search = '';
$('#product-search').value = '';
renderProducts();
});
$('#product-search').addEventListener('input', event => {
state.search = event.target.value.trim();
renderProducts();
});
$('#product-search').addEventListener('keydown', event => {
if (event.key === 'Enter') {
event.preventDefault();
$('.search-panel').classList.remove('open');
$('#shop').scrollIntoView({ behavior: 'smooth' });
}
});
overlay.addEventListener('click', () => {
if (successModal.classList.contains('open')) closeSuccess();
else if (checkoutModal.classList.contains('open')) closeCheckout();
else if (productModal.classList.contains('open')) closeProduct();
else if (cartDrawer.classList.contains('open')) closeCart();
else closeFilters();
});
$('#apply-promo').addEventListener('click', () => {
const code = $('#promo-code').value.trim().toUpperCase();
if (code === 'KOVA10') {
state.discount = true;
saveState();
renderCheckoutSummary();
showToast('Discount applied');
} else if (!code) {
$('.promo-message').textContent = 'Enter a discount code.';
} else {
state.discount = false;
saveState();
renderCheckoutSummary();
$('.promo-message').textContent = 'That code isn’t valid. Try KOVA10.';
}
});
$('#card-number').addEventListener('input', event => {
const digits = event.target.value.replace(/\D/g, '').slice(0, 16);
event.target.value = digits.replace(/(\d{4})(?=\d)/g, '$1 ');
setFieldError(event.target);
});
$('#expiry').addEventListener('input', event => {
const digits = event.target.value.replace(/\D/g, '').slice(0, 4);
event.target.value = digits.length > 2
…