:root {
    --bg:        #FFFFFF;
    --image-bg:  #EFEFEF;
    --ink:       #0A0A0A;
    --muted:     #999999;
    --hairline:  rgba(0, 0, 0, 0.08);

    --font-sans: "Geist Pixel", "Geist Mono", monospace;

    --gutter:    24px;
    --side-pad:  32px;
    --ease:      cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
*                      { margin: 0; padding: 0; }
html                   { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* Slim scrollbar — hairline, fits the minimal aesthetic */
html { scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.18) transparent; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.35); }

body {
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a      { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }

/* Page-load entrance: hero and grid drift up + fade in once. */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

body.page-ready .site-header { animation: rise-in 0.7s var(--ease) both; }
body.page-ready .filter-bar  { animation: rise-in 0.7s var(--ease) 0.08s both; }
body.page-ready .grid        { animation: rise-in 0.7s var(--ease) 0.16s both; }
body.page-ready .wish-cta    { animation: rise-in 0.7s var(--ease) 0.1s both; }

/* Header — big bold title that shrinks into a slim bar on scroll
   (minimalgoods.co-style: driven by --header-progress, 0 → 1) */
:root { --hero-h: 200px; --hero-shrink: 168px; --title-shrink: 0.88; }

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    height: calc(var(--hero-h) - var(--hero-shrink) * var(--header-progress, 0));
    padding: 0 var(--side-pad);
    overflow: hidden;
    box-shadow: 0 calc(var(--header-progress, 0) * 1px) 0 var(--hairline);
}

.header-share {
    position: absolute;
    top: calc(24px - 16px * var(--header-progress, 0));
    right: var(--side-pad);
    font-size: 13px;
    color: var(--muted);
    transition: color 0.15s var(--ease);
}

.header-share:hover,
.header-share:focus-visible { color: var(--ink); }

.header-share:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.site-title {
    font-size: clamp(40px, 15vw, 150px);
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    color: var(--ink);
    white-space: nowrap;
    transform: scale(calc(1 - var(--title-shrink, 0.72) * var(--header-progress, 0)));
    transform-origin: center center;
}

.site-subtitle {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.02em;
    max-height: calc(24px * (1 - var(--header-progress, 0)));
    overflow: hidden;
    opacity: calc(1 - var(--header-progress, 0) * 1.6);
    margin-top: calc(8px * (1 - var(--header-progress, 0)) - 8px);
}

/* Content starts below the hero (header offset + hero height) */
.filter-bar { margin-top: calc(var(--header-offset, 0px) + var(--hero-h)); }

/* Wishlist call-to-action strip below the filter bar */
.wish-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 13px var(--side-pad);
    background: #FAFAFA;
    border-bottom: 1px solid var(--hairline);
}

.wish-cta-text {
    font-size: 13px;
    color: var(--ink);
}

.wish-cta-text strong { font-weight: 600; }

.wish-cta-btn {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    padding: 8px 18px;
    transition: opacity 0.15s var(--ease);
}

.wish-cta-btn:hover { opacity: 0.85; }

.wish-cta-btn:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Attention pulse on the wishlist chip */
@keyframes wish-pulse {
    0%, 100% { color: var(--ink); }
    50%      { color: #E0245E; }
}

.wish-filter.pulse { animation: wish-pulse 0.8s ease 3; }

.wordmark-link,
.site-footer a {
    color: inherit;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s var(--ease);
}

.wordmark-link { border-bottom-color: currentColor; }
.wordmark-link:hover { border-bottom-color: transparent; }
.site-footer a:hover { border-bottom-color: var(--muted); }

/* Filter bar — sticky: rides just below the header's collapsing bottom edge,
   so the category tabs stay visible once you scroll (top tracks the header
   height via --header-progress, set per-frame in script.js). */
.filter-bar {
    position: sticky;
    top: calc(var(--header-offset, 0px) + var(--hero-h) - var(--hero-shrink) * var(--header-progress, 0));
    z-index: 55;
    background: var(--bg);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 24px;
    padding: 14px var(--side-pad);
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
}

.filter-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    max-width: 100%;
}

.filter-link {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s var(--ease);
}

.filter-link:hover,
.filter-link.active { color: var(--ink); }

.filter-link:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.product-count {
    position: absolute;
    right: var(--side-pad);
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: row dense;
    gap: var(--gutter);
    padding: var(--gutter) var(--side-pad) 64px;
}

/* Filter-switch transition: cards fade + rise in, staggered across the grid */
@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.grid.grid-switching .card {
    animation: card-in 0.45s var(--ease) both;
}

