/* al-fatawa.com – site stylesheet (v8).
   Palette: the site's own browns and greys. Type: Amiri for headings and the verse, Noto Naskh Arabic for text
   (loaded from Google Fonts with display=swap; system Arabic faces as fallback).
   The critical subset of these rules is inlined in every page template (static/css/critical.css). */

:root {
    --ink: #341910;
    --accent: #7D6249;
    --accent-deep: #5A4633;
    --panel: #7F6751;
    --tan: #AB9C8E;
    --ground: #D9D9D9;
    --sheet: #E7E4DF;
    --sheet-line: #C6BCB0;
    --surface: #EEEBE6;
    --muted: #5A4633;
    --cream: #F3ECE2;
    --aaya: #8E2A10;
    --hadith: #23536F;
    --speaker: #1C5A50;
    --shadow: 0 6px 18px rgba(52, 25, 16, 0.14);
    --font-body: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, Arial, sans-serif;
    --font-display: "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
}

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

html { background: var(--ground); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ground);
    color: var(--ink);
    direction: rtl;
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.9;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 6px; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { font: inherit; color: inherit; touch-action: manipulation; }
img { max-width: 100%; }
mark { background: rgba(125, 98, 73, 0.18); color: inherit; padding: 0 0.1em; border-radius: 3px; }

.VisuallyHidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.SkipLink { position: absolute; top: -100px; right: 1rem; z-index: 20; background: var(--accent); color: #fff; padding: 0.5rem 1rem; border-radius: 0 0 8px 8px; }
.SkipLink:focus { top: 0; }

/* ---------- header band ---------- */

.Band {
    position: relative;
    padding: 1.75rem 1.25rem 2.75rem;
    text-align: center;
    background: var(--accent);
    color: var(--cream);
    overflow: hidden;
}
.Band::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../img/pattern-cream.svg") center / 96px 100px repeat;
    opacity: 0.16;
    pointer-events: none;
}
.Band > * { position: relative; }
.Band .Logo { display: inline-block; }
.Band .Logo img { display: block; width: 150px; height: 69px; filter: brightness(0) invert(0.93) sepia(0.2); }
.Band.Large { padding: 3rem 1.25rem 3.25rem; }
.Band.Large .Logo img { width: 220px; height: 101px; }
.Verse { font-family: var(--font-display); font-size: 1.2rem; margin: 0.6rem 0 0; line-height: 1.7; }
.Band.Large .Verse { font-size: 1.45rem; }
.Verse::before, .Verse::after { content: "﴿"; opacity: 0.7; margin: 0 0.35rem; }
.Verse::after { content: "﴾"; }
.Tagline { max-width: 40rem; margin: 0.9rem auto 0; font-size: 1.05rem; line-height: 1.8; opacity: 0.95; }
.Band h1.BandTitle { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin: 1rem 0 0; line-height: 1.5; text-wrap: balance; }

/* ---------- search ---------- */

