/* ══ Blok Galeri — item grid ══
   overflow/aspect-ratio/border-radius sengaja ditaruh di file CSS eksternal
   ini (bukan inline style="...") — HtmlSanitizer (HTMLPurifier) memakai
   whitelist CSS default yang tidak mengizinkan properti seperti border-radius,
   overflow, atau aspect-ratio pada atribut style inline, jadi kalau ditulis
   inline akan senyap terpangkas saat konten disimpan.

   Struktur: <figure class="bk-gallery-item"> adalah target klik (area zoom +
   caption), sedangkan crop rasio 4:3 + overflow:hidden + radius HANYA di
   <div class="bk-gallery-media"> yang membungkus <img>. Kalau overflow:hidden
   ditaruh di <figure> yang juga membungkus <figcaption>, teks caption akan
   ikut terpotong karena melewati tinggi box rasio 4:3 itu. */
.bk-gallery-item {
    display: block;
    margin: 0;
    cursor: zoom-in;
}
.bk-gallery-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}
.bk-gallery-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform .25s ease, opacity .2s ease;
}
.bk-gallery-item:hover .bk-gallery-media img {
    transform: scale(1.03);
    opacity: .92;
}

.bk-gallery-media.bk-gallery-radius-none { border-radius: 0; }
.bk-gallery-media.bk-gallery-radius-sm { border-radius: 6px; }
.bk-gallery-media.bk-gallery-radius-md { border-radius: 12px; }
.bk-gallery-media.bk-gallery-radius-lg { border-radius: 24px; }
.bk-gallery-media.bk-gallery-radius-circle { border-radius: 50%; }

/* ══ Blok Carousel (page builder) ══
   Gambar slide memakai inline height tetap (mis. 500px). object-fit/object-position
   dulu dibuang HtmlSanitizer, sehingga di HP foto lebar ±330px ditarik ke 500px
   dan terlihat gepeng. Aturan di sini memperbaiki konten lama tanpa perlu simpan
   ulang. Selector id^="bk-cr-" hanya mengenai carousel buatan page builder.
   Juga me-reset margin/border-radius dari .sp-body img / .pg-body img. */
.carousel[id^="bk-cr-"] .carousel-item img {
    width: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
    margin: 0;
    border-radius: 0;
}
.carousel[id^="bk-cr-"] .carousel-inner { border-radius: 10px; }

@media (max-width: 767.98px) {
    /* max-height mengalahkan inline height yang lebih besar tanpa !important;
       62vw ≈ rasio 16:10 supaya foto tetap landscape di HP. */
    .carousel[id^="bk-cr-"] .carousel-item img { max-height: 62vw; }
}

/* ══════════════════════════════════════════════════════════════════
   Blok Galeri (baru) — markup App\Helpers\GalleryBlockRenderer,
   interaksi js/components/gallery-block.js.
   Tata letak: grid · masonry · justified · mosaic · carousel · slideshow
   Variabel: --gap --rad --ratio --cols --cols-m --row-h --sh
   ══════════════════════════════════════════════════════════════════ */
