/* ==========================================================
   Mahmood Masjid — Quran pages (v7)
   Matches the site theme: white page, near-black text,
   dark-green header + footer, soft frosted cards.

   Load AFTER style.css and after each page's inline <style>.

   IMPORTANT: header, nav, side menu, language modal and footer are
   styled by style.css (theme-final.css). Do NOT restyle them here —
   the old v2–v6 rules for those parts were removed because they forced
   a white header and dark text onto the new dark-green header/footer.
   ========================================================== */

/* Re-declare the tokens some quran pages' inline <style> may override.
   Values match the global theme. */
:root {
    --text: #14201a;
    --muted: #566a5e;
    --bg: #f6f8f7;
    --accent: #167a35;
    --green: #167a35;
    --green-soft: #e7f3ea;
    --line: #dfe8e2;
    --line-strong: #c4d6cb;
    --card: #f6faf7;
    --card-hover: #eaf4ed;
    --panel: #ffffff;
    --shadow: 0 1px 2px rgba(16, 36, 26, .05), 0 8px 24px rgba(16, 36, 26, .07);
}

/* ---------- Base ----------
   body stays transparent so the soft backdrop from style.css shows through. */
html {
    background: #f6f8f7 !important;
}

body {
    background: transparent !important;
    color: var(--text);
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.6;
    margin: 0;
}

.background-layer {
    display: none !important;
}

/* Keep long Quran lines from widening the page.
   "clip" (not "hidden") so the sticky header keeps working. */
html,
body {
    overflow-x: clip;
}

@supports not (overflow: clip) {
    html {
        overflow-x: hidden;
    }
}

/* ---------- Page layout ---------- */
.shell {
    width: min(100% - 2rem, 1100px) !important;
    margin: 0 auto !important;
    padding: 1.75rem 0 2rem !important;
    min-width: 0 !important;
}

/* Hide the extra small labels */
.eyebrow,
.section-tag,
.hero__text {
    display: none !important;
}

/* Headings inside the page content only (never the footer) */
.shell h1,
.shell h2,
.shell h3,
.shell h4 {
    color: var(--text) !important;
}

/* ---------- Hero ---------- */
.page-hero,
.page-hero>*,
.page-hero__main {
    text-align: center !important;
}

.shell h1,
.page-hero h1,
.page-hero__main h1 {
    text-align: center !important;
    margin: 0 auto .5rem !important;
    white-space: normal !important;
    font-size: clamp(1.8rem, 4vw, 2.5rem) !important;
}

/* short green underline, same detail as the card headings */
.page-hero h1::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    margin: .65rem auto 0;
    border-radius: 3px;
    background: var(--accent);
}

.breadcrumb {
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .6rem;
    color: var(--muted) !important;
    font-size: .92rem;
}

.breadcrumb a,
.breadcrumb span {
    color: var(--muted) !important;
}

.breadcrumb a:hover {
    color: var(--accent) !important;
}

/* ---------- Cards & panels (frosted white, like the rest of the site) ---------- */
.glass-panel,
.glass-card,
.content-card,
.page-hero,
.block,
.create {
    background: var(--lq-fill, rgba(255, 255, 255, .72)) !important;
    border: 1px solid rgba(255, 255, 255, .9) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .95), 0 0 0 1px rgba(16, 36, 26, .07) !important;
    -webkit-backdrop-filter: blur(var(--lq-blur, 16px)) saturate(150%) !important;
    backdrop-filter: blur(var(--lq-blur, 16px)) saturate(150%) !important;
    color: var(--text) !important;
}

.page-hero {
    padding: 1.75rem 1rem !important;
    background:
        linear-gradient(135deg, rgba(22, 122, 53, .09), rgba(255, 255, 255, .7)) !important;
}

.content-card,
.list-wrap {
    margin-top: 1.25rem;
    padding: 1.25rem;
}

.block-head h2 {
    font-size: 1.35rem !important;
}

/* ---------- Grids ---------- */
.catalog-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.page-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
}

/* ---------- Option cards, surah tiles, saved items ---------- */
.choice-card,
.catalog-card,
.surah,
.items li {
    background: rgba(255, 255, 255, .72) !important;
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    color: var(--text) !important;
    box-shadow: 0 1px 2px rgba(16, 36, 26, .04) !important;
    text-align: center;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.catalog-card {
    padding: 1rem;
}

.choice-card {
    position: relative;
    padding: 1.9rem 1rem 1.6rem;
}

.choice-card h2 {
    margin: 0 !important;
    font-size: 1.35rem !important;
}

/* small arrow that nudges on hover — signals "open" without extra text */
.choice-card::after {
    content: "\2192";
    display: block;
    margin-top: .55rem;
    color: var(--accent);
    font-weight: 700;
    transition: transform .16s ease;
}

.choice-card:hover::after {
    transform: translateX(4px);
}

.choice-card:hover,
.catalog-card:hover,
.surah:hover,
.items li:hover {
    background: #ffffff !important;
    border-color: var(--accent) !important;
}

.choice-card:hover,
.catalog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow) !important;
}

/* card text: always visible */
.catalog-card h3 {
    color: var(--text) !important;
    margin: 0 0 .25rem;
}

.catalog-card .section-copy {
    color: var(--muted) !important;
    margin: 0;
    font-size: .9rem;
}

