/*
 * Ruang Bestari Legacy Content Native V1
 * Native, dependency-free media gallery and CTA components.
 */

body.single-post.rb-legacy-content-native-v1 {
    --rb-native-surface: var(--rb-color-surface, #ffffff);
    --rb-native-surface-soft: var(--rb-color-surface-soft, #f6f9f8);
    --rb-native-text: var(--rb-color-text-primary, #191c1f);
    --rb-native-muted: var(--rb-color-text-secondary, #687078);
    --rb-native-border: var(--rb-color-border, #e5e7ea);
    --rb-native-primary: var(--rb-color-primary-strong, #094c4e);
    --rb-native-primary-hover: var(--rb-color-primary-hover, #0f9599);
    --rb-native-focus: var(--rb-color-accent, #ff751f);
}

body.single-post .entry-content.single-content .rb-native-gallery,
body.single-post .entry-content.single-content .rb-native-media {
    box-sizing: border-box;
    clear: both;
    color: var(--rb-native-text);
    margin: clamp(1.5rem, 3vw, 2.25rem) auto;
    max-width: 100%;
    width: 100%;
}

body.single-post .entry-content.single-content .rb-native-gallery--portrait,
body.single-post .entry-content.single-content .rb-native-media--portrait {
    width: min(100%, 680px);
}

body.single-post .entry-content.single-content .rb-native-gallery *,
body.single-post .entry-content.single-content .rb-native-media * {
    box-sizing: border-box;
}

body.single-post .entry-content.single-content .rb-native-gallery:focus {
    outline: none;
}

body.single-post .entry-content.single-content .rb-native-gallery:focus-visible,
body.single-post .entry-content.single-content .rb-native-gallery__link:focus-visible,
body.single-post .entry-content.single-content .rb-native-media__link:focus-visible,
body.single-post .entry-content.single-content .rb-native-gallery__arrow:focus-visible,
body.single-post .entry-content.single-content .rb-native-gallery__dot:focus-visible,
body.single-post .entry-content.single-content .rb-native-button:focus-visible {
    outline: 3px solid var(--rb-native-focus);
    outline-offset: 3px;
}

body.single-post .entry-content.single-content .rb-native-gallery__viewport,
body.single-post .entry-content.single-content .rb-native-media {
    background: var(--rb-native-surface-soft);
    border: 1px solid var(--rb-native-border);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(9, 76, 78, 0.08);
    overflow: hidden;
    position: relative;
}

body.single-post .entry-content.single-content .rb-native-gallery__track {
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.single-post .entry-content.single-content .rb-native-gallery__slide {
    background: var(--rb-native-surface-soft);
    border: 0;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

body.single-post .entry-content.single-content .rb-native-gallery__link,
body.single-post .entry-content.single-content .rb-native-media__link {
    align-items: center;
    background: var(--rb-native-surface-soft);
    display: flex;
    justify-content: center;
    text-decoration: none;
    width: 100%;
}

body.single-post .entry-content.single-content .rb-native-gallery--portrait .rb-native-gallery__link,
body.single-post .entry-content.single-content .rb-native-media--portrait .rb-native-media__link {
    aspect-ratio: 4 / 5;
}

body.single-post .entry-content.single-content .rb-native-gallery--landscape .rb-native-gallery__link,
body.single-post .entry-content.single-content .rb-native-media--landscape .rb-native-media__link {
    aspect-ratio: 3 / 2;
}

body.single-post .entry-content.single-content .rb-native-gallery__image,
body.single-post .entry-content.single-content .rb-native-media__image {
    display: block;
    height: 100%;
    margin: 0;
    max-height: none;
    max-width: 100%;
    object-fit: contain;
    width: 100%;
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow,
body.single-post .entry-content.single-content .rb-native-gallery__footer {
    display: none;
}

body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__track {
    display: flex;
    gap: 0;
    transform: translate3d(0, 0, 0);
    transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__slide {
    flex: 0 0 100%;
    min-width: 100%;
}

body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__arrow {
    align-items: center;
    appearance: none;
    background: var(--rb-native-surface);
    background: color-mix(in srgb, var(--rb-native-surface) 92%, transparent);
    border: 1px solid var(--rb-native-border);
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(9, 76, 78, 0.16);
    color: var(--rb-native-primary);
    cursor: pointer;
    display: flex;
    font: inherit;
    height: 44px;
    justify-content: center;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
    width: 44px;
    z-index: 3;
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow span {
    display: block;
    font-family: Arial, sans-serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    transform: translateY(-1px);
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow--prev {
    left: 14px;
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow--next {
    right: 14px;
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow:hover {
    background: var(--rb-native-primary);
    color: #ffffff;
}

body.single-post .entry-content.single-content .rb-native-gallery__arrow:active {
    transform: translateY(-50%) scale(0.95);
}

body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__footer {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    min-height: 38px;
    padding: 12px 4px 0;
}

body.single-post .entry-content.single-content .rb-native-gallery__dots {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

body.single-post .entry-content.single-content .rb-native-gallery__dot {
    appearance: none;
    background: var(--rb-native-border);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    height: 8px;
    margin: 0;
    min-height: 8px;
    min-width: 8px;
    padding: 0;
    transition: background-color 180ms ease, width 180ms ease;
    width: 8px;
}

body.single-post .entry-content.single-content .rb-native-gallery__dot.is-active {
    background: var(--rb-native-primary);
    width: 24px;
}

body.single-post .entry-content.single-content .rb-native-gallery__counter {
    color: var(--rb-native-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 3.25rem;
}

body.single-post .entry-content.single-content .rb-native-actions {
    align-items: center;
    clear: both;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0 1.75rem;
}

body.single-post .entry-content.single-content .rb-native-button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 12px;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1.2;
    min-height: 46px;
    padding: 0.78rem 1.15rem;
    text-align: center;
    text-decoration: none !important;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

body.single-post .entry-content.single-content .rb-native-button--primary {
    background: var(--rb-native-primary);
    border-color: var(--rb-native-primary);
    color: #ffffff !important;
}

body.single-post .entry-content.single-content .rb-native-button--primary:hover {
    background: var(--rb-native-primary-hover);
    border-color: var(--rb-native-primary-hover);
    color: #ffffff !important;
    transform: translateY(-1px);
}

body.single-post .entry-content.single-content .rb-native-button--secondary {
    background: var(--rb-native-surface);
    border-color: var(--rb-native-border);
    color: var(--rb-native-primary) !important;
}

body.single-post .entry-content.single-content .rb-native-button--secondary:hover {
    background: var(--rb-native-surface-soft);
    border-color: var(--rb-native-primary);
    color: var(--rb-native-primary-hover) !important;
    transform: translateY(-1px);
}

.rb-native-visually-hidden {
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    white-space: nowrap !important;
    width: 1px !important;
}

html[data-rb-theme="dark"] body.single-post .entry-content.single-content .rb-native-gallery__viewport,
html[data-rb-theme="dark"] body.single-post .entry-content.single-content .rb-native-media {
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

html[data-rb-theme="dark"] body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__arrow {
    background: var(--rb-native-surface);
    background: color-mix(in srgb, var(--rb-native-surface) 90%, transparent);
}

html[data-rb-theme="dark"] body.single-post .entry-content.single-content .rb-native-gallery__arrow:hover {
    background: var(--rb-native-primary);
    color: var(--rb-color-on-emphasis, #ffffff);
}

@media (max-width: 700px) {
    body.single-post .entry-content.single-content .rb-native-gallery,
    body.single-post .entry-content.single-content .rb-native-media {
        border-radius: 16px;
        margin-bottom: 1.5rem;
        margin-top: 1.5rem;
        width: 100%;
    }

    body.single-post .entry-content.single-content .rb-native-gallery__viewport,
    body.single-post .entry-content.single-content .rb-native-media {
        border-radius: 16px;
    }

    body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__arrow {
        height: 38px;
        width: 38px;
    }

    body.single-post .entry-content.single-content .rb-native-gallery__arrow--prev {
        left: 10px;
    }

    body.single-post .entry-content.single-content .rb-native-gallery__arrow--next {
        right: 10px;
    }

    body.single-post .entry-content.single-content .rb-native-gallery__arrow span {
        font-size: 1.7rem;
    }

    body.single-post .entry-content.single-content .rb-native-actions {
        align-items: stretch;
        flex-direction: column;
    }

    body.single-post .entry-content.single-content .rb-native-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.single-post .entry-content.single-content .rb-native-gallery.is-ready .rb-native-gallery__track,
    body.single-post .entry-content.single-content .rb-native-gallery__arrow,
    body.single-post .entry-content.single-content .rb-native-gallery__dot,
    body.single-post .entry-content.single-content .rb-native-button {
        scroll-behavior: auto;
        transition: none;
    }
}
