/* =====================================================================
   dakeera.in - site styles (with dome-mosque watermark)
   ===================================================================== */

:root {
    --lib-emerald: #0B4F45;
    --lib-emerald-deep: #073934;
    --lib-gold:    #C9A24A;
    --lib-gold-light: #E4C878;
    --lib-ink:     #0B1F1B;
    --lib-cream:   #F5EFE1;
    --lib-font-display:   "Amiri", "Reem Kufi", serif;
    --lib-font-arabic:    "Amiri", "Noto Naskh Arabic", "Noto Kufi Arabic", serif;
    --lib-font-malayalam: "Manjari", "Noto Serif Malayalam", "Noto Sans Malayalam", serif;
    --lib-font-body:      "Noto Sans", system-ui, sans-serif;
}

body {
    font-family: var(--lib-font-body);
    background: var(--lib-cream);
    color: #1a1a1a;
}

/* --- Navbar --- */
.lib-navbar {
    background: var(--lib-emerald);
    padding: .75rem 0;
    position: relative;
    z-index: 5;
}
.lib-navbar .nav-link,
.lib-navbar .navbar-brand {
    color: #fff !important;
}
.lib-brand {
    font-family: var(--lib-font-display);
    font-weight: 700;
    font-size: 1.4rem;
}
.lib-brand-logo {
    height: 38px;
    width: 38px;
    object-fit: cover;
    border-radius: 12px;
    background: #fff;
    padding: 2px;
    margin-right: .5rem;
    vertical-align: -10px;
    border: 1px solid rgba(201, 162, 74, .55);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .12),
        0 3px 10px rgba(0, 0, 0, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.lib-brand:hover .lib-brand-logo {
    transform: translateY(-1px) rotate(-2deg);
    box-shadow:
        0 0 0 1px rgba(201, 162, 74, .5),
        0 6px 16px rgba(0, 0, 0, .35);
}
.lib-navbar .navbar-toggler {
    border-color: #fff;
}
.lib-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(255,255,255,.25);
}
.lib-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,1%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.lib-shelf-edge {
    height: 4px;
    background: linear-gradient(to right, transparent, var(--lib-gold), transparent);
}

/* =====================================================================
   HERO
   ===================================================================== */
.lib-hero {
    background:
        radial-gradient(ellipse at top, rgba(201, 162, 74, 0.15) 0%, transparent 60%),
        linear-gradient(180deg, var(--lib-emerald) 0%, var(--lib-emerald-deep) 100%);
    color: #fff;
    padding: 3.5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    isolation: isolate;   /* new stacking context */
}
.lib-hero::before,
.lib-hero::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--lib-gold), transparent);
    opacity: .5;
    z-index: 2;
}
.lib-hero::before { top: 20px; }
.lib-hero::after  { bottom: 20px; }

/* Dome-of-the-Rock watermark image */
.lib-hero-mosque {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1000px, 100%);
    height: auto;
    opacity: 0.14;
    pointer-events: none;
    z-index: 0;
    filter: brightness(1.4) contrast(0.9);
    -webkit-user-select: none;
    user-select: none;
}

.lib-hero > .container {
    position: relative;
    z-index: 1;
}

.lib-hero-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

/* --- Portrait --- */
.lib-hero-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}
.lib-hero-portrait-frame {
    position: relative;
    width: 170px;
    height: 170px;
    padding: 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lib-gold-light) 0%, var(--lib-gold) 100%);
    box-shadow:
        0 0 0 1px rgba(201, 162, 74, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.35);
}
.lib-hero-portrait-frame::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(201, 162, 74, 0.35);
    pointer-events: none;
}
.lib-hero-portrait-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 20%;
    background: #fff;
    display: block;
}
.lib-hero-portrait-name-wrap {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-top: 1rem;
}
.lib-hero-portrait-flourish {
    color: var(--lib-gold);
    font-size: .85rem;
    opacity: .85;
}
.lib-hero-portrait-name-lines {
    text-align: center;
}
.lib-hero-portrait-name-ar {
    font-family: var(--lib-font-arabic);
    color: var(--lib-gold-light);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.8;
}
.lib-hero-portrait-name {
    font-family: var(--lib-font-display);
    color: var(--lib-gold-light);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .04em;
    white-space: nowrap;
}

