/* مكتبة تفسير: the public site. Colours and type follow the app (lib/core/theme/tokens.dart). */
@font-face { font-family: "Somar Sans"; src: url("fonts/SomarSans-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Somar Sans"; src: url("fonts/SomarSans-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
    --page: #F7F3ED; --surface: #FAF8F4; --mute: #EFE9DE; --cream: #EFE7D7; --line: #E2D8C8;
    --ink: #1F1F1F; --ink-2: #3C3C43; --muted: #6F6A5F;
    --gold: #B79851; --gold-light: #C8AA63; --gold-deep: #92763C;
    --olive: #627536; --olive-deep: #3E4A22; --feature: #3E4A22; --on-feature: #F5F1E8;
    --chip: rgba(183, 152, 81, .14); --shadow: 0 18px 40px -18px rgba(62, 52, 30, .35);
    --radius: 22px; --wrap: 1120px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --page: #171613; --surface: #211F1A; --mute: #28251F; --cream: #24211B; --line: #3A342B;
        --ink: #F5F1E8; --ink-2: #D8CFBF; --muted: #B8AE9E; --olive: #A8B77D; --feature: #28311A;
        --chip: rgba(200, 170, 99, .2); --shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
    }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.8 "Somar Sans", "Segoe UI", Tahoma, sans-serif; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 14px; border-radius: 10px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 20px; color: var(--olive-deep); }
@media (prefers-color-scheme: dark) { .brand { color: var(--ink); } }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.nav { display: flex; gap: 22px; margin-inline-start: auto; font-size: 15px; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--gold-deep); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 14px; font-weight: 700; font-size: 15px; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; }
.btn-olive { background: var(--olive-deep); color: #F5F1E8; }
.btn-olive:hover { background: #33401b; }
.btn-gold { background: var(--gold); color: #1F1A10; }
.btn-gold:hover { background: var(--gold-light); }
@media (max-width: 820px) { .nav { display: none; } .top .btn { margin-inline-start: auto; } }

/* hero */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; }
.hero::before { content: ""; position: absolute; inset: -30% -10% auto auto; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, var(--chip), transparent 65%); pointer-events: none; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; position: relative; }
.eyebrow { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--chip); color: var(--gold-deep); font-size: 14px; font-weight: 700; }
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--gold-light); } }
.hero h1 { font-size: clamp(34px, 5.2vw, 56px); margin: 18px 0 14px; }
.hero h1 em { font-style: normal; color: var(--gold-deep); }
@media (prefers-color-scheme: dark) { .hero h1 em { color: var(--gold-light); } }
.lead { font-size: 19px; color: var(--muted); max-width: 520px; }
.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.store { display: inline-flex; align-items: center; gap: 12px; padding: 10px 20px 10px 22px; border-radius: 16px; background: #1F1F1F; color: #fff; text-decoration: none; min-width: 190px; }
.store:hover { background: #000; }
.store svg { width: 26px; height: 26px; flex: none; }
.store small { display: block; font-size: 12px; opacity: .8; line-height: 1.3; }
.store b { display: block; font-size: 18px; line-height: 1.3; direction: ltr; text-align: start; }
@media (prefers-color-scheme: dark) { .store { background: var(--surface); border: 1px solid var(--line); } }
.trial-note { margin-top: 14px; font-size: 14px; color: var(--muted); }
.trial-note b { color: var(--olive); }
.phones { position: relative; height: 600px; }
.phone { position: absolute; width: 250px; border-radius: 36px; padding: 8px; background: #1d1b17; box-shadow: var(--shadow); }
.phone img { border-radius: 29px; width: 100%; height: auto; aspect-ratio: 9 / 20; object-fit: cover; object-position: top; background: var(--mute); }
.phones .phone:first-child { inset-inline-end: 8%; top: 0; z-index: 2; }
.phones .phone:last-child { inset-inline-start: 6%; top: 50px; transform: rotate(-5deg); }
@media (max-width: 900px) {
    .hero { padding-top: 36px; }
    .hero .wrap { grid-template-columns: 1fr; text-align: center; }
    .lead { margin: 0 auto; }
    .stores { justify-content: center; }
    .phones { height: 470px; max-width: 400px; width: 100%; margin: 0 auto; }
    .phone { width: 200px; border-radius: 30px; padding: 7px; }
    .phone img { border-radius: 24px; }
    .phones .phone:first-child { inset-inline-end: 4%; }
    .phones .phone:last-child { inset-inline-start: 4%; top: 40px; }
}

/* sections */
section { padding: 72px 0; }
.head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.head h2 { font-size: clamp(28px, 3.6vw, 38px); margin: 12px 0 10px; }
.head p { color: var(--muted); }
.alt { background: var(--surface); border-block: 1px solid var(--line); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--page); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.alt .feature { background: var(--page); }
.feature .ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--chip); color: var(--gold-deep); margin-bottom: 16px; }
@media (prefers-color-scheme: dark) { .feature .ico { color: var(--gold-light); } }
.feature .ico svg { width: 26px; height: 26px; }
.feature h3 { font-size: 20px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 16px; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

.gallery { display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 20px 22px; margin: 0 auto; max-width: var(--wrap); scrollbar-width: thin; }
.gallery figure { margin: 0; flex: 0 0 236px; scroll-snap-align: center; text-align: center; }
.gallery .phone { position: static; width: 100%; }
.gallery figcaption { margin-top: 14px; font-weight: 700; }
.gallery figcaption span { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; max-width: 900px; margin: 0 auto; }
.plan { position: relative; background: var(--page); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 26px; text-align: center; }
.plan.best { border: 2px solid var(--gold); background: var(--cream); }
.plan .badge { position: absolute; top: -14px; inset-inline: 0; margin: 0 auto; width: max-content; padding: 2px 14px; border-radius: 999px; background: var(--gold); color: #1F1A10; font-size: 13px; font-weight: 700; }
.plan h3 { font-size: 20px; }
.plan .price { font-size: 42px; font-weight: 700; margin: 12px 0 0; line-height: 1.2; }
.plan .price small { font-size: 16px; color: var(--muted); font-weight: 400; }
.plan .per { color: var(--muted); font-size: 15px; }
.plan .monthly { margin-top: 6px; font-size: 14px; color: var(--olive); font-weight: 700; }
.plan .trial { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); font-size: 15px; }
.plans-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: 22px; }

.books { display: grid; grid-template-columns: repeat(6, 1fr); gap: 22px 18px; }
.book { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.book .cover { aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--mute); box-shadow: 0 10px 22px -12px rgba(31, 28, 22, .45); transition: transform .2s; }
.book:hover .cover { transform: translateY(-4px); }
.book .cover img { width: 100%; height: 100%; object-fit: cover; }
.book b { font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book span { font-size: 13px; color: var(--gold-deep); line-height: 1.4; }
@media (prefers-color-scheme: dark) { .book span { color: var(--gold-light); } }
@media (max-width: 900px) { .books { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) { .books { grid-template-columns: repeat(3, 1fr); gap: 18px 12px; } .book b { font-size: 13px; } }

.cta { position: relative; overflow: hidden; border-radius: 30px; background: var(--feature); color: var(--on-feature); padding: 54px 40px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.cta::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 210px; background: url("hero.webp") left center / auto 100% no-repeat; opacity: .45; -webkit-mask-image: linear-gradient(to left, transparent, #000 60%); mask-image: linear-gradient(to left, transparent, #000 60%); }
.cta > * { position: relative; z-index: 1; }
.cta h2 { font-size: clamp(26px, 3.4vw, 36px); }
.cta p { opacity: .85; margin-top: 8px; }
.cta .stores { margin-top: 0; }
.cta .store { background: #F5F1E8; color: #1F1F1F; border: 0; }
@media (max-width: 820px) { .cta { grid-template-columns: 1fr; text-align: center; padding: 40px 22px; } .cta::after { display: none; } .cta .stores { justify-content: center; } }

/* footer */
footer.site { padding: 48px 0 36px; border-top: 1px solid var(--line); margin-top: 72px; font-size: 15px; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.center img { width: 64px; height: 64px; }
.center b { display: block; }
.center span { color: var(--muted); font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.links a { text-decoration: none; color: var(--ink-2); }
.links a:hover { color: var(--gold-deep); }
.copy { width: 100%; color: var(--muted); font-size: 13px; }

/* text pages (privacy, terms, about) */
.doc { max-width: 780px; margin: 0 auto; padding: 48px 20px 0; }
.doc h1 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 6px; }
.doc .updated { color: var(--muted); font-size: 14px; margin-bottom: 30px; }
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px clamp(20px, 4vw, 44px); }
.prose h2, .prose h3 { margin: 28px 0 10px; font-size: 22px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose a { color: var(--olive); }
.prose img { height: auto; border-radius: 12px; }

/* authors' form */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label, .field legend { font-weight: 700; font-size: 15px; padding: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.field input, .field select, .field textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--page); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; width: 100%; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--chip); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.phone-row select { flex: 0 0 38%; }
.radios { display: flex; gap: 20px; padding-top: 6px; }
.radios label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.radios input { width: auto; accent-color: var(--olive); }
.file { position: relative; display: flex; align-items: center; gap: 12px; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; background: var(--page); }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--chip); }
.file .btn { padding: 8px 16px; background: var(--chip); color: var(--ink); pointer-events: none; }
.file span { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { font-size: 13px; color: var(--muted); }
.error { font-size: 13px; color: #B0443E; min-height: 0; }
.alert { grid-column: 1 / -1; padding: 14px 18px; border-radius: 14px; background: rgba(176, 68, 62, .1); color: #B0443E; }
.done { text-align: center; padding: 30px 10px; }
.done h2 { font-size: 26px; margin-bottom: 10px; }
.done p { color: var(--muted); margin-bottom: 22px; }
@media (max-width: 640px) { .form { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }
