/* ==========================================================================
   Extra products (staff-named groups, e.g. candy), cart/_offers.php. Under the cart lines and in the
   added-to-cart sheet, so this loads on every page like cart-sheet.css.
   Staff pick per group (display): row = image-first cards like "Se även", the picture sells;
   compact = small picture beside the name, for a quieter row; button = one line that opens the
   group in a dialog over the cart. Rows scroll sideways at every width; arrows beside the heading from 701 px.
   ========================================================================== */
.sp-cart-offer-error { margin-bottom: 16px; }
.sp-cart-offers + .sp-cart-offers { margin-top: 36px; }
.sp-cart-offers-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sp-cart-offers h2 { flex: 1; margin: 0; font-size: var(--sp-fs-h3); font-weight: 600; line-height: 1.2; }
.sp-cart-offers-all { font-size: var(--sp-fs-ui); font-weight: 500; color: var(--sp-action); white-space: nowrap; }
body.sp .sp-cart-offers-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.sp-cart-offers-nav { display: none; gap: 8px; }
.sp-cart-offers-arrow {
    display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--sp-line-strong); background: var(--sp-paper); color: var(--sp-ink); cursor: pointer;
}
.sp-cart-offers-arrow svg { width: 18px; height: 18px; }
body.sp .sp-cart-offers-arrow:hover:not(:disabled) { background: var(--sp-surface); }
.sp-cart-offers-arrow:disabled { color: var(--sp-ink-faint); box-shadow: inset 0 0 0 1px var(--sp-line); cursor: default; }
.sp-cart-offers-arrow:focus-visible { outline: 2px solid var(--sp-focus); outline-offset: 2px; }
.sp-cart-offer-list {
    display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: var(--sp-gap);
    margin: 0 calc(var(--sp-gutter) * -1); padding: 0 var(--sp-gutter); list-style: none;
    overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--sp-gutter); scrollbar-width: none; overscroll-behavior-x: contain;
}
.sp-cart-offer-list::-webkit-scrollbar { display: none; }
@media (min-width: 701px) {
    .sp-cart-offers-nav { display: inline-flex; }
}
.sp-cart-offer { scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sp-cart-offer-img {
    display: grid; place-items: center; aspect-ratio: 1; padding: 12px;
    border-radius: var(--sp-r-tile); background: var(--sp-surface); overflow: hidden;
}
.sp-cart-offer-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; transition: transform var(--sp-slow) var(--sp-ease); }
@media (hover: hover) { .sp-cart-offer:hover .sp-cart-offer-img img { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .sp-cart-offer-img img { transition: none; } }
.sp-cart-offer-img svg { width: 40%; height: 40%; color: var(--sp-ink-faint); }
.sp-cart-offer-name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 0 2px;
    font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--sp-ink-soft); overflow-wrap: anywhere;
}
body.sp a.sp-cart-offer-name:hover { color: var(--sp-ink); text-decoration: underline; text-underline-offset: 3px; }
/* The price is the add button: full width, tinted green, price left, plus right. In the cart: solid green and the count. */
.sp-cart-offer-add { margin: auto 0 0; padding-top: 2px; }
.sp-cart-offer-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: var(--sp-hit); padding: 0 14px;
    border: 0; border-radius: var(--sp-r-ctl); background: var(--sp-t1); color: var(--sp-action);
    font: 600 var(--sp-fs-ui) var(--sp-font); font-variant-numeric: tabular-nums; cursor: pointer;
    transition: background var(--sp-fast), color var(--sp-fast);
}
@media (hover: hover) { body.sp .sp-cart-offer-btn:hover { background: var(--sp-t2); } }
.sp-cart-offer-plus { position: relative; display: grid; place-items: center; flex: none; }
.sp-cart-offer-plus > svg { width: 20px; height: 20px; }
.sp-cart-offer-btn.is-in { background: var(--sp-action); color: var(--sp-paper); }
@media (hover: hover) { body.sp .sp-cart-offer-btn.is-in:hover { background: var(--sp-action-hover); } }
.sp-cart-offer-btn:disabled { opacity: .6; cursor: progress; }
/* Room for the sticky checkout bar when focus scrolls a card into view */
.sp-cart-offer-btn { scroll-margin: 24px 0 100px; }
.sp-cart-offer-btn:focus-visible { outline: 2px solid var(--sp-focus); outline-offset: 2px; }
/* How many are already in the cart, on the plus; the words are in .sp-cart-offer-count for screen readers */
.sp-cart-offer-badge {
    position: absolute; top: -9px; right: -11px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--sp-paper); color: var(--sp-action);
    font: 700 11px/18px var(--sp-font); text-align: center;
}

/* In the sheet: after the two ways on, edge to edge with the sheet's padding */
.sp-sheet .sp-cart-offers { padding-top: 4px; }
.sp-sheet .sp-cart-offer-list { margin: 0 -28px; padding: 0 28px; scroll-padding: 0 28px; }
@media (max-width: 700px) {
    .sp-sheet .sp-cart-offer-list { grid-auto-columns: 40%; margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; }
}