/* Outgoing cards fade out before the new set fades in */
@keyframes card-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-10px); }
}

.grid.grid-fading .card {
    animation: card-out 0.19s var(--ease) both;
}

.grid.grid-switching .card:nth-child(1)  { animation-delay: 0ms; }
.grid.grid-switching .card:nth-child(2)  { animation-delay: 30ms; }
.grid.grid-switching .card:nth-child(3)  { animation-delay: 60ms; }
.grid.grid-switching .card:nth-child(4)  { animation-delay: 90ms; }
.grid.grid-switching .card:nth-child(5)  { animation-delay: 120ms; }
.grid.grid-switching .card:nth-child(6)  { animation-delay: 150ms; }
.grid.grid-switching .card:nth-child(7)  { animation-delay: 180ms; }
.grid.grid-switching .card:nth-child(8)  { animation-delay: 210ms; }
.grid.grid-switching .card:nth-child(9)  { animation-delay: 240ms; }
.grid.grid-switching .card:nth-child(10) { animation-delay: 270ms; }
.grid.grid-switching .card:nth-child(11) { animation-delay: 300ms; }
.grid.grid-switching .card:nth-child(12) { animation-delay: 330ms; }

.card        { display: block; position: relative; color: var(--ink); }
.card.large  { grid-column: span 2; }
.card-link   { display: block; color: inherit; cursor: pointer; }

/* Card image — non-bleed cards use the "constrained image" model:
   the <img> itself is sized to a fixed percentage of the card-image box,
   so every silhouette (square, tall, wide) ends up with the same visible
   margin around it regardless of card aspect. Bleed cards bypass this. */
.card-image {
    position: relative;
    background: var(--image-bg);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

.card.large .card-image {
    aspect-ratio: 2 / 1;
}

/* Let <picture> dissolve so its <img> is the flex item we can size. */
.card-image picture { display: contents; }

.card-image img {
    width: 70%;
    height: 70%;
    max-width: 70%;
    max-height: 70%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.card-image.has-image img                  { opacity: 1; }
.card-image.has-image .card-image-fallback { display: none; }
.card:hover .card-image img                { transform: scale(1.03); }

/* Soft lift on hover — restrained, monochrome */
.card-image {
    transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.card:hover .card-image {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}

.card-image-fallback {
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(10, 10, 10, 0.18);
    text-align: center;
    pointer-events: none;
    user-select: none;
}

/* Full-bleed: vehicles category by default, or any card opted in via data-bleed */
.card[data-category="vehicles"] .card-image img,
.card[data-bleed="true"]        .card-image img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
}

/* Framed override: forces the constrained-image (non-bleed) look back on. */
.card[data-framed="true"] .card-image img {
    width: 70%;
    height: 70%;
    max-width: 70%;
    max-height: 70%;
    object-fit: contain;
}

/* Card meta */
.card-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 2px 0;
}

.card-text-link {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.card-name,
.card-brand { font-size: 13px; line-height: 1.4; }
.card-name  { color: var(--ink); }
.card-brand { color: var(--muted); }

/* Wishlist heart — sits where the copy icon used to be (right of the meta row) */
.card-wish {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin: -6px -6px 0 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}

.card-wish:hover,
.card-wish:focus-visible { color: var(--ink); }
.card-wish:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

.card-wish:hover { transform: scale(1.12); }
.card-wish svg  { width: 15px; height: 15px; display: block; }

.card-wish.saved { color: #E0245E; }
.card-wish.saved svg { fill: currentColor; }

/* Wishlist filter chip */
.wish-filter.active { color: var(--ink); }

/* Heart-tap animation — monochrome pop, particles, fly into the chip */
@keyframes heart-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.card-wish.tapped { animation: heart-pop 0.4s var(--ease); }

@keyframes chip-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.22); }
    100% { transform: scale(1); }
}

.wish-filter.bump { animation: chip-bump 0.45s var(--ease); }

.img-fly {
    position: fixed;
    z-index: 80;
    pointer-events: none;
    will-change: transform;
    /* horizontal axis: fast start, gentle settle */
    transition: transform 0.6s cubic-bezier(0.33, 0.7, 0.4, 1);
}

.img-fly-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--image-bg);
    border-radius: 6px;
    /* vertical axis: lazy start, catches up — combined with the wrap's
       horizontal ease this makes the image swoop on a curve */
    transition: transform 0.6s cubic-bezier(0.1, 0.35, 0.55, 1), opacity 0.6s var(--ease);
    will-change: transform, opacity;
}

