/* ==========================================================================
   Product gallery — sticky category switcher + showcase panels
   ========================================================================== */

.rp-gallery {
    --rp-navy: #0f3f60;
    --rp-navy-deep: #0a2c45;
    --rp-orange: #f5a11a;
    --rp-ink: #14364f;
    --rp-muted: #546b7d;
    --rp-line: rgba(15, 63, 96, 0.12);
    --rp-radius: 18px;
    --rp-sticky-top: 84px;
    position: relative;
    padding: clamp(64px, 8vw, 104px) 0 clamp(56px, 7vw, 88px);
    text-align: start;
    color: var(--rp-ink);
    font-family: Outfit, Tajawal, sans-serif;
}

html[dir="rtl"] .rp-gallery {
    font-family: Tajawal, sans-serif;
}

/* ── Heading ─────────────────────────────────────────────── */
.rp-gallery__head {
    max-width: 760px;
    margin: 0 auto clamp(28px, 4vw, 44px);
    text-align: center;
}

.rp-gallery__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #c07a06;
}

.rp-gallery__eyebrow::before,
.rp-gallery__eyebrow::after {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
}

html[dir="rtl"] .rp-gallery__eyebrow {
    letter-spacing: 0;
    font-size: 0.95rem;
}

.rp-gallery__title {
    margin: 0 0 14px;
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--rp-navy);
    text-wrap: balance;
}

html[dir="rtl"] .rp-gallery__title {
    font-family: Tajawal, sans-serif;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
}

.rp-gallery__subtitle {
    margin: 0 auto;
    max-width: 58ch;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--rp-muted);
}

/* ── Sticky category switcher ────────────────────────────── */
.rp-gallery__nav-wrap {
    position: sticky;
    top: var(--rp-sticky-top);
    z-index: 30;
    display: flex;
    justify-content: center;
    padding: 10px 0;
    pointer-events: none;
}

.rp-gallery__nav {
    position: relative;
    display: inline-flex;
    gap: 4px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--rp-line);
    box-shadow: 0 12px 34px rgba(10, 44, 69, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
}

.rp-tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 22px 6px 6px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--rp-ink);
    font: inherit;
    cursor: pointer;
    transition: color 0.3s ease, background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

html[dir="rtl"] .rp-tab {
    padding: 6px 6px 6px 22px;
}

.rp-tab:hover:not(.is-active) {
    background: rgba(15, 63, 96, 0.06);
}

.rp-tab:focus-visible {
    outline: 2px solid var(--rp-orange);
    outline-offset: 2px;
}

/* Without JS the active tab paints its own background; with JS a sliding pill does. */
.rp-tab.is-active {
    color: #fff;
    background: var(--rp-navy);
}

.rp-gallery__nav.has-indicator .rp-tab.is-active {
    background: transparent;
}

.rp-gallery__indicator {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--rp-navy) 0%, var(--rp-navy-deep) 100%);
    box-shadow: 0 8px 20px rgba(10, 44, 69, 0.28);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), width 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.rp-gallery__nav.has-indicator .rp-gallery__indicator {
    opacity: 1;
}

.rp-tab__thumb {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    background: #e7edf2;
}

.rp-tab__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rp-tab__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.rp-tab__label {
    font-size: 1rem;
    font-weight: 700;
}

.rp-tab__count {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.68;
}

/* ── Panels ──────────────────────────────────────────────── */
.rp-gallery__panels {
    margin-top: clamp(22px, 3vw, 36px);
}

.rp-panel {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}

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

.rp-panel__intro {
    position: sticky;
    top: calc(var(--rp-sticky-top) + 96px);
    padding-top: 6px;
}

.rp-panel__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(245, 161, 26, 0.12);
    color: #a96500;
    font-size: 0.8rem;
    font-weight: 700;
}

.rp-panel__title {
    margin: 16px 0 12px;
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 2.6vw, 2.4rem);
    line-height: 1.12;
    color: var(--rp-navy);
}