.catalog-card .ar {
    margin: .25rem 0 .5rem !important;
}

.surah .num {
    color: var(--accent) !important;
    letter-spacing: 0 !important;
}

.surah .en {
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
    font-family: "Inter", system-ui, sans-serif !important;
    font-size: 1.1rem !important;
    font-weight: 600;
    opacity: 1 !important;
    visibility: visible !important;
}

.surah .ar {
    color: var(--muted) !important;
    font-size: 1.15rem;
}

.none {
    color: var(--muted) !important;
}

.item-link,
.items li:hover .item-link {
    color: var(--text) !important;
}

.items li button {
    color: var(--muted) !important;
}

.items li button:hover {
    color: var(--accent) !important;
}

@media (max-width: 640px) {
    .surah-grid {
        display: block;
    }

    .surah {
        flex-direction: row !important;
        text-align: left;
        background: transparent !important;
        border: 0 !important;
        border-bottom: 1px solid var(--line) !important;
        border-radius: 0 !important;
    }

    .surah:hover {
        background: var(--card) !important;
    }
}

/* ---------- Buttons & inputs (page content only, never the footer form) ---------- */
.ghost-button,
.small-btn,
.add-btn,
.button {
    background: rgba(255, 255, 255, .8) !important;
    color: var(--accent) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 10px !important;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9) !important;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.ghost-button:hover,
.small-btn:hover,
.add-btn:hover,
.button:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
}

/* :not(#email) keeps the footer newsletter field out of this */
input:not(#email),
select,
textarea {
    background: #ffffff !important;
    color: var(--text) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 10px;
}

input:not(#email)::placeholder {
    color: #7d8f85 !important;
}

input:not(#email):focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(22, 122, 53, .45) !important;
    outline-offset: 1px;
    border-color: var(--accent) !important;
}

select option {
    background: #ffffff !important;
    color: var(--text) !important;
}

/* ---------- Search ---------- */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.search-wrap {
    display: flex !important;
    align-items: center;
    justify-content: center !important;
    gap: .6rem;
    width: 100%;
    max-width: 38rem !important;
    margin: 1rem auto 0 !important;
}

.search-wrap input {
    flex: 1;
    min-width: 0;
    font-size: 1.15rem !important;
    padding: .9rem 1.2rem !important;
    border-radius: 14px !important;
}

.search-wrap .ghost-button {
    font-size: 1rem !important;
    padding: .9rem 1.2rem !important;
    border-radius: 14px !important;
}

/* ==========================================================
   Reader page (read.html) — 16-line Mushaf
   Unchanged behaviour: every line stays on ONE line and is sized
   by the page's script to fill the width; "Aa" large-text mode.
   ========================================================== */
.bar,
.sheet {
    background: rgba(255, 255, 255, .96) !important;
    border: 1px solid var(--line-strong) !important;
    box-shadow: var(--shadow) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

#count,
#ref {
    color: var(--muted) !important;
}

.sheet .on {
    background: var(--green-soft) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

.mushaf {
    background: #ffffff !important;
    width: min(100%, 64rem) !important;
    padding: 1.5rem 1.25rem !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

#page {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

#page,
#page .ln,
#page .ay {
    color: #14201a !important;
    -webkit-text-fill-color: #14201a !important;
}

/* Never wrap a Quran line; the script scales it to fit */
#page .ln {
    white-space: nowrap !important;
    overflow: visible;
    margin: 0;
}

/* surah name banner */
#page .ln.s {
    background: var(--green-soft) !important;
    border: 1px solid var(--line-strong) !important;
    color: #0f4d2a !important;
    -webkit-text-fill-color: #0f4d2a !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible;
    font-size: clamp(1.5rem, 4vw, 2.2rem) !important;
    line-height: 1.6 !important;
    padding: .5rem 1rem !important;
    margin: 0 0 1rem !important;
    height: auto !important;
}

.ay.saved {
    background: rgba(22, 122, 53, .14) !important;
}

.ay.sel {
    background: rgba(22, 122, 53, .30) !important;
}

.ay.out {
    opacity: .4;
}

.note {
    color: #b3402f !important;
}

.ar {
    color: var(--text) !important;
    text-align: center;
    direction: rtl;
}

/* Large-text mode: bigger Arabic that wraps; easiest to read on phones */
#page.large .ln {
    white-space: normal !important;
    font-size: clamp(2rem, 6.5vw, 3rem) !important;
    line-height: 1.9 !important;
    height: auto !important;
    text-align: center !important;
    text-align-last: center !important;
}

#page.large .ln.s {
    font-size: clamp(1.35rem, 4vw, 2rem) !important;
}

#sizeBtn {
    white-space: nowrap;
}

/* Phones & small tablets: use the full screen width */
@media (max-width: 640px) {
    .shell {
        width: calc(100% - .5rem) !important;
        padding-top: .5rem !important;
    }

    .mushaf {
        width: 100% !important;
        padding: .75rem .25rem !important;
        border-radius: 14px;
    }

    .bar {
        padding: .4rem !important;
        gap: .35rem !important;
    }

    #page {
        font-size: 1.3rem !important;
    }

    #page .ln {
        padding: 0 4px !important;
    }
}