/* ==========================================================================
   Cart drawer
   --------------------------------------------------------------------------
   Slide-in cart panel opened from the header cart icon. Markup comes from
   inc/tobor-cart-drawer.php; rows and add-on cards are built by
   js/cart-drawer.js from Store API data.

   Shares the cart page's tokens so the two read as one system.
   ========================================================================== */

.tobor-drawer {
    --td-ink: #101114;
    --td-ink-mid: #5b606b;
    --td-ink-soft: #8a8f99;
    --td-line: #e4e6eb;
    --td-line-mid: #d3d7de;
    --td-surface: #fff;
    --td-tile: #f7f8fa;
    --td-foot: #f4f5f7;
    --td-blue: #506ccd;
    --td-green: #99c300;
    --td-green-dark: #6a8700;
    --td-danger: #b4232a;
    --td-width: 460px;

    position: fixed;
    inset: 0;
    z-index: 100000;
    font-family: Helvetica, Arial, sans-serif;
    color: var(--td-ink);
}

.tobor-drawer[hidden] {
    display: none;
}

html.tobor-drawer-open {
    overflow: hidden;
    padding-right: var(--tobor-scrollbar, 0px);
}

/* The parent theme's hover basket covers the same job as the drawer, and both
   are triggered by the same icon. */
#progression-checkout-basket {
    display: none !important;
}

/* The sticky product bar sits at z-index 2147483647, so it cannot be
   out-stacked — it has to be taken out while the drawer is open, or it covers
   the Check out button. The contact tab goes with it, as any modal should. */
html.tobor-drawer-open .tobor-product-bar,
html.tobor-drawer-open #toborStickyContactFormContainer {
    display: none !important;
}

/* Scrim ------------------------------------------------------------------- */

.tobor-drawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(16, 17, 20, 0.42);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.tobor-drawer.is-open .tobor-drawer__scrim {
    opacity: 1;
}

/* Panel ------------------------------------------------------------------- */

.tobor-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(var(--td-width), 100vw);
    height: 100%;
    background: var(--td-surface);
    border-radius: 20px 0 0 20px;
    box-shadow: -24px 0 60px -24px rgba(16, 17, 20, 0.35);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.tobor-drawer.is-open .tobor-drawer__panel {
    transform: translateX(0);
}

.tobor-drawer__panel:focus {
    outline: none;
}

/* Drag handle — only shown when the panel is a bottom sheet. */
.tobor-drawer__grab {
    display: none;
    flex: 0 0 auto;
    width: 36px;
    height: 4px;
    margin: 10px auto 0;
    background: var(--td-line-mid);
    border-radius: 999px;
}

.tobor-drawer__panel.is-busy {
    cursor: progress;
}

.tobor-drawer__panel.is-busy .tobor-drawer__items,
.tobor-drawer__panel.is-busy .tobor-drawer__addons {
    opacity: 0.55;
    pointer-events: none;
}

/* Header ------------------------------------------------------------------ */

.tobor-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--td-line);
}

.tobor-drawer__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--td-ink);
    text-transform: none;
}

.tobor-drawer__count {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    background: var(--td-tile);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    color: var(--td-ink-mid);
    font-variant-numeric: tabular-nums;
}

.tobor-drawer__count[hidden] {
    display: none;
}

.tobor-drawer__close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    background: none;
    border: 1px solid var(--td-line-mid);
    border-radius: 999px;
    color: var(--td-ink);
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.tobor-drawer__close:hover {
    background: var(--td-tile);
    border-color: var(--td-ink-soft);
}

.tobor-drawer__close:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: 2px;
}

/* Body -------------------------------------------------------------------- */

.tobor-drawer__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 24px 20px;
}

.tobor-drawer__status {
    margin: 16px 0 0;
    padding: 10px 12px;
    background: #fdf2f2;
    border: 1px solid #f0c9c9;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--td-danger);
}

.tobor-drawer__status[hidden] {
    display: none;
}

/* Free-shipping banner ---------------------------------------------------- */

.tobor-drawer__shipbar {
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--td-line);
}

.tobor-drawer__shipbar[hidden] {
    display: none;
}