.bk-gal { --gal-accent: var(--main-color, #2563eb); position: relative; width: 100%; }
.bk-gal figure { margin: 0; }
.bk-gal-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.bk-gal-title { margin: 0 0 4px; font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 800; letter-spacing: -.01em; }
.bk-gal-sub { margin: 0; color: #667085; font-size: 15px; max-width: 620px; }
.bk-gal-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-gal-filter button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid #e4e7ec; border-radius: 999px; background: #fff; color: #344054; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.bk-gal-filter button span { font-size: 11.5px; font-weight: 700; color: #98a2b3; }
.bk-gal-filter button:hover { border-color: #c4c9d2; }
.bk-gal-filter button.is-on { background: #101828; border-color: #101828; color: #fff; }
.bk-gal-filter button.is-on span { color: rgba(255,255,255,.6); }

/* item dasar */
.bk-gal-item { position: relative; min-width: 0; }
.bk-gal-item[hidden] { display: none !important; }
.bk-gal-item.is-out { display: none !important; }
.bk-gal-link { display: block; color: inherit; text-decoration: none !important; border-radius: var(--rad); outline: none; }
a.bk-gal-link { cursor: zoom-in; }
a.bk-gal-link:focus-visible .bk-gal-media { outline: 3px solid var(--gal-accent); outline-offset: 3px; }
.bk-gal-media { position: relative; display: block; overflow: hidden; border-radius: var(--rad); background: #eef0f3; isolation: isolate; }
/* cover: foto memenuhi sel (grid/mosaik/carousel) tanpa pita kosong di kiri-kanan.
   Jangan diganti contain — rasio sel ≠ rasio foto memunculkan pita latar. Foto utuh = gaya Masonry/Justified/Slideshow. */
.bk-gal-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; margin: 0 !important; max-width: none !important; border-radius: 0 !important; transition: transform .6s cubic-bezier(.2,.8,.2,1), filter .4s, opacity .3s; }
.bk-gal-zoom { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.92); color: #101828; font-size: 14px; opacity: 0; transform: scale(.8); transition: opacity .25s, transform .25s; pointer-events: none; }
.has-lb .bk-gal-link:hover .bk-gal-zoom, .has-lb .bk-gal-link:focus-visible .bk-gal-zoom { opacity: 1; transform: none; }
.bk-gal:not(.has-lb) .bk-gal-zoom { display: none; }

/* efek hover */
.bk-gal-h-zoom .bk-gal-link:hover img { transform: scale(1.07); }
.bk-gal-h-lift .bk-gal-media { transition: transform .3s, box-shadow .3s; }
.bk-gal-h-lift .bk-gal-link:hover .bk-gal-media { transform: translateY(-5px); box-shadow: 0 18px 36px -16px rgba(16,24,40,.45); }
.bk-gal-h-overlay .bk-gal-media::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(16,24,40,0) 40%, rgba(16,24,40,.55)); opacity: 0; transition: opacity .3s; }
.bk-gal-h-overlay .bk-gal-link:hover .bk-gal-media::after { opacity: 1; }
.bk-gal-h-overlay .bk-gal-link:hover img { transform: scale(1.03); }
.bk-gal-h-gray img { filter: grayscale(1) contrast(1.05); }
.bk-gal-h-gray .bk-gal-link:hover img { filter: none; transform: scale(1.03); }

/* caption */
.bk-gal-cap { font-size: 13.5px; line-height: 1.45; }
.bk-gal-c-below .bk-gal-cap { margin-top: 8px; color: #475467; }
.bk-gal-c-overlay .bk-gal-cap, .bk-gal-c-hover .bk-gal-cap { position: absolute; inset: auto 0 0 0; z-index: 2; padding: 28px 14px 12px; color: #fff; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.35); background: linear-gradient(180deg, transparent, rgba(16,24,40,.78)); }
.bk-gal-c-hover .bk-gal-cap { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.bk-gal-c-hover .bk-gal-link:hover .bk-gal-cap, .bk-gal-c-hover .bk-gal-link:focus-visible .bk-gal-cap { opacity: 1; transform: none; }
@media (hover: none) { .bk-gal-c-hover .bk-gal-cap { opacity: 1; transform: none; } }

/* +N foto */
.bk-gal-more { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(16,24,40,.6); color: #fff; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); transition: background .2s; }
.bk-gal-more b { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; line-height: 1; }
.bk-gal-more small { font-size: 12.5px; font-weight: 600; opacity: .85; }
.bk-gal-link:hover .bk-gal-more { background: rgba(16,24,40,.7); }
.bk-gal-item:has(.bk-gal-more) .bk-gal-cap, .bk-gal-item:has(.bk-gal-more) .bk-gal-zoom { display: none; }

/* 1) GRID */
.bk-gal-grid .bk-gal-items { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap); }
.bk-gal-grid .bk-gal-media { aspect-ratio: var(--ratio); }

/* 2) MASONRY */
.bk-gal-masonry .bk-gal-items { column-count: var(--cols); column-gap: var(--gap); }
.bk-gal-masonry .bk-gal-item { break-inside: avoid; margin-bottom: var(--gap); }
.bk-gal-masonry .bk-gal-media img { height: auto; }

/* 3) JUSTIFIED (baris rata, rasio asli) */
.bk-gal-justified .bk-gal-items { display: flex; flex-wrap: wrap; gap: var(--gap); }
.bk-gal-justified .bk-gal-items::after { content: ""; flex-grow: 999999; }
.bk-gal-justified .bk-gal-item { flex-grow: calc(var(--w) / var(--h) * 100); flex-basis: calc(var(--row-h) * var(--w) / var(--h)); }
.bk-gal-justified .bk-gal-media { aspect-ratio: var(--w) / var(--h); }

/* 4) MOSAIK / BENTO */
.bk-gal-mosaic .bk-gal-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: calc(var(--row-h) * .75); grid-auto-flow: dense; gap: var(--gap); }
/* bento berulang per 5 foto: foto besar 2×2 bergantian kiri/kanan → tanpa lubang (5, 10, 15 …) */
.bk-gal-mosaic .bk-gal-item:nth-child(5n + 1) { grid-column: span 2; grid-row: span 2; }
.bk-gal-mosaic .bk-gal-item:nth-child(10n + 6) { grid-column: 3 / span 2; }
.bk-gal-mosaic .bk-gal-link, .bk-gal-mosaic .bk-gal-media { height: 100%; }
.bk-gal-mosaic.bk-gal-c-below .bk-gal-cap { display: none; }

/* 5) CAROUSEL */
.bk-gal-viewport { position: relative; }
.bk-gal-track { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 2px; outline: none; }
.bk-gal-track::-webkit-scrollbar { display: none; }
.bk-gal-track .bk-gal-item { scroll-snap-align: start; }
.bk-gal-carousel .bk-gal-media { aspect-ratio: var(--ratio); }

/* panah (carousel & slideshow) */
.bk-gal-arrow { position: absolute; top: 50%; z-index: 6; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: -22px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.95); color: #101828; font-size: 18px; cursor: pointer; box-shadow: 0 8px 22px -8px rgba(16,24,40,.45); transition: transform .15s, opacity .2s; }
.bk-gal-arrow:hover { transform: scale(1.07); }
.bk-gal-arrow:focus-visible { outline: 3px solid var(--gal-accent); outline-offset: 2px; }
.bk-gal-arrow[disabled] { opacity: 0; pointer-events: none; }
.bk-gal-prev { inset-inline-start: -14px; } .bk-gal-next { inset-inline-end: -14px; }
.bk-gal-carousel.bk-gal-c-below .bk-gal-arrow { margin-top: -38px; }
[dir="rtl"] .bk-gal-arrow i { transform: scaleX(-1); }

/* 6) SLIDESHOW */
.bk-gal-stage { position: relative; height: var(--sh); border-radius: var(--rad); overflow: hidden; background: #101828; }
.bk-gal-slides, .bk-gal-slides .bk-gal-item { position: absolute; inset: 0; }
.bk-gal-slides .bk-gal-item { opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility .6s; }
.bk-gal-slides .bk-gal-item.is-on, .bk-gal-slides:not(.is-js) .bk-gal-item:first-child { opacity: 1; visibility: visible; }
.bk-gal-slides .bk-gal-link, .bk-gal-slides .bk-gal-media { height: 100%; border-radius: 0; }
.bk-gal-slides .bk-gal-media { background: #101828; }
.bk-gal-slideshow .bk-gal-media img { object-fit: contain; }
.bk-gal-slideshow .bk-gal-prev { inset-inline-start: 16px; } .bk-gal-slideshow .bk-gal-next { inset-inline-end: 16px; }
.bk-gal-slideshow.bk-gal-c-below .bk-gal-cap, .bk-gal-slideshow.bk-gal-c-hover .bk-gal-cap { position: absolute; inset: auto 0 0 0; z-index: 2; margin: 0; padding: 28px 16px 14px; color: #fff; opacity: 1; transform: none; background: linear-gradient(180deg, transparent, rgba(16,24,40,.78)); font-weight: 600; }
.bk-gal-count { position: absolute; top: 14px; inset-inline-start: 14px; z-index: 6; padding: 4px 11px; border-radius: 999px; background: rgba(16,24,40,.6); color: #fff; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.bk-gal-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 4px; }
.bk-gal-thumb { flex: 0 0 auto; width: 92px; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: calc(var(--rad) * .6); overflow: hidden; cursor: pointer; opacity: .55; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .2s, outline-color .2s; background: #eef0f3; }
.bk-gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0 !important; }
.bk-gal-thumb:hover { opacity: .85; }
.bk-gal-thumb.is-on { opacity: 1; outline-color: var(--gal-accent); }

/* ── Responsif ── */
@media (max-width: 991.98px) {
    .bk-gal-grid .bk-gal-items { grid-template-columns: repeat(var(--cols-t), minmax(0, 1fr)); }
    .bk-gal-masonry .bk-gal-items { column-count: var(--cols-t); }
    .bk-gal-track { --cols: var(--cols-t); }
    .bk-gal-mosaic .bk-gal-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .bk-gal-head { align-items: flex-start; }
    .bk-gal-filter { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; padding-bottom: 2px; }
    .bk-gal-filter button { flex: 0 0 auto; height: 34px; }
    .bk-gal-grid .bk-gal-items { grid-template-columns: repeat(var(--cols-m), minmax(0, 1fr)); }
    .bk-gal-masonry .bk-gal-items { column-count: var(--cols-m); }
    .bk-gal-justified .bk-gal-item { flex-basis: calc(var(--row-h) * .6 * var(--w) / var(--h)); }
    .bk-gal-mosaic .bk-gal-items { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: calc(var(--row-h) * .55); }
    .bk-gal-mosaic .bk-gal-item:nth-child(10n + 6) { grid-column: span 2; }
    .bk-gal-track { grid-auto-columns: 82%; }
    .bk-gal-prev { inset-inline-start: 6px; } .bk-gal-next { inset-inline-end: 6px; }
    .bk-gal-arrow { width: 38px; height: 38px; margin-top: -19px; font-size: 16px; }
    .bk-gal-stage { height: min(var(--sh), 62vh); }
    .bk-gal-thumb { width: 68px; }
}
@media (prefers-reduced-motion: reduce) {
    .bk-gal-media img, .bk-gal-slides .bk-gal-item, .bk-gal-media, .bk-gal-cap { transition: none !important; }
    .bk-gal-track { scroll-behavior: auto; }
}

/* ══ Lightbox galeri (.bk-glb) ══ */
.bk-glb { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 11, 18, .96); color: #fff; overflow: hidden; }
.bk-glb[open] { display: grid; grid-template-rows: auto 1fr auto; animation: bkGlbIn .2s ease-out; }
.bk-glb::backdrop { background: transparent; }
@keyframes bkGlbIn { from { opacity: 0; } to { opacity: 1; } }
.bk-glb-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 20px; }
.bk-glb-count { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; }
.bk-glb-cap { flex: 1; min-width: 0; text-align: center; font-size: 14.5px; color: rgba(255,255,255,.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-glb-acts { display: flex; gap: 4px; }
.bk-glb-acts button, .bk-glb-acts a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #fff; font-size: 17px; text-decoration: none; cursor: pointer; transition: background .15s; }
.bk-glb-acts button:hover, .bk-glb-acts a:hover { background: rgba(255,255,255,.12); color: #fff; }
.bk-glb-acts .is-on { background: rgba(255,255,255,.18); }
.bk-glb-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.bk-glb-img { max-width: calc(100% - 140px); max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: transform .25s ease, opacity .25s; cursor: zoom-in; border-radius: 4px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.bk-glb.is-zoom .bk-glb-img { cursor: zoom-out; transition: transform .08s linear; }
.bk-glb.is-loading .bk-glb-img { opacity: .35; }
.bk-glb-spin { position: absolute; width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; animation: bkGlbSpin .8s linear infinite; opacity: 0; pointer-events: none; }
.bk-glb.is-loading .bk-glb-spin { opacity: 1; }
@keyframes bkGlbSpin { to { transform: rotate(360deg); } }
.bk-glb-nav { position: absolute; top: 50%; z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-top: -26px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 22px; cursor: pointer; transition: background .15s; }
.bk-glb-nav:hover { background: rgba(255,255,255,.22); }
.bk-glb-prev { left: 18px; } .bk-glb-next { right: 18px; }
.bk-glb-strip { display: flex; gap: 8px; padding: 12px 16px 16px; overflow-x: auto; justify-content: safe center; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent; }
.bk-glb-strip button { flex: 0 0 auto; width: 72px; height: 52px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; opacity: .45; cursor: pointer; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .2s, outline-color .2s; background: #1d2939; }
.bk-glb-strip button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-glb-strip button:hover { opacity: .8; }
.bk-glb-strip button.is-on { opacity: 1; outline-color: #fff; }
.bk-glb-prog { position: absolute; top: 0; left: 0; height: 3px; width: 0; background: #fff; opacity: .8; }
.bk-glb.is-play .bk-glb-prog { animation: bkGlbProg var(--glb-int, 4s) linear; }
@keyframes bkGlbProg { from { width: 0; } to { width: 100%; } }
.bk-glb-lock { overflow: hidden !important; }
@media (max-width: 767.98px) {
    .bk-glb-img { max-width: 100%; border-radius: 0; }
    .bk-glb-nav { display: none; }
    .bk-glb-cap { display: none; }
    .bk-glb-strip button { width: 56px; height: 42px; }
    .bk-glb-mcap { display: block; padding: 0 16px 4px; font-size: 13.5px; text-align: center; color: rgba(255,255,255,.85); }
}
@media (min-width: 768px) { .bk-glb-mcap { display: none; } }

/* Pengaman terhadap content-typography.css (img{height:auto;margin}, h3{margin}) */
.bk-gal .bk-gal-media img { width: 100% !important; height: 100% !important; }
.bk-gal-masonry .bk-gal-media img { height: auto !important; }
.bk-gal .bk-gal-title { margin: 0 0 4px !important; line-height: 1.25; }
.bk-gal .bk-gal-sub { margin: 0 !important; }
.bk-gal .bk-gal-cap { margin-bottom: 0; }
.bk-gal-thumb img, .bk-glb-strip img { height: 100% !important; }
