/*
 * Shop: search bar, parts grid and pagination.
 *
 * Shared by the shop landing page, the catalogue / search results and the
 * product page, which each used to carry their own copy of the search styles.
 */

:root {
    --shop-red: #d00000;
    --shop-red-dark: #8c1414;
    --shop-ink: #15171c;
    --shop-muted: #6b7280;
    --shop-faint: #9ca3af;
    --shop-line: rgba(0, 0, 0, 0.08);
    --shop-tint: #f6f5f3;
    --shop-green: #128c3e;
    --shop-ease: cubic-bezier(0.22, 1, 0.36, 1);
}


/* ------------------------------------------------------------------
   Banner layout and search bar
   ------------------------------------------------------------------ */

.shop-header h1 {
    margin-bottom: 0;
}

.shop-search {
    width: 50%;
    max-width: 560px;
    margin: 0.9rem 0 0;
}

.shop-search_field {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.shop-search_field:focus-within {
    border-color: var(--shop-red);
    box-shadow: 0 0 0 4px rgba(208, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.25);
}

.shop-search_icon {
    flex-shrink: 0;
    padding-left: 14px;
    color: var(--shop-faint);
    font-size: 15px;
}

.shop-search_input {
    flex: 1;
    min-width: 0;
    padding: 9px 6px;
    border: 0;
    outline: 0;
    background: none;
    color: var(--shop-ink);
    /* 16px stops iOS zooming the page when the field is focused */
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
}

.shop-search_input::placeholder {
    color: var(--shop-faint);
}

/* Our own clear button replaces the browser's, which renders differently everywhere */
.shop-search_input::-webkit-search-cancel-button,
.shop-search_input::-webkit-search-decoration {
    -webkit-appearance: none;
    display: none;
}

.shop-search_clear {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--shop-faint);
    font-size: 15px;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}

.shop-search_clear:hover {
    color: var(--shop-ink);
    background: var(--shop-tint);
}

.shop-search_clear[hidden] {
    display: none;
}

.shop-search_submit {
    flex-shrink: 0;
    padding: 10px 24px;
    border: 0;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--shop-red), var(--shop-red-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 200ms ease;
}

.shop-search_submit:hover {
    filter: brightness(1.12);
}

@media (max-width: 800px) {
    .shop-search {
        margin-top: 0;
    }
}

/* Search drops below the heading on smaller screens */
@media (max-width: 768px) {
    .shop-header {
        flex-direction: column;
        text-align: center;
    }

    .shop-header h1 {
        width: 100%;
        text-align: center;
    }

    .shop-search {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .shop-search_icon {
        display: none;
    }

    .shop-search_input {
        padding-left: 14px;
    }

    .shop-search_submit {
        padding: 10px 18px;
    }
}


/* ------------------------------------------------------------------
   Results toolbar
   ------------------------------------------------------------------ */

.shop-results {
    padding: 40px 0 72px;
}

.shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 24px;
}

.shop-toolbar_count {
    margin: 0;
    color: var(--shop-muted);
    font-size: 15px;
}

.shop-toolbar_count strong {
    color: var(--shop-ink);
}

.shop-toolbar_link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--shop-red);
    font-size: 14px;
    font-weight: 700;
}

.shop-toolbar_link:hover {
    color: var(--shop-red-dark);
}


/* ------------------------------------------------------------------
   Parts grid
   ------------------------------------------------------------------ */

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (min-width: 768px) {
    .shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .shop-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 24px;
    }
}

.part-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--shop-line);
    border-radius: 16px;
    transition: transform 280ms var(--shop-ease), box-shadow 280ms var(--shop-ease), border-color 280ms ease;
}

.part-card:hover {
    transform: translateY(-6px);
    border-color: rgba(208, 0, 0, 0.25);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.part-card_media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 11;
    overflow: hidden;
    background: var(--shop-tint);
}

/* The real photo sits over the part-number tile. It stays see-through until
   shop.js marks it loaded, so the tile shows while it loads, and a photo that
   fails to load is removed outright. */
.part-card_photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 12px;
    object-fit: contain;
    transition: transform 400ms var(--shop-ease);
}

.part-card_photo.is-loaded {
    background: #fff;
}

.part-card:hover .part-card_photo {
    transform: scale(1.05);
}

.part-card_placeholder {
    display: -webkit-box;
    max-width: 100%;
    margin: 0 14px;
    overflow: hidden;
    color: var(--shop-faint);
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-align: center;
    word-break: break-all;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.part-card_body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 16px 18px 18px;
}

