* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto; /* HTML should be the scrolling container for sticky to work */
    -webkit-text-size-adjust: 100%;
    height: 100%;
    /* Disable horizontal overscroll (rubber-band) on mobile; keep vertical */
    overscroll-behavior-x: none;
}

body {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    background-color: #ffffff;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    width: 100%;
    overflow: visible; /* Body should NOT be the scrolling container - use visible, not hidden/auto */
    margin: 0;
    padding: 0;
    /* Ensure body doesn't create a scrolling context that breaks sticky */
    position: static;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overscroll-behavior-x: none;
}

/* Prevent page scrolling when bag is open - using class instead of inline style */
/* Since HTML is the scrolling container, we need to prevent scrolling on both html and body */
html.bag-open {
    overflow-y: hidden;
}

body.bag-open {
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Hide elements during password protection - using class instead of inline style */
.password-hidden {
    display: none !important;
}

/* Sticky header (contains collection nav + bag) */
.sticky-top {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: transparent;
    width: 100%;
}

/* Header: collection nav left, bag right; no center brand */
header.header,
.header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 16px;
    background-color: transparent;
    width: 100%;
    margin: 0;
}

.header-cart {
    justify-self: end;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    margin: 0;
}

/* Collection nav (left side of header: ALL, JEANS, JACKETS, INFO) */
.collection-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 0;
    width: 100%;
}

.collection-nav a {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    text-decoration: none;
}

.collection-nav a:hover {
    text-decoration: none;
}

.collection-nav a.active {
    text-decoration: underline;
}

/* Main Content - flex: 1 so footer stays at bottom of viewport when content is short */
body > main {
    flex: 1;
}

.main-content {
    width: 100%;
}

/* Products Grid */
.products-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Row spacing */
.products-grid-row {
    display: flex;
    gap: 8px;
    padding-bottom: 32px;
    width: 100%;
}

.products-grid-row .product-card {
    flex: 1 0 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    min-width: 0;
}

.products-grid-row .product-image-container {
    aspect-ratio: 3000 / 3750;
    width: 100%;
    position: relative;
    overflow: hidden;
    /* Force GPU acceleration to prevent flickering on iOS */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.products-grid-row .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    /* Prevent image flickering on iOS scroll */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.products-grid-row .product-details {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 8px;
    width: 100%;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
}

.products-grid-row .product-title {
    flex-shrink: 0;
}

.products-grid-row .product-price {
    flex-shrink: 0;
}

/* Footer */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 16px 16px;
    background-color: #ffffff;
    width: 100%;
}

.footer-link {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .products-grid-row {
        gap: 4px;
        padding-bottom: 20px;
    }

    .products-grid-row .product-card {
        gap: 12px;
    }

    .footer {
        padding-top: 32px;
    }
}