.tobor-drawer__shipbar-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--td-ink-mid);
}

/* Loading skeleton -------------------------------------------------------- */

.tobor-drawer__skeleton {
    display: grid;
    gap: 18px;
    padding: 20px 0;
}

.tobor-drawer__skeleton[hidden] {
    display: none;
}

.tobor-drawer__skeleton span {
    display: block;
    height: 78px;
    background: linear-gradient(90deg, var(--td-tile), #eef0f4, var(--td-tile));
    background-size: 200% 100%;
    border-radius: 12px;
    animation: tobor-drawer-shimmer 1.4s ease-in-out infinite;
}

@keyframes tobor-drawer-shimmer {
    0% { background-position: 150% 0; }
    100% { background-position: -50% 0; }
}

/* Items ------------------------------------------------------------------- */

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

.tobor-drawer__items[hidden] {
    display: none;
}

.tobor-drawer__item {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 0 14px;
    margin: 0;
    padding: 16px 0;
    border-bottom: 1px solid var(--td-line);
    list-style: none;
}

/* No tile or frame: the product shots already sit on their own white ground,
   so a bordered tile reads as a box inside a box. */
.tobor-drawer__thumb {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 96px;
    height: 96px;
    overflow: hidden;
}

.tobor-drawer__thumb img {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tobor-drawer__item-main {
    min-width: 0;
}

.tobor-drawer__item-name {
    display: block;
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--td-ink);
    text-decoration: none;
}

.tobor-drawer__item-name:hover,
.tobor-drawer__item-name:focus-visible {
    color: var(--td-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--td-line-mid);
}

.tobor-drawer__item-meta {
    margin: 0 0 4px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--td-ink-soft);
}

.tobor-drawer__item-unit {
    margin: 0 0 2px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--td-ink-soft);
    font-variant-numeric: tabular-nums;
}

.tobor-drawer__item-price {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--td-ink);
    font-variant-numeric: tabular-nums;
}

.tobor-drawer__item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* Quantity stepper -------------------------------------------------------- */

.tobor-drawer__stepper {
    display: grid;
    grid-template-columns: 32px minmax(28px, auto) 32px;
    align-items: stretch;
    box-sizing: border-box;
    height: 34px;
    background: var(--td-surface);
    border: 1px solid var(--td-line);
    border-radius: 999px;
    overflow: hidden;
}

.tobor-drawer__step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: 0;
    color: var(--td-ink-mid);
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

/* Glyphs are drawn rather than set as text, so they never depend on a font. */
.tobor-drawer__step::before {
    content: "";
    display: block;
    width: 10px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.tobor-drawer__step--plus::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 10px;
    margin: -5px 0 0 -1px;
    border-radius: 1px;
    background: currentColor;
}

.tobor-drawer__step:hover:not(:disabled) {
    background: var(--td-tile);
    color: var(--td-ink);
}

.tobor-drawer__step:disabled {
    color: var(--td-ink-soft);
    opacity: 0.45;
    cursor: not-allowed;
}

.tobor-drawer__step:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: -2px;
}

.tobor-drawer__step-value {
    display: grid;
    place-items: center;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--td-ink);
    font-variant-numeric: tabular-nums;
}

.tobor-drawer__remove {
    padding: 0;
    background: none;
    border: 0;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--td-ink-mid);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--td-line-mid);
    cursor: pointer;
    transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

.tobor-drawer__remove:hover {
    color: var(--td-danger);
    text-decoration-color: var(--td-danger);
}

.tobor-drawer__remove:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Empty state ------------------------------------------------------------- */

.tobor-drawer__empty {
    padding: 48px 0;
    text-align: center;
}

.tobor-drawer__empty[hidden] {
    display: none;
}

.tobor-drawer__empty-title {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 600;
    color: var(--td-ink);
}

.tobor-drawer__empty-link {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--td-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Add-ons ----------------------------------------------------------------- */

.tobor-drawer__item:last-child {
    border-bottom: 0;
}

/* Anchored to the bottom of the body when the content runs short, so the
   empty space sits between items and suggestions instead of dangling below. */
.tobor-drawer__addons {
    margin-top: auto;
    padding: 16px 0 2px;
    border-top: 1px solid var(--td-line);
}

.tobor-drawer__addons[hidden] {
    display: none;
}

.tobor-drawer__addons-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}