.part-card_brand {
    margin-bottom: 4px;
    color: var(--shop-red);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.part-card_title {
    /* global.css makes every heading relative, which would trap the
       stretched link below inside the title instead of the whole card */
    position: static;
    display: -webkit-box;
    margin: 0 0 8px;
    overflow: hidden;
    color: var(--shop-ink);
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.part-card_link {
    color: inherit;
}

.part-card_link:hover {
    color: var(--shop-red);
}

/* Stretches the title link over the whole card */
.part-card_link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.part-card_partno {
    align-self: flex-start;
    max-width: 100%;
    margin-bottom: 8px;
    padding: 3px 8px;
    overflow: hidden;
    background: var(--shop-tint);
    border-radius: 6px;
    color: var(--shop-ink);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.part-card_fitment {
    display: -webkit-box;
    margin: 0 0 12px;
    overflow: hidden;
    color: var(--shop-muted);
    font-size: 13px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.part-card_footer {
    margin-top: auto;
}

.part-card_meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
    margin-bottom: 12px;
}

.part-card_price {
    color: var(--shop-ink);
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.part-card_price.is-request {
    color: var(--shop-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
}

.part-card_stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.part-card_stock::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.part-card_stock.is-in {
    color: var(--shop-green);
}

.part-card_stock.is-out {
    color: #b45309;
}

.part-card_cta {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--shop-red), var(--shop-red-dark));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: filter 200ms ease, box-shadow 200ms ease;
}

.part-card_cta i {
    font-size: 17px;
}

.part-card_cta:hover,
.part-card_cta:focus-visible {
    color: #fff;
    filter: brightness(1.12);
    box-shadow: 0 6px 16px rgba(140, 20, 20, 0.3);
}

@media (max-width: 575.98px) {
    .shop-results {
        padding-top: 28px;
    }

    .shop-grid {
        gap: 12px;
    }

    .part-card {
        border-radius: 12px;
    }

    .part-card:hover {
        transform: none;
    }

    .part-card_body {
        padding: 12px 12px 14px;
    }

    .part-card_placeholder {
        font-size: 15px;
    }

    .part-card_brand {
        font-size: 10px;
    }

    .part-card_title {
        font-size: 15px;
    }

    .part-card_partno {
        font-size: 12px;
    }

    .part-card_fitment {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }

    .part-card_meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .part-card_price {
        font-size: 17px;
    }

    .part-card_cta {
        padding: 8px 10px;
        font-size: 13px;
    }
}


/* ------------------------------------------------------------------
   Empty and notice states
   ------------------------------------------------------------------ */

.shop-empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 56px 16px;
    text-align: center;
}

.shop-empty > i {
    margin-bottom: 18px;
    color: #d1d5db;
    font-size: 52px;
}

.shop-empty h2 {
    margin-bottom: 10px;
    color: var(--shop-ink);
    font-size: 26px;
}

.shop-empty p {
    margin-bottom: 24px;
    color: var(--shop-muted);
}

.shop-empty_actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.shop-empty_btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border: 1.5px solid var(--shop-line);
    border-radius: 50px;
    color: var(--shop-ink);
    font-weight: 700;
    transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}

.shop-empty_btn:hover {
    border-color: var(--shop-ink);
    color: var(--shop-ink);
}

.shop-empty_btn.is-whatsapp {
    background: linear-gradient(135deg, var(--shop-red), var(--shop-red-dark));
    border-color: transparent;
    color: #fff;
}

.shop-empty_btn.is-whatsapp:hover {
    color: #fff;
    filter: brightness(1.12);
}

.shop-notice {
    margin: 32px 0 0;
    color: var(--shop-muted);
    font-size: 14px;
    font-style: italic;
    text-align: center;
}


/* ------------------------------------------------------------------
   Product page
   ------------------------------------------------------------------ */

.part-detail_back {
    margin-bottom: 24px;
}

.part-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
}

@media (min-width: 992px) {
    .part-detail {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        align-items: start;
        gap: 56px;
    }
}

.part-detail_media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--shop-tint);
    border: 1px solid var(--shop-line);
    border-radius: 20px;
}

@media (min-width: 992px) {
    .part-detail_media {
        aspect-ratio: 1;
    }
}

.part-detail_media .part-card_placeholder {
    font-size: clamp(24px, 4vw, 36px);
}

.part-detail_media .part-card_photo {
    padding: 24px;
}

.part-detail_zoom {
    position: absolute;
    inset: 0;
    cursor: zoom-in;
}

.lity-content img {
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.part-detail_info .part-card_brand {
    display: block;
    font-size: 12px;
}

.part-detail_title {
    margin: 2px 0 12px;
    color: var(--shop-ink);
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.15;
}

.part-detail_partno {
    display: inline-block;
    margin-bottom: 0;
    font-size: 15px;
}

.part-detail_buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-top: 24px;
}