.Search { max-width: 44rem; margin: -1.75rem auto 0; padding: 0 1.25rem; position: relative; }
.SearchForm {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--sheet-line);
    border-radius: 999px;
    padding: 0.3rem 0.3rem 0.3rem 0.6rem;
    box-shadow: var(--shadow);
}
.SearchForm:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(125, 98, 73, 0.22), var(--shadow); }
.SearchInput {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    padding: 0.65rem 0.75rem;
    color: var(--ink);
}
.SearchInput::placeholder { color: var(--muted); opacity: 0.85; }
.SearchInput:focus-visible { outline: none; }
.SearchInput:disabled { opacity: 0.5; }
.IconButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
}
.IconButton:hover { background: rgba(125, 98, 73, 0.12); }
.IconButton.Primary { background: var(--accent); color: #fff; }
.IconButton.Primary:hover { background: var(--accent-deep); }
.IconButton.Primary:disabled { opacity: 0.5; cursor: default; }
.IconButton svg { width: 22px; height: 22px; }
.IconButton[aria-expanded="true"] { background: rgba(125, 98, 73, 0.16); }

.Filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    justify-content: center;
    margin: 0.9rem 0 0;
    font-size: 0.95rem;
}
.Filters[hidden] { display: none; }
.Filters .FilterLabel { color: var(--muted); }
.Chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--sheet-line);
    background: var(--surface);
    cursor: pointer;
    color: var(--accent-deep);
}
.Chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.Chip[aria-checked="true"]::before { content: "✓"; font-size: 0.85em; }
.Segmented { display: inline-flex; border: 1px solid var(--sheet-line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.Segmented button { border: 0; background: transparent; min-height: 40px; padding: 0 1rem; cursor: pointer; color: var(--accent-deep); }
.Segmented button[aria-checked="true"] { background: var(--accent); color: #fff; }
.AdvancedForm { display: none; flex-basis: 100%; }
.AdvancedForm.Open { display: block; }
.AdvancedFields { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.AdvancedInput {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--sheet-line);
    border-radius: 999px;
    background: var(--surface);
    font: inherit;
    font-size: 1rem;
    padding: 0 1rem;
    color: var(--ink);
}
.AdvancedSubmit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    margin-top: 0.5rem;
    padding: 0 1.25rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}
.AdvancedSubmit:hover { background: var(--accent-deep); }
.AdvancedSubmit svg { width: 18px; height: 18px; }

/* ---------- page frame and sheets ---------- */

.Page { width: 100%; max-width: 46rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; flex: 1 0 auto; }
.Page.Wide { max-width: 56rem; }
.Sheet { background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 10px; padding: 1.75rem 1.5rem; }
.Sheet + .Sheet, .Page > .Sheet + .Sheet { margin-top: 1.25rem; }
.SectionTitle, .Sheet h2.SectionTitle { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin: 0 0 0.5rem; line-height: 1.5; text-wrap: balance; }

.Breadcrumbs { font-size: 0.9rem; color: var(--muted); margin: 0 0 1rem; }
.Breadcrumbs ol { display: flex; gap: 0.5rem; margin: 0; padding: 0; min-width: 0; list-style: none; white-space: nowrap; overflow: hidden; }
.Breadcrumbs li { min-width: 0; }
.Breadcrumbs li:last-child { overflow: hidden; text-overflow: ellipsis; }
.Breadcrumbs li + li::before { content: "‹"; margin-left: 0.5rem; color: var(--tan); }

/* ---------- fatwa article ---------- */

.FatwaTitle {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.6vw, 2.3rem);
    line-height: 1.5;
    margin: 0;
    color: var(--ink);
    text-wrap: balance;
}
.FatwaScholar { display: flex; align-items: center; gap: 0.45rem; margin: 0.6rem 0 0; color: var(--muted); font-size: 1.05rem; }
.FatwaScholar svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.FatwaScholar a { color: var(--accent-deep); }
.Ornament { display: flex; align-items: center; justify-content: center; color: var(--tan); margin: 1.25rem 0 1.5rem; position: relative; }
.Ornament .Star { position: absolute; color: var(--accent); }
.FatwaText { font-size: 1.22rem; line-height: 2; }
.FatwaText .scholar {
    display: inline-block;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--speaker);
    background: rgba(28, 90, 80, 0.1);
    border-radius: 999px;
    padding: 0 0.6em;
    margin-left: 0.25em;
    line-height: 1.7;
    vertical-align: 0.1em;
}
.FatwaText .hadith, .FatwaText .hadith a { color: var(--hadith); font-weight: 600; }
.FatwaText .aaya { color: var(--aaya); font-family: var(--font-display); font-size: 1.08em; }
.FatwaText a { text-decoration: underline; text-underline-offset: 4px; }

.SourceBox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    margin: 1.5rem 0 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--sheet-line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.97rem;
}
.SourceBox .SourceLabel { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--accent-deep); }
.SourceBox .SourceLabel svg { width: 16px; height: 16px; }
.SourceBox a { display: inline-flex; align-items: center; gap: 0.3rem; }
.SourceBox a svg { width: 14px; height: 14px; }
.SourceBox .SourceNote { color: var(--muted); font-size: 0.9rem; flex-basis: 100%; }
.Actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.ActionButton {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--sheet-line);
    background: var(--surface);
    cursor: pointer;
    color: var(--accent-deep);
    font-size: 0.95rem;
    text-decoration: none;
}
.ActionButton:hover { border-color: var(--accent); background: var(--accent); color: #fff; text-decoration: none; }
.ActionButton svg { width: 18px; height: 18px; }

/* ---------- similar fatwas ---------- */

.SimilarList { list-style: none; margin: 0; padding: 0; }
.SimilarList li + li { border-top: 1px solid var(--sheet-line); }
.SimilarList a { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 0; color: var(--ink); }
.SimilarList .SimilarTitle { flex: 1; min-width: 0; }
.SimilarList .SimilarScholar { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }
.SimilarList .Chevron { width: 18px; height: 18px; color: var(--tan); flex-shrink: 0; }
.SimilarList .Chevron svg { width: 18px; height: 18px; display: block; }
.SimilarList a:hover { text-decoration: none; color: var(--accent); }
.SimilarList a:hover .Chevron { color: var(--accent); }

/* ---------- footer band ---------- */

.Footer {
    position: relative;
    margin-top: auto;
    padding: 1.75rem 1.25rem 2rem;
    background: var(--accent);
    color: var(--cream);
    text-align: center;
    overflow: hidden;
}
.Footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../img/pattern-cream.svg") center / 96px 100px repeat;
    opacity: 0.16;
    pointer-events: none;
}
.Footer > * { position: relative; }
.FooterNav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.5rem; }
.FooterNav a { color: var(--cream); padding: 0.4rem 0; display: inline-block; }
.Footer p { margin: 0.75rem 0 0; font-size: 0.9rem; opacity: 0.85; }

/* ---------- home ---------- */

