/* ==========================================================================
   rs-ui.css — Kit komponen UI aksesibel website RSU Pemasyarakatan Jakarta (9 Nov 2026)
   --------------------------------------------------------------------------
   Dimuat SESUDAH style.css. Tidak mengubah tampilan dasar; hanya menambah:
     1. Tautan "Lewati ke konten", cincin fokus keyboard
     2. Animasi: aman bila skrip AOS gagal dimuat + hormati "kurangi gerakan"
     3. Tombol tanpa gaya (kartu poli/layanan yang kini <button>)
     4. Kontrol jeda slider (WCAG 2.2.2)
     5. Gambar gagal dimuat, gambar memuat
     6. Tabel lebar bisa digeser (HP)
     7. Dialog PDF: memuat / tidak bisa ditampilkan di HP
     8. Jadwal dokter: cari dokter, "hari ini", keadaan kosong
     9. Judul halaman + remah roti (halaman informasi publik)
    10. Halaman 404
    11. Tombol kembali ke atas
    12. Perbaikan tata letak HP (hero, tabel, slider) & kontras warna (WCAG AA)
   ========================================================================== */

/* ---------- 1. Lewati ke konten & fokus ---------- */
.rs-lewati {
  position: fixed; top: .5rem; left: .5rem; z-index: 100000;
  padding: .7rem 1.1rem; border-radius: 10px; background: #0b3d91; color: #fff !important;
  font-weight: 600; text-decoration: none; transform: translateY(-160%); transition: transform .15s;
}
.rs-lewati:focus { transform: none; outline: 3px solid #ffbf47; outline-offset: 2px; }
main#konten:focus, [tabindex="-1"]:focus:not(a):not(button) { outline: none; }
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid #0b5ed7 !important; outline-offset: 2px !important; box-shadow: 0 0 0 5px rgba(255, 255, 255, .85) !important;
}
footer :where(a, button):focus-visible, .hero :where(a, button):focus-visible, #poli-section :where(a, button):focus-visible {
  outline-color: #ffbf47 !important; box-shadow: 0 0 0 5px rgba(0, 0, 0, .55) !important;
}
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }

/* ---------- 2. Animasi ---------- */
/* aos.css menyembunyikan [data-aos] (opacity 0) sampai skripnya jalan. Bila CDN/skrip gagal → isi tidak pernah muncul.
   Kelas html.aos-siap dipasang di <head>; rs-ui.js mencabutnya bila AOS tidak tersedia. */
html:not(.aos-siap) [data-aos] { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-aos], .animate-text, .animate-image, .animate-pdf, .mission-card, .gallery-item { opacity: 1 !important; transform: none !important; }
}

/* ---------- 3. Kartu yang kini berupa tombol ---------- */
button.poli-circle-item, button.rs-kartu-tombol {
  appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: center; cursor: pointer;
}
button.poli-circle-item:focus-visible { outline-offset: 6px !important; border-radius: 18px; }
button.poli-circle-item:focus-visible .poli-circle { transform: scale(1.06); }

/* ---------- 4. Kontrol jeda slider ---------- */
.rs-jeda {
  position: absolute; z-index: 30; right: .75rem; bottom: .75rem;
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .35rem .8rem;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .7); background: rgba(10, 25, 50, .72); color: #fff;
  font-size: .82rem; font-weight: 600; line-height: 1; cursor: pointer;
}
.rs-jeda:hover { background: rgba(10, 25, 50, .9); }
.rs-jeda--luar { z-index: 40; }
.hero .rs-jeda { bottom: auto; top: 3.2rem; }
@media (max-width: 991.98px) { .hero .rs-jeda { top: .75rem; } }
.swiper-button-next, .swiper-button-prev { min-width: 44px; min-height: 44px; }

/* ---------- 5. Gambar ---------- */
img.rs-img-gagal {
  object-fit: contain !important; background: #eef3f8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.5'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m21 17-5-5-9 8'/%3E%3C/svg%3E") center / 40% no-repeat;
  min-height: 120px;
}
img.rs-img-gagal.dokter-photo-portrait {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.4'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
}