/* --- Small cards: picture beside the name and price, about three to a row on desktop --- */
.sp-cart-offers--compact .sp-cart-offer-list { grid-auto-columns: 80%; }
.sp-cart-offers--compact .sp-cart-offer { display: grid; grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 6px 12px; }
.sp-cart-offers--compact .sp-cart-offer-img { grid-row: 1 / 3; align-self: start; width: 88px; padding: 8px; border-radius: 12px; }
.sp-cart-offers--compact .sp-cart-offer-name { align-self: start; padding: 2px 0 0; }
.sp-cart-offers--compact .sp-cart-offer-add { padding: 0; }
.sp-sheet .sp-cart-offers--compact .sp-cart-offer-list { grid-auto-columns: 72%; }

/* --- Button: one line with a few pictures that opens the group in a dialog --- */
.sp-cart-offer-open {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 16px;
    border: 0; border-radius: var(--sp-r-tile); background: var(--sp-surface); color: var(--sp-ink);
    font: inherit; text-align: left; cursor: pointer; transition: background var(--sp-fast);
}
@media (hover: hover) { body.sp .sp-cart-offer-open:hover { background: var(--sp-surface-2); } }
.sp-cart-offer-open:focus-visible { outline: 2px solid var(--sp-focus); outline-offset: 2px; }
.sp-cart-offer-open > svg { flex: none; width: 20px; height: 20px; margin-left: auto; color: var(--sp-ink-soft); }
.sp-cart-offer-thumbs { display: flex; flex: none; }
.sp-cart-offer-thumbs img {
    width: 52px; height: 52px; padding: 4px; border-radius: 12px; background: var(--sp-paper);
    box-shadow: 0 0 0 2px var(--sp-surface); object-fit: contain;
}
.sp-cart-offer-thumbs img + img { margin-left: -16px; }
.sp-cart-offer-open-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-cart-offer-open-title { font-size: var(--sp-fs-h3); font-weight: 600; line-height: 1.25; }
.sp-cart-offer-open-sub { font-size: 13px; color: var(--sp-ink-soft); font-variant-numeric: tabular-nums; }

/* --- The dialog: one product per line, the price button on the right, the whole range at the bottom --- */
.sp-cart-offer-dialog { --pad: 28px; width: min(620px, calc(100% - 32px)); }
/* Heading with the X and the whole-range link stay in view while the list scrolls under them */
.sp-cart-offer-dialog .sp-dialog-head {
    position: sticky; top: calc(var(--pad) * -1); z-index: 1;
    margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0; padding: var(--pad) var(--pad) 12px; background: var(--sp-paper);
}
.sp-cart-offer-foot {
    position: sticky; bottom: calc(var(--pad) * -1); z-index: 1;
    margin: 0 calc(var(--pad) * -1) calc(var(--pad) * -1); padding: 12px var(--pad) var(--pad);
    border-top: 1px solid var(--sp-line); background: var(--sp-paper);
}
.sp-cart-offer-dialog .sp-cart-offer-error { margin: 8px 0; }
.sp-cart-offer-list--dialog { display: block; margin: 0; padding: 0; overflow: visible; scroll-snap-type: none; }
.sp-cart-offer-list--dialog .sp-cart-offer {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px;
    padding: 10px 0; border-top: 1px solid var(--sp-line);
}
.sp-cart-offer-list--dialog .sp-cart-offer:first-child { border-top: 0; }
.sp-cart-offer-list--dialog .sp-cart-offer-img { width: 64px; padding: 6px; border-radius: 12px; }
.sp-cart-offer-list--dialog .sp-cart-offer-name { padding: 0; font-size: var(--sp-fs-ui); color: var(--sp-ink); }
.sp-cart-offer-list--dialog .sp-cart-offer-add { margin: 0; padding: 0; }
.sp-cart-offer-list--dialog .sp-cart-offer-btn { width: auto; min-width: 104px; gap: 14px; scroll-margin: 16px; }
.sp-cart-offer-all {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--sp-hit);
    padding: 0 16px; border-radius: var(--sp-r-ctl); box-shadow: inset 0 0 0 1px var(--sp-line-strong);
    font-weight: 600; font-size: var(--sp-fs-ui); color: var(--sp-ink);
}
.sp-cart-offer-all svg { width: 18px; height: 18px; flex: none; }
@media (hover: hover) { body.sp .sp-cart-offer-all:hover { background: var(--sp-surface); } }
@media (max-width: 700px) {
    .sp-cart-offer-dialog { --pad: 20px; width: calc(100% - 24px); }
    .sp-cart-offer-list--dialog .sp-cart-offer { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; }
    .sp-cart-offer-list--dialog .sp-cart-offer-img { width: 56px; }
    .sp-cart-offer-list--dialog .sp-cart-offer-btn { min-width: 92px; padding: 0 12px; }
}
