/* =====================================================================
   Dermosa Product Slider — Products Hub
   Full-screen, app-grade, RTL. Consumes the theme tokens with hard-coded
   fallbacks so it renders correctly even before tokens.css paints.
   Scoped entirely under .dps-hub — nothing else on the site is touched.
   ===================================================================== */

/* Android/iOS fix: a transform / filter / perspective on an ancestor traps a
   fixed-position host. Neutralized only while the hub is open. */
html.dps-hub-locked,
html.dps-hub-locked body {
    overflow: hidden !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    -webkit-perspective: none !important;
    will-change: auto !important;
}

.dps-hub {
    --h-primary: var(--drm-primary, #6c1410);
    --h-primary-700: var(--drm-primary-700, #560f0c);
    --h-tint: var(--drm-comp-warm, #fff2ea);
    --h-page: #ffffff;
    --h-card: #ffffff;
    --h-soft: #fafafa;
    --h-line: var(--drm-border, #ececec);
    --h-text: var(--drm-text, #4d4d4d);
    --h-strong: var(--drm-text-strong, #1e1e1e);
    --h-muted: var(--drm-text-muted, #8a8a8a);
    --c-primary: #6c1410;
    --c-text: #4d4d4d;
    --c-text-strong: #1e1e1e;
    --c-taupe: #9e8c88;
    --r-card: 20px;
    --r-thumb: 16px;
    --r-btn: 14px;
    --r-chip: 14px;
    --fast: .18s;
    --h-r-lg: var(--drm-r-lg, 22px);
    --h-r-md: var(--drm-r-md, 16px);
    --h-r-sm: var(--drm-r-sm, 12px);
    --h-pill: 999px;
    --h-gutter: 15px;
    --h-pad: var(--h-gutter);
    --h-ease: var(--drm-ease, cubic-bezier(.22, .61, .36, 1));

    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    flex-direction: column;
    background: var(--h-page);
    color: var(--h-text);
    font-family: var(--drm-font, "Dermosa", "Vazirmatn", Tahoma, system-ui, sans-serif);
    font-size: 14px;
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    opacity: 0;
    transition: opacity .26s var(--h-ease);
    -webkit-tap-highlight-color: transparent;
}

.dps-hub.is-mounted {
    display: flex;
}

.dps-hub.is-open {
    opacity: 1;
}

.dps-hub * {
    box-sizing: border-box;
}

.dps-hub svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dps-hub a {
    color: inherit;
    text-decoration: none;
}

/* ---------------- top bar ---------------- */

.dps-hub__bar {
    flex: 0 0 auto;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--h-card);
}

.dps-hub__barin {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: var(--h-width, 1350px);
    margin-inline: auto;
    padding-inline: var(--h-pad, 15px);
    padding-bottom: 12px;
}

.dps-hub__barin::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inset-inline: var(--h-pad, 15px);
    height: 1px;
    background: var(--h-line);
}

.dps-hub__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 10px;
    border: 0;
    border-radius: var(--h-r-sm);
    background: var(--h-soft);
    color: var(--h-strong);
    cursor: pointer;
    transition: background .18s var(--h-ease);
}

.dps-hub__close:hover,
.dps-hub__close:focus-visible {
    background: var(--h-tint);
    color: var(--h-primary);
    outline: none;
}

.dps-hub__heads {
    flex: 1 1 auto;
    min-width: 0;
}

.dps-hub__title {
    display: block;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--h-strong);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dps-hub__count {
    display: block;
    font-size: 11.5px;
    color: var(--h-muted);
    line-height: 1.5;
}

.dps-hub__source {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--h-pill);
    background: var(--h-soft);
    color: var(--h-muted);
    font-size: 11.5px;
    font-weight: 700;
    transition: background .18s var(--h-ease), color .18s var(--h-ease);
}

.dps-hub__source svg {
    width: 14px;
    height: 14px;
}

.dps-hub__source:hover,
.dps-hub__source:focus-visible {
    background: var(--h-tint);
    color: var(--h-primary);
    outline: none;
}

/* ---------------- chips (mobile) + sidebar rows (desktop) ---------------- */

.dps-hub__chips {
    display: flex;
    gap: 8px;
    padding: 10px 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

.dps-hub__chips[hidden] {
    display: none;
}

.dps-hub__chips::-webkit-scrollbar {
    display: none;
}

.dps-hub__chip {
    flex: 0 0 auto;
    padding: 9px 18px;
    border: 0;
    border-radius: var(--r-chip);
    background: #f6f7f9;
    color: #0c0c0c;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--fast), color var(--fast);
}

.dps-hub__chip:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

.dps-hub__chip.is-active {
    background: #6c1410;
    color: #ffffff;
}

.dps-hub__side {
    display: none;
}

.dps-hub .dcat-side__brand {
    text-align: center;
    padding: 6px 0 16px;
}

.dps-hub .dcat-side__mark {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--c-primary);
}

.dps-hub .dcat-side__tag {
    margin-top: 6px;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--c-taupe);
    text-transform: uppercase;
}

.dps-hub .dcat-side__sep {
    height: 1px;
    background: #ececec;
    margin: 6px 0 16px;
}

.dps-hub .dcat-side__h {
    margin: 0 0 10px;
    padding: 0;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--c-text-strong);
}

.dps-hub .dcat-side__group {
    margin-bottom: 20px;
}

.dps-hub .dcat-side__group[hidden] {
    display: none;
}

.dps-hub .dcat-side__cats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dps-hub .dcat-side__cat {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: transparent;
    color: var(--c-text);
    font-size: 11px;
    font-weight: 700;
    text-align: start;
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
}

.dps-hub .dcat-side__cat > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dps-hub .dcat-side__cat .n {
    flex: 0 0 auto;
    font-size: 9px;
    font-weight: 700;
    color: var(--c-taupe);
    background: #fff;
    border-radius: 999px;
    padding: 2px 8px;
}

.dps-hub .dcat-side__cat:hover {
    background: #fff;
}

.dps-hub .dcat-side__cat.is-active {
    background: var(--c-primary);
    color: #fff;
}

.dps-hub .dcat-side__cat.is-active .n {
    color: var(--c-primary);
    background: #fff;
}

.dps-hub .dcat-side__sort {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.dps-hub .dcat-side__sortbtn {
    padding: 9px 8px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fff;
    color: var(--c-text);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background var(--fast), color var(--fast), border-color var(--fast);
}

.dps-hub .dcat-side__sortbtn.is-active {
    background: #fbeeec;
    border-color: #fbeeec;
    color: var(--c-primary);
    font-weight: 800;
}

.dps-hub .dcat-side__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--c-text-strong);
}

