/* Matchy Quantity Discounts - Alpro Gift Campaign
 *
 * Mobile first: base rules target the ~95% of traffic on phones, the min-width
 * block below scales up. Loaded only while a campaign is active, so removing the
 * campaign leaves the tier cards styled exactly as before.
 *
 * Colour tokens match assets/css/frontend.css, always with a literal fallback.
 */

/* ---------------------------------------------------------------- Notice --- */

.mqd-gift-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 7px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.35;
    color: #5c3a41;
    color: var(--oburgundy, #5c3a41);
}

.mqd-gift-notice .mqd-gift-icon {
    flex-shrink: 0;
    color: #d97098;
    color: var(--ppink, #d97098);
}

/* ------------------------------------------------------- Benefit lines --- */

.mqd-gift-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    line-height: 1.35;
    color: #5c3a41;
    color: var(--oburgundy, #5c3a41);
}

.mqd-gift-line .mqd-gift-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #d97098;
    color: var(--ppink, #d97098);
}

.mqd-gift-line-text {
    min-width: 0;
}

/* ------------------------------------------------- Featured (top) tier --- */

.mqd-option-ribbon {
    position: absolute;
    top: -9px;
    left: 14px;
    z-index: 1;
    padding: 2px 9px;
    border-radius: 20px;
    background: #5c3a41;
    background: var(--oburgundy, #5c3a41);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.5;
}

/* Only spacing, so the ribbon does not collide with the card above. The border
   accent was removed: pink is the selected-state colour, so a permanently pink top
   card was indistinguishable from the customer's actual selection. The ribbon
   carries the emphasis on its own. :has() paints before JS runs; gift.js adds
   .mqd-option-featured as a fallback for browsers without :has(). */
.mqd-option:has(.mqd-option-ribbon),
.mqd-option.mqd-option-featured {
    margin-top: 6px;
}

/* ------------------------------------------------------ Flavour picker --- */

.mqd-gift-picker {
    margin-top: 14px;
}

/* Every flavour sold out: nothing to show but the explanation. */
.mqd-gift-picker[data-hidden="1"] .mqd-gift-picker-label,
.mqd-gift-picker[data-hidden="1"] .mqd-gift-flavours {
    display: none;
}

/* "All flavours" tier: the chips are a summary of what is in the box, not controls.
   They must NOT reuse the pink selected styling - pink means "the one you picked",
   and three pink chips read as three simultaneous selections, which is impossible
   for a radio group. Muted, flat, check-marked, visibly not tappable. */
.mqd-gift-picker[data-all="1"] .mqd-gift-flavour {
    pointer-events: none;
    border-style: solid;
    border-color: rgba(92, 58, 65, 0.15);
    background: rgba(92, 58, 65, 0.04);
}

.mqd-gift-picker[data-all="1"] .mqd-gift-flavour-name::before {
    content: "\2713\00a0";
    font-weight: 700;
    color: #2d7f5e;
    color: var(--fgreen, #2d7f5e);
}

/* A sold-out flavour is excluded, so it keeps its sold-out look and loses the tick
   rather than claiming to be included. */
.mqd-gift-picker[data-all="1"] .mqd-gift-flavour-disabled .mqd-gift-flavour-name::before {
    content: none;
}

.mqd-gift-picker-label {
    display: block;
    text-align: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #5c3a41;
    color: var(--oburgundy, #5c3a41);
}

.mqd-gift-flavours {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mqd-gift-flavour {
    flex: 1 1 30%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 44px minimum touch target */
    min-height: 44px;
    padding: 8px 6px;
    margin: 0;
    background: #f9f7f5;
    background: var(--ivory, #f9f7f5);
    border: 2px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.mqd-gift-flavour input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mqd-gift-flavour-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: #5c3a41;
    color: var(--oburgundy, #5c3a41);
}

.mqd-gift-flavour:hover {
    border-color: #d97098;
    border-color: var(--ppink, #d97098);
}

.mqd-gift-flavour.mqd-gift-flavour-selected {
    border-color: #d97098;
    border-color: var(--ppink, #d97098);
    background: rgba(217, 112, 152, 0.08);
}

/* Sold out: disabled but still visible, never hidden. */
.mqd-gift-flavour.mqd-gift-flavour-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    border-color: #ccc;
    border-style: dashed;
    background: #f2f2f2;
}

.mqd-gift-flavour.mqd-gift-flavour-disabled:hover {
    border-color: #ccc;
}

.mqd-gift-flavour.mqd-gift-flavour-disabled .mqd-gift-flavour-name {
    text-decoration: line-through;
}

.mqd-gift-flavour-stock {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #8a6b72;
}

.mqd-gift-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 7px;
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.35;
    color: #8a6b72;
}

/* The rules above set `display`, which outranks the user agent's
   [hidden] { display: none } because a class selector beats a bare attribute
   selector. Without these, the "all three included" and "sold out" lines render
   permanently, regardless of the hidden attribute PHP and gift.js set. */
.mqd-gift-unavailable[hidden],
.mqd-gift-flavour-stock[hidden] {
    display: none;
}

/* Cart / checkout */
.mqd-gift-qty {
    display: inline-block;
    min-width: 2em;
    text-align: center;
}

.mqd-gift-free {
    font-weight: 600;
    color: #2d7f5e;
    color: var(--fgreen, #2d7f5e);
}

/* ------------------------------------------------------------ Larger --- */

@media (min-width: 481px) {
    .mqd-gift-notice,
    .mqd-gift-line,
    .mqd-gift-unavailable {
        font-size: 14px;
    }

    .mqd-gift-flavour {
        flex: 1 1 0;
    }

    .mqd-gift-flavour-name {
        font-size: 15px;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mqd-gift-flavour {
        transition: none;
    }
}
