/* Shared styles for Manhajie's hand-built pages (home, books, about, editorial standards).
   Palette and type match the individual book pages: warm paper, ink, and a brown accent. */
:root {
    color-scheme: light;
    --bg: #f4efe6;
    --bg-soft: #fbf7f1;
    --paper: #fffdf9;
    --text: #1f1a17;
    --muted: #65584d;
    --accent: #7a4f2d;
    --accent-2: #b86f3a;
    --border: rgba(70, 45, 23, 0.14);
    --shadow: 0 20px 50px rgba(54, 30, 10, 0.12);
    --serif: Georgia, "Times New Roman", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: var(--serif);
    color: var(--text);
    background: linear-gradient(180deg, #fcf8f3 0%, var(--bg) 100%);
    background-attachment: fixed;
    line-height: 1.5;
    /* keep the footer at the bottom of short pages */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body > main { flex: 1 0 auto; }

img { max-width: 100%; }

a { color: inherit; }

/* Visually hidden without off-screen offsets (left:-9999px adds scroll width on right-to-left pages) */
.skip-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus {
    width: auto; height: auto; clip-path: none;
    inset-inline-start: 1rem; top: 1rem; z-index: 10;
    padding: .75rem 1rem; background: #fff; border-radius: 999px; box-shadow: var(--shadow);
}

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 1.25rem; }
.narrow { max-width: 760px; }

/* Header */
.site-header { padding-block: 1.1rem; border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand img { width: 48px; height: 48px; border-radius: 999px; object-fit: cover; box-shadow: 0 8px 20px rgba(54, 30, 10, .12); }
.brand span { font-size: 1rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; margin: 0; padding: 0; list-style: none; font-family: var(--sans); font-size: .95rem; }
.site-nav a { text-decoration: none; color: var(--muted); padding-block: .3rem; border-bottom: 1px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Type */
.eyebrow { margin: 0 0 .75rem; font: 700 .78rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3 { font-weight: 700; letter-spacing: -.02em; }
h1 { margin: 0 0 1rem; font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1; }
h2 { margin: 0 0 1rem; font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.1; }
h3 { margin: 0 0 .5rem; font-size: 1.2rem; }
.lede { max-width: 44rem; margin: 0; font: 1.15rem/1.65 var(--sans); color: var(--muted); }
.prose { font: 1.03rem/1.75 var(--sans); color: #3d342d; }
.prose p { margin: 0 0 1.1rem; }
.prose h2 { margin-top: 2.6rem; font-family: var(--serif); font-size: 1.6rem; color: var(--text); }
.prose ul { padding-left: 1.3rem; }
.prose li { margin: .55rem 0; }
.prose strong { color: var(--text); }
.meta { font: .9rem var(--sans); color: var(--muted); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn { display: inline-block; padding: .85rem 1.3rem; border-radius: 999px; font: 700 .98rem var(--sans); text-decoration: none; border: 1px solid var(--accent); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #643f22; }
.btn-ghost { color: var(--accent); background: transparent; }
.btn-ghost:hover { background: rgba(122, 79, 45, .07); }

/* Sections */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.section-head h2 { margin: 0; }
.text-link { font: 700 .95rem var(--sans); color: var(--accent); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Book cards */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: clamp(1.25rem, 2.5vw, 2.25rem); align-items: start; }
.book-card { display: block; text-decoration: none; }
.book-card img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); transition: transform 180ms ease, box-shadow 180ms ease; }
.book-card:hover img, .book-card:focus-visible img { transform: translateY(-4px); box-shadow: 0 24px 60px rgba(54, 30, 10, .2); }
.book-card .kind { display: block; margin-top: 1rem; font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.book-card h3 { margin: .3rem 0 .4rem; font-size: 1.15rem; line-height: 1.25; }
.book-card p { margin: 0; font: .92rem/1.5 var(--sans); color: var(--muted); }

/* Grids of short items */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.card { padding: 1.5rem; background: var(--paper); border: 1px solid var(--border); border-radius: 16px; }
.card p { margin: 0; font: .97rem/1.6 var(--sans); color: var(--muted); }
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.5rem 2rem; margin: 0; padding: 0; list-style: none; }
.principles li { border-top: 2px solid var(--accent); padding-top: .9rem; }
.principles strong { display: block; margin-bottom: .35rem; font-size: 1.1rem; }
.principles span { font: .93rem/1.55 var(--sans); color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.lang-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.lang-list li { padding: .4rem .85rem; border: 1px solid var(--border); border-radius: 999px; background: var(--paper); font: .9rem var(--sans); }

/* Contact: the email address is the call to action */
.email-link { display: inline-block; margin-top: .25rem; font: 700 clamp(1.35rem, 3vw, 1.9rem) var(--serif); color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.email-link:hover { color: #643f22; }

/* Footer */
.site-footer { margin-top: 2rem; padding-block: 3rem 2.5rem; background: #2a221c; color: #e9e1d6; font-family: var(--sans); font-size: .93rem; }
.site-footer a { color: #e9e1d6; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer-grid h2 { margin: 0 0 .8rem; font: 700 .75rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: #c9a77f; }
.footer-grid ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.footer-brand p { margin: .6rem 0 0; color: #b9ad9f; max-width: 22rem; line-height: 1.6; }
.footer-brand strong { font-family: var(--serif); font-size: 1.2rem; letter-spacing: .14em; text-transform: uppercase; }
.footer-langs { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(233, 225, 214, .15); }
.legal { margin: 1.5rem 0 0; color: #9d9184; font-size: .85rem; }

@media (max-width: 820px) {
    .split { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .books-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem 1rem; }
}

/* Homepage featured row: six across, then three, then two */
.books-grid.six { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1000px) { .books-grid.six { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .books-grid.six { grid-template-columns: repeat(2, 1fr); gap: 1.25rem 1rem; } }

/* Individual book pages */
.book-page { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; margin-top: 2rem; }
.book-cover { width: 100%; border-radius: 10px; box-shadow: 0 26px 60px rgba(54, 30, 10, .22); position: sticky; top: 1.5rem; }
.book-page h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.byline { margin: -.25rem 0 1.25rem; font: 1.05rem var(--sans); color: var(--muted); }
.book-page .actions { margin: 1.75rem 0 2.5rem; }
.book-body { max-width: 44rem; }
.book-body h2 { font-size: 1.35rem; }
.editions { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.editions h2 { font: 700 .78rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.editions ul { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; font-family: var(--sans); }
.editions a { text-decoration: none; }
.editions a:hover { text-decoration: underline; }
.editions span { display: inline-block; min-width: 6.5rem; color: var(--muted); font-size: .9rem; }
@media (max-width: 720px) {
    .book-page { grid-template-columns: 1fr; }
    .book-cover { position: static; max-width: 300px; }
}

/* Arabic / right-to-left pages */
:root[lang="ar"] {
    --serif: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", "Times New Roman", serif;
    --sans: "Noto Sans Arabic", "Geeza Pro", Tahoma, "Segoe UI", Arial, sans-serif;
}
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3 { letter-spacing: 0; line-height: 1.35; }
:root[lang="ar"] .eyebrow, :root[lang="ar"] .brand span, :root[lang="ar"] .footer-grid h2,
:root[lang="ar"] .footer-brand strong, :root[lang="ar"] .book-card .kind { letter-spacing: 0; text-transform: none; }
:root[lang="ar"] .eyebrow { font-size: .9rem; }
:root[lang="ar"] .book-card h3[lang="en"] { font-family: Georgia, "Times New Roman", serif; text-align: right; }
[dir="rtl"] .prose ul { padding-left: 0; padding-right: 1.3rem; }

/* Homepage hero with fanned covers (.covers holds 1-3 cover links) */
.hero { padding-block: clamp(3.5rem, 9vw, 7rem); }
.hero .split { align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
.hero .lede { margin-top: 1.5rem; }
.covers { position: relative; width: 100%; height: clamp(320px, 42vw, 480px); }
.covers a { position: absolute; top: 50%; width: 46%; transition: transform 200ms ease; }
.covers img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; box-shadow: 0 26px 60px rgba(54, 30, 10, .28); }
.covers a:nth-child(1) { left: 0; transform: translateY(-50%) rotate(-6deg); }
.covers a:nth-child(2) { left: 27%; z-index: 2; transform: translateY(-54%); }
.covers a:nth-child(3) { right: 0; transform: translateY(-50%) rotate(6deg); }
.covers.n2 a:nth-child(1) { left: 6%; }
.covers.n2 a:nth-child(2) { left: auto; right: 6%; transform: translateY(-50%) rotate(5deg); }
.covers.n1 a:nth-child(1) { left: 27%; transform: translateY(-50%) rotate(-3deg); }
.covers a:hover { z-index: 3; }
.brandline { margin-top: 1.75rem; font: .85rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.note { margin: .5rem 0 0; font: .95rem var(--sans); color: var(--muted); }
@media (max-width: 820px) { .covers { max-width: 420px; height: 340px; margin-inline: auto; } }