/* ---------- 6. Tabel lebar ---------- */
.rs-tabel-geser { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; margin-bottom: 1rem;
  background: linear-gradient(90deg, #fff 30%, rgba(255, 255, 255, 0)), linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 70%) 100% 0,
              radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .14), transparent), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .14), transparent) 100% 0;
  background-repeat: no-repeat; background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; }
.rs-tabel-geser > table { margin-bottom: 0; }
.rs-tabel-petunjuk { display: none; font-size: .8rem; color: #475569; margin: -.5rem 0 .75rem; }
@media (max-width: 767.98px) { .rs-tabel-petunjuk { display: block; } }

/* ---------- 7. Dialog PDF ---------- */
.rs-pdf-wadah { position: relative; height: 100%; }
.rs-pdf-muat { position: absolute; inset: 0; display: flex; flex-direction: column; gap: .75rem; align-items: center; justify-content: center;
  background: #f8fafc; color: #334155; font-weight: 500; }
.rs-pdf-muat[hidden] { display: none; }
.rs-pdf-hp { padding: 2rem 1.25rem; text-align: center; }

/* ---------- 8. Jadwal dokter ---------- */
.rs-cari-dokter { max-width: 560px; margin: 0 auto 1.75rem; position: relative; }
.rs-cari-dokter label { display: block; color: #fff; font-weight: 600; margin-bottom: .4rem; text-align: left; }
.rs-cari-dokter .form-control { min-height: 48px; border-radius: 999px; padding-left: 2.8rem; border: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.rs-cari-dokter .rs-cari-ikon { position: absolute; left: 1.05rem; bottom: .95rem; color: #64748b; pointer-events: none; }
.rs-cari-info { color: #fff; text-align: center; margin: -1rem 0 1.25rem; font-weight: 500; min-height: 1.5em; }
.jadwal-item.rs-hari-ini { background: #fff7d6; border-radius: 8px; box-shadow: inset 3px 0 0 #b45309; }
.jadwal-item.rs-hari-ini .jadwal-hari::after { content: "Hari ini"; margin-left: .4rem; font-size: .7rem; font-weight: 700; color: #7c2d12;
  background: #fde68a; border-radius: 999px; padding: .05rem .45rem; vertical-align: middle; }
.rs-kosong { text-align: center; padding: 2.5rem 1rem; color: #fff; }
.rs-kosong .rs-kosong-ikon { font-size: 2.6rem; opacity: .85; margin-bottom: .75rem; }
.rs-kosong h3, .rs-kosong .rs-kosong-judul { font-size: 1.2rem; font-weight: 700; margin-bottom: .35rem; color: inherit; }
.rs-kosong p { margin: 0 0 1rem; opacity: .95; }
.dokter-card-portrait .rs-dokter-poli { font-size: .8rem; color: #475569; margin-top: .15rem; }
.jadwal-kosong-dokter { font-size: .85rem; color: #475569; font-style: italic; }
#poli-title:focus { outline: none; }

/* ---------- 9. Judul halaman ---------- */
.rs-judul-halaman { padding: 2rem 0 .25rem; }
.rs-judul-halaman h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); font-weight: 700; color: #13294b; margin: .35rem 0 0; }
.rs-remah { font-size: .9rem; color: #475569; }
.rs-remah ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
.rs-remah li + li::before { content: "›"; margin-right: .5rem; color: #94a3b8; }
.rs-remah a { color: #0b5ed7; text-decoration: none; }
.rs-remah a:hover { text-decoration: underline; }
.rs-remah [aria-current] { color: #1e293b; font-weight: 600; }

/* ---------- 10. Halaman 404 ---------- */
.rs-404 { padding: clamp(3rem, 8vw, 6rem) 0; text-align: center; }
.rs-404 .rs-404-kode { font-size: clamp(3.5rem, 2rem + 8vw, 7rem); font-weight: 800; line-height: 1; color: #0b5ed7; letter-spacing: -.03em; }
.rs-404 h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; color: #13294b; margin: 1rem 0 .5rem; }
.rs-404 p { color: #475569; max-width: 560px; margin: 0 auto 1.5rem; }
.rs-404-tautan { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; max-width: 760px; margin: 2rem auto 0; }
.rs-404-tautan a { flex: 0 1 170px; display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-radius: 14px; border: 1px solid #dbe4ef;
  background: #fff; color: #13294b; font-weight: 600; text-decoration: none; text-align: left; }
.rs-404-tautan a:hover { border-color: #0b5ed7; color: #0b5ed7; }
.rs-404-tautan i { color: #0b5ed7; width: 1.25rem; text-align: center; }

/* ---------- 11. Kembali ke atas ---------- */
.rs-ke-atas { position: fixed; right: 1rem; bottom: 1rem; z-index: 1040; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: #0b3d91; color: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .25); display: none; align-items: center; justify-content: center; }
.rs-ke-atas.tampil { display: inline-flex; }
.rs-ke-atas:hover { background: #082c69; }
@media print { .rs-ke-atas, .rs-jeda, .rs-lewati { display: none !important; } }

/* ---------- 12. Perbaikan tata letak & kontras ---------- */
/* nama RS di navbar HP tidak mendorong tombol menu keluar layar */
@media (max-width: 575.98px) {
  .navbar .brand-rs { font-size: 1rem; white-space: normal; line-height: 1.2; max-width: calc(100% - 64px); display: inline-flex; align-items: center; gap: .5rem; }
  .navbar .brand-rs .logo-rs { width: 40px; height: 40px; flex: none; }
}
.navbar-toggler { min-width: 48px; min-height: 44px; }
/* hero beranda di HP: kotak info tidak menutupi teks, ditumpuk di bawahnya */
@media (max-width: 991.98px) {
  .hero { height: auto !important; min-height: 0 !important; }
  .hero .slide-content { height: auto; }
  .hero .slide-content .row { min-height: 0; padding: 4.25rem 0 2rem; }
  .hero .slide-title { font-size: clamp(1.8rem, 1rem + 4vw, 2.6rem); word-break: normal; overflow-wrap: anywhere; }
  .hero .hero-info-grid { position: static !important; transform: none !important; left: auto; bottom: auto;
    width: 100%; max-width: 100%; margin: 1.5rem 0 0; border-radius: 22px; flex-direction: column; align-items: stretch; gap: .75rem; padding: 1rem 1.25rem; }
  .hero .hero-info-item { gap: .85rem; }
  .hero .hero-info-item:not(:last-child) { border-right: 0; padding-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .25); padding-bottom: .9rem; }
  .hero .hero-info-item .info-label { margin: 0 0 .15rem; }
}
/* paragraf deskripsi section beranda (sebelumnya .row tanpa .container → melebar keluar layar) */
.rs-prosa { max-width: 100%; }
/* slider peralatan IGD tidak keluar layar */
.equipmentSwiper { overflow: hidden; }
@media (max-width: 991.98px) { .row.g-5, .row.gx-5 { --bs-gutter-x: 1.5rem; } }
/* animasi AOS (fade-left/right) menggeser elemen keluar layar sebelum tampil → halaman bisa digeser ke samping di HP.
   overflow-x: clip memotongnya tanpa membuat wadah gulir (navbar sticky tetap jalan). */
@supports (overflow: clip) { html { overflow-x: clip; } }
/* kontras: tombol filter kamar, tombol PDF, subjudul struktur organisasi */
.filter-btn { color: #1e3a5f; }
.filter-btn[data-filter="wbp"] { color: #7c2d12; }
.btn-outline-danger { --bs-btn-color: #b02a37; --bs-btn-border-color: #b02a37; }
.org-subtitle { color: #334155 !important; }
/* fokus terlihat di kartu peralatan/kartu layanan yang bisa diklik */
.ps-circle-card:focus-visible, .service-card:focus-within { outline: 3px solid #0b5ed7; outline-offset: 3px; }