.lib-hero-ornament {
    display: block;
    font-size: 2rem;
    color: var(--lib-gold);
    margin-bottom: .75rem;
    line-height: 1;
    opacity: .9;
}

/* --- Title / Rule / Subtitle --- */
.lib-hero-title {
    font-family: var(--lib-font-display);
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
    margin: 0;
    letter-spacing: .01em;
    line-height: 1.1;
    background: linear-gradient(180deg, #fff 0%, var(--lib-gold-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 2px 20px rgba(0,0,0,.15);
    position: relative;
}
.lib-hero-title-ar {
    font-family: var(--lib-font-arabic);
    font-size: clamp(1.9rem, 4vw, 3.2rem);
    line-height: 1.7;
    letter-spacing: 0;
    padding: 0 .5rem;
}

.lib-hero-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin: 1.25rem 0 1rem;
}
.lib-hero-rule-no-subtitle { margin-bottom: 0; }
.lib-hero-rule-line {
    height: 1px;
    width: 70px;
    background: linear-gradient(to right, transparent, var(--lib-gold), transparent);
}
.lib-hero-rule-diamond {
    color: var(--lib-gold);
    font-size: .7rem;
    transform: translateY(-1px);
}

.lib-hero-subtitle {
    font-family: var(--lib-font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--lib-cream);
    opacity: .92;
    margin: 0;
    letter-spacing: .02em;
    line-height: 1.5;
}
.lib-hero-subtitle-ml {
    font-family: var(--lib-font-malayalam);
    font-style: normal;
    font-size: 1.05rem;
    line-height: 1.9;
    letter-spacing: 0;
    max-width: 780px;
    margin: 0 auto;
    padding: 0 .5rem;
    color: #f0e7d0;
    position: relative;
}
.lib-hero-subtitle-ar {
    font-family: var(--lib-font-arabic);
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1.9;
    letter-spacing: 0;
    direction: rtl;
}

/* =====================================================================
   SHELF
   ===================================================================== */
.lib-shelf { padding: 2.5rem 0; }
.lib-shelf-featured { padding-bottom: 1rem; }
.lib-shelf-books    { padding-top: 1rem; }

.lib-section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 480px;
    margin: 1rem auto 2rem;
}
.lib-section-divider span:not(.lib-section-diamond) {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--lib-gold), transparent);
}
.lib-section-diamond {
    color: var(--lib-gold);
    font-size: .8rem;
}

/* --- Book cards --- */
.lib-book-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
    height: 100%;
    max-width: 240px;
    margin: 0 auto;
}
.lib-book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.lib-book-link {
    color: inherit;
    text-decoration: none;
    display: block;
}
.lib-book-cover-frame {
    aspect-ratio: 1 / 1;
    background: var(--lib-ink);
    overflow: hidden;
    position: relative;
}
.lib-book-cover-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lib-book-title-wrap { padding: .6rem .85rem .75rem; }
.lib-book-title {
    font-family: var(--lib-font-display);
    font-weight: 700;
    color: var(--lib-emerald);
    line-height: 1.2;
    font-size: 1rem;
}
.lib-book-author {
    color: #666;
    font-size: .85rem;
    margin-top: .2rem;
}