.tobor-drawer__addons-title {
    margin: 0;
    padding: 0;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--td-ink-soft);
}

.tobor-drawer__addons-nav {
    display: flex;
    gap: 8px;
}

.tobor-drawer__nav-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: none;
    border: 1px solid var(--td-line-mid);
    border-radius: 999px;
    color: var(--td-ink);
    cursor: pointer;
    transition: background-color 0.16s ease, opacity 0.16s ease;
}

.tobor-drawer__nav-btn:hover:not(:disabled) {
    background: var(--td-tile);
}

.tobor-drawer__nav-btn:disabled {
    border-color: var(--td-line);
    color: var(--td-ink-soft);
    opacity: 0.4;
    cursor: not-allowed;
}

.tobor-drawer__nav-btn:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: 2px;
}

/* Fades out on the right so it reads as scrollable without needing a card
   border around every item. The fade is wide enough to swallow most of the
   clipped card, so the cut does not look accidental. */
.tobor-drawer__addons-track {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0 0 6px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent);
}

.tobor-drawer__addons-track::-webkit-scrollbar {
    display: none;
}

.tobor-drawer__addon {
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
    flex: 0 0 132px;
    width: 132px;
    scroll-snap-align: start;
}

.tobor-drawer__addon-thumb {
    display: grid;
    place-items: center;
    height: 64px;
    overflow: hidden;
}

.tobor-drawer__addon-thumb img {
    width: auto;
    max-width: 100%;
    max-height: 64px;
}

.tobor-drawer__addon-body {
    flex: 1 1 auto;
    min-height: 0;
}

.tobor-drawer__addon-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--td-ink);
    text-decoration: none;
}

.tobor-drawer__addon-name:hover {
    color: var(--td-blue);
}

.tobor-drawer__addon-price {
    margin: 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--td-ink-mid);
    font-variant-numeric: tabular-nums;
}

/* Outlined, not filled: Check out is the only filled button in the panel. */
.tobor-drawer__addon-action {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 30px;
    padding: 0 16px;
    background: transparent;
    border: 1px solid var(--td-line-mid);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--td-ink);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.tobor-drawer__addon-action:hover {
    background: var(--td-ink);
    border-color: var(--td-ink);
    color: #fff;
}

.tobor-drawer__addon-action.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.tobor-drawer__addon-action:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: 2px;
}

/* Discount --------------------------------------------------------------- */

.tobor-drawer__discount {
    flex: 0 0 auto;
    padding: 6px 24px;
    border-top: 1px solid var(--td-line);
}

.tobor-drawer__discount-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 6px 0;
    background: none;
    border: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--td-ink-mid);
    cursor: pointer;
    transition: color 0.16s ease;
}

.tobor-drawer__discount-toggle svg {
    width: 17px;
    height: 17px;
}

.tobor-drawer__discount-toggle:hover {
    color: var(--td-ink);
}

.tobor-drawer__discount-toggle:focus-visible {
    outline: 2px solid var(--td-blue);
    outline-offset: 2px;
    border-radius: 6px;
}

.tobor-drawer__discount-panel[hidden] {
    display: none;
}

.tobor-drawer__discount-form {
    display: flex;
    gap: 10px;
    margin: 6px 0 0;
}

.tobor-drawer__discount-form input {
    flex: 1 1 auto;
    box-sizing: border-box;
    height: 42px;
    padding: 0 12px;
    background: var(--td-surface);
    border: 1px solid var(--td-line-mid);
    border-radius: 10px;
    font-size: 14px;
    color: var(--td-ink);
}

.tobor-drawer__discount-form input:focus {
    border-color: var(--td-blue);
    outline: 2px solid rgba(80, 108, 205, 0.25);
}

.tobor-drawer__discount-apply {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 18px;
    background: var(--td-ink);
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.tobor-drawer__discount-apply:hover {
    background: #2b2e35;
}

.tobor-drawer__discount-error {
    margin: 8px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--td-danger);
}

.tobor-drawer__discount-error[hidden] {
    display: none;
}