html[dir="rtl"] .rp-panel__title {
    font-family: Tajawal, sans-serif;
    font-weight: 800;
    line-height: 1.3;
}

.rp-panel__pitch {
    margin: 0 0 20px;
    font-size: 1.04rem;
    line-height: 1.65;
    color: var(--rp-muted);
}

.rp-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 26px;
    padding: 0;
    list-style: none;
}

.rp-panel__chips li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--rp-line);
    background: #fff;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--rp-ink);
    white-space: nowrap;
}

.rp-panel__chips li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rp-orange);
}

.rp-panel__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 999px;
    background: var(--rp-orange);
    color: #fff;
    font-weight: 700;
    font-size: 0.98rem;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(245, 161, 26, 0.3);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.rp-panel__cta:hover {
    background: #e8940d;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(245, 161, 26, 0.36);
}

.rp-panel__cta svg {
    width: 16px;
    height: 16px;
}

html[dir="rtl"] .rp-panel__cta svg,
html[dir="rtl"] .rp-more svg {
    transform: scaleX(-1);
}

/* ── Bento grid ──────────────────────────────────────────── */
.rp-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(170px, 15.5vw, 236px);
    grid-auto-flow: dense;
    gap: 14px;
}

.rp-card {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--rp-radius);
    overflow: hidden;
    background: #e9eef2;
    cursor: zoom-in;
    box-shadow: 0 6px 20px rgba(10, 44, 69, 0.08);
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}

.rp-card--feature {
    grid-column: span 2;
    grid-row: span 2;
}

.rp-card--wide {
    grid-column: span 2;
}

.rp-card--full {
    grid-column: 1 / -1;
}

.rp-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}

.rp-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 44, 69, 0) 55%, rgba(10, 44, 69, 0.45) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 1;
}

.rp-card__zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--rp-navy);
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

html[dir="rtl"] .rp-card__zoom {
    right: auto;
    left: 14px;
}

.rp-card__zoom svg {
    width: 18px;
    height: 18px;
}

@media (hover: hover) {
    .rp-card:hover img {
        transform: scale(1.06);
    }

    .rp-card:hover::after {
        opacity: 1;
    }

    .rp-card:hover .rp-card__zoom {
        opacity: 1;
        transform: none;
    }
}

.rp-card:focus-visible {
    outline: 3px solid var(--rp-orange);
    outline-offset: 3px;
}

/* Collapsed state: only the first N cards (desktop). */
.rp-card.is-extra {
    display: none;
}

.rp-panel.is-expanded .rp-card.is-extra {
    display: block;
}

