/* Husnut Tilawah - gaya mengikuti PDF (biru, emas, latar putih) */

:root {
    --biru: #1e609d;
    --biru-tua: #0f4c82;
    --emas: #e8c766;
    --abu: #f0f0f0;
    --teks: #1b2a3a;
    --garis: #d9dee4;
    --tinggi-kaki: 52px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: #fff;
    color: var(--teks);
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    line-height: 1.5;
}

a { color: inherit; }

:focus-visible { outline: 3px solid var(--biru-tua); outline-offset: 3px; }
.bar-bawah :focus-visible, .bar-atas :focus-visible { outline-color: var(--emas); }

[lang="ar"] { font-family: 'Noto Sans Arabic', 'Lateef', serif; }

/* ---------- Sampul (landing) ---------- */

.sampul {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--abu);
    text-align: center;
}

.sampul-emas { height: 22px; background: var(--emas); }

/* Ganti pola ini dengan gambar dari Canva:
   tambahkan background-image: url('../img/pola-emas.png') di .sampul-pola */
.sampul-pola {
    position: relative;
    height: 150px;
    background: repeating-linear-gradient(45deg, var(--emas) 0 2px, #f6e9bd 2px 12px);
}

.lengkung {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(70%, 360px);
    height: 80px;
    background: var(--abu);
    border-radius: 180px 180px 0 0 / 80px 80px 0 0;
}

.sampul-isi {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 24px 40px;
}

.logo { color: var(--biru); }

.sampul-situs { margin: 4px 0 22px; font-size: .85rem; font-weight: 500; color: var(--biru); }

.sampul-judul {
    margin: 0 0 12px;
    font-size: clamp(2.6rem, 9vw, 4.6rem);
    font-weight: 700;
    line-height: 1.05;
    color: var(--biru);
}

.sampul-sub { margin: 0 0 28px; font-size: 1.05rem; color: var(--biru); }

.tombol-mulai {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 32px;
    border-radius: 999px;
    background: var(--biru);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.tombol-mulai:hover { background: var(--biru-tua); }

.sampul-kaki { border-top: 14px solid var(--emas); }
.sampul-kaki span { display: block; }
.sampul-kaki .k1 { height: 44px; background: var(--biru); }
.sampul-kaki .k2 { height: 70px; background: var(--biru-tua); }

/* ---------- Kerangka halaman (HP dulu) ---------- */

.halaman {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
}

.bar-atas {
    position: relative;
    padding: 12px 16px;
    background: var(--biru);
    color: #fff;
    text-align: center;
    font-size: .95rem;
    border-bottom: 5px solid var(--emas);
    border-radius: 0 0 18px 18px;
}

.bar-balik {
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    line-height: 1;
    text-decoration: none;
}

.isi {
    flex: 1;
    padding: 20px 18px 96px;
}

.bar-bawah {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--tinggi-kaki);
    padding: 6px 12px;
    background: var(--biru);
    color: #fff;
    font-weight: 600;
    border-top: 5px solid var(--emas);
    border-radius: 18px 18px 0 0;
}
.bar-tengah { justify-content: center; }

.nav {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
    text-decoration: none;
}
.nav.mati { opacity: .3; }

/* ---------- Blok isi bergaya PDF ---------- */

.kartu-judul {
    margin-bottom: 16px;
    padding: 16px 12px;
    background: var(--biru);
    color: #fff;
    border-radius: 18px;
    text-align: center;
}
.kartu-judul small { display: block; font-size: 1.05rem; }
.kartu-judul strong { display: block; font-size: 2rem; font-weight: 700; line-height: 1.15; }

.blok { margin-bottom: 14px; min-width: 0; }

.label-emas {
    padding: 6px 0 16px;
    background: var(--emas);
    color: var(--biru-tua);
    border-radius: 16px 16px 0 0;
    text-align: center;
    font-weight: 700;
    letter-spacing: .04em;
}

.badan-biru {
    position: relative;
    margin-top: -12px;
    padding: 16px;
    background: var(--biru);
    color: #fff;
    border-radius: 16px;
}

.grid-makhraj {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.grid-makhraj .blok { margin-bottom: 0; }

.badan-makhraj { min-height: 150px; text-align: center; }
.badan-makhraj img { display: block; max-width: 100%; height: auto; margin: 0 auto 8px; }
.badan-makhraj p { margin: 0; font-size: .95rem; }

.badan-huruf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    margin-top: 0;
}
.grid-makhraj .blok:nth-child(2) { display: flex; }
.grid-makhraj .blok:nth-child(2) .badan-huruf { flex: 1; }
.huruf-besar { font-size: 4.6rem; line-height: 1.25; }
.nama-arab { font-size: 1.7rem; line-height: 1.4; }

.sifat { margin: 0; font-size: .82rem; }
.sifat div { display: flex; gap: 14px; padding: 4px 0; }
.sifat dt { flex: 0 0 30%; font-weight: 600; text-align: right; padding-right: 14px; border-right: 2px solid rgba(255, 255, 255, .6); }
.sifat dd { margin: 0; flex: 1; }

.catatan { margin: 0; padding-left: 18px; font-size: .88rem; }
.catatan li + li { margin-top: 6px; }

.kosong { padding: 24px 12px; text-align: center; color: #5b6b7b; }

/* ---------- Latihan ---------- */

.kartu-judul-latihan { margin-bottom: 0; border-radius: 18px 18px 0 0; padding-bottom: 26px; }

.label-latihan {
    position: relative;
    margin-top: -14px;
    padding: 6px 0;
    background: var(--emas);
    color: var(--biru-tua);
    border-radius: 18px 18px 0 0;
    text-align: center;
    font-weight: 600;
    font-size: 1.05rem;
}

.panel-latihan {
    padding: 18px 12px 24px;
    border: 4px solid var(--emas);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    background: #fff;
    text-align: center;
}

.baris-arab {
    margin: 0;
    font-family: 'Lateef', 'Noto Sans Arabic', serif;
    font-size: clamp(1.9rem, 7vw, 2.4rem);
    line-height: 1.9;
    color: var(--biru);
}

.panel-latihan hr { width: 70%; margin: 12px auto; border: 0; border-top: 2px solid var(--biru); }

/* ---------- Daftar huruf ---------- */

.grid-huruf {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.kartu-huruf {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 6px 10px;
    background: var(--biru);
    color: #fff;
    border-bottom: 5px solid var(--emas);
    border-radius: 16px;
    text-decoration: none;
}
.kartu-huruf .arab { font-size: 2.2rem; line-height: 1.3; }
.kartu-huruf .nama { font-size: .8rem; }
.kartu-huruf .no { position: absolute; top: 6px; left: 10px; font-size: .7rem; opacity: .85; }
.kartu-huruf.belum { background: #5d86ad; }
.kartu-huruf:hover { background: var(--biru-tua); }

/* ---------- Tab (HP) dan tombol video ---------- */

.tab-hal {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--garis);
}

.tab-balik { margin-right: auto; color: var(--biru); font-size: .85rem; text-decoration: none; }

.tab {
    padding: 6px 14px;
    border: 1px solid var(--biru);
    border-radius: 999px;
    background: #fff;
    color: var(--biru);
    font: 500 .85rem 'Poppins', sans-serif;
    cursor: pointer;
}
.tab.aktif { background: var(--biru); color: #fff; }

.btn-video {
    position: fixed;
    left: 16px;
    bottom: calc(var(--tinggi-kaki) + 16px);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--emas);
    color: var(--biru-tua);
    box-shadow: 0 3px 0 var(--biru-tua);
    font: 600 .9rem 'Poppins', sans-serif;
    cursor: pointer;
}
.btn-video:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--biru-tua); }

/* Di HP: satu halaman tampil sekali, dipilih lewat tab */
@media (max-width: 991.98px) {
    .js .layar-huruf .halaman:not(.aktif) { display: none; }
}

/* ---------- Dialog video ---------- */

.dialog-video {
    width: min(92vw, 720px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}
.dialog-video::backdrop { background: rgba(15, 76, 130, .6); }

.dialog-kepala {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 16px;
    background: var(--biru);
    color: #fff;
    border-bottom: 4px solid var(--emas);
}

.tutup {
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.video-bingkai { background: #000; }
.video-bingkai:empty { display: none; }
.video-bingkai iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; }
.video-bingkai video {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 140px);
    object-fit: contain;
    background: #000;
}
.video-kosong { margin: 0; padding: 28px 18px; text-align: center; }

/* ---------- Layar lebar: buku terbuka ---------- */

@media (min-width: 600px) {
    .grid-huruf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .tab { display: none; }
    .tab-balik { margin: 0 auto 0 0; }
    .tab-hal { position: static; max-width: 960px; margin: 0 auto; padding: 14px 0 0; border: 0; }

    .halaman { min-height: 0; }
    .layar-daftar .halaman { max-width: 900px; margin: 24px auto; border: 1px solid var(--garis); border-radius: 18px; overflow: hidden; }
    .layar-daftar .bar-atas { border-radius: 0 0 18px 18px; }
    .grid-huruf { grid-template-columns: repeat(6, minmax(0, 1fr)); }

    .buku {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
        max-width: 940px;
        margin: 16px auto 32px;
    }

    .buku .halaman {
        min-height: 780px;
        border: 1px solid var(--garis);
        border-radius: 18px;
        overflow: hidden;
    }

    .buku .isi { padding-bottom: 80px; }

    .halaman-makhraj .nav-next,
    .halaman-latihan .nav-prev { visibility: hidden; }

    .btn-video {
        position: absolute;
        left: 20px;
        bottom: calc(var(--tinggi-kaki) + 16px);
    }
}