.dps-hub .dcat-side__sw {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #cfd2d6;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
    cursor: pointer;
    transition: background var(--fast);
}

.dps-hub .dcat-side__sw::after {
    content: "";
    position: absolute;
    inset-block-start: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: inset-inline-start var(--fast);
}

.dps-hub .dcat-side__sw.is-on {
    background: var(--c-primary);
    box-shadow: none;
}

.dps-hub .dcat-side__sw.is-on::after {
    inset-inline-start: 21px;
}

.dps-hub__reset {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    background: #fff;
    color: var(--c-taupe);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    transition: color var(--fast), background var(--fast);
}

.dps-hub__reset:hover {
    background: var(--c-primary);
    color: #fff;
}

/* ---------------- body / grid ---------------- */

.dps-hub__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.dps-hub__wrap {
    width: 100%;
    max-width: var(--h-width, 1350px);
    margin-inline: auto;
    padding-inline: var(--h-pad, 15px);
}

.dps-hub__main {
    min-width: 0;
}

.dps-hub__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 6px;
}

@media (min-width: 560px) {
    .dps-hub__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

@media (min-width: 980px) {
    .dps-hub__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

/* =====================================================================
   Product card — identical to the theme's category-page .dcat-pcard.
   The rules are scoped to .dps-hub so they can never leak onto the
   category page itself (where the theme ships the same values inline).
   ===================================================================== */

.dps-hub button {
    font-family: inherit;
    cursor: pointer;
    border: 0;
}

.dps-hub .dcat-pcard {
    display: flex;
    flex-direction: column;
    background: #f6f7f9;
    border-radius: var(--r-card);
    padding: 8px;
    position: relative;
}

.dps-hub .dcat-pcard__media {
    position: relative;
    border-radius: var(--r-thumb);
    overflow: hidden;
    background: #ececec;
    aspect-ratio: 3 / 4;
    display: block;
}

.dps-hub .dcat-pcard__media::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(100deg, #ececec 30%, #f6f6f6 50%, #ececec 70%);
    background-size: 200% 100%;
    animation: dcatShimmer 1.2s ease-in-out infinite;
    opacity: 1;
    transition: opacity .35s ease;
    pointer-events: none;
}

.dps-hub .dcat-pcard__media.is-loaded::before {
    opacity: 0;
}

.dps-hub .dcat-pcard__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity .4s ease;
}

.dps-hub .dcat-pcard__media.is-loaded img {
    opacity: 1;
}

@keyframes dcatShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dps-hub .dcat-pcard__colors {
    position: absolute;
    z-index: 2;
    inset-block-end: 8px;
    inset-inline: 0;
    margin-inline: auto;
    width: max-content;
    max-width: calc(100% - 16px);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .28);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.dps-hub .dcat-pcard__swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .75);
}