.lib-featured-badge {
    position: absolute;
    top: .4rem;
    left: .4rem;
    background: var(--lib-gold);
    color: var(--lib-ink);
    padding: .18rem .5rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.lib-featured-card { border: 2px solid var(--lib-gold); }

/* --- Chapters page --- */
.lib-toc-header {
    border-bottom: 2px solid var(--lib-gold);
    padding-bottom: .75rem;
    margin-bottom: 1.5rem;
}
.lib-toc-eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--lib-gold);
    font-size: .8rem;
}
.lib-toc-title {
    font-family: var(--lib-font-display);
    color: var(--lib-emerald);
    font-size: 2rem;
    font-weight: 700;
}
.lib-chapter-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1rem;
    background: #fff;
    border: 1px solid #eae2cc;
    border-radius: 6px;
    margin-bottom: .5rem;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.lib-chapter-row:hover {
    background: #faf5e6;
    color: var(--lib-emerald);
}
.lib-chapter-number {
    background: var(--lib-emerald);
    color: #fff;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    flex: 0 0 auto;
}
.lib-chapter-title { flex: 1; font-weight: 500; }
.lib-chapter-open-icon { color: var(--lib-gold); font-weight: 600; }

.lib-empty-state {
    background: #fff;
    border: 1px dashed #cfc4a8;
    padding: 2rem;
    text-align: center;
    color: #777;
    border-radius: 8px;
}

.btn-lib { background: var(--lib-emerald); color: #fff; border: none; }
.btn-lib:hover { background: #093a34; color: #fff; }
.btn-lib-outline { background: transparent; border: 1px solid #fff; color: #fff; }
.btn-lib-outline:hover { background: #fff; color: var(--lib-emerald); }
.btn-lib-gold { background: var(--lib-gold); color: var(--lib-ink); }
.btn-lib-gold:hover { background: #b8912f; color: #fff; }

.lib-footer {
    background: var(--lib-emerald);
    color: #cbdad4;
    padding: 1.25rem 0;
    margin-top: 3rem;
}

.lib-admin-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.lib-admin-card {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 12px 30px rgba(0,0,0,.3);
}
.lib-admin-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

/* =====================================================================
   MOBILE
   ===================================================================== */
@media (max-width: 576px) {
    .lib-brand-logo {
        height: 32px;
        width: 32px;
        border-radius: 10px;
        vertical-align: -8px;
        margin-right: .4rem;
    }
    .lib-hero { padding: 2rem 0 2.25rem; }
    .lib-hero::before { top: 12px; }
    .lib-hero::after  { bottom: 12px; }
    .lib-hero-inner { padding: 0 .75rem; }

    .lib-hero-mosque {
        opacity: 0.11;
        bottom: 0;
    }

    .lib-hero-portrait { margin-bottom: 1rem; }
    .lib-hero-portrait-frame { width: 105px; height: 105px; padding: 3px; }
    .lib-hero-portrait-frame::before { inset: -5px; }
    .lib-hero-portrait-name-wrap { margin-top: .6rem; gap: .45rem; }
    .lib-hero-portrait-name { font-size: .82rem; letter-spacing: .03em; white-space: normal; }
    .lib-hero-portrait-name-ar { font-size: 1rem; line-height: 1.7; }
    .lib-hero-portrait-flourish { font-size: .7rem; }

    .lib-hero-title-ar {
        font-size: 1.35rem;
        line-height: 1.75;
        padding: 0 .25rem;
    }

    .lib-hero-rule { margin: .75rem 0 .75rem; gap: .5rem; }
    .lib-hero-rule-line { width: 32px; }
    .lib-hero-rule-diamond { font-size: .55rem; }

    .lib-hero-subtitle-ml { font-size: .82rem; line-height: 1.75; padding: 0 .25rem; }

    .lib-book-card { max-width: 160px; }
    .lib-book-title { font-size: .9rem; }
    .lib-book-author { font-size: .78rem; }
    .lib-book-title-wrap { padding: .5rem .65rem .6rem; }

    .lib-shelf { padding: 1.75rem 0; }
    .lib-shelf-featured { padding-bottom: .5rem; }
    .lib-shelf-books    { padding-top: .5rem; }

    .lib-featured-badge { font-size: .6rem; padding: .12rem .4rem; }
}

@media (max-width: 380px) {
    .lib-hero-title-ar { font-size: 1.2rem; line-height: 1.7; }
    .lib-hero-subtitle-ml { font-size: .78rem; }
    .lib-hero-portrait-frame { width: 95px; height: 95px; }
    .lib-book-card { max-width: 140px; }
}
