/* Generic image carousel — used for آراء عملائنا and بعض من أعمالنا on the
   contact page. Behaviour comes from offers-carousel-script.php; the dots are
   .rn-carousel__dot, styled once in offers.css, so both carousels look the same.

   The two load-bearing rules below are the same pair the offers carousel needed,
   and for the same reasons — see offers.css for the long version:
     · the track is width: max-content, or RTL inline-end overflow is unreachable
       and the carousel cannot scroll at all;
     · slides snap to start, not center, because a centred first slide has no
       reachable scroll position. */

.rn-mcar {
    position: relative;
}

.rn-mcar__viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-inline: -0.75rem;
    padding: 0.5rem 0.75rem 1rem;
}

.rn-mcar__viewport::-webkit-scrollbar {
    display: none;
}

.rn-mcar__viewport:focus-visible {
    outline: 2px solid var(--ct-accent);
    outline-offset: 4px;
    border-radius: 1rem;
}

.rn-mcar__track {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    width: max-content;
    padding-inline-end: 0.25rem;
}

.rn-mcar__slide {
    flex: 0 0 auto;
    width: var(--rn-mcar-width, 300px);
    scroll-snap-align: start;
}

/* Gallery mode: each slide holds a real .rn-gal__item from gallery-tile.php, so
   the crop, the play badge and the category chip all come from gallery.css and
   match the portfolio pages exactly. Nothing here may restyle the tile — only
   let it fill the slide. */
.rn-mcar--gallery .rn-mcar__slide > .rn-gal__item {
    width: 100%;
}

.rn-mcar__frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--rn-mcar-ratio, 4 / 5);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: 1rem;
    /* Matches the letterboxing colour below, so a shorter image reads as one
       object rather than a picture floating on a lighter card. */
    background: #14141f;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

div.rn-mcar__frame {
    cursor: default;
}

.rn-mcar__frame:hover,
.rn-mcar__frame:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px var(--ct-shadow);
    border-color: var(--ct-accent);
    outline: none;
}

.rn-mcar__img {
    display: block;
    width: 100%;
    height: 100%;
    /* contain, not cover: these are screenshots of reviews and finished work.
       Cropping a review cuts the sentence that makes it worth showing. */
    object-fit: contain;
}

.rn-mcar__badge {
    position: absolute;
    inset-inline-start: 0.6rem;
    top: 0.6rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--ct-accent-gradient);
    color: #14121c;
    font-size: 0.72rem;
    font-weight: 700;
}

.rn-mcar__zoom {
    position: absolute;
    inset-inline-end: 0.6rem;
    bottom: 0.6rem;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(13, 13, 24, 0.72);
    color: var(--ct-text);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rn-mcar__frame:hover .rn-mcar__zoom,
.rn-mcar__frame:focus-visible .rn-mcar__zoom {
    opacity: 1;
}

/* ---- controls ---- */

.rn-mcar__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

.rn-mcar__nav {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--ct-border);
    background: rgba(31, 31, 52, 0.85);
    color: var(--ct-text);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.rn-mcar__nav:hover:not(:disabled),
.rn-mcar__nav:focus-visible {
    background: var(--ct-accent-gradient);
    color: #16162b;
    border-color: transparent;
    outline: none;
}

.rn-mcar__nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.rn-carousel__dots {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: center;
}

.rn-carousel__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(208, 177, 212, 0.35);
    cursor: pointer;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rn-carousel__dot:hover {
    background: var(--ct-accent-dark);
}

.rn-carousel__dot.is-active {
    width: 26px;
    background: var(--ct-accent-gradient);
}

@media (max-width: 575.98px) {
    .rn-mcar__track { gap: 0.75rem; }
    .rn-mcar__slide { width: min(86vw, var(--rn-mcar-width, 300px)); }
    .rn-mcar__nav { width: 40px; height: 40px; }
    /* 65 reviews would otherwise wrap into a block of dots taller than the
       carousel itself. */
    .rn-carousel__dots { max-width: 55%; max-height: 2.2rem; overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .rn-mcar__viewport { scroll-behavior: auto; }
    .rn-mcar__frame,
    .rn-mcar__zoom { transition: none; }
    .rn-mcar__frame:hover,
    .rn-mcar__frame:focus-visible { transform: none; }
}