.dps-hub .dcat-pcard__body {
    padding: 9px 4px 3px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dps-hub .dcat-pcard__row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.dps-hub .dcat-pcard__title {
    margin: 0;
    font-size: var(--h-title-size, 10px);
    font-weight: var(--h-title-weight, 600);
    color: var(--c-text-strong);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
    width: 100%;
}

.dps-hub .dcat-pcard__title a {
    text-decoration: none;
    color: inherit;
    font-weight: inherit;
}

.dps-hub .dcat-pcard__price {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.dps-hub .dcat-pcard__now {
    font-size: var(--h-price-size, 13px);
    font-weight: var(--h-price-weight, 800);
    color: var(--c-text-strong);
}

.dps-hub .dcat-pcard__now .unit {
    font-size: 8.5px;
    font-weight: 600;
    color: var(--c-taupe);
    margin-inline-start: 3px;
}

.dps-hub .dcat-pcard__old {
    font-size: 9.5px;
    color: var(--c-taupe);
    font-weight: 600;
    text-decoration: line-through;
}

.dps-hub .dcat-pcard__price--sale {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.dps-hub .dcat-pcard__price--sale .dcat-pcard__old {
    opacity: .7;
}

.dps-hub .dcat-pcard__add {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: var(--r-btn);
    background: #6c1410;
    color: #fff;
    display: grid;
    place-items: center;
    transition: transform var(--fast), background var(--fast);
}

.dps-hub .dcat-pcard__add svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.dps-hub .dcat-pcard__add:active {
    transform: scale(.9);
}

.dps-hub .dcat-pcard.is-oos {
    opacity: .9;
}

.dps-hub .dcat-pcard.is-oos .dcat-pcard__media img {
    filter: grayscale(1) contrast(.95) brightness(1.02);
}

.dps-hub .dcat-pcard.is-oos .dcat-pcard__title a {
    color: #9a9a9a;
}

.dps-hub .dcat-pcard__oos {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-start: 8px;
    z-index: 2;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    color: #5a5a5a;
    background: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(9px) saturate(140%);
    backdrop-filter: blur(9px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .6);
    box-shadow: 0 4px 14px rgba(28, 26, 24, .10);
}

.dps-hub .dcat-pcard__price--oos .dcat-pcard__oostext {
    font-size: 13px;
    font-weight: 800;
    color: #9a9a9a;
}

.dps-hub .dcat-pcard__disc {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-end: 8px;
    z-index: 2;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    background: rgba(108, 20, 16, .42);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    backdrop-filter: blur(8px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .25);
    box-shadow: 0 4px 14px rgba(108, 20, 16, .22);
}

.dps-hub .dcat-reveal {
    opacity: 0;
    transform: translateY(8px);
}

.dps-hub .dcat-reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity .45s var(--h-ease), transform .45s var(--h-ease);
}

/* ---------------- skeleton (same as the category page) ---------------- */

.dps-hub .dcat-skel {
    position: relative;
    overflow: hidden;
    background: #ededed;
    border-radius: var(--r-thumb);
    display: block;
}

.dps-hub .dcat-skel::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
    animation: drmShimmerR 1.25s infinite;
}

@keyframes drmShimmerR {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.dps-hub .sk-media {
    aspect-ratio: 3 / 4;
    border-radius: var(--r-thumb);
}

.dps-hub .sk-line {
    height: 11px;
    border-radius: 6px;
}

.dps-hub .sk-w70 { width: 70%; }
.dps-hub .sk-w40 { width: 40%; }

/* ---------------- footer states ---------------- */

.dps-hub__foot {
    display: flex;
    justify-content: center;
    padding: 22px 0 6px;
}

.dps-hub__more {
    min-height: 46px;
    padding: 0 30px;
    border: 0;
    border-radius: var(--h-pill);
    background: var(--h-primary);
    color: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .18s var(--h-ease);
}

.dps-hub__more:hover {
    opacity: .92;
}

.dps-hub__more.is-busy {
    opacity: .6;
    pointer-events: none;
}

.dps-hub__end {
    display: block;
    text-align: center;
    padding: 20px 0 4px;
    font-size: 12px;
    color: var(--h-muted);
}

.dps-hub__empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
    padding: 60px 20px;
    color: var(--h-muted);
}

.dps-hub__empty svg {
    width: 46px;
    height: 46px;
    color: #d8d0cd;
}

.dps-hub__empty strong {
    font-size: 14.5px;
    color: var(--h-strong);
}

.dps-hub__empty span {
    font-size: 12.5px;
}

/* ---------------- responsive ---------------- */

@media (min-width: 560px) {
    .dps-hub__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

@media (min-width: 980px) {
    .dps-hub__bar {
        padding-block: 16px;
    }

    .dps-hub {
        --h-pad: 20px;
    }

    .dps-hub__wrap {
        padding-inline: var(--h-pad);
    }

    .dps-hub__wrap {
        display: grid;
        grid-template-columns: 248px 1fr;
        gap: 24px;
        align-items: start;
        padding-block: 26px 0;
    }

    .dps-hub__side {
        display: block;
        position: sticky;
        top: 16px;
        align-self: start;
        background: #fafafa;
        border-radius: var(--r-card);
        padding: 18px;
    }

    .dps-hub__chips {
        display: none;
    }

    .dps-hub__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        padding-top: 0;
    }

    .dps-hub__title {
        font-size: 18px;
    }

    .dps-hub .dcat-pcard__now {
        font-size: calc(var(--h-price-size, 13px) + 2px);
    }

    .dps-hub .dcat-pcard__now .unit {
        font-size: 9.5px;
    }

    .dps-hub .dcat-pcard__old {
        font-size: 10.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dps-hub {
        transition: none;
        opacity: 1;
    }

    .dps-hub .dcat-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .dps-hub .dcat-skel::after,
    .dps-hub .dcat-pcard__media::before {
        animation: none;
    }
}