.particle {
    position: fixed;
    z-index: 79;
    pointer-events: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink);
    transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
    will-change: transform, opacity;
}

.particle-grey { background: #B9B9B9; }

/* Share popover with social icons */
.share-pop {
    position: fixed;
    top: 96px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
    padding: 14px 16px;
    min-width: 292px;
    max-width: calc(100vw - 32px);
}

.share-pop-note {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    line-height: 1.45;
    margin-bottom: 10px;
}

.share-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.share-pop-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.share-pop-close {
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s var(--ease);
}

.share-pop-close:hover { color: var(--ink); }

.share-pop-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    white-space: nowrap;
}

.share-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    color: var(--ink);
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.share-icon:hover {
    background: #F5F5F5;
    border-color: rgba(0, 0, 0, 0.16);
}

.share-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.share-pop-copy {
    display: flex;
    gap: 8px;
}

.share-pop-input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 7px 10px;
    background: #FAFAFA;
}

.share-pop-copybtn {
    flex-shrink: 0;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--ink);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--ink);
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.share-pop-copybtn:hover { background: var(--ink); color: #fff; }

/* Mobile: popover becomes a bottom sheet */
@media (max-width: 480px) {
    .share-pop {
        position: fixed;
        top: auto;
        left: 16px;
        right: 16px;
        bottom: 16px;
        transform: none;
        min-width: 0;
    }
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--hairline);
    padding: 36px var(--side-pad) 40px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.footer-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-actions a,
.footer-actions .footer-link {
    color: var(--ink);
    font-size: 13px;
    font-family: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s var(--ease);
}

.footer-actions a:hover,
.footer-actions .footer-link:hover {
    border-bottom-color: currentColor;
}

.footer-copy {
    display: block;
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* Submit modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.open { display: flex; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    background: var(--bg);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 32px 28px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    animation: modalIn 0.2s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s var(--ease);
}
.modal-close:hover { color: var(--ink); }

.modal-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}

.submit-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.submit-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.submit-form label > span {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.submit-form input,
.submit-form select,
.submit-form textarea {
    font: inherit;
    font-size: 13px;
    padding: 10px 12px;
    border: 1px solid var(--hairline);
    border-radius: 4px;
    background: var(--bg);
    color: var(--ink);
    width: 100%;
    transition: border-color 0.15s var(--ease);
}

.submit-form input:focus,
.submit-form select:focus,
.submit-form textarea:focus {
    outline: none;
    border-color: var(--ink);
}

.submit-form textarea {
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
}

.submit-btn {
    background: var(--ink);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity 0.15s var(--ease);
}

.submit-btn:hover { opacity: 0.88; }

@media (max-width: 1024px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 599px) {
    :root { --side-pad: 16px; --gutter: 12px; }

    /* Compact hero on small screens (collapsed bar stays ~32px) */
    :root { --hero-h: 150px; --hero-shrink: 118px; --title-shrink: 0.60; }
    .header-share { top: calc(14px - 6px * var(--header-progress, 0)); }
    .site-title  { font-size: clamp(40px, 13vw, 52px); }

    /* Filter bar: horizontal scroll of pill-shaped tabs.
       The category list can be long on mobile, so we drop the wrap-and-center
       layout and let the user swipe. Active pill is filled for tap feedback. */
    .filter-bar {
        padding: 0;
        gap: 0;
    }
    .filter-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 8px;
        padding: 12px 16px;
        scrollbar-width: none;            /* Firefox */
        -webkit-overflow-scrolling: touch;
    }
    .filter-list::-webkit-scrollbar { display: none; }   /* WebKit */

    .filter-link {
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 13px;
        border: 1px solid var(--hairline);
        border-radius: 999px;
    }
    .filter-link.active {
        color: var(--bg);
        background: var(--ink);
        border-color: var(--ink);
    }
    .product-count { display: none; }     /* hide to make room for the scroll row */

    .grid          { padding: 12px 16px 48px; }
    .card-name,
    .card-brand    { font-size: 12px; }
}

@media (max-width: 419px) {
    /* Stay at 2 columns even on the smallest phones — but force non-bleed
       large cards to 1:1 so a span-2 large card isn't a wide short strip. */
    .card.large .card-image { aspect-ratio: 1 / 1; }

    .card.large[data-category="vehicles"] .card-image,
    .card.large[data-bleed="true"]        .card-image { aspect-ratio: 2 / 1; }

    .card.large[data-framed="true"] .card-image { aspect-ratio: 1 / 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
