/* =============================================================================
   qty-stepper.css
   Unified quantity stepper component used across:
     - product detail page  (.pd-actions)
     - side cart offcanvas   (#cartDynamicArea rows)
     - main cart page        (#productCart rows)

   Markup contract (see qty-stepper.js):
     <div class="hh-qty" data-min="1" data-max="10" data-value="2"
          data-context="detail|sidecart|cart">
        <button class="hh-qty-btn" data-action="dec" aria-label="Decrease quantity">…</button>
        <input class="hh-qty-input" type="text" inputmode="numeric" value="2" />
        <button class="hh-qty-btn" data-action="inc" aria-label="Increase quantity">…</button>
     </div>

   Design language: 2026 glass / soft-neumorphic pill.
   - Translucent background with backdrop-blur so the stepper floats over any
     parent surface (white card, green hero, offcanvas body).
   - Circular icon buttons with a barely-there gradient that brightens on hover.
   - Tabular-num input so digit width is stable while typing.
   - A focus ring that matches the brand's forest/gold gradient.
   - Min/Max disabled buttons fade to 35% opacity — visible but unclickable.
============================================================================= */

.hh-qty {
    --hh-qty-h: 44px;
    --hh-qty-btn: 40px;
    --hh-qty-bg: rgba(255, 255, 255, 0.72);
    --hh-qty-border: rgba(20, 30, 25, 0.10);
    --hh-qty-border-strong: rgba(20, 30, 25, 0.22);
    --hh-qty-text: #1a1a1a;
    --hh-qty-muted: #6b7280;
    --hh-qty-accent: #0a2e1c;
    --hh-qty-accent-2: #C19A6B;
    --hh-qty-radius: 14px;

    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: var(--hh-qty-h);
    padding: 4px;
    border-radius: var(--hh-qty-radius);
    background: var(--hh-qty-bg);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid var(--hh-qty-border);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
    isolation: isolate;
}

/* Subtle top highlight that gives the pill its "glass" feel */
.hh-qty::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.hh-qty:focus-within {
    border-color: var(--hh-qty-border-strong);
    box-shadow:
        0 0 0 4px rgba(10, 46, 28, 0.10),
        0 6px 22px rgba(10, 46, 28, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ── Icon buttons ── */
.hh-qty-btn {
    width: var(--hh-qty-btn);
    height: var(--hh-qty-btn);
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f3f5f4 100%);
    color: var(--hh-qty-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 6px rgba(0, 0, 0, 0.04);
    -webkit-tap-highlight-color: transparent;
}

.hh-qty-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.hh-qty-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--hh-qty-accent) 0%, #14543a 100%);
    color: #fff;
    transform: translateY(-1px) scale(1.04);
    box-shadow:
        0 4px 12px rgba(10, 46, 28, 0.28),
        0 1px 2px rgba(0, 0, 0, 0.08);
}

.hh-qty-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.hh-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Numeric input ── */
.hh-qty-input {
    width: 44px;
    flex: 0 0 44px;
    height: var(--hh-qty-btn);
    border: none;
    background: transparent;
    color: var(--hh-qty-text);
    text-align: center;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
    outline: none;
    cursor: text;
    padding: 0;
    -moz-appearance: textfield;
}

.hh-qty-input::-webkit-outer-spin-button,
.hh-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide the blinking caret only on tiny mobile widths to avoid layout jump */
@media (max-width: 380px) {
    .hh-qty-input { caret-color: var(--hh-qty-accent); }
}

/* ── Optional stock hint ── */
.hh-qty-stock {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--hh-qty-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.hh-qty-stock.is-low { color: #c2410c; }
.hh-qty.is-focused .hh-qty-stock,
.hh-qty:hover .hh-qty-stock { opacity: 1; }


/* ── Context: side cart (smaller) ── */
.hh-qty[data-context="sidecart"] {
    --hh-qty-h: 36px;
    --hh-qty-btn: 30px;
    --hh-qty-radius: 11px;
    gap: 2px;
    padding: 3px;
}
.hh-qty[data-context="sidecart"] .hh-qty-input {
    width: 32px;
    flex: 0 0 32px;
    font-size: 13px;
}
.hh-qty[data-context="sidecart"] .hh-qty-btn svg { width: 13px; height: 13px; }
.hh-qty[data-context="sidecart"] .hh-qty-btn { font-size: 15px; }


/* ── Context: main cart page (slightly wider input for 3+ digit qty) ── */
.hh-qty[data-context="cart"] .hh-qty-input {
    width: 52px;
    flex: 0 0 52px;
}


/* ── Dark surface variant (used when the stepper sits on a dark/green bg) ── */
.hh-qty.is-on-dark {
    --hh-qty-bg: rgba(255, 255, 255, 0.10);
    --hh-qty-border: rgba(255, 255, 255, 0.22);
    --hh-qty-border-strong: rgba(255, 255, 255, 0.55);
    --hh-qty-text: #ffffff;
    --hh-qty-muted: rgba(255, 255, 255, 0.65);
}
.hh-qty.is-on-dark .hh-qty-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.06) 100%);
    color: #fff;
}
.hh-qty.is-on-dark .hh-qty-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffffff 0%, #f3f5f4 100%);
    color: var(--hh-qty-accent);
}


/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .hh-qty, .hh-qty-btn { transition: none; }
    .hh-qty-btn:hover:not(:disabled) { transform: none; }
}


/* ── Mobile ── */
@media (max-width: 575.98px) {
    .hh-qty { --hh-qty-h: 40px; --hh-qty-btn: 36px; }
    .hh-qty[data-context="sidecart"] { --hh-qty-h: 32px; --hh-qty-btn: 28px; }
}