.part-detail_price {
    color: var(--shop-ink);
    font-family: 'Outfit', sans-serif;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

.part-detail_price.is-request {
    color: var(--shop-muted);
    font-size: 26px;
}

.part-detail_buy .part-card_stock {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 13px;
}

.part-detail_buy .part-card_stock.is-in {
    background: rgba(18, 140, 62, 0.1);
}

.part-detail_buy .part-card_stock.is-out {
    background: rgba(180, 83, 9, 0.1);
}

.part-detail_trade {
    margin: 10px 0 0;
    color: var(--shop-muted);
    font-size: 14px;
    font-style: italic;
}

.part-detail_specs {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    margin: 28px 0 0;
    border-top: 1px solid var(--shop-line);
}

.part-detail_specs dt,
.part-detail_specs dd {
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--shop-line);
    font-size: 15px;
}

.part-detail_specs dt {
    padding-right: 24px;
    color: var(--shop-muted);
    font-weight: 600;
}

.part-detail_specs dd {
    color: var(--shop-ink);
    overflow-wrap: anywhere;
}

.part-detail_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.part-detail_btn {
    display: inline-flex;
    flex: 1 1 200px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border: 1.5px solid var(--shop-line);
    border-radius: 50px;
    color: var(--shop-ink);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}

.part-detail_btn:hover {
    border-color: var(--shop-ink);
    color: var(--shop-ink);
}

.part-detail_btn i {
    font-size: 18px;
}

.part-detail_btn.is-whatsapp {
    background: linear-gradient(135deg, var(--shop-red), var(--shop-red-dark));
    border-color: transparent;
    color: #fff;
}

.part-detail_btn.is-whatsapp:hover {
    color: #fff;
    filter: brightness(1.12);
    box-shadow: 0 8px 20px rgba(140, 20, 20, 0.3);
}

.part-detail_notes {
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.part-detail_notes li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    color: var(--shop-muted);
    font-size: 14px;
}

.part-detail_notes i {
    width: 16px;
    color: var(--shop-red);
    text-align: center;
}

.part-detail_notes a {
    color: var(--shop-red);
    font-weight: 600;
}


/* ------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------ */

.shop-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 48px;
}

.shop-pager_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid var(--shop-line);
    border-radius: 50px;
    color: var(--shop-ink);
    font-size: 14px;
    font-weight: 600;
    transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

a.shop-pager_btn:hover {
    border-color: var(--shop-red);
    color: var(--shop-red);
}

.shop-pager_btn.is-active {
    background: linear-gradient(135deg, var(--shop-red), var(--shop-red-dark));
    border-color: transparent;
    color: #fff;
}

.shop-pager_btn.is-disabled {
    opacity: 0.35;
}

.shop-pager_gap {
    min-width: 20px;
    color: var(--shop-faint);
    text-align: center;
    user-select: none;
}

.shop-pager_meta {
    margin: 14px 0 0;
    color: var(--shop-muted);
    font-size: 13px;
    text-align: center;
}

@media (max-width: 575.98px) {
    .shop-pager {
        gap: 4px;
    }

    .shop-pager_btn {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }

    .shop-pager_gap {
        min-width: 14px;
    }

    /* Two pages either side is too wide for a phone; one is enough */
    .shop-pager_btn.is-far {
        display: none;
    }
}


/* ------------------------------------------------------------------
   Engine and transmission replacement banner (shop landing page)
   ------------------------------------------------------------------ */

.replace-banner_img {
    width: auto;
    max-height: 120px;
}

.replace-banner_actions,
.replace-banner_stock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.replace-banner_actions {
    margin-top: 18px;
}

.replace-banner_stock {
    margin-top: 12px;
    font-size: 14px;
}

.replace-banner_btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: #fff;
    border: 1.5px solid #fff;
    border-radius: 50px;
    color: var(--shop-red-dark);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}

.replace-banner_btn:hover {
    background: transparent;
    color: #fff;
}

.replace-banner_btn.is-outline {
    background: transparent;
    color: #fff;
}

.replace-banner_btn.is-outline:hover {
    background: #fff;
    color: var(--shop-red-dark);
}

.replace-banner_btn.is-whatsapp {
    background: var(--shop-green);
    border-color: var(--shop-green);
    color: #fff;
}

.replace-banner_btn.is-whatsapp:hover {
    background: transparent;
    border-color: #fff;
}

.replace-banner_btn.is-stock {
    padding: 6px 16px;
    background: #ffc107;
    border-color: #ffc107;
    color: var(--shop-ink);
    font-size: 14px;
}

.replace-banner_btn.is-stock:hover {
    background: transparent;
    color: #ffc107;
}

@media (max-width: 767.98px) {
    .replace-banner_img {
        max-height: 80px;
    }
}

/* Phones can't fit a row of three, so the buttons fill each row evenly
   instead of leaving one stranded, and the stock label gets its own line */
@media (max-width: 575.98px) {
    .replace-banner_btn {
        flex: 1 1 140px;
        justify-content: center;
    }

    .replace-banner_stock > span {
        flex-basis: 100%;
    }
}
