.product-thumbnail img {
    max-width: 255px;
    height: 255px;
    object-fit: contain;
    filter: brightness(95%);
}
.middle-ribbon .product-thumbnail img {
    filter: brightness(98%);
}
.middle-ribbon .product-thumbnail {
    background: #fcfcfc;
}
.product-thumbnail {
    text-align: center;
    border-radius: 8px;
    background: #f2f2f2;
    height: 255px;
    position: relative;
}
/* Admin cart trigger sits inline next to the Exclude button. Square pill
   the same height as Exclude so they line up; tap to add/remove the ASIN
   from the floating cart. */
.cart-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #c8c8c8;
    background: #fff;
    color: #333;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
    flex-shrink: 0;
}
.cart-toggle-btn:hover { background: #f5f5f5; }
.cart-toggle-btn.is-in-cart {
    background: var(--theme-bg-strong-color, #d98641);
    color: #fff;
    border-color: var(--theme-bg-strong-color, #d98641);
}
.cart-toggle-btn.is-in-cart:hover { background: var(--theme-bg-color-light, #bf711d); }
/* Floating admin cart (bottom-right). Sits *above* the back-to-top button
   so the two don't overlap when both are visible. FAB is always-on once
   items are added; the expandable panel pops above it. */
.admin-cart-wrap {
    position: fixed;
    right: 1.5rem;
    bottom: 5rem;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
@media (max-width: 600px) {
    /* On phones .back-to-top is bigger and sits at bottom: 5rem, so push the
       cart further up to keep clear of it. */
    .admin-cart-wrap { bottom: 10rem; }
}
.admin-cart-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--theme-bg-strong-color, #d98641);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-cart-fab:hover { transform: translateY(-2px); }
.admin-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fff;
    color: var(--theme-bg-strong-color, #d98641);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 7px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.admin-cart-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    width: min(360px, 90vw);
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.admin-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #ececec;
    font-size: 14px;
}
.admin-cart-empty {
    padding: 18px 14px;
    text-align: center;
    color: #888;
    font-size: 13px;
}
.admin-cart-list {
    list-style: none;
    padding: 6px 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}
.admin-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid #f4f4f4;
}
.admin-cart-item:last-child { border-bottom: none; }
.admin-cart-item img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fafafa;
    border-radius: 6px;
    flex-shrink: 0;
}
.admin-cart-meta { flex: 1; min-width: 0; }
.admin-cart-title {
    font-size: 13px;
    line-height: 1.3;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.admin-cart-asin { font-size: 11px; color: #888; margin-top: 2px; }
.admin-cart-remove {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(180, 30, 30, 0.1);
    color: #b41e1e;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.admin-cart-remove:hover { background: rgba(180, 30, 30, 0.2); }
.admin-cart-footer {
    padding: 10px 14px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #ececec;
    background: #fafafa;
}
.product {
    border: 1px solid #f2f2f2;
    border-radius: 8px;
    position: relative;
    max-width: 600px;
    background: #f8f8f8;
}
.product.sticky {
    border: 2px solid orange;
}
.product .badge-orange {
    background: orange !important;
    top: 0px !important;
}
.product-title {
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.product-title:hover,
.product-title:active {
    color: #bf711d;
}
.product .sick-deal-badge {
    position: absolute;
    top: 1px;
    right: 30px;
    background: #666;
    font-size: 14px;
    pointer-events: none;
    border-radius: 0 0 6px 6px;
    padding: 3px 10px;
}
/* Tiny corner cue that a coupon exists. The discount value + Copy button live in the
   price area; this is just a glance-icon to flag the product even before the user
   reads the price row. Brand orange so the cue blends with the site theme. */
.coupon-marker {
    position: absolute;
    top: 1px;
    left: 8px;
    background: var(--theme-bg-color, #f29c55);
    color: #fff;
    font-size: 13px;
    pointer-events: none;
    border-radius: 0 0 6px 6px;
    padding: 3px 6px;
}

/* A "second chip" rendered in the price area beside the regular discount, so a coupon
   reads like a real discount instead of a side note. Theme orange. */
.product-price-discount.coupon-extra,
.scroll-discount.coupon-extra {
    background: var(--theme-bg-color, #f29c55);
    color: #fff;
}
.product-price-discount.coupon-extra .bi,
.scroll-discount.coupon-extra .bi {
    margin-right: 3px;
    font-size: 0.9em;
}

/* Copy-coupon button. Placed right under the price so the action is obviously
   connected to the chip above. Code-coupon variant shows the code inside a <code>
   pill; URL-coupon variant is a plain "Apply coupon" link button. */
.coupon-action {
    margin-top: 6px;
}

/* ===== Product detail page ===== */
.pd-breadcrumb {
    margin: 15px 0 4px;
    font-size: 14px;
    color: #888;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.pd-breadcrumb a { color: #555; text-decoration: none; }
.pd-breadcrumb a:hover { color: var(--theme-bg-color, #bf711d); text-decoration: underline; }
.pd-breadcrumb a:first-child { font-weight: 600; }
.pd-crumb-sep { color: #ccc; }

.pd-top {
    display: flex;
    align-items: stretch;   /* sidebar stretches to the details column's height */
    gap: 24px;
    margin-top: 16px;
}
/* Details takes its content width (image + a comfortable info column); it does NOT
   grow, so the leftover space goes to the Top Deals sidebar instead of stretching the
   price box. */
.pd-details { flex: 0 1 auto; min-width: 0; }
.pd-details-grid {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.pd-hero {
    position: relative;
    /* Hug the image instead of reserving a fixed 42% column — otherwise there's dead
       space between the image and the details. The image's own max-width sets the size. */
    flex: 0 0 auto;
    text-align: left;
}
.pd-hero img {
    width: auto;
    max-width: 340px;
    max-height: 380px;
    object-fit: contain;
}
/* Comfortable info column width so the price box doesn't stretch the whole page. */
.pd-info { flex: 0 1 560px; min-width: 0; }
/* Brand on its own bold line, title (rest) smaller below it. */
.pd-brand-name { font-weight: 800; font-size: 1.15rem; margin: 0 0 2px; }
.pd-name { font-size: 1.02rem; font-weight: 600; line-height: 1.35; color: #333; margin: 0 0 14px; }

.pd-prices {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: #fcfcfc;
}
.pd-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.pd-price-label { color: #777; font-size: 14px; min-width: 110px; }
.pd-price-strike { color: #999; text-decoration: line-through; }
.pd-price-current { font-size: 20px; font-weight: 700; }
.pd-price-coupon .pd-coupon-amount {
    color: #fff;
    background: var(--theme-bg-color, #f29c55);
    padding: 2px 10px;
    border-radius: 6px;
    font-weight: 700;
}
.pd-price-final { border-top: 1px dashed #e0e0e0; margin-top: 4px; padding-top: 10px; }
.pd-final-amount { font-size: 24px; font-weight: 900; color: #1d7c4d; }

.pd-coupon-action { margin-bottom: 14px; }

/* Two-step CTA row: [1 copy code]  →  [2 Ver en Amazon]. Both buttons equal width. */
.pd-cta-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 6px;
}
.pd-cta-row .pd-cta {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    border-radius: 10px;
    white-space: normal;
    text-align: center;
}
/* Numbered step badge — translucent disc on the orange buttons. */
.pd-cta .pd-step {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}
.pd-cta .pd-cta-label { min-width: 0; }
/* The order arrow between the two buttons. */
.pd-cta-arrow {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-bg-strong-color, #d98641);
    font-size: 20px;
}
/* Stack on very narrow screens; arrow rotates to keep pointing "next". */
@media (max-width: 480px) {
    .pd-cta-row { flex-direction: column; gap: 8px; }
    .pd-cta-arrow { transform: rotate(90deg); }
}

.pd-reveal-btn { cursor: pointer; }
.pd-reveal-btn .pd-reveal-code {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-size: 13px;
}
.pd-coupon-hint { font-size: 12px; color: #999; margin-top: 4px; }
.pd-coupon-guide-link {
    color: var(--link-color, #0077cc);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    white-space: nowrap;
}
.pd-coupon-guide-link:hover { text-decoration: underline; }
.pd-amazon { margin-top: 4px; }

/* Right sidebar — grows to fill the space left after image + details, scrolls within
   the details column's height. */
.pd-sidebar {
    position: relative;
    flex: 1 1 300px;
    min-width: 280px;
}
.pd-sidebar-inner {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}
.pd-sidebar-title, .pd-related-title { font-size: 1.05rem; margin: 0 0 12px; }

/* Compact product card used in both sidebar and related grid */
.pd-card {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.pd-card:hover { background: #f6f6f6; color: inherit; }
.pd-card-img { position: relative; flex: 0 0 64px; width: 64px; height: 64px; }
.pd-card-img img { width: 100%; height: 100%; object-fit: contain; }
.pd-card-img .coupon-marker { top: -2px; left: -2px; padding: 2px 5px; font-size: 11px; }
.pd-card-body { min-width: 0; flex: 1; }
.pd-card-brand { font-weight: 700; font-size: 12px; }
.pd-card-title {
    font-size: 13px; line-height: 1.3; margin: 2px 0 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pd-card-price { font-size: 13px; }

.pd-related { margin-top: 28px; }
.pd-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);   /* 4 per row, bigger cards */
    gap: 16px;
}
/* Related cards are vertical (big image on top) for visibility, vs the compact
   horizontal cards used in the sidebar. */
.pd-related-grid .pd-card {
    flex-direction: column;
    padding: 10px;
    border: 1px solid #eee;
}
.pd-related-grid .pd-card-img {
    flex: none;
    width: 100%;
    height: 150px;
}
.pd-related-grid .pd-card-title {
    -webkit-line-clamp: 3;
    font-size: 14px;
}
.pd-related-grid .pd-card-price { font-size: 14px; }
@media (max-width: 900px) {
    .pd-related-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .pd-related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Stack on narrow screens: sidebar drops below the details. */
@media (max-width: 768px) {
    .pd-top { flex-direction: column; gap: 12px; }   /* tighter gap between details and sidebar */
    /* Reset the horizontal flex-basis values — in a column they'd become VERTICAL sizes
       and reserve huge empty height. Everything sizes to its content instead. */
    .pd-details { flex: 0 0 auto; }
    .pd-details-grid { flex-direction: column; align-items: stretch; }
    .pd-info { flex: 0 0 auto; }
    .pd-hero { flex: 0 0 auto; max-width: 100%; }
    /* Image ~40% smaller on mobile. */
    .pd-hero img { max-width: 200px; max-height: 230px; }

    .pd-sidebar { flex: 0 0 auto; max-width: 100%; }
    .pd-sidebar-inner { position: static; max-height: none; overflow: visible; padding: 10px 0 0; border: none; box-shadow: none; }
    /* Right category becomes a horizontal scroll strip instead of a vertical list. */
    .pd-sidebar-cards {
        display: flex;
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 6px;
    }
    .pd-sidebar-cards .pd-card {
        flex: 0 0 auto;
        width: 150px;
        flex-direction: column;       /* image on top, text below — like a mini product card */
        scroll-snap-align: start;
        border: 1px solid #eee;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }
    .pd-sidebar-cards .pd-card-img {
        flex: none;
        width: 100%;
        height: 120px;
    }
    .pd-sidebar-cards .pd-card-title { -webkit-line-clamp: 2; }
}
.coupon-btn {
    background: var(--theme-bg-color, #f29c55);
    color: #fff;
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.2;
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    /* Keep the label on one line so the button stays compact instead of ballooning
       into a multi-line block. */
    white-space: nowrap;
}
.coupon-btn:hover, .coupon-btn:focus {
    background: #bf711d;  /* darker theme accent for hover */
    color: #fff;
    text-decoration: none;
}
.coupon-btn code {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}
.coupon-btn.copied {
    background: #bf711d;
}
.coupon-btn.copied::after {
    content: ' \2713';  /* checkmark */
    margin-left: 4px;
}

/* Admin-only banner that appears under the price when an ASIN lookup returned a
   product that isn't a live deal. Visually subdued — not a hot deal, just a result. */
.not-a-deal-notice {
    margin-top: 8px;
    padding: 6px 10px;
    border-left: 3px solid #bf711d;
    background: #fff4e6;
    color: #6c4318;
    font-size: 13px;
    border-radius: 0 4px 4px 0;
}
.not-a-deal-notice .bi {
    margin-right: 4px;
}
.not-a-deal-reasons {
    font-size: 11.5px;
    color: #8a6b3d;
    margin-top: 2px;
}
.product-grid {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.product-description {
    text-align: left;
    padding: 8px 10px;
    position: relative;
}
.product-price-container {
    line-height: 35px;
    vertical-align: middle;
}
.product-price {
    font-size: 20px;
    font-weight: bold;
}
.product-price-before {
    color: #999;
    text-decoration: line-through;
}
.product-price-discount {
    font-size: 20px;
    background: orange;
    color: #fff;
    font-weight: bold;
    padding: 4px;
    border-radius: 5px;
    margin: 4px;
}
.product-buttons {
    padding-top: 30px;
    display: flex;
    justify-content: space-between;
}
.product-buttons > .left-items {
    display: flex;
    gap: 2px;
}
.disclaimer {
    color: #777;
    font-size: 14px;
    margin: 20px 0;
    padding: 20px 0;
    text-align: justify;
}
button.decision-button {
    height: 40px;
}
#deals-menu-container {
    position: relative;
    z-index: 100;
}
#deals-bar {
    background: #fafafa;
    width: 100%;
    padding: 8px 0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #e8e8e8;
}
.deals-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-container {
    flex: 1;
    min-width: 0;
    line-height: 36px;
    display: flex;
    position: relative;
}
.search-container input {
    width: 100%;
    padding: 0 32px 0 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    height: 38px;
    background: #fff;
}
.search-container .bi-search {
    font-size: 18px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}
.bar-icon-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 16px;
    color: #666;
    cursor: pointer;
}
.bar-icon-btn:hover {
    background: #f5f5f5;
    color: #333;
}
.bar-icon-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}
.bar-icon-btn.has-label {
    width: auto;
    padding: 0 10px;
    gap: 6px;
}
.bar-icon-label {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Drawer */
#deals-drawer {
    background: #fff;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    padding: 16px 0;
}
.drawer-enter-active, .drawer-leave-active {
    transition: all 0.2s ease;
    max-height: 500px;
    opacity: 1;
}
.drawer-enter-from, .drawer-leave-to {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
}
#deals-drawer {
    position: relative;
    z-index: 1;
}
.drawer-section {
    margin-bottom: 14px;
}
.drawer-section:last-child {
    margin-bottom: 0;
}
.drawer-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 8px;
}
.drawer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.drawer-options button {
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    color: #555;
    cursor: pointer;
}
.drawer-options button.active {
    background: #333;
    color: #fff;
    border-color: #333;
}
.drawer-options button:hover:not(.active) {
    background: #f5f5f5;
}
.drawer-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}
.drawer-categories button {
    padding: 5px 12px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}
.drawer-categories button.active {
    background: #333;
    color: #fff;
    border-color: #333;
}
.drawer-categories button:hover:not(.active) {
    background: #f5f5f5;
}
.cat-count {
    color: inherit;
    opacity: 0.6;
    font-size: 12px;
}

/* Category Tree */
.drawer-tree {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}
.tree-row {
    display: flex;
    align-items: center;
    padding: 2px 0;
}
.tree-toggle {
    width: 20px;
    text-align: center;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
}
.tree-toggle:hover {
    color: #333;
}
.tree-toggle-spacer {
    width: 20px;
    flex-shrink: 0;
}
.tree-row button {
    padding: 4px 10px;
    font-size: 13px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    color: #444;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-row button:hover {
    background: #f5f5f5;
}
.tree-row button.active {
    background: #333;
    color: #fff;
    border-color: #333;
}
select {
    font-size: 18px;
    padding: 5px;
}
.more-results {
    margin: 5px;
    margin-top: 30px;
    border-radius: 4px;
    padding: 6px 12px;
    background: #fff;
}
.price-update-time-warning {
    font-size: 12px;
    color: #777;
}
.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9999;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
    cursor: pointer;
    background: #fc9003;
    color: #f9fafb;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}
.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
}
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.fade-enter-from,
.fade-leave-to {
    opacity: 0;
    transform: translateY(10px);
}
.product-attribute {
    color: #666;
    font-size: 13px;
}

/* ========== Homepage Sections ========== */
.homepage-sections {
    padding: 4px 0 10px;
}

/* Promo Carousel */
.promo-carousel {
    position: relative;
    margin-bottom: 20px;
}
/* Mosaic is a fluid 4-column grid that scales proportionally with the page width.
   Row height and gap are container-relative (cqw) so the whole layout zooms in/out
   without any breakpoints — no rearrangement on resolution change. The choice
   between mosaic and mobile carousel is decided server-side via UA detection
   (see .is-mobile-device override below). */
.promo-carousel {
    container-type: inline-size;
    container-name: promo-shelf;
}
.promo-carousel-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* ~200px when the container is ~1170px wide; scales smoothly in either direction. */
    grid-auto-rows: 17cqw;
    grid-auto-flow: dense;
    gap: 1.2cqw;
}
.promo-carousel-dots {
    display: none;
}

/* Promo Banners */
.promo-banner {
    border-radius: 16px;
    overflow: hidden;
    transform: translateY(0) scale(1);
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
    transform-origin: center center;
}
/* Whole-tile lift on hover. The parent transform carries every descendant
   (title, image, button) along with it — koupon.ai-style motion, no shadow. */
.promo-banner:hover {
    transform: translateY(-10px) scale(1.04);
    z-index: 2;
}
/* Mobile carousel: single tile fills the width, so we skip the lift to avoid
   a weird half-visible shift. */
.promo-carousel.is-mobile-device .promo-banner:hover {
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    .promo-banner {
        transition: none;
    }
    .promo-banner:hover {
        transform: none;
    }
}
.promo-banner-color-0 {
    background: linear-gradient(135deg, #ffb6d9 0%, #f8c8e0 50%, #e8d5f0 100%);
}
.promo-banner-color-1 {
    background: linear-gradient(135deg, #b6e6ff 0%, #c8e0f8 50%, #d5e8f0 100%);
}
.promo-banner-color-2 {
    background: linear-gradient(135deg, #b6ffcc 0%, #c8f8d5 50%, #d5f0e0 100%);
}

/* Phone/tablet mode: server-side UA flag triggers a single-banner carousel instead
   of the desktop mosaic. No viewport breakpoints — switching is data-driven.
   This is a TRANSFORM-driven slider, NOT native scroll: the container clips overflow
   and JS positions .promo-carousel-track via translateX. Native scroll momentum was
   removed because it flings past multiple slides on a hard swipe (see deals-base.js
   carousel methods). */
.promo-carousel.is-mobile-device {
    overflow: hidden;
    /* Stop horizontal gestures here from bubbling into the browser's edge back/forward
       swipe navigation, which on iOS Safari would hijack a past-the-edge over-swipe and
       leave the carousel unresponsive. */
    overscroll-behavior-x: contain;
}
/* touch-action: pan-y must cover the WHOLE carousel subtree, not just the track.
   The finger lands on the banner / image / link inside, and those default to
   touch-action: auto — which lets iOS Safari interpret a right-edge swipe as its
   forward-navigation gesture and steal the touch. Forcing pan-y on every descendant
   tells the browser "vertical scroll is yours, horizontal is mine" everywhere a
   touch can start. */
.promo-carousel.is-mobile-device,
.promo-carousel.is-mobile-device * {
    touch-action: pan-y;
}
.promo-carousel.is-mobile-device .promo-carousel-track {
    display: flex;
    flex-wrap: nowrap;
    /* The track is exactly one container wide; children overflow to the right and JS
       slides the whole track left by -100% per index. touch-action keeps vertical
       page scroll working while we handle horizontal drags ourselves. */
    width: 100%;
    touch-action: pan-y;
    gap: 0;
    grid-auto-rows: initial;
    /* No `will-change: transform` here on purpose — permanently promoting the track to a
       compositor layer triggered an iOS Safari hit-test bug where touch events stopped
       reaching it after the first transformed gesture. Transform animations are still
       composited fine without it. */
}
.promo-carousel.is-mobile-device .promo-banner {
    flex: 0 0 100%;
    border-radius: 12px;
    /* Fixed height for every slide. Without this, the flex row sizes to the tallest
       image and the other slides' cover-images get stretched to match. A fixed height
       makes every slide identical and lets each image fill its box consistently. */
    height: 200px;
    /* Drop any per-tile grid-column / grid-row spans inherited from desktop. */
    grid-column: auto !important;
    grid-row: auto !important;
}

/* Mobile CATEGORY-banner layout (NOT link tiles): text fills the left, the square
   Amazon product image fits on the right. Link tiles are excluded — they're designed
   full-bleed promo graphics and keep the desktop image-cover + text-overlay treatment
   (which the general .promo-banner:has(.promo-banner-img) rules above already provide). */
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) {
    background: #ececec;
}
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-link {
    flex-direction: row;
    align-items: stretch;
    /* Kill the link padding on the image side so the photo can span the full banner
       height with no top/bottom margin. */
    padding: 0;
}
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-content {
    /* Restore inner spacing for the text column only (the link padding is now 0). */
    padding: 24px;
    flex: 1;
}
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-img {
    position: relative;
    inset: auto;
    flex: 0 0 45%;
    width: 45%;
    /* Stretch to the full banner height (no vertical centering gap). */
    height: auto;
    align-self: stretch;
    background: transparent;
    animation: none;
}
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-img img {
    width: 100%;
    height: 100%;
    /* contain: the whole product is scaled to fit, keeping aspect ratio — never cropped.
       Any leftover space around it shows the banner's background colour. */
    object-fit: contain;
    object-position: right center;
    filter: none;
}
/* Category banner text colours (no dark image scrim behind it like the tile/desktop case). */
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-title,
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img):nth-child(2n) .promo-banner-title,
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img):nth-child(3n) .promo-banner-title {
    color: #1a5276;
}
.promo-carousel.is-mobile-device .promo-banner:not(.promo-banner-tile):has(.promo-banner-img) .promo-banner-subtitle {
    color: #444;
}
.promo-carousel.is-mobile-device .promo-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 4px;
}
.promo-carousel.is-mobile-device .promo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d0d0d0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.promo-carousel.is-mobile-device .promo-dot.active {
    background: var(--theme-bg-strong-color);
    transform: scale(1.3);
}
.promo-banner-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    height: 100%;
    min-height: 180px;
    padding: 24px;
    gap: 16px;
    box-sizing: border-box;
}
.promo-banner-link:hover {
    color: inherit;
}
.promo-banner-content {
    flex: 1;
    min-width: 0;
    z-index: 1;
}
.promo-banner-title {
    font-size: 26px;
    font-weight: 900;
    color: #c0192c;
    margin: 0 0 8px;
    line-height: 1.2;
}
.promo-banner:nth-child(2n) .promo-banner-title {
    color: #1a5276;
}
.promo-banner:nth-child(3n) .promo-banner-title {
    color: #1a7642;
}
.promo-banner-subtitle {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
    line-height: 1.4;
    max-width: 320px;
    /* Render textarea line breaks as actual line breaks. pre-line collapses
       runs of spaces but keeps every \n the admin typed. The ::before pseudo
       inherits this so the shadow halo wraps the same way. */
    white-space: pre-line;
}
.promo-banner-btn {
    display: inline-block;
    background: #fff;
    color: #222;
    font-weight: 700;
    font-size: 15px;
    padding: 10px 24px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.promo-banner-img {
    flex: 0 0 auto;
    width: 200px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.promo-banner-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.15));
}

/* Banner with an image: stretch the image across the whole tile and overlay
   the text on top with a soft scrim so titles stay legible. The colored
   gradient fallback above still applies when no image is set. */
.promo-banner:has(.promo-banner-img) {
    position: relative;
    background: #2a2a2a;
}
.promo-banner:has(.promo-banner-img) .promo-banner-img {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    z-index: 0;
    /* Soft gray shimmer behind the <img> — visible only while the photo is loading
       (or if it 404s). Once the image is decoded it covers the box completely. */
    background-color: #d8d8d8;
    background-image: linear-gradient(100deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 70%);
    background-size: 220% 100%;
    background-repeat: no-repeat;
    animation: promo-banner-img-shimmer 1.6s ease-in-out infinite;
}
.promo-banner:has(.promo-banner-img) .promo-banner-img img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    filter: none;
    position: relative;
    z-index: 1;
}
@keyframes promo-banner-img-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .promo-banner:has(.promo-banner-img) .promo-banner-img {
        animation: none;
    }
}
.promo-banner:has(.promo-banner-img) .promo-banner-content {
    position: relative;
    z-index: 1;
}
.promo-banner:has(.promo-banner-img) .promo-banner-title,
.promo-banner:has(.promo-banner-img):nth-child(2n) .promo-banner-title,
.promo-banner:has(.promo-banner-img):nth-child(3n) .promo-banner-title {
    color: #fff;
}
.promo-banner:has(.promo-banner-img) .promo-banner-subtitle {
    color: #f0f0f0;
}

/* Multi-image banner: prev/next arrows on the sides + dots at the bottom.
   Only the button inside is a link, so arrows can be clicked without navigating. */
.promo-banner-multi {
    position: relative;
}
.promo-banner-multi .promo-banner-link {
    position: relative;
}
.promo-banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}
.promo-banner-arrow svg {
    display: block;
}
.promo-banner-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}
.promo-banner-arrow-prev { left: 12px; }
.promo-banner-arrow-next { right: 12px; }
.promo-banner-image-dots {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 3;
}
.promo-banner-image-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.45);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.promo-banner-image-dot.active {
    background: var(--theme-bg-strong-color);
    border-color: rgba(0, 0, 0, 0.55);
    transform: scale(1.2);
}
/* When the button is hidden but the banner still needs to be clickable (multi-image mode),
   this transparent overlay covers the tile under the arrows/dots/content. */
.promo-banner-fullclick {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-decoration: none;
}
/* The content block has to stay positioned (so the button isn't covered by the
   .promo-banner-fullclick overlay). Arrows and dots already have their own
   position:absolute / z-index, so we leave them alone here. */
.promo-banner-multi .promo-banner-content {
    position: relative;
    z-index: 2;
}
@media (max-width: 520px) {
    .promo-banner-arrow {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    .promo-banner-arrow-prev { left: 8px; }
    .promo-banner-arrow-next { right: 8px; }
}

/* Section Row */
.section-row {
    margin-bottom: 28px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 2px;
}
.section-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #222;
}
.see-all-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-bg-strong-color);
    text-decoration: none;
    white-space: nowrap;
}
.see-all-link:hover {
    color: var(--theme-bg-color-light);
}

/* Horizontal Scroll Container */
.scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #d8d8d8 transparent;
    margin: 0 -4px;
    padding: 0 4px 8px;
}
.scroll-container::-webkit-scrollbar {
    height: 6px;
}
.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}
.scroll-container::-webkit-scrollbar-thumb {
    background: #d8d8d8;
    border-radius: 3px;
}
.scroll-track {
    display: flex;
    gap: 12px;
}

/* Scroll Product Card */
.scroll-product-card {
    flex: 0 0 155px;
    border: 1px solid #f2f2f2;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}
.scroll-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    color: inherit;
}
.scroll-product-img {
    height: 170px;
    background: #fcfcfc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.scroll-product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.scroll-product-info {
    padding: 8px 10px 10px;
}
.scroll-product-brand {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.scroll-product-title {
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
    height: 34px;
}
.scroll-product-price {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.scroll-discount {
    font-size: 14px;
    background: orange;
    color: #fff;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}
.scroll-price {
    font-size: 17px;
    font-weight: 700;
    color: #111;
}
.scroll-price-before {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

/* Promo banner typography & padding scale proportionally with the mosaic container
   (cqw) instead of switching at viewport breakpoints. clamp() bounds them so they
   never get illegibly small on a phone or absurdly large on a 4K monitor. */
.promo-banner-link {
    padding: clamp(18px, 2cqw, 32px);
}
.promo-banner-title {
    font-size: clamp(20px, 2cqw, 30px);
}
.promo-banner-subtitle {
    font-size: clamp(15px, 1.3cqw, 19px);
}
.promo-banner-btn {
    font-size: clamp(13px, 1cqw, 16px);
}

/* Non-banner responsive bits stay as-is. */
@media (min-width: 520px) {
    .scroll-product-card {
        flex: 0 0 175px;
    }
}
@media (min-width: 768px) {
    .section-header h3 {
        font-size: 22px;
    }
    .scroll-product-card {
        flex: 0 0 185px;
    }
    .scroll-product-img {
        height: 200px;
    }
}

@media (max-width: 520px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .product-thumbnail {
        overflow: hidden;
    }
    .product-thumbnail img {
        max-width: 106%;
        height: 106%;
        margin-top: -3%;
        margin-left: -3%;
        object-fit: contain;
    }
}
@media (min-width: 520px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    }
}
#submenu {
    min-height: 54px;
}
/* …but only reserve that height when it actually holds the filter bar (homepage).
   On pages where it's empty (product detail, etc.) it shouldn't leave a 54px gap. */
#submenu:empty {
    min-height: 0;
}
@media (max-width: 600px) {
    .back-to-top {
        right: 2rem;
        bottom: 5rem;
        padding: 2rem;
        font-size: 1.5rem;
        opacity: 0.7;
    }
}
