/* ============================================
   AMAR — Cart toggle (header) + Mini-cart drawer
   Palette: #f5f3e6 bg · #492622 text · #c3292f accent
   Caricato globalmente (su ogni pagina del sito).
   ============================================ */

/* ============================================
   HEADER ACTIONS — wrapper nav + cart toggle
   ============================================ */
.pomme-header__actions {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* ============================================
   CART TOGGLE (icon + counter)
   ============================================ */
.amar-cart-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Public Sans', sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 17px;
    letter-spacing: 0.6px;
    color: #492622;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
}

.amar-cart-toggle:hover {
    color: #c3292f;
}

.amar-cart-toggle:focus {
    outline: none;
}

.amar-cart-toggle:focus-visible {
    outline: 2px solid #c3292f;
    outline-offset: 4px;
}

.amar-cart-drawer__close:focus {
    outline: none;
}

.amar-cart-drawer__close:focus-visible {
    outline: 1px solid #492622;
    outline-offset: 2px;
}

.amar-cart-toggle__icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.amar-cart-toggle.is-pulsing .amar-cart-toggle__icon {
    transform: scale(1.15) rotate(-4deg);
}

.amar-cart-toggle__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: #f5f3e6;
    background-color: #c3292f;
    border-radius: 999px;
    letter-spacing: 0;
    line-height: 1;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

/* Hide counter when zero */
.amar-cart-toggle[data-count="0"] .amar-cart-toggle__count {
    opacity: 0;
    transform: scale(0);
    width: 0;
    min-width: 0;
    padding: 0;
    margin-left: -8px;
}

.amar-cart-toggle.is-pulsing .amar-cart-toggle__count {
    transform: scale(1.3);
}

/* ============================================
   OVERLAY
   ============================================ */
.amar-cart-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(73, 38, 34, 0.45);
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s cubic-bezier(0.2, 0.6, 0.2, 1), visibility 0.45s linear;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.amar-cart-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.45s cubic-bezier(0.2, 0.6, 0.2, 1), visibility 0s linear;
}

body.amar-cart-open {
    overflow: hidden;
}

/* ============================================
   DRAWER
   ============================================ */
.amar-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 440px;
    background-color: #f5f3e6;
    z-index: 9991;
    transform: translateX(100%);
    transition: transform 0.55s cubic-bezier(0.2, 0.6, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -1px 0 0 rgba(73, 38, 34, 0.08);
    overflow: hidden;
}

.amar-cart-drawer.is-open {
    transform: translateX(0);
}

.amar-cart-drawer__content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ============================================
   DRAWER HEADER
   ============================================ */
.amar-cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px 32px;
    border-bottom: 1px solid rgba(73, 38, 34, 0.12);
    flex-shrink: 0;
}

.amar-cart-drawer__title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: normal;
    font-size: 17px;
    line-height: 1;
    color: #492622;
    margin: 0;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.amar-cart-drawer__title-count {
    color: rgba(73, 38, 34, 0.45);
    font-size: 14px;
}

.amar-cart-drawer__close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #492622;
    font-size: 26px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, color 0.25s ease;
}

.amar-cart-drawer__close:hover {
    color: #c3292f;
    transform: rotate(90deg);
}

/* ============================================
   DRAWER BODY (items)
   ============================================ */
.amar-cart-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 32px;
    -webkit-overflow-scrolling: touch;
}

.amar-cart-drawer__body::-webkit-scrollbar {
    width: 4px;
}

.amar-cart-drawer__body::-webkit-scrollbar-thumb {
    background-color: rgba(73, 38, 34, 0.2);
    border-radius: 2px;
}

.amar-cart-drawer__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ============================================
   CART ITEM
   ============================================ */
.amar-cart-item {
    display: flex;
    gap: 16px;
    padding: 22px 0;
    border-bottom: 1px solid rgba(73, 38, 34, 0.08);
    position: relative;
    transition: opacity 0.35s ease;
    animation: amarCartItemIn 0.4s cubic-bezier(0.2, 0.6, 0.2, 1);
}

@keyframes amarCartItemIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.amar-cart-item:last-child {
    border-bottom: none;
}

.amar-cart-item.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.amar-cart-item.is-removing {
    opacity: 0;
    transform: translateX(40px);
}

.amar-cart-item__media {
    flex: 0 0 84px;
    width: 84px;
    height: 105px;
    overflow: hidden;
    background-color: rgba(73, 38, 34, 0.04);
    display: block;
    text-decoration: none;
}

.amar-cart-item__media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
    max-width: none;
}

.amar-cart-item__media:hover img {
    transform: scale(1.04);
}

.amar-cart-item__info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding-right: 24px;
}

.amar-cart-item__top {
    margin-bottom: 12px;
}