.Why { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.Why li { background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 10px; padding: 1.1rem 1.2rem; display: grid; gap: 0.2rem; }
.Why svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 0.35rem; }
.Why strong { font-family: var(--font-display); font-size: 1.2rem; }
.Why span { font-size: 0.97rem; color: var(--muted); line-height: 1.7; }
.HomeSection { margin-top: 2.25rem; }
.ScholarGrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 0.75rem; }
.ScholarGrid a { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.9rem 1rem; background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 10px; color: var(--ink); }
.ScholarGrid a:hover { border-color: var(--accent); text-decoration: none; color: var(--accent); }
.ScholarGrid .ScholarName { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.ScholarGrid .ScholarCount { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.TopicList { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.TopicList a { display: inline-block; padding: 0.45rem 1rem; border: 1px solid var(--sheet-line); border-radius: 999px; background: var(--sheet); font-size: 1rem; color: var(--ink); }
.TopicList a:hover { border-color: var(--accent); background: var(--accent); color: #fff; text-decoration: none; }

/* ---------- search results ---------- */

.ResultsHeading { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin: 0; line-height: 1.5; }
.SearchStatus { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 1rem; }
.ResultList { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.Result h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; margin: 0; line-height: 1.5; }
.Result h2 a { color: var(--ink); }
.Result h2 mark { background: none; font-weight: 700; }
.ResultText { font-size: 1.12rem; line-height: 1.95; margin: 0.8rem 0 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ResultText.Open { display: block; -webkit-line-clamp: unset; }
.ExpandButton { margin: 0.35rem 0 0; padding: 0.4rem 0; border: 0; background: none; color: var(--accent-deep); text-decoration: underline; text-underline-offset: 5px; cursor: pointer; font-size: 0.95rem; }
.ExpandButton[hidden] { display: none; }
.ResultMeta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--sheet-line); font-size: 0.95rem; }
.ResultMeta .ResultSource { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.ResultMeta .ResultSource svg { width: 15px; height: 15px; }
.ResultMeta .ResultSource a { display: inline-flex; align-items: center; gap: 0.3rem; }
.TextButton { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 0.6rem; border: 0; background: none; color: var(--accent-deep); cursor: pointer; font-size: 0.95rem; }
.TextButton svg { width: 16px; height: 16px; }
.TextButton:hover { text-decoration: underline; text-underline-offset: 5px; }
.LoadMoreButton { display: block; margin: 1.5rem auto 0; min-height: 44px; padding: 0 1.5rem; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent-deep); cursor: pointer; }
.LoadMoreButton:hover { background: var(--accent); color: #fff; }
.LoadMoreButton[hidden] { display: none; }
.NothingFound { text-align: center; padding: 1.5rem; }
.NothingFound[hidden] { display: none; }
.Loader { display: flex; justify-content: center; gap: 7px; height: 40px; margin: 1rem auto; }
.Loader[hidden] { display: none; }
.Loader > div { width: 8px; background: var(--accent); border-radius: 4px; animation: wave 1.2s ease-in-out infinite; }
.Loader > div:nth-child(2) { animation-delay: 0.15s; }
.Loader > div:nth-child(3) { animation-delay: 0.3s; }
.Loader > div:nth-child(4) { animation-delay: 0.45s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

/* ---------- trust pages and scholar hubs ---------- */

.PageBody { font-size: 1.1rem; line-height: 1.95; }
.PageBody h1 { font-family: var(--font-display); font-size: 2rem; margin: 0 0 0.75rem; line-height: 1.4; }
.PageBody h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 1.75rem 0 0.5rem; }
.PageBody p, .PageBody ul, .PageBody ol { margin: 0 0 0.75rem; }
.PageBody ul, .PageBody ol { padding-right: 1.4rem; padding-left: 0; }
.PageBody a { text-decoration: underline; text-underline-offset: 4px; }
.PageBody .Lead { font-weight: 600; }
.ScholarBio { margin-top: 0.75rem; }
.ScholarBioSource, .ScholarMeta { font-size: 0.97rem; color: var(--muted); margin: 0.5rem 0 0; }
.Pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.Pagination a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--sheet-line); border-radius: 999px; background: var(--surface); }

/* ---------- tooltips ---------- */

.Tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    background: rgba(52, 25, 16, 0.85);
    color: var(--cream);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 1.1rem;
    visibility: hidden;
    opacity: 0;
    transition: opacity 300ms;
}
.Tooltip.Visible { visibility: visible; opacity: 1; }

/* ---------- responsive and motion ---------- */

@media (max-width: 520px) {
    body { font-size: 18px; }
    .Sheet { padding: 1.25rem 1rem; }
    .SimilarList a { flex-wrap: wrap; }
    .SimilarList .SimilarTitle { flex-basis: 100%; }
    .Band { padding-bottom: 2.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
    .Chip, .Segmented button, .IconButton, .ActionButton, .TopicList a, .ScholarGrid a, .LoadMoreButton { transition: background-color 150ms, border-color 150ms, color 150ms; }
}
@media (prefers-reduced-motion: reduce) {
    .Loader > div { animation: none; }
    .Tooltip { transition: none; }
}
@media print {
    .Band, .Footer, .Search, .Actions, .SimilarList, .SkipLink { display: none !important; }
    body { background: #fff; }
    .Sheet { border: 0; background: #fff; padding: 0; }
}