/* Entrance animation when a panel opens */
.rp-panel.is-animating .rp-card {
    animation: rp-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes rp-rise {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ── Footer (show all / counter) ─────────────────────────── */
.rp-panel__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 26px;
}

.rp-progress,
.rp-panel__counter {
    display: none;
}

.rp-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 26px;
    border-radius: 999px;
    border: 1.5px solid var(--rp-navy);
    background: #fff;
    color: var(--rp-navy);
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.rp-more:hover {
    background: var(--rp-navy);
    color: #fff;
}

.rp-more svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.rp-more__close {
    display: none;
}

.rp-panel.is-expanded .rp-more__open {
    display: none;
}

.rp-panel.is-expanded .rp-more__close {
    display: inline;
}

.rp-panel.is-expanded .rp-more svg {
    transform: rotate(180deg);
}

/* ── Tablet ──────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .rp-panel {
        grid-template-columns: 1fr;
    }

    .rp-panel__intro {
        position: static;
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 28px;
        align-items: end;
    }

    .rp-panel__intro > * {
        grid-column: 1;
    }

    .rp-panel__cta {
        grid-column: 2;
        grid-row: 1 / span 4;
        align-self: end;
        margin-bottom: 26px;
    }

    .rp-grid {
        grid-auto-rows: clamp(160px, 24vw, 230px);
    }
}

/* ── Mobile: swipe carousel, always-visible switcher ─────── */
@media (max-width: 768px) {
    .rp-gallery {
        padding: 56px 0 48px;
    }

    .rp-gallery__head {
        padding: 0 8px;
        margin-bottom: 18px;
    }

    .rp-gallery__subtitle {
        font-size: 0.98rem;
    }

    .rp-gallery__nav-wrap {
        margin-inline: calc(50% - 50vw);
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid transparent;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .rp-gallery__nav-wrap.is-stuck {
        border-bottom-color: var(--rp-line);
        box-shadow: 0 8px 18px rgba(10, 44, 69, 0.08);
    }

    .rp-gallery__nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        max-width: 480px;
        padding: 4px;
        border-radius: 16px;
        box-shadow: none;
        background: #eef2f6;
        border-color: transparent;
    }

    .rp-tab,
    html[dir="rtl"] .rp-tab {
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 9px 4px;
        border-radius: 12px;
        min-height: 54px;
    }

    .rp-gallery__indicator {
        top: 4px;
        bottom: 4px;
        border-radius: 12px;
    }

    .rp-tab__thumb {
        display: none;
    }

    .rp-tab__text {
        align-items: center;
    }

    .rp-tab__label {
        font-size: 0.92rem;
    }

    .rp-tab__count {
        font-size: 0.7rem;
    }

    .rp-gallery__panels {
        margin-top: 18px;
    }

    .rp-panel {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .rp-panel__intro {
        display: contents;
    }

    .rp-panel__badge {
        order: 1;
        align-self: flex-start;
    }

    .rp-panel__title {
        order: 2;
        margin: 12px 0 8px;
        font-size: 1.75rem;
    }

    .rp-panel__pitch {
        order: 3;
        font-size: 0.98rem;
        margin-bottom: 14px;
    }

    .rp-panel__chips {
        order: 4;
        flex-wrap: nowrap;
        overflow-x: auto;
        box-sizing: border-box;
        width: 100vw;
        max-width: 100vw;
        align-self: center;
        margin: 0 0 16px;
        padding: 0 16px 2px;
        scrollbar-width: none;
    }

    .rp-panel__chips::-webkit-scrollbar {
        display: none;
    }

    .rp-panel__body {
        order: 5;
    }

    .rp-panel__cta {
        order: 6;
        width: 100%;
        margin: 18px 0 0;
    }

    .rp-grid {
        display: flex;
        gap: 12px;
        box-sizing: border-box;
        width: 100vw;
        max-width: 100vw;
        margin-inline: calc(50% - 50vw);
        padding: 4px 16px 10px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 16px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .rp-grid::-webkit-scrollbar {
        display: none;
    }

    .rp-card,
    .rp-card--feature,
    .rp-card--wide,
    .rp-card--full,
    .rp-card.is-extra {
        display: block;
        flex: 0 0 80%;
        width: 80%;
        height: auto;
        aspect-ratio: 4 / 5;
        scroll-snap-align: start;
        grid-column: auto;
        grid-row: auto;
    }

    .rp-card__zoom {
        opacity: 1;
        transform: none;
        width: 36px;
        height: 36px;
    }

    .rp-panel__footer {
        justify-content: space-between;
        margin-top: 12px;
    }

    .rp-progress {
        display: block;
        position: relative;
        flex: 1;
        height: 3px;
        border-radius: 3px;
        background: rgba(15, 63, 96, 0.12);
        overflow: hidden;
    }

    .rp-progress__bar {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: var(--rp-progress, 10%);
        border-radius: 3px;
        background: var(--rp-orange);
        transition: width 0.25s ease;
    }

    .rp-panel__counter {
        display: inline-block;
        min-width: 52px;
        text-align: end;
        font-size: 0.85rem;
        font-weight: 700;
        color: var(--rp-navy);
        font-variant-numeric: tabular-nums;
        direction: ltr;
        unicode-bidi: isolate;
    }

    .rp-more {
        display: none;
    }
}

@media (max-width: 380px) {
    .rp-tab__label {
        font-size: 0.84rem;
    }

    .rp-card,
    .rp-card--feature,
    .rp-card.is-extra {
        flex-basis: 84%;
        width: 84%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rp-panel.is-animating .rp-card {
        animation: none;
    }

    .rp-gallery__indicator,
    .rp-card img {
        transition: none;
    }
}

/* ==========================================================================
   Clients + Events — mobile presentation
   ========================================================================== */
.rp-clients-m,
.rp-events-m {
    display: none;
}

@media (max-width: 768px) {
    /* ── Clients: two auto-scrolling rows ─────────────────── */
    .client-logos-section {
        padding: 48px 0 40px !important;
    }

    .client-logos-header {
        margin-bottom: 24px !important;
    }

    .client-logos-container {
        display: none !important;
    }

    .rp-clients-m {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100vw;
        margin-inline: calc(50% - 50vw);
        overflow: hidden;
        direction: ltr;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
    }

    .rp-clients-m__row {
        overflow: hidden;
    }

    .rp-clients-m__track {
        display: flex;
        gap: 12px;
        width: max-content;
        animation: rp-marquee 38s linear infinite;
    }

    .rp-clients-m__row--rev .rp-clients-m__track {
        animation-direction: reverse;
        animation-duration: 44s;
    }

    .rp-clients-m__logo {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: none;
        width: 132px;
        height: 76px;
        padding: 12px 16px;
        box-sizing: border-box;
        border-radius: 16px;
        background: #fff;
        border: 1px solid rgba(15, 63, 96, 0.09);
        box-shadow: 0 6px 16px rgba(10, 44, 69, 0.06);
    }

    .rp-clients-m__logo img {
        display: block;
        max-width: 100%;
        max-height: 48px;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* ── Events: square, uncropped swipe cards ────────────── */
    .events-section {
        padding: 48px 0 !important;
    }

    .events-header {
        margin-bottom: 22px !important;
    }

    .events-grid,
    .events-swiper {
        display: none !important;
    }

    .rp-events-m {
        display: block;
    }

    .rp-events-m__track {
        display: flex;
        gap: 12px;
        box-sizing: border-box;
        width: 100vw;
        margin-inline: calc(50% - 50vw);
        padding: 4px 16px 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 16px;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .rp-events-m__track::-webkit-scrollbar {
        display: none;
    }

    .rp-events-m__card {
        flex: 0 0 82%;
        aspect-ratio: 1 / 1;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 18px;
        overflow: hidden;
        background: #e9eef2;
        box-shadow: 0 8px 22px rgba(10, 44, 69, 0.12);
        scroll-snap-align: start;
        cursor: zoom-in;
    }

    .rp-events-m__card img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .rp-events-m__footer {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-top: 6px;
    }

    .rp-events-m__footer .rp-progress {
        display: block;
        position: relative;
        flex: 1;
        height: 3px;
        border-radius: 3px;
        background: rgba(15, 63, 96, 0.12);
        overflow: hidden;
    }

    .rp-events-m__footer .rp-progress__bar {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: var(--rp-progress, 14%);
        border-radius: 3px;
        background: #f5a11a;
        transition: width 0.25s ease;
    }

    .rp-events-m__counter {
        min-width: 44px;
        text-align: end;
        font-size: 0.85rem;
        font-weight: 700;
        color: #0f3f60;
        font-variant-numeric: tabular-nums;
        direction: ltr;
        unicode-bidi: isolate;
    }
}

@keyframes rp-marquee {
    to {
        transform: translateX(calc(-50% - 6px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .rp-clients-m__track {
        animation: none;
    }

    .rp-clients-m__row {
        overflow-x: auto;
    }
}
