/* Zavelgorba design system — values from the brand guide (Zavil_Qurba_Brand_Guide). */

@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn-arabic.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
/* Book typography: a Naskh for titles, names and headings (the script these books are printed in),
   EB Garamond for the same roles in English; Vazirmatn / IBM Plex Sans Arabic / Inter for the interface. */
@font-face { font-family: 'Noto Naskh Arabic'; src: url('/fonts/noto-naskh-arabic-vf.woff2') format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200F, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'EB Garamond'; src: url('/fonts/eb-garamond-latin-vf.woff2') format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
/* Hero headline face (home page only); a single 400 weight. */
@font-face { font-family: 'Lalezar'; src: url('/fonts/lalezar-arabic.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'EB Garamond'; src: url('/fonts/eb-garamond-latin-ext-vf.woff2') format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0100-02AF, U+02BE-02BF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    /* Brand */
    --green-900: #0F4C3A;      /* Deep Islamic Green */
    --green-700: #4F7A5A;      /* Heritage Green */
    --gold: #B08D57;           /* Manuscript Gold */
    --cream: #F7F1E3;          /* Old Paper Cream */
    --ink: #1E2420;            /* Text Black */
    /* Functional */
    --success: #2E7D32;
    --discount: #C62828;
    --warning: #D97706;
    --info: #2563EB;
    /* Derived */
    --surface: #FFFDF8;
    --surface-2: #F1E9D6;
    --border: #E6DCC5;
    --muted: #6B6B5E;
    --green-050: #E7EFEA;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(15, 76, 58, .07);
    --font-ui: 'Vazirmatn', system-ui, sans-serif;
    --font-display: 'Noto Naskh Arabic', 'Vazirmatn', serif;
    /* Book titles and people's names: Arabic in Naskh, a Latin (English) title in Garamond. */
    --font-arabic: 'Noto Naskh Arabic', 'EB Garamond', Georgia, serif;
    /* Motion */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    font-family: var(--font-ui);
    background: var(--cream);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; color: var(--green-900); }
/* Naskh has tall ascenders and deep descenders: give wrapped headings room. */
[dir="rtl"] :is(h1, h2, h3, .h1, .h2, .h3) { line-height: 1.6; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
@media (min-width: 992px) { h1 { font-size: 3rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; } }
.caption { font-size: .8125rem; color: var(--muted); }
.arabic-title { font-family: var(--font-arabic); font-weight: 700; line-height: 1.75; }
/* Original-script text inside an English page (the printed Arabic title, an Arabic name). */
.original-title { font-family: 'Noto Naskh Arabic', var(--font-ui); font-weight: 500; font-size: 1.15rem; line-height: 1.8; color: var(--muted); }

a { color: var(--green-900); text-decoration: none; }
a:hover { color: var(--green-700); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn { border-radius: 10px; font-weight: 600; }
.btn-brand { background: var(--green-900); color: #fff; border: 0; }
.btn-brand:hover, .btn-brand:focus { background: #0B3A2C; color: #fff; }
.btn-outline-brand { border: 1.5px solid var(--green-900); color: var(--green-900); background: transparent; }
.btn-outline-brand:hover { background: var(--green-900); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; border: 0; }
.btn-gold:hover { background: #967647; color: #fff; }
.form-control, .form-select { border-radius: 10px; border-color: var(--border); background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--green-700); box-shadow: 0 0 0 .2rem rgba(79, 122, 90, .2); }
.text-brand { color: var(--green-900) !important; }
.text-gold { color: var(--gold) !important; }
.text-discount { color: var(--discount) !important; }
.bg-gold { background-color: var(--gold) !important; color: #fff; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* ---------- Header ---------- */
.topbar { background: var(--green-900); color: #E8E2D0; font-size: .8125rem; }
.topbar a { color: #E8E2D0; }
.topbar a:hover { color: #fff; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1020; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 44px; height: 44px; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--green-900); line-height: 1.45; }
.brand-tag { font-size: .75rem; color: var(--muted); }
.search-box { position: relative; }
.search-box input { padding-inline-end: 52px; height: 46px; border-radius: 12px; }
.search-box button { position: absolute; inset-inline-end: 4px; top: 4px; bottom: 4px; width: 44px; border-radius: 9px; }
.main-nav .nav-link { color: var(--ink); font-weight: 600; padding: 14px 12px; border-bottom: 2px solid transparent; }
.main-nav .nav-link:hover, .main-nav .nav-link.active { color: var(--green-900); border-bottom-color: var(--green-900); }
.icon-btn { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--green-900); background: transparent; border: 0; }
.icon-btn:hover { background: var(--green-050); }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Mobile drawer */
.drawer { width: min(360px, 88vw) !important; background: var(--surface); }
.drawer .nav-link { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); color: var(--ink); font-weight: 600; }
.drawer .sub .nav-link { font-weight: 400; padding-inline-start: 20px; }

/* ---------- Hero ---------- */
/* Images: 4× AI-upscaled originals, AVIF/WebP at 1×/2× (JPEG fallback). Preloaded on the home page. */
.hero, .invite, .site-footer {
    --hero-books: url('/img/hero-books.jpg');
    --hero-books: image-set(url('/img/hero-books-1200.avif') type('image/avif') 1x, url('/img/hero-books-2400.avif') type('image/avif') 2x,
                            url('/img/hero-books-1200.webp') type('image/webp') 1x, url('/img/hero-books-2400.webp') type('image/webp') 2x,
                            url('/img/hero-books.jpg') type('image/jpeg') 1x);
    --hero-arch: url('/img/hero-arch.jpg');
    --hero-arch: image-set(url('/img/hero-arch-400.avif') type('image/avif') 1x, url('/img/hero-arch-800.avif') type('image/avif') 2x,
                           url('/img/hero-arch-400.webp') type('image/webp') 1x, url('/img/hero-arch-800.webp') type('image/webp') 2x,
                           url('/img/hero-arch.jpg') type('image/jpeg') 1x);
}
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    background: #f5efdf; min-height: clamp(380px, 25vw, 600px);
    display: flex; align-items: center; border-bottom: 1px solid var(--border);
}
.hero-scene { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: url('/img/hero-heritage-2172.webp?v=2') right center / cover no-repeat; }
.hero > .container { position: relative; max-width: none; width: 100%; padding-inline: 0; }
.hero-content { box-sizing: border-box; padding: 32px clamp(20px, 2.5vw, 56px); width: 30%; max-width: none; margin-left: auto; margin-right: 0; text-align: center; container-type: inline-size; overflow-wrap: anywhere; }
/* Persian/Arabic hero headline in Lalezar (single 400 weight); English keeps the display face. */
.hero { --hero-font: 'Lalezar', var(--font-display); --hero-w: 400; }
html[lang="en"] .hero { --hero-font: var(--font-display); --hero-w: 700; }
.hero h1 { font-family: var(--hero-font); font-weight: var(--hero-w); font-size: clamp(2rem, 15cqi, 5rem); margin: 0 0 6px; line-height: 1.45; color: #163f2b; }
.hero-subtitle { font-family: var(--hero-font); font-weight: var(--hero-w); color: #6c4c25; font-size: clamp(1.15rem, 7cqi, 2.25rem); line-height: 1.65; margin: 0; }
.hero-orn { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px auto 4px; color: var(--gold); }
.hero-orn i { display: block; width: 64px; height: 1px; background: currentColor; opacity: .6; }
.hero-orn svg { width: 16px; height: 16px; fill: currentColor; }
.hero .pillars { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; color: #494638; font-size: clamp(.75rem, 1vw, 1rem); margin: 10px 0 26px; }

/* Living light over the hero photo: a breathing glow in the arch, a shimmer on the dome, the lamp's
   flicker, a slow light sweep and drifting motes. The layer matches the photo's own box (3:1), so the
   lights stay on the dome whether the photo covers the hero (desktop) or sits above the text (phones). */
.hero-lights { position: absolute; left: 0; right: 0; top: 50%; aspect-ratio: 3; transform: translateY(-50%); pointer-events: none; opacity: .8; }
.hero-glow { position: absolute; border-radius: 50%; aspect-ratio: 1; translate: -50% -50%; mix-blend-mode: screen; }
.hero-glow.g1 { left: 51%; top: 35%; width: 40%; background: radial-gradient(circle, rgba(255, 221, 150, .55) 0, rgba(255, 214, 140, .18) 38%, transparent 66%); animation: hero-breathe 8s ease-in-out infinite alternate; }
.hero-glow.g2 { left: 52.5%; top: 49%; width: 12%; background: radial-gradient(circle, rgba(255, 236, 170, .75) 0, transparent 62%); animation: hero-shimmer 5.5s ease-in-out infinite; }
.hero-glow.g3 { left: 5.5%; top: 76%; width: 9%; background: radial-gradient(circle, rgba(255, 200, 120, .8) 0, transparent 60%); animation: hero-flicker 3.2s ease-in-out infinite; }
.hero-beam { position: absolute; top: -30%; left: 0; width: 14%; height: 160%; background: linear-gradient(90deg, transparent, rgba(255, 243, 214, .42), transparent); transform: translateX(-120%) rotate(16deg); mix-blend-mode: soft-light; animation: hero-sweep 16s ease-in-out infinite; }
.hero-mote { position: absolute; border-radius: 50%; background: #FFE7B0; box-shadow: 0 0 6px 2px rgba(255, 214, 140, .7); opacity: 0; animation: hero-drift linear infinite; }
@keyframes hero-breathe { from { opacity: .55; scale: .92; } to { opacity: 1; scale: 1.06; } }
@keyframes hero-shimmer { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes hero-flicker { 0%, 100% { opacity: .7; scale: 1; } 30% { opacity: .95; scale: 1.08; } 55% { opacity: .6; } 80% { opacity: .9; scale: .97; } }
@keyframes hero-sweep { 0% { transform: translateX(-120%) rotate(16deg); } 55%, 100% { transform: translateX(800%) rotate(16deg); } }
@keyframes hero-drift { 0% { opacity: 0; transform: none; } 15% { opacity: .9; } 80% { opacity: .6; } 100% { opacity: 0; transform: translate(18px, -120px); } }
/* Title sheen and a one-time entrance. */
.hero h1 span { background: linear-gradient(100deg, #163f2b 0 42%, #4c8a63 50%, #163f2b 58% 100%); background-size: 260% 100%; background-position: 100% 0;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: hero-sheen 10s ease-in-out 1.4s infinite; }
@keyframes hero-sheen { 0% { background-position: 100% 0; } 45%, 100% { background-position: 0 0; } }
.hero-content > * { animation: hero-rise 1s var(--ease-out) both; }
.hero-content > :nth-child(2) { animation-delay: .15s; } .hero-content > :nth-child(3) { animation-delay: .25s; }
.hero-content > :nth-child(4) { animation-delay: .35s; } .hero-content > :nth-child(5) { animation-delay: .45s; }
@keyframes hero-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .hero-lights *, .hero h1 span, .hero-content > * { animation: none !important; }
    .hero-mote { opacity: .5; }
}
/* Tile border (hashie) under the hero. */
.hashie { display: block; width: 100%; height: 14px; color: var(--gold); opacity: .75; }
.hero .pillars span { white-space: nowrap; }
.hero .pillars span + span::before { content: '|'; margin: 0 9px; color: #8a8069; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.hero-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; min-height: 50px; font-size: 1rem; }
.hero-actions .btn-outline-brand { border-color: #94a58b; background: rgb(255 253 248 / 38%); }
html[lang="en"] .hero h1 { font-size: clamp(2rem, 14cqi, 4.5rem); line-height: 1.15; letter-spacing: -.025em; margin-bottom: 14px; }
html[lang="en"] .hero-subtitle { font-size: clamp(1.15rem, 6.5cqi, 2rem); line-height: 1.4; }
@media (max-width: 1199px) and (min-width: 992px) {
    .hero-actions { gap: 8px; }
    .hero-actions .btn { padding-inline: 18px !important; font-size: .9rem; }
}
@media (max-width: 991px) {
    .hero { display: block; min-height: 0; }
    .hero-scene { position: relative; height: clamp(220px, 49vw, 420px); background-size: auto 100%; background-position: left center; clip-path: none; }
    .hero-lights { inset: 0 auto 0 0; top: 0; height: 100%; width: auto; transform: none; }
    .hero-scene::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 78%, #f5efdf); }
    .hero > .container { padding-inline: 20px; }
    .hero-content { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 0 30px; }
    .hero h1 { font-size: clamp(3rem, 9vw, 4.4rem); }
    .hero-subtitle { font-size: clamp(1.4rem, 4.5vw, 2rem); }
    .hero .pillars { font-size: .85rem; margin: 8px 0 22px; }
    .hero .pillars span + span::before { margin-inline: 7px; }
    .hero-actions .btn { padding-inline: 20px !important; font-size: .95rem; }
}
@media (min-width: 992px) { html[dir="ltr"] .hero-content { margin-inline-start: auto; } }

/* ---------- Subjects ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (min-width: 992px) { .subject-grid { grid-template-columns: repeat(8, 1fr); } }
.subject {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 8px; text-align: center; color: var(--ink);
    transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), color 150ms ease;
}
@media (hover: hover) and (pointer: fine) { .subject:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--green-900); } }
.subject .icon { width: 40px; height: 40px; color: var(--gold); stroke-width: 1.3; margin-bottom: 8px; }
.subject-name { font-weight: 700; font-size: .9rem; }
@media (max-width: 575px) { .subject { padding: 12px 4px; } .subject-name { font-size: .75rem; } .subject .icon { width: 30px; height: 30px; } }

/* ---------- Section heads ---------- */
.section { margin-top: 48px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 1.5rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head h2 .icon { color: var(--gold); }
.see-all { font-weight: 600; font-size: .9rem; }

/* Horizontal scroller for product rows */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.shelf > * { scroll-snap-align: start; }
@media (min-width: 1200px) { .shelf { grid-auto-columns: calc((100% - 5 * 16px) / 6); } }

/* ---------- Book card ---------- */
.book-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px; height: 100%; display: flex; flex-direction: column; position: relative;
    transition: box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .book-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); } }
.book-cover {
    aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; margin-bottom: 10px;
    background: linear-gradient(160deg, #1A5A46, var(--green-900)); display: flex; align-items: center; justify-content: center;
    color: #E9D8B4; font-family: var(--font-arabic); font-weight: 700; text-align: center; padding: 14px; font-size: 1.05rem; line-height: 1.8;
    border: 3px double rgba(176, 141, 87, .6);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover.has-image { padding: 0; border: 0; background: var(--surface-2); }
.book-title { font-family: var(--font-arabic); font-weight: 700; font-size: 1.1rem; line-height: 1.75; color: var(--ink); margin-bottom: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-title a { color: inherit; }
.book-title a::after { content: ''; position: absolute; inset: 0; } /* whole card clickable */
.book-meta { color: var(--muted); font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.price { font-weight: 700; color: var(--green-900); font-size: .95rem; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: .8rem; }
.chip { display: inline-block; white-space: nowrap; font-size: .75rem; padding: 2px 10px; border-radius: 20px; background: var(--surface-2); color: #5B4A2B; font-weight: 600; }
.badge-off { position: absolute; top: 18px; inset-inline-start: 18px; background: var(--discount); color: #fff; font-weight: 700; font-size: .75rem; border-radius: 8px; padding: 2px 8px; z-index: 1; }
.badge-soldout { position: absolute; top: 18px; inset-inline-start: 18px; background: #fff; color: var(--ink); font-weight: 700; font-size: .75rem; border-radius: 8px; padding: 2px 8px; z-index: 1; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
/* Gold premium label (brand book §08): manuscript gold marks premium heritage editions only. */
.badge-premium { position: absolute; top: 18px; inset-inline-start: 18px; z-index: 1; background: var(--gold); color: #fff; font-weight: 700; font-size: .72rem;
    border-radius: 8px; padding: 2px 8px; box-shadow: 0 1px 4px rgba(62, 45, 20, .25); }
.badge-off ~ .badge-premium, .badge-soldout ~ .badge-premium { top: 44px; }
.label-premium { display: inline-flex; align-items: center; gap: 6px; color: #7A5C2E; background: #F4ECDD; border: 1px solid rgba(176, 141, 87, .55);
    border-radius: 20px; padding: 2px 12px; font-size: .8rem; font-weight: 700; }
.label-premium::before { content: '✦'; color: var(--gold); }
/* Stand-in cover: ornament, title, author, publisher (brand book §07). */
.cover-art { flex-direction: column; justify-content: space-between; gap: 6px; padding: 16px 12px; position: relative; }
.cover-art::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(176, 141, 87, .45); border-radius: 6px; pointer-events: none; }
.cover-ornament { width: 34px; height: 34px; flex-shrink: 0; background: var(--gold); opacity: .8;
    clip-path: polygon(50% 0, 61% 26%, 85% 15%, 74% 39%, 100% 50%, 74% 61%, 85% 85%, 61% 74%, 50% 100%, 39% 74%, 15% 85%, 26% 61%, 0 50%, 26% 39%, 15% 15%, 39% 26%); }
.cover-title { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: #F1E4C6; }
.cover-author { font-family: var(--font-ui); font-weight: 400; font-size: .72em; color: #D9C8A3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover-publisher { font-family: var(--font-display); font-size: .62em; color: var(--gold); border-top: 1px solid rgba(176, 141, 87, .5); padding-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--success); }
.dot-no { background: var(--discount); }

/* ---------- Stats band ---------- */
.stats-band { position: relative; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 28px; }
/* Faint girih ornament at the leading edge, fading toward the centre. */
.stats-band::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 220px; pointer-events: none; opacity: .22;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none' stroke='%23B08D57' stroke-width='1'%3E%3Cpath d='M28 4l7 17 17 7-17 7-7 17-7-17-17-7 17-7z'/%3E%3Cpath d='M28 14l4 10 10 4-10 4-4 10-4-10-10-4 10-4z'/%3E%3Ccircle cx='28' cy='28' r='3'/%3E%3Cpath d='M0 0l10 10M56 0L46 10M0 56l10-10M56 56L46 46'/%3E%3C/svg%3E") repeat;
    -webkit-mask-image: linear-gradient(to left, #000, transparent); mask-image: linear-gradient(to left, #000, transparent); }
[dir="ltr"] .stats-band::before { -webkit-mask-image: linear-gradient(to right, #000, transparent); mask-image: linear-gradient(to right, #000, transparent); }
.stats-row { position: relative; }
.stat { display: flex; align-items: center; justify-content: center; gap: 14px; }
.stat .icon { width: 48px; height: 48px; flex-shrink: 0; color: var(--green-900); stroke-width: 1.2; }
.stat-value { font-family: var(--font-ui); font-weight: 800; font-size: 1.6rem; color: var(--green-900); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink); font-size: .85rem; margin-top: 4px; }
@media (min-width: 992px) {
    .stats-row > * + * .stat { border-inline-start: 1px solid rgba(176, 141, 87, .35); }
}

/* People */
.person { text-align: center; color: var(--ink); display: block; }
.avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 8px; background: var(--green-900); color: #E9D8B4;
    display: flex; align-items: center; justify-content: center; font-family: var(--font-arabic); font-size: 2rem; border: 3px solid var(--gold); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-name { font-weight: 700; font-size: .9rem; }

/* Feature tiles */
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .icon { width: 36px; height: 36px; color: var(--green-900); stroke-width: 1.3; }
.feature-title { font-weight: 700; }

/* Reference collaboration and testimonial band: text remains selectable and localized. */
.heritage-band { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 9fr); gap: 26px; align-items: stretch; }
.invite { position: relative; isolation: isolate; overflow: hidden; min-height: 184px; background: #eee5d1; border-radius: 4px; display: flex; align-items: center; padding: 22px 26px; }
.invite-scene { position: absolute; inset: 0; z-index: -1; background: url('/img/invite-books-hd.webp') left center / cover no-repeat; }
.invite-quill { position: absolute; inset-inline-start: 5px; top: 10px; height: calc(100% - 20px); width: 65px; color: #b59a61; opacity: .55; pointer-events: none; }
.invite-body { width: 60%; position: relative; padding-inline-start: 14px; text-align: center; }
.invite h2 { font-size: clamp(1.1rem, 1.65vw, 1.55rem); line-height: 1.6; margin: 0 0 2px; }
.invite p { font-size: .83rem; line-height: 1.9; margin: 0 0 8px; color: #665e48; }
.invite .btn { display: inline-flex; align-items: center; gap: 12px; border-radius: 999px; padding: 5px 18px; font-size: .8rem; }
.invite .btn { min-height: 44px; }
.heritage-band { scroll-margin-top: 160px; }
.invite-body, .quote-body { overflow-wrap: anywhere; }
.quote-card { position: relative; isolation: isolate; display: flex; align-items: center; gap: 18px; padding: 24px 50px; min-height: 184px; }
.quote-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; }
.quote-frame path { fill: #faf5e9; fill-opacity: .7; stroke: #bba36b; stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.quote-ornament { position: absolute; top: 50%; translate: 0 -50%; color: #bba36b; font-size: 1.35rem; line-height: 1; }
.quote-ornament-start { inset-inline-start: 23px; }
.quote-ornament-end { inset-inline-end: 23px; }
.quote-body { flex: 1; min-width: 0; position: relative; padding-inline-start: 24px; }
.quote-body p { font-size: .9rem; line-height: 2.1; margin-bottom: 6px; color: #504d42; }
.quote-body footer b { color: #40503b; font-size: .88rem; }
.quote-body footer .caption { font-size: .72rem; color: #8a806a; line-height: 1.8; }
.quote-mark { position: absolute; inset-inline-start: 0; top: -12px; font-family: Georgia, serif; font-size: 3rem; line-height: 1; color: #bba36b; }
.quote-photo { flex-shrink: 0; width: 160px; height: 170px; align-self: end; margin-block: -32px -24px; overflow: hidden; border-radius: 48% 48% 6px 6px; }
.quote-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
html[dir="ltr"] .invite-scene { transform: scaleX(-1); }
html[lang="en"] .heritage-band { grid-template-columns: minmax(0, 5fr) minmax(0, 9fr); }
html[lang="en"] .quote-body p { font-size: .84rem; line-height: 1.8; }
@media (max-width: 575px) {
    .invite-scene::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to left, #f3ebdb 0%, rgb(243 235 219 / 95%) 42%, rgb(243 235 219 / 55%) 66%, transparent 88%); }
    html[lang="en"] .hero h1 { font-size: clamp(2.5rem, 10vw, 3.6rem); }
}
@media (min-width: 1600px) { .heritage-band { gap: 32px; } .invite, .quote-card { min-height: 206px; } }
@media (max-width: 1199px) { .heritage-band { gap: 18px; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); } .invite { padding-inline: 16px; } .invite-body { width: 65%; } .quote-card { padding-inline: 38px; gap: 12px; } .quote-photo { width: 120px; height: 160px; } .quote-body p { font-size: .82rem; } .quote-ornament-start { inset-inline-start: 16px; } .quote-ornament-end { inset-inline-end: 16px; } }
@media (max-width: 991px) { .heritage-band, html[lang="en"] .heritage-band { grid-template-columns: 1fr; gap: 20px; } .invite { min-height: 200px; } .invite-body { width: 55%; max-width: 380px; } .invite p { font-size: .95rem; } .invite h2 { font-size: 1.5rem; } .quote-body p { font-size: .95rem; } }
@media (max-width: 575px) { .invite { min-height: 200px; padding-inline: 12px; } .invite-body { width: 65%; padding-inline-start: 6px; } .invite-quill { width: 40px; opacity: .3; } .invite p { font-size: .83rem; } .invite h2 { font-size: 1.2rem; } .quote-card { flex-direction: column-reverse; gap: 16px; text-align: center; padding: 28px 32px; } .quote-photo { align-self: center; width: 128px; height: 144px; margin: 0; } .quote-body { padding: 0; } .quote-body p { font-size: .87rem; line-height: 2; } .quote-mark { position: static; display: block; height: 24px; } .quote-ornament { font-size: 1rem; } .quote-ornament-start { inset-inline-start: 10px; } .quote-ornament-end { inset-inline-end: 10px; } }

/* ---------- Footer ---------- */
.site-footer { position: relative; overflow: hidden; background: var(--green-900); color: #D9D3C1; margin-top: 64px; padding: 44px 0 20px; }
/* The shrine dome at the outer edge, fading into the green (fills the side margin on wide screens only). */
.footer-shrine {
    position: absolute; inset-block: 0; inset-inline-end: 0;
    width: calc((100% - 1320px) / 2 + 110px);
    background: var(--hero-arch) center 62% / cover no-repeat;
    -webkit-mask-image: linear-gradient(to right, #000 35%, transparent);
    mask-image: linear-gradient(to right, #000 35%, transparent);
    opacity: .9;
}
html[dir="ltr"] .footer-shrine { -webkit-mask-image: linear-gradient(to left, #000 35%, transparent); mask-image: linear-gradient(to left, #000 35%, transparent); }
.footer-brand { color: inherit; }
.footer-brand .brand-tag { color: #C9B27E; font-size: .82rem; }
.footer-bullets li::before { content: '•'; color: var(--gold); margin-inline-end: 8px; }
.footer-contact li { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; }
.footer-contact .icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; color: var(--gold); }
.footer-contact a { overflow-wrap: anywhere; }
.social-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: #fff !important; transition: background-color 150ms ease, border-color 150ms ease; }
.social-icon .icon { width: 19px; height: 19px; }
@media (hover: hover) and (pointer: fine) { .social-icon:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.5); } }
.site-footer h3 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer a { color: #D9D3C1; }
.site-footer a:hover { color: #fff; }
.site-footer li { margin-bottom: 2px; }
.footer-links a { display: inline-block; padding: 6px 0; } /* comfortable tap height without spacing the list apart */
.social-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: #fff !important; font-size: .875rem; transition: background-color 150ms ease, border-color 150ms ease; }
.social-pill .icon { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .social-pill:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.5); } }
.site-footer .copyright { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 16px; font-size: .8rem; }
@media (max-width: 991.98px) {
    .site-footer { margin-top: 48px; padding-top: 32px; }
    .site-footer .copyright { justify-content: center; text-align: center; margin-top: 20px; }
}
.trust-seals { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.trust-seals a { display: inline-flex; align-items: center; justify-content: center; width: 100px; height: 100px; border-radius: 8px; background: #fff; }
.newsletter .form-control { background: #fff; }

/* ---------- Book page ---------- */
.breadcrumb { font-size: .85rem; }
.gallery-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.gallery-main .book-cover { margin: 0; font-size: 1.6rem; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { width: 64px; height: 84px; padding: 0; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; background: none; flex-shrink: 0; }
.thumbs button[aria-current="true"] { border-color: var(--green-900); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.spec-list { list-style: none; padding: 0; margin: 0; }
.spec-list li { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.spec-list li span:first-child { color: var(--muted); min-width: 110px; }
.buy-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 96px; }
.currency-tabs .btn { padding: 4px 14px; font-size: .85rem; }
.currency-tabs .btn[aria-pressed="true"] { background: var(--green-900); border-color: var(--green-900); color: #fff; } /* not the red «liked» state of .btn-outline-brand */
.big-price { font-family: var(--font-ui); font-weight: 800; font-size: 1.6rem; color: var(--green-900); font-variant-numeric: tabular-nums; }
.tag-link { display: inline-block; border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-size: .8rem; margin: 0 0 6px 4px; background: var(--surface); }

/* ---------- Forms (cooperation) ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { display: block; height: 100%; text-align: center; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px 10px; cursor: pointer; background: var(--surface); }
.choice label .icon { width: 36px; height: 36px; color: var(--gold); margin-bottom: 6px; }
.choice input:checked + label { border-color: var(--green-900); background: var(--green-050); box-shadow: inset 0 0 0 1px var(--green-900); }
.choice input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--green-900); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---------- Admin ---------- */
.admin-body { background: #F6F3EA; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 250px; background: var(--green-900); color: #DCE7E0; flex-shrink: 0; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side { height: 100dvh; overscroll-behavior: contain; }
.admin-side[hidden], .admin-side-backdrop[hidden] { display: none; }
.admin-side-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-inline-start: auto; margin-bottom: 8px; border: 1px solid #9FB6A7; border-radius: 8px; background: transparent; color: #fff; }
.admin-side-backdrop { display: none; }
#admin-menu-toggle, .admin-side-close { flex-shrink: 0; touch-action: manipulation; }
.admin-side .brand-name { color: #fff; font-size: 1.05rem; }
.admin-side .brand-tag { color: #B9CDBF; }
.admin-side .nav-link { color: #DCE7E0; border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; font-weight: 500; margin-bottom: 2px; }
.admin-side .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-side .nav-link.active { background: #F1E9D6; color: var(--green-900); font-weight: 700; }
.admin-side .group { font-size: .72rem; color: #9FB6A7; margin: 16px 12px 6px; }
.admin-main { flex: 1; min-width: 0; }
.admin-top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
.admin-content { padding: 20px; }
@media (max-width: 991.98px) {
    .admin-side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1040; max-width: 85vw; }
    .admin-side-backdrop { display: block; position: fixed; inset: 0; z-index: 1030; border: 0; background: rgba(0,0,0,.4); }
    .admin-body.admin-menu-open { overflow: hidden; }
}
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; height: 100%; }
.kpi .icon-wrap { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--green-050); color: var(--green-900); flex-shrink: 0; }
.kpi .icon-wrap.warn { background: #FDF0DF; color: var(--warning); }
.kpi .icon-wrap.danger { background: #FBE7E7; color: var(--discount); }
.kpi .icon-wrap.gold { background: #F4ECDD; color: var(--gold); }
.kpi-value { font-family: var(--font-ui); font-weight: 800; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.kpi-link:hover { border-color: var(--green-900); color: inherit; }
.kpi-link.active { border-color: var(--green-900); box-shadow: 0 0 0 2px var(--green-050); }
.table-soft { --bs-table-bg: transparent; }
.table-soft th { color: var(--muted); font-weight: 600; font-size: .82rem; background: #FAF6EC; }
.table-soft td { vertical-align: middle; font-size: .9rem; }
.status { font-size: .75rem; font-weight: 700; border-radius: 8px; padding: 3px 10px; display: inline-block; }
.status-ok { background: #E6F2E7; color: var(--success); }
.status-warn { background: #FDF0DF; color: var(--warning); }
.status-no { background: #FBE7E7; color: var(--discount); }
.status-info { background: #E6EEFD; color: var(--info); }
.status-muted { background: #EEE; color: #555; }

/* Warehouse rows */
.stock-row { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.stock-chip { background: var(--surface-2); color: #5B4A2B; padding: 2px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.qty { display: inline-flex; align-items: center; background: #F6F3EA; border-radius: 8px; padding: 2px 4px; }
.qty button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: #E8DFCC; font-weight: 700; }
.qty button:hover { background: #D9CCB0; }
.qty input { width: 52px; text-align: center; border: 0; background: transparent; font-weight: 700; }
.qty input.changed { color: var(--warning); }
.thumb { width: 44px; height: 58px; border-radius: 6px; object-fit: cover; background: var(--green-900); flex-shrink: 0; }
.table-ledger td, .table-ledger th { vertical-align: middle; font-size: .9rem; }
.qty-in { color: var(--success); font-weight: 700; }
.qty-out { color: var(--discount); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Customer / partner panel navigation */
.panel-nav .nav-link { color: var(--ink); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.panel-nav .nav-link:hover { background: var(--green-050); }
.panel-nav .nav-link.active { background: var(--green-050); color: var(--green-900); font-weight: 700; box-shadow: inset -3px 0 0 var(--green-900); }

/* Product card actions sit above the full-card link overlay */
.card-actions { position: relative; z-index: 2; display: flex; gap: 6px; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.btn-icon .icon { width: 18px; height: 18px; }
.wish-btn { position: absolute; top: 18px; inset-inline-end: 18px; z-index: 2; background: #fff; border: 0; border-radius: 50%; width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); color: var(--muted); }
.wish-btn[aria-pressed="true"] { color: var(--discount); }
.wish-btn[aria-pressed="true"] .icon { fill: currentColor; }
.cart-badge { position: absolute; top: -2px; inset-inline-end: -2px; background: var(--discount); color: #fff; border-radius: 10px; font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
.cart-badge:empty { display: none; }
.btn-outline-brand[aria-pressed="true"], .btn-icon[aria-pressed="true"] { color: var(--discount); border-color: var(--discount); }
.btn-outline-brand[aria-pressed="true"] .icon { fill: currentColor; }

/* Star rating: display (--rating: 0..5) and input (RTL row, highest first) */
.stars { --size: 1rem; display: inline-block; font-size: var(--size); line-height: 1; letter-spacing: 2px;
    background: linear-gradient(to left, var(--gold) calc(var(--rating) / 5 * 100%), #d9cfb8 calc(var(--rating) / 5 * 100%));
    -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars::before { content: '★★★★★'; }
.rating-input { flex-direction: row-reverse; justify-content: flex-end; }
.rating-input label { font-size: 1.8rem; color: #d9cfb8; cursor: pointer; line-height: 1; }
.rating-input input:checked ~ label, .rating-input label:hover, .rating-input label:hover ~ label { color: var(--gold); }
.rating-input input:focus-visible + label { outline: 3px solid var(--gold); }

/* ---------- Languages (brand guide §4–7) ---------- */
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('/fonts/plex-arabic-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('/fonts/plex-arabic-700.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('/fonts/plex-latin-400.woff2') format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin-ext.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+02BE-02BF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

html[lang="ar"] { --font-ui: 'IBM Plex Sans Arabic', 'Vazirmatn', sans-serif; --font-display: 'Noto Naskh Arabic', 'IBM Plex Sans Arabic', serif; }
html[lang="en"] {
    --font-ui: 'Inter', 'Vazirmatn', system-ui, sans-serif;
    --font-display: 'EB Garamond', 'Noto Naskh Arabic', Georgia, serif;
    --font-arabic: 'EB Garamond', 'Noto Naskh Arabic', Georgia, serif;
}
html[lang="en"] :is(h1, h2, h3, .h1, .h2, .h3) { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
html[lang="en"] .book-title, html[lang="en"] .arabic-title { font-weight: 600; line-height: 1.35; }
html[lang="en"] .book-title { font-size: 1.12rem; }
/* Persian/Arabic passages on an English page keep their own shaping and spacing. */
html[lang="en"] [lang="fa"], html[lang="en"] [lang="ar"] { font-family: 'Vazirmatn', sans-serif; line-height: 1.9; }
html[lang="en"] .original-title[lang="ar"] { font-family: 'Noto Naskh Arabic', serif; }
/* Admin stays on the interface sans for dense screens; titles keep the Naskh. */
.admin-body { --font-display: 'Vazirmatn', system-ui, sans-serif; }
@media (min-width: 992px) {
    html[dir="ltr"] .hero-books { -webkit-mask-image: linear-gradient(to left, #000 45%, rgba(0, 0, 0, .55) 70%, transparent 96%); mask-image: linear-gradient(to left, #000 45%, rgba(0, 0, 0, .55) 70%, transparent 96%); }
}
html[dir="ltr"] .invite::after { -webkit-mask-image: linear-gradient(to left, #000, transparent); mask-image: linear-gradient(to left, #000, transparent); }
.topbar .lang-switch a { padding: 0 6px; opacity: .75; }
.topbar .lang-switch a[aria-current="true"] { opacity: 1; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* Card footer: wrap instead of overflowing the card on narrow cards / long labels */
.book-foot { flex-wrap: wrap; row-gap: 6px; }
.book-foot > div:first-child { min-width: 0; }
.card-actions { margin-inline-start: auto; align-items: center; }
/* Direction-aware arrows */
[dir="ltr"] .arrow { display: inline-block; transform: scaleX(-1); }
.currency-select { width: auto; background-color: transparent; color: inherit; border-color: rgba(255,255,255,.35); font-size: .8rem; }
.currency-select option { color: var(--ink); }
/* Payment is in Toman: remind when another currency is displayed. */
.currency-note { display: none; }
html:not([data-currency="irt"])[data-currency] .currency-note { display: block; }

/* ---------- Motion ----------
   Quiet by design: feedback on presses and cart/wishlist changes, the header lifting once the page
   scrolls, and home/about sections easing in once as they first come into view. Listings, search
   results and admin screens don't animate. */

/* Press feedback */
.btn, .icon-btn, .wish-btn { transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease; }
.btn:active:not(:disabled), .icon-btn:active, .wish-btn:active { transform: scale(0.97); }

/* Card cover: slight zoom on hover, the card itself already lifts */
.book-cover img { transition: transform 300ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .book-card:hover .book-cover img { transform: scale(1.03); } }

/* Nav links: underline and colour ease in instead of snapping */
.main-nav .nav-link { transition: color 150ms ease, border-color 150ms ease; }

/* Header gains a shadow once content scrolls under it (data-scrolled set by site.js) */
.site-header { transition: box-shadow 200ms ease; }
.site-header[data-scrolled] { box-shadow: 0 4px 18px rgba(15, 76, 58, .08); }

/* Toast: rises in from the bottom, leaves the same way */
.toast-box {
    position: fixed; bottom: 24px; left: 24px; z-index: 2000; max-width: calc(100vw - 48px);
    opacity: 0; transform: translateY(12px); visibility: hidden; pointer-events: none;
    transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out), visibility 0s linear 250ms;
}
.toast-box[data-open] { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }

/* Cart badge bump and heart pop (driven by element.animate in site.js) */
.cart-badge { will-change: transform; }

/* Scroll reveal: only once html has .js-motion (set by site.js), so content never stays hidden without JS. */
.js-motion [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out); }
.js-motion [data-reveal][data-visible] { opacity: 1; transform: none; }
.js-motion [data-reveal-group] > * { opacity: 0; transform: translateY(10px); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); transition-delay: calc(var(--i, 0) * 50ms); }
.js-motion [data-reveal-group][data-visible] > * { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .js-motion [data-reveal], .js-motion [data-reveal-group] > * { opacity: 1; transform: none; }
    .btn:active:not(:disabled), .icon-btn:active, .wish-btn:active { transform: none; }
}

/* Phones: iOS zooms the page into any field under 16px; html is 15px there, so fields get 16px explicitly. */
@media (max-width: 767.98px) {
    .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
}

/* Phone search row under the header (opened by the header search icon). */
.mobile-search .search-box { margin-bottom: 10px; }

/* Drawer: currency + language rows; 44px tap targets. */
.drawer-prefs .btn { min-height: 44px; padding-inline: 14px; }
.drawer-prefs .currency-tabs { margin-bottom: 0 !important; flex-wrap: wrap; }

/* Book page, phones: price + «add to cart» stay reachable while reading. Hidden while the real buy box is on screen. */
.mobile-buy-bar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1030;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(15, 76, 58, .08);
    transition: transform 220ms var(--ease-out);
}
.mobile-buy-bar[data-hidden] { transform: translateY(110%); visibility: hidden; transition: transform 220ms var(--ease-out), visibility 0s 220ms; } /* off-screen and out of the tab order */
.mobile-buy-bar > div { min-width: 0; } /* lets the title truncate */
.mobile-buy-bar .btn { min-height: 44px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 991.98px) {
    body:has(.mobile-buy-bar) { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    body:has(.mobile-buy-bar:not([data-hidden])) .toast-box { bottom: calc(80px + env(safe-area-inset-bottom)); } /* above the bar, not over its button */
}
@media (prefers-reduced-motion: reduce) { .mobile-buy-bar { transition: none; } }

/* ---------- 3D book (Shared/_BookCover3D) ----------
   A flat cover photo becomes a standing hardback turned slightly to show its page block.
   Arabic/Persian books bind on the right, so the pages are on the LEFT in every UI language (physical sides on purpose).
   Sizes use container units, so the same look scales from a shelf card to the book page. */
.book-cover.book-3d {
    position: relative; overflow: visible; container-type: inline-size;
    display: grid; place-items: center;
    background: radial-gradient(ellipse 80% 70% at 50% 42%, #FFFFFF 0%, #F6F1E6 70%, #EFE7D6 100%);
    border-radius: 10px;
}
.book-3d-body {
    --t: 10cqi;                                /* book thickness */
    position: relative; width: 62cqi; aspect-ratio: 0.7;   /* وزیری 16.5×23.5 */
    transform-style: preserve-3d;
    transform: perspective(260cqi) rotateY(32deg) rotateX(2deg);
    transition: transform 450ms var(--ease-out);
}
/* Front board: the photo itself. Cropped to the book's shape, square on the binding side, rounded on the fore-edge. */
.book-cover.book-3d .book-3d-body > img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    transform: translateZ(calc(var(--t) / 2));
    border-radius: 3px 1px 1px 3px;
    backface-visibility: hidden;
}
/* Light: a hinge crease near the spine and a soft sheen across the board. */
.book-3d-shine {
    position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    transform: translateZ(calc(var(--t) / 2 + .5px));
    background:
        linear-gradient(to left, rgba(0,0,0,.22) 0, rgba(255,255,255,.28) 1.5%, rgba(0,0,0,.12) 3.5%, transparent 7%),
        linear-gradient(105deg, rgba(255,255,255,.18) 0%, transparent 38%, transparent 70%, rgba(0,0,0,.06) 100%);
}
/* Page block on the fore-edge (left). */
.book-3d-body::before {
    content: ''; position: absolute; top: 1.2%; bottom: 1.2%; left: 0; width: var(--t);
    transform: translateX(calc(var(--t) / -2)) rotateY(-90deg);
    background: repeating-linear-gradient(90deg, #FDFBF6 0 1.5px, #E4DDCD 1.5px 2.2px);
    box-shadow: inset 0 0 6px rgba(80, 60, 30, .18);
}
/* Back board, carrying the cast shadow. */
.book-3d-body::after {
    content: ''; position: absolute; inset: 0;
    transform: translateZ(calc(var(--t) / -2));
    background: #2F3A33; border-radius: 3px 1px 1px 3px;
    box-shadow: 14px 10px 28px rgba(45, 35, 15, .32), 4px 4px 8px rgba(45, 35, 15, .2);
}
/* Floor shadow under the book. */
.book-cover.book-3d::after {
    content: ''; position: absolute; left: 22%; right: 14%; bottom: 11%; height: 6%;
    background: radial-gradient(closest-side, rgba(45, 35, 15, .3), transparent);
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .book-card:hover .book-3d-body, .gallery-main:hover .book-3d-body { transform: perspective(260cqi) rotateY(18deg) rotateX(1deg); }
}
/* Book page: back cover / sample pages are not a front cover — show them flat. */
.book-3d[data-flat] .book-3d-body,
.book-3d[data-flat] .book-3d-body:hover { transform: none; width: 84cqi; }
.book-3d[data-flat] .book-3d-body > img { transform: none; border-radius: 6px; object-fit: contain; }
.book-3d[data-flat] .book-3d-body::before, .book-3d[data-flat] .book-3d-body::after,
.book-3d[data-flat] .book-3d-shine, .book-3d[data-flat]::after { display: none; }
/* Photo that is already a book mockup (site.js): show it whole and large, its white backdrop melted
   into the cream stage by multiply; hover lifts it instead of turning it. */
/* A percentage width cycles through the auto grid track and collapses to zero; use the stage's inline size. */
.book-3d[data-mockup]:not([data-flat]) .book-3d-body { transform: none; width: 100cqi; height: 100%; aspect-ratio: auto; }
.book-3d[data-mockup]:not([data-flat]) .book-3d-body > img {
    transform: none; border-radius: 0; object-fit: contain; mix-blend-mode: multiply;
    transition: transform 450ms var(--ease-out);
}
.book-3d[data-mockup] .book-3d-body::before, .book-3d[data-mockup] .book-3d-body::after,
.book-3d[data-mockup] .book-3d-shine, .book-3d[data-mockup]::after { display: none; }
@media (hover: hover) and (pointer: fine) {
    .book-card:hover .book-3d[data-mockup] .book-3d-body,
    .gallery-main:hover .book-3d[data-mockup] .book-3d-body { transform: none; }
    .book-card:hover .book-3d[data-mockup]:not([data-flat]) .book-3d-body > img,
    .gallery-main:hover .book-3d[data-mockup]:not([data-flat]) .book-3d-body > img { transform: translateY(-2.5%) scale(1.04); }
}

/* Admin warehouse: floating bar for actions on selected products */
.bulk-bar {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1050;
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
    width: max-content; max-width: calc(100vw - 32px);
    background: var(--green-900); color: #fff; padding: 10px 16px; border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(15, 76, 58, .3);
}
.bulk-bar[hidden], body.modal-open .bulk-bar { display: none; }
body:has(.bulk-bar:not([hidden])) main { padding-bottom: 96px; }

/* ---------- Persian-Islamic ornament: stats band, founder quote, footer ----------
   Overrides the earlier blocks; kept together so the home/footer look reads as one piece. */
.stats-band { background: var(--green-900); border: 0; border-radius: 22px; padding: clamp(22px, 3vw, 40px) clamp(18px, 3vw, 44px); }
.stats-band::before { inset: 0; width: auto; opacity: .12; -webkit-mask-image: none; mask-image: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48' fill='none' stroke='%23E3C88F' stroke-width='1'%3E%3Cpath d='M14 14h20v20H14z'/%3E%3Cpath d='M24 9.9 38.1 24 24 38.1 9.9 24z'/%3E%3Cpath d='M24 0v9.9M24 38.1V48M0 24h9.9M38.1 24H48M0 0l14 14M48 0 34 14M0 48l14-14M48 48 34 34'/%3E%3C/svg%3E") repeat; }
[dir="ltr"] .stats-band::before { -webkit-mask-image: none; mask-image: none; }
.stats-band .stat .icon { color: #E3C88F; }
.stats-band .stat-value { color: #E3C88F; }
.stats-band .stat-label { color: #E8E2D0; }
@media (min-width: 992px) { .stats-band .stats-row > * + * .stat { border-inline-start-color: rgba(227, 200, 143, .25); } }

/* Founder photo in a mihrab frame. */
.quote-photo { width: 116px; height: 150px; align-self: center; margin: 0; border-radius: 999px 999px 12px 12px; border: 2px solid var(--gold); box-shadow: 0 0 0 5px rgba(176, 141, 87, .15); background: #efe6d2; }
.quote-photo img { object-position: center 20%; }
@media (max-width: 1199px) { .quote-photo { width: 100px; height: 130px; } }
@media (max-width: 575px) { .quote-photo { width: 96px; height: 124px; } }

/* Footer */
.site-footer { overflow: visible; isolation: isolate; margin-top: clamp(96px, 10vw, 130px); padding: 0 0 4px; }
.footer-edge { position: absolute; inset-inline: 0; top: -17px; display: block; width: 100%; height: 18px; }
.footer-pattern { position: absolute; inset: 0; z-index: -1; opacity: .07; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none' stroke='%23E3C88F' stroke-width='1'%3E%3Cpath d='M16.4 16.4h23.2v23.2H16.4z'/%3E%3Cpath d='M28 11.6 44.4 28 28 44.4 11.6 28z'/%3E%3Cpath d='M28 0v11.6M28 44.4V56M0 28h11.6M44.4 28H56M0 0l16.4 16.4M56 0 39.6 16.4M0 56l16.4-16.4M56 56 39.6 39.6'/%3E%3Ccircle cx='28' cy='28' r='4'/%3E%3C/svg%3E") repeat; }
.footer-vine { position: absolute; bottom: 0; width: 240px; height: 240px; color: #E3C88F; opacity: .3; z-index: -1; pointer-events: none; }
.footer-vine-right { right: 0; }
.footer-vine-left { left: 0; transform: scaleX(-1); }
.footer-medal { position: absolute; top: -58px; left: 50%; translate: -50% 0; width: 116px; height: 116px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25)); }
.footer-medal svg { display: block; width: 100%; height: 100%; }
.footer-medal img { position: absolute; left: 24%; top: 26%; width: 52%; height: 48%; object-fit: contain; }
.footer-main { padding-top: 84px; }
.footer-news { position: relative; isolation: isolate; max-width: 900px; margin: 0 auto; padding: 30px clamp(28px, 6vw, 80px);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; }
.footer-news-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.footer-news-frame path { fill: rgba(255, 255, 255, .035); stroke: var(--gold); stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.footer-news-text { flex: 1 1 260px; }
.footer-news h2 { color: #fff; font-size: clamp(1.2rem, 1.8vw, 1.45rem); margin: 0; }
.footer-news p { margin: 0; font-size: .875rem; }
.footer-news form { display: flex; gap: 8px; flex: 1 1 300px; max-width: 420px; }
.footer-news input { flex: 1; min-width: 0; height: 48px; border-radius: 999px; border: 1px solid rgba(227, 200, 143, .45); background: rgba(255, 255, 255, .06); color: #fff; padding: 0 18px; font-size: 16px; }
.footer-news input::placeholder { color: #BFB8A4; }
.footer-news input:focus { outline: none; border-color: #E3C88F; box-shadow: 0 0 0 3px rgba(227, 200, 143, .2); }
.footer-news button { height: 48px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--gold); color: #1d1a12; font-weight: 700; transition: background-color 150ms ease; }
.footer-news button:hover { background: #E3C88F; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr 1.1fr; gap: 36px; padding-block: 44px 28px; }
.footer-brand { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.footer-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; color: #fff; line-height: 1.5; }
.site-footer h3 { margin-bottom: 6px; }
.footer-rule { display: block; position: relative; width: 64px; height: 1px; background: var(--gold); margin-bottom: 14px; }
.footer-rule::after { content: ''; position: absolute; inset-inline-start: -3px; top: -3px; width: 7px; height: 7px; background: var(--gold); rotate: 45deg; }
.footer-links a { display: inline-flex; align-items: center; gap: 10px; }
.footer-links a::before { content: ''; width: 5px; height: 5px; background: var(--gold); rotate: 45deg; flex-shrink: 0; }
.footer-contact .icon { color: #E3C88F; }
.social-icon { color: #E3C88F !important; border-color: rgba(227, 200, 143, .4); }
@media (hover: hover) and (pointer: fine) { .social-icon:hover { background: var(--gold); border-color: var(--gold); color: var(--green-900) !important; } }
.footer-arch { min-height: 250px; border-radius: 999px 999px 14px 14px; overflow: hidden; border: 1.5px solid rgba(227, 200, 143, .55); box-shadow: 0 0 0 6px rgba(227, 200, 143, .08);
    background: var(--hero-arch) center 40% / cover no-repeat; }
.footer-hashie { opacity: .5; }
.site-footer .copyright { border-top: 0; margin-top: 6px; padding-top: 12px; }
@media (max-width: 1199.98px) { .footer-grid { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); } .footer-arch { display: none; } }
@media (max-width: 991.98px) { .site-footer { margin-top: 100px; padding-top: 0; } }
@media (max-width: 767.98px) {
    .footer-news { text-align: center; justify-content: center; border: 1px solid var(--gold); border-radius: 18px; padding: 24px 18px; }
    .footer-news-frame { display: none; }
    .footer-news form { max-width: none; }
    .footer-vine { width: 150px; height: 150px; }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
    .footer-col-brand, .footer-col-contact { grid-column: 1 / -1; }
}

/* Admin product modal: cover thumbnail next to the camera / gallery pickers */
.cover-preview { width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }

/* A14 book chat */
.chat-widget { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 1040; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chat-panel { width: min(360px, calc(100vw - 32px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.chat-list { overflow-y: auto; flex: 1 1 auto; min-height: 80px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { padding: 6px 10px; border-radius: 10px; white-space: pre-wrap; max-width: 92%; }
.chat-me { align-self: flex-end; background: var(--bs-light, #f1f1f1); }
.chat-bot { align-self: flex-start; background: #E6F2E7; }
.chat-book { display: block; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: #fff; text-decoration: none; }
.chat-toggle { border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
@media print { .chat-widget { display: none; } }
