:root {
    --product-card-width: 248px;
    --product-card-media-height: 188px;
    --product-card-gap: 15px;
}

.offer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--product-card-width));
    justify-content: start;
    align-items: stretch;
    gap: var(--product-card-gap);
}

.deal-strip {
    display: grid;
    grid-auto-columns: var(--product-card-width);
    grid-auto-flow: column;
    gap: var(--product-card-gap);
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x proximity;
    scrollbar-color: #b8b7ac transparent;
}

.offer-grid .offer-card,
.deal-strip .offer-card {
    width: 100%;
}

.deal-strip .offer-card {
    scroll-snap-align: start;
}

.offer-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
    transition: transform .2s ease, box-shadow .2s ease;
}

.offer-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.offer-visual {
    position: relative;
    width: 100%;
    height: var(--product-card-media-height);
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(24,34,29,.055);
    border-radius: 12px;
    background: #fff;
}

.offer-visual > img {
    position: absolute;
    inset: 13px;
    display: block;
    width: calc(100% - 26px);
    height: calc(100% - 26px);
    max-width: none;
    max-height: none;
    padding: 0;
    object-fit: contain;
    object-position: center;
}

.offer-card.source-carrefour .offer-visual {
    background: #fff;
}

.offer-card.source-carrefour .offer-visual > img {
    width: calc(100% - 26px);
    height: calc(100% - 26px);
    max-width: none;
    max-height: none;
}

.product-image-preview {
    position: fixed;
    z-index: 1000;
    display: grid;
    pointer-events: none;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(24,34,29,.14);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 65px rgba(24,34,29,.24);
    opacity: 1;
    transform: translateZ(0);
}

.product-image-preview-media {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: #fff;
}

.product-image-preview-copy {
    min-width: 0;
    padding: 20px 21px;
    border-top: 1px solid rgba(24,34,29,.1);
    background: #fbfaf5;
}

.product-image-preview.layout-side .product-image-preview-copy {
    border-top: 0;
    border-left: 1px solid rgba(24,34,29,.1);
}

.product-image-preview.layout-side.description-left .product-image-preview-copy {
    border-right: 1px solid rgba(24,34,29,.1);
    border-left: 0;
}

.product-image-preview-copy strong,
.product-image-preview-copy small {
    display: block;
}

.product-image-preview-copy strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.3;
}

.product-image-preview-copy small {
    margin-top: 5px;
    color: var(--green);
    font-size: 10px;
    font-weight: 750;
}

.product-image-preview-copy p {
    display: -webkit-box;
    margin: 12px 0 0;
    overflow: hidden;
    color: #59615c;
    font-size: 12px;
    line-height: 1.52;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
}

.product-image-preview.layout-stack .product-image-preview-copy p {
    -webkit-line-clamp: 4;
}

.product-image-preview[hidden] {
    display: none;
}

.product-image-preview img {
    position: absolute;
    inset: 50% auto auto 50%;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: contain;
    object-position: center;
    transform: translate(-50%, -50%);
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 9px;
    border-radius: 7px;
    color: white;
    background: var(--orange);
    font-weight: 700;
}

.discount-badge.regular-price {
    color: var(--green);
    background: #e9eddc;
    font-size: 11px;
}

.store-logo-badge {
    position: absolute;
    z-index: 2;
    bottom: 10px;
    left: 10px;
    width: 38px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 4px;
    border: 1px solid rgba(24,34,29,.12);
    border-radius: 10px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 3px 12px rgba(24,34,29,.14);
}

.store-logo-badge img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.store-logo-badge.fallback {
    color: var(--green);
    font: 800 13px system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.favorite-toggle {
    position: absolute;
    z-index: 2;
    top: 9px;
    right: 9px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(21,75,54,.28);
    border-radius: 50%;
    color: var(--green);
    background: rgba(255,255,255,.96);
    box-shadow: 0 3px 12px rgba(24,34,29,.12);
    font-size: 23px;
    line-height: 1;
    font-weight: 900;
    transition: transform .18s ease, color .18s ease, background .18s ease;
}

.favorite-toggle:hover {
    transform: scale(1.08);
}

.favorite-toggle.selected {
    color: white;
    background: var(--green);
    border-color: var(--green);
}

.favorite-toggle:disabled {
    opacity: .55;
    cursor: wait;
}

.store-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 13px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.store-name {
    color: var(--green);
    font-weight: 700;
}

.product-name {
    min-height: 64px;
    margin: 8px 0 2px;
    font: 700 15px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.product-name a {
    color: inherit;
    text-decoration: none;
}

.product-name a:hover {
    color: var(--green);
    text-decoration: underline;
}

.product-meta,
.unit-price {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.offer-card .unit-price {
    padding-bottom: 12px;
}

.offer-condition {
    margin: 8px 0 0;
    padding: 7px 9px;
    border-radius: 8px;
    color: #714116;
    background: #fff1d9;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.offer-card .offer-condition:not([hidden]) {
    margin-bottom: 12px;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 13px;
}

.price {
    font: 800 21px system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.old-price {
    color: #929990;
}

.offer-card .add-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    margin-top: auto;
    padding: 10px 12px;
    border: 1px solid var(--green);
    border-radius: 10px;
    color: var(--green);
    background: transparent;
    font-weight: 700;
}

.offer-card .add-button.selected {
    color: white;
    background: var(--green);
}

@media (hover: none), (pointer: coarse) {
    .product-image-preview {
        display: none !important;
    }
}

@media (hover: hover) and (pointer: fine) {
    .offer-visual.has-image-preview {
        cursor: zoom-in;
    }
}

@media (max-width: 540px) {
    .offer-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .deal-strip {
        grid-auto-columns: min(var(--product-card-width), 82vw);
    }
}