.amar-cart-item__name {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: normal;
    font-size: 14px;
    line-height: 1.3;
    color: #492622;
    margin: 0 0 6px 0;
    text-decoration: none;
    transition: color 0.25s ease;
}

a.amar-cart-item__name:hover {
    color: #c3292f;
}

.amar-cart-item__variant {
    font-family: 'Public Sans', sans-serif;
    font-size: 11px;
    color: rgba(73, 38, 34, 0.6);
    line-height: 1.5;
}

.amar-cart-item__variant p,
.amar-cart-item__variant dl {
    margin: 0;
}

.amar-cart-item__variant dt,
.amar-cart-item__variant dd {
    display: inline;
    margin: 0;
}

.amar-cart-item__variant dt {
    font-weight: 500;
}

.amar-cart-item__variant dt::after {
    content: ': ';
}

.amar-cart-item__variant dd + dt::before {
    content: ' · ';
    margin-left: 2px;
}

.amar-cart-item__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.amar-cart-item__qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(73, 38, 34, 0.2);
    height: 30px;
}

.amar-cart-item__qty-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #492622;
    font-family: 'Public Sans', sans-serif;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.amar-cart-item__qty-btn:hover {
    color: #c3292f;
}

.amar-cart-item__qty-btn:disabled {
    color: rgba(73, 38, 34, 0.25);
    cursor: not-allowed;
}

.amar-cart-item__qty-value {
    min-width: 28px;
    text-align: center;
    font-family: 'Public Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: #492622;
}

.amar-cart-item__price {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: #c3292f;
    white-space: nowrap;
}

.amar-cart-item__price .woocommerce-Price-amount {
    color: inherit;
}

.amar-cart-item__remove {
    position: absolute;
    top: 22px;
    right: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(73, 38, 34, 0.4);
    font-size: 16px;
    line-height: 1;
    padding: 6px;
    transition: color 0.25s ease, transform 0.25s ease;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.amar-cart-item__remove:hover {
    color: #c3292f;
    transform: rotate(90deg);
}

/* ============================================
   DRAWER FOOTER
   ============================================ */
.amar-cart-drawer__footer {
    border-top: 1px solid rgba(73, 38, 34, 0.12);
    padding: 24px 32px 28px;
    flex-shrink: 0;
}

.amar-cart-drawer__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.amar-cart-drawer__subtotal-label {
    font-family: 'Public Sans', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(73, 38, 34, 0.6);
}

.amar-cart-drawer__subtotal-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    color: #492622;
    line-height: 1.1;
}

.amar-cart-drawer__subtotal-value .woocommerce-Price-amount,
.amar-cart-drawer__subtotal-value .amount {
    color: inherit;
}

.amar-cart-drawer__shipping-note {
    font-family: 'Public Sans', sans-serif;
    font-size: 11px;
    color: rgba(73, 38, 34, 0.5);
    margin: 0 0 22px 0;
    letter-spacing: 0.02em;
    line-height: 1.5;
}

.amar-cart-drawer__ctas {
    display: flex;
    gap: 8px;
}

.amar-cart-drawer__cta {
    flex: 1;
    text-align: center;
    padding: 17px 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border-radius: 0;
    line-height: 1;
    border: 1px solid #492622;
}

.amar-cart-drawer__cta--secondary {
    color: #492622;
    background-color: transparent;
}

.amar-cart-drawer__cta--secondary:hover {
    background-color: #492622;
    color: #f5f3e6;
}

.amar-cart-drawer__cta--primary {
    color: #f5f3e6 !important;
    background-color: #492622;
}

.amar-cart-drawer__cta--primary:hover {
    background-color: #c3292f;
    border-color: #c3292f;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.amar-cart-drawer__empty {
    text-align: center;
    padding: 80px 24px 60px;
}

.amar-cart-drawer__empty-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16px;
    color: rgba(73, 38, 34, 0.55);
    margin: 0 0 28px 0;
    line-height: 1.4;
}

.amar-cart-drawer__continue {
    font-family: 'Public Sans', sans-serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c3292f;
    text-decoration: none;
    transition: opacity 0.25s ease;
}

.amar-cart-drawer__continue:hover {
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .pomme-header__actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 20px;
    }

    .amar-cart-toggle__icon {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .amar-cart-drawer {
        max-width: 100%;
    }

    .amar-cart-drawer__header {
        padding: 22px 20px;
    }

    .amar-cart-drawer__body {
        padding: 0 20px;
    }

    .amar-cart-drawer__footer {
        padding: 20px 20px 24px;
    }

    .amar-cart-drawer__ctas {
        flex-direction: column;
        gap: 8px;
    }

    .amar-cart-item__media {
        flex: 0 0 72px;
        width: 72px;
        height: 92px;
    }

    .amar-cart-item__info {
        padding-right: 28px;
    }
}