.tobor-drawer__coupons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.tobor-drawer__coupon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: var(--td-tile);
    border: 1px solid var(--td-line);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--td-ink);
}

.tobor-drawer__coupon-remove {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: none;
    border: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--td-ink-mid);
    cursor: pointer;
}

.tobor-drawer__coupon-remove:hover {
    color: var(--td-danger);
}

/* Footer ----------------------------------------------------------------- */

.tobor-drawer__foot {
    flex: 0 0 auto;
    padding: 14px 24px 18px;
    background: var(--td-foot);
    border-top: 1px solid var(--td-line);
}

.tobor-drawer__totals {
    margin: 0 0 12px;
}

.tobor-drawer__trow {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 3px 0;
    font-size: 13.5px;
    line-height: 1.4;
}

.tobor-drawer__trow[hidden] {
    display: none;
}

.tobor-drawer__trow-label {
    font-weight: 500;
    color: var(--td-ink-mid);
}

.tobor-drawer__trow-value {
    font-weight: 600;
    color: var(--td-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tobor-drawer__trow--discount .tobor-drawer__trow-value {
    color: var(--td-green-dark);
}

.tobor-drawer__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 6px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid var(--td-line);
}

.tobor-drawer__total-label {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--td-ink);
}

.tobor-drawer__total-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--td-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tobor-drawer__totals-note {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--td-ink-soft);
}

.tobor-drawer__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tobor-drawer__checkout,
.tobor-drawer__view-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.tobor-drawer__checkout {
    background: var(--td-green);
    border: 0;
    color: #14170c;
}

.tobor-drawer__checkout:hover {
    background: var(--td-green-dark);
    color: #fff;
    transform: translateY(-1px);
}

.tobor-drawer__view-cart {
    background: transparent;
    border: 1px solid var(--td-ink);
    color: var(--td-ink);
}

.tobor-drawer__view-cart:hover {
    background: var(--td-ink);
    color: #fff;
}

.tobor-drawer__checkout:focus-visible,
.tobor-drawer__view-cart:focus-visible {
    outline: 3px solid rgba(80, 108, 205, 0.45);
    outline-offset: 2px;
}

/* Narrow screens: the panel becomes a bottom sheet ------------------------ */

@media (max-width: 640px) {
    .tobor-drawer__panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -18px 50px -18px rgba(16, 17, 20, 0.4);
        transform: translateY(100%);
    }

    .tobor-drawer.is-open .tobor-drawer__panel {
        transform: translateY(0);
    }

    .tobor-drawer__grab {
        display: block;
    }

    .tobor-drawer__foot {
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }

    /* iOS Safari zooms into any focused input below 16px. */
    .tobor-drawer__discount-form input,
    .tobor-drawer__stepper input {
        font-size: 16px !important;
    }
}

/* The page must not scroll behind an open sheet — iOS ignores
   overflow:hidden on body, so the body is pinned in place instead. */
body.tobor-drawer-body-lock {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}

@media (max-width: 520px) {

    .tobor-drawer__head {
        padding: 18px 16px 14px;
    }

    .tobor-drawer__body {
        padding: 4px 16px 16px;
    }

    .tobor-drawer__discount {
        padding: 10px 16px;
    }

    .tobor-drawer__foot {
        padding: 16px;
    }

    .tobor-drawer__item {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 4px 12px;
    }

    .tobor-drawer__thumb {
        grid-row: 1 / span 2;
        width: 64px;
        height: 64px;
    }

    .tobor-drawer__item-side {
        grid-column: 2;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        margin-top: 10px;
    }

    .tobor-drawer__actions {
        grid-template-columns: 1fr;
    }

    /* Keep the primary action first once the buttons stack. */
    .tobor-drawer__checkout {
        order: 0;
    }

    .tobor-drawer__view-cart {
        order: 1;
        min-height: 44px;
        font-weight: 600;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tobor-drawer__panel,
    .tobor-drawer__scrim {
        transition-duration: 0.01ms;
    }

    .tobor-drawer__skeleton span {
        animation: none;
    }

    .tobor-drawer__checkout:hover {
        transform: none;
    }
}
