/* ============================================================
   قالب «رِواق» (riwaq) — منصّة ناشر
   طابع سوقٍ طازجٍ مرتّب: أخضر زمرّديّ، وأصفر ليمونيّ للتنبيه،
   وبطاقاتٌ بيضاء بإطارٍ خفيف، ورأسُ غلافٍ عريض بصورةٍ دائريّة.
   كلّ التنسيق هنا، بلا مكتبات.
   ============================================================ */

:root {
  /* ألوان الهويّة (قيم تجريبيّة) */
  --store-primary: #17734A;
  --store-primary-dark: #0E4A30;
  --store-accent: #F2D54B;
  --store-bg: #F6F8F5;
  --store-text: #1E2622;

  /* ألوان محايدة */
  --white: #FFFFFF;
  --tint: #E6F2EA;
  --muted: #5C6B63;
  --line: #E1E8E3;
  --line-strong: #C9D5CD;
  --gold: #E3A008;
  --on-dark-muted: #B8C9BF;

  /* ألوان نوع الكتاب (ثابتة في المواصفات) */
  --type-paper: #DB7056;
  --type-ebook: #5675A3;
  --type-audio: #986AB0;
  --type-edu: #3f8f6b;

  --container: 1320px;
  --gutter: 16px;
  --radius: 10px;
  --radius-sm: 6px;
  --pill: 999px;
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  --shadow: 0 10px 28px rgba(30,38,34,.08);
}

body[data-corners="sharp"] { --radius: 0px; --radius-sm: 0px; --pill: 0px; }

/* ---------- أساسيّات ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.7; color: var(--store-text); background: var(--store-bg); overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 800; }
p { margin: 0; }
svg { flex-shrink: 0; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--store-primary); outline-offset: 2px; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }

/* ---------- الشريط العلويّ ---------- */
.topbar { background: var(--store-primary-dark); color: var(--white); font-size: 13px; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; }
.topbar-note { display: inline-flex; align-items: center; gap: 8px; }
.topbar-note svg { color: var(--store-accent); }
.topbar-end { display: flex; align-items: center; gap: 18px; }
.topbar-end > span { display: inline-flex; align-items: center; gap: 6px; }
.social { display: flex; gap: 6px; }
.social a { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.social a:hover { background: var(--store-accent); color: var(--store-text); }

/* ---------- الرأس ---------- */
.site-header { background: var(--white); position: sticky; top: 0; z-index: 40; }
.header-main .container { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 36px; min-height: 86px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand img { width: 48px; height: 48px; }
.brand > span { display: flex; flex-direction: column; }
.brand-name { font-size: 22px; font-weight: 800; line-height: 1.1; }
.brand-tag { font-size: 12px; color: var(--muted); }
.search-bar { display: flex; align-items: stretch; height: 50px; max-width: 680px; width: 100%; justify-self: center; background: var(--store-bg); border: 2px solid var(--store-primary); border-radius: var(--radius); overflow: hidden; }
.search-bar input { flex: 1; min-width: 0; border: 0; padding: 0 16px; outline: none; background: transparent; }
.search-bar .btn { border-radius: 0; min-height: 0; padding-inline: 22px; }
.header-actions { display: flex; align-items: center; }
.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--tint); color: var(--store-primary); }
.badge-count { position: absolute; top: 2px; inset-inline-end: 0; min-width: 19px; height: 19px; padding-inline: 4px; border-radius: 10px; background: var(--store-accent); color: var(--store-text); font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; }
.account-link { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px; }
.account-link:hover { background: var(--tint); }
.account-link small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.account-link b { display: block; line-height: 1.2; }
.cart-pill { display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: var(--radius); background: var(--tint); color: var(--store-primary-dark); font-weight: 800; transition: background .2s, color .2s; }
.cart-pill:hover { background: var(--store-primary); color: var(--white); }
.cart-pill .cart-ico { position: relative; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--store-primary); color: var(--white); display: inline-flex; align-items: center; justify-content: center; }
.cart-pill .badge-count { top: -6px; inset-inline-end: -6px; }
.menu-toggle { display: none; }

.nav-bar { background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 1px 0 var(--line); position: relative; z-index: 35; transition: box-shadow .3s; }
.nav-bar.is-scrolled { box-shadow: 0 8px 22px rgba(30,38,34,.08); }
.nav-bar .container { display: flex; align-items: stretch; gap: 28px; min-height: 52px; }
.cats-menu { position: relative; }
.cats-toggle { height: 100%; min-width: 260px; display: flex; align-items: center; gap: 10px; padding-inline: 18px; background: var(--store-primary); color: var(--white); font-weight: 800; }
.cats-toggle .chev { margin-inline-start: auto; transition: transform .25s; }
.cats-menu.is-open .cats-toggle .chev { transform: rotate(180deg); }
.cats-list { background: var(--white); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.cats-menu .cats-list { position: absolute; top: 100%; inset-inline-start: 0; width: 100%; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .25s, transform .25s var(--ease), visibility .25s; z-index: 30; }
.cats-menu.is-open .cats-list { opacity: 1; visibility: visible; transform: none; }
.cats-list a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; font-weight: 500; transition: background .2s, color .2s; }
.cats-list a:last-child { border-bottom: 0; }
.cats-list a:hover { background: var(--tint); color: var(--store-primary); }
.cats-list img { width: 28px; height: 28px; padding: 3px; border-radius: 50%; background: var(--tint); }
.cats-list .tag { margin-inline-start: auto; padding: 0 8px; border-radius: var(--pill); font-size: 11px; font-weight: 800; line-height: 1.8; }
.tag-new { background: var(--store-accent); color: var(--store-text); }
.tag-hot { background: var(--store-primary); color: var(--white); }
.main-nav { display: flex; align-items: stretch; gap: 2px; flex: 1; }
.main-nav a { display: flex; align-items: center; padding-inline: 14px; font-weight: 700; position: relative; }
.main-nav a::after { content: ""; position: absolute; inset-inline: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--store-primary); transform: scaleY(0); transform-origin: bottom; transition: transform .2s; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--store-primary); }
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { transform: none; }
.nav-hot { display: flex; align-items: center; gap: 8px; font-weight: 800; white-space: nowrap; }
.nav-hot span { padding: 2px 10px; border-radius: var(--pill); background: var(--store-accent); font-size: 12px; }

/* الدرج الجانبيّ */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(30,38,34,.5); z-index: 90; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 100; width: min(86vw, 340px); background: var(--white); transform: translateX(100%); transition: transform .35s var(--ease); display: flex; flex-direction: column; overflow-y: auto; }
.drawer-open .drawer { transform: none; }
.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--store-primary); color: var(--white); }
.drawer-head .brand-name { font-size: 19px; }
.drawer-head .brand img { width: 38px; height: 38px; }
.drawer-head .icon-btn:hover { background: rgba(255,255,255,.15); color: var(--white); }
.drawer-title { padding: 16px 18px 6px; font-size: 13px; font-weight: 800; color: var(--store-primary); }
.drawer .cats-list { border: 0; border-radius: 0; }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-weight: 700; }
.drawer-nav a:hover { background: var(--tint); }
.drawer-foot { margin-top: auto; padding: 16px 18px; display: grid; gap: 10px; font-size: 14px; background: var(--tint); }
.drawer-foot span { display: inline-flex; gap: 8px; align-items: center; }
.bottom-nav { display: none; }

/* ---------- الأزرار ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 24px; font-weight: 800; font-size: 15px; border: 2px solid transparent; border-radius: var(--radius-sm); transition: background .2s, color .2s, border-color .2s; white-space: nowrap; }
.btn-primary { background: var(--store-primary); color: var(--white); }
.btn-primary:hover { background: var(--store-primary-dark); }
.btn-accent { background: var(--store-accent); color: var(--store-text); }
.btn-accent:hover { background: var(--store-text); color: var(--white); }
.btn-outline { border-color: var(--store-primary); color: var(--store-primary); background: var(--white); }
.btn-outline:hover { background: var(--store-primary); color: var(--white); }
.btn-soft { background: var(--tint); color: var(--store-primary-dark); }
.btn-soft:hover { background: var(--store-primary); color: var(--white); }
.btn-light { background: var(--white); color: var(--store-primary-dark); }
.btn-light:hover { background: var(--store-accent); color: var(--store-text); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { background: var(--line); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--store-primary); transition: gap .2s; white-space: nowrap; }
.link-more:hover { gap: 10px; }

/* ---------- عنوان القسم ---------- */
.section { padding-block: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { display: flex; align-items: center; gap: 12px; font-size: 23px; }
.section-title::before { content: ""; width: 6px; height: 26px; border-radius: 3px; background: var(--store-accent); }
.section-sub { font-size: 14px; color: var(--muted); margin-top: 2px; padding-inline-start: 18px; }

/* ---------- التقييم والسعر ---------- */
.rating { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stars { display: inline-flex; gap: 1px; }
.stars svg { width: 14px; height: 14px; }
.stars .on { fill: var(--gold); }
.stars .off { fill: #D7DFDA; }
.stars .half { fill: url(#half-gold); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now { font-weight: 800; font-size: 18px; color: var(--store-primary-dark); }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.price.is-sale .price-now { color: var(--store-primary); }

/* ---------- بطاقة الكتاب ---------- */
.books-grid { --per-row: 5; display: grid; grid-template-columns: repeat(var(--per-row), minmax(0, 1fr)); gap: 16px; }
body[data-books-per-row="3"] .books-grid { --per-row: 3; }
body[data-books-per-row="4"] .books-grid { --per-row: 4; }
body[data-books-per-row="6"] .books-grid { --per-row: 6; }
.book-card { position: relative; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; transition: border-color .25s, box-shadow .25s; }
.book-card:hover { border-color: var(--store-primary); box-shadow: var(--shadow); }
.book-media { position: relative; aspect-ratio: 2 / 3; background: var(--tint); border-radius: var(--radius-sm); overflow: hidden; }
.book-media > a > img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.book-card:hover .book-media > a > img { transform: scale(1.04); }
.type-dot { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--white); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.type-dot svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.type-dot.paper { background: var(--type-paper); }
.type-dot.ebook { background: var(--type-ebook); }
.type-dot.audio { background: var(--type-audio); }
.type-dot.edu { background: var(--type-edu); }
.badges { position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 4px; font-size: 12px; font-weight: 800; line-height: 1.8; }
.badge-sale { background: var(--store-primary); color: var(--white); }
.badge-new { background: var(--store-accent); color: var(--store-text); }
.stock-out { position: absolute; inset-inline: 0; bottom: 0; z-index: 2; background: rgba(30,38,34,.88); color: var(--white); text-align: center; font-size: 13px; font-weight: 800; padding: 6px 0; }
.book-card.is-out .book-media > a > img { filter: grayscale(.7); opacity: .7; }
.wish-btn { position: absolute; top: 46px; inset-inline-end: 8px; z-index: 2; width: 32px; height: 32px; border-radius: 50%; background: var(--white); color: var(--store-text); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.14); opacity: 0; transition: opacity .25s, color .2s; }
.book-card:hover .wish-btn, .wish-btn:focus-visible, .wish-btn.is-active { opacity: 1; }
.wish-btn:hover, .wish-btn.is-active { color: var(--store-primary); }
.wish-btn.is-active svg { fill: currentColor; }
.book-body { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; flex: 1; }
.book-author { font-size: 12.5px; color: var(--muted); }
.book-author b { color: var(--store-primary); font-weight: 700; }
.book-author:hover b { text-decoration: underline; }
.book-title { font-size: 15px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-title a:hover { color: var(--store-primary); }
.book-card .price { margin-top: 2px; }
/* السعر يُدفع إلى أسفل البطاقة لتتساوى الصفوف (البند 7)، وتحته زرّ القالب الأصليّ «أضف إلى السلّة» بعرض البطاقة، ظاهرٌ دائمًا وبلا كمّيّة */
.book-card .book-body > .price { margin-top: auto; padding-top: 8px; }
.book-card .card-cart { padding-top: 8px; }
.book-card .card-cart .btn { width: 100%; min-height: 40px; font-size: 14px; padding-inline: 10px; }
.books-grid.is-list .book-body > .price { margin-top: 6px; padding-top: 0; }
.books-grid.is-list .card-cart .btn { width: auto; padding-inline: 22px; }
body[data-card-style="framed"] .book-card { border-width: 2px; }
body[data-card-style="minimal"] .book-card { border-color: transparent; background: transparent; padding: 0; }
body[data-card-style="minimal"] .book-card:hover { box-shadow: none; }

/* عرض القائمة في صفحة التصنيف */
.books-grid.is-list { grid-template-columns: 1fr !important; }
.books-grid.is-list .book-card { flex-direction: row; gap: 18px; }
.books-grid.is-list .book-media { width: 130px; flex-shrink: 0; }
.books-grid.is-list .book-title { min-height: 0; font-size: 17px; }

/* ---------- ترقيم الصفحات ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 42px; height: 42px; padding-inline: 8px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--white); border: 1px solid var(--line); transition: border-color .2s, color .2s; }
.pagination a:hover { border-color: var(--store-primary); color: var(--store-primary); }
.pagination .is-current { background: var(--store-primary); border-color: var(--store-primary); color: var(--white); }
.pagination .gap { background: transparent; border: 0; min-width: 18px; color: var(--muted); }

/* ---------- الاشتراك ---------- */
.newsletter { background: var(--store-primary); color: var(--white); }
.newsletter .container { display: grid; grid-template-columns: auto 1fr minmax(320px, 520px); align-items: center; gap: 24px; padding-block: 32px; }
.newsletter-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--store-accent); color: var(--store-text); display: inline-flex; align-items: center; justify-content: center; }
.newsletter h2 { font-size: 23px; }
.newsletter p { font-size: 14px; color: #E3F1E8; }
.newsletter-form { display: flex; height: 52px; background: var(--white); border-radius: var(--radius-sm); overflow: hidden; }
.newsletter-form input { flex: 1; min-width: 0; border: 0; padding: 0 16px; outline: none; color: var(--store-text); }
.newsletter-form .btn { border-radius: 0; min-height: 100%; }

/* ---------- التذييل ---------- */
.site-footer { background: var(--store-text); color: var(--on-dark-muted); font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 40px; padding-block: 52px 36px; }
.footer-brand .brand-name { color: var(--white); }
.footer-brand .brand-tag { color: var(--on-dark-muted); }
.footer-brand p { margin-top: 16px; max-width: 330px; }
.footer-brand .social { margin-top: 16px; gap: 8px; }
.footer-brand .social a { width: 36px; height: 36px; background: rgba(255,255,255,.08); color: var(--white); }
.footer-col h4 { font-size: 16px; color: var(--white); margin-bottom: 14px; }
.footer-col li + li { margin-top: 9px; }
.footer-col a:hover { color: var(--store-accent); }
.footer-contact li { display: flex; gap: 10px; }
.footer-contact svg { color: var(--store-accent); margin-top: 3px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); }
.footer-bottom .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; font-size: 13px; flex-wrap: wrap; }

/* ---------- صفحة المكوّنات ---------- */
.kit-hero { background: var(--white); border-bottom: 1px solid var(--line); padding-block: 36px; }
.kit-hero h1 { font-size: 28px; }
.kit-hero p { color: var(--muted); margin-top: 6px; }
.kit-block { padding-block: 36px; border-bottom: 1px dashed var(--line-strong); }
.kit-label { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.kit-label b { font-size: 18px; color: var(--store-text); }
.kit-label code { direction: ltr; unicode-bidi: isolate; background: var(--white); padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.kit-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.kit-legend { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 26px; }
.kit-legend span { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; }
.kit-legend .type-dot { position: static; }
.kit-dark { background: var(--store-primary-dark); padding: 22px; border-radius: var(--radius); }

/* ============================================================
   أقسام الصفحات
   ============================================================ */

/* ---------- البطل ---------- */
.hero { padding-top: 20px; }
.hero-grid { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.hero-cats { align-self: start; }
.hero-cats .cats-list { border-radius: var(--radius); }
.hero-cats .cats-list a { padding-block: 9px; }
.hero-box { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--tint); }
.hero-track { position: relative; height: 100%; min-height: 440px; }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .7s, visibility .7s; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-slide > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left center; }
.hero-caption { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 480px; padding-inline: 48px; }
.hero-tag { display: inline-flex; padding: 3px 12px; border-radius: 4px; background: var(--store-accent); color: var(--store-text); font-weight: 800; font-size: 13px; }
.hero-title { font-size: clamp(28px, 3.2vw, 44px); line-height: 1.2; margin-top: 14px; }
.hero-title span { color: var(--store-primary); }
.hero-text { margin-top: 12px; color: var(--muted); font-size: 16px; }
.hero-caption .btn { margin-top: 22px; }
.hero-dots { position: absolute; bottom: 20px; inset-inline-start: 48px; z-index: 2; display: flex; gap: 8px; }
.hero-dots button { width: 10px; height: 10px; border-radius: 5px; background: rgba(23,115,74,.25); transition: width .3s, background .3s; }
.hero-dots button[aria-current="true"] { width: 28px; background: var(--store-primary); }
.trust { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.trust-item { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.trust-item + .trust-item { border-inline-start: 1px solid var(--line); }
.trust-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--tint); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; }
.trust-item h3 { font-size: 15px; }
.trust-item p { font-size: 13px; color: var(--muted); }

/* ---------- البانران ---------- */
.banner-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.promo { position: relative; overflow: hidden; display: flex; min-height: 230px; border-radius: var(--radius); }
.promo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left center; transition: transform .7s var(--ease); }
.promo:hover > img { transform: scale(1.04); }
.promo-body { position: relative; z-index: 1; padding: 28px 32px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 60%; }
.promo-tag { font-size: 13px; font-weight: 800; }
.promo-title { font-size: clamp(20px, 2.1vw, 28px); margin: 6px 0 16px; }
.promo.is-green { color: var(--white); }
.promo.is-green .promo-tag { color: var(--store-accent); }
.promo.is-yellow { color: var(--store-text); }

/* ---------- بطاقات المؤلّفين المصغّرة (رأس الغلاف) ---------- */
.authors-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mini-store { display: block; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.mini-store:hover { border-color: var(--store-primary); box-shadow: var(--shadow); }
.mini-cover { height: 84px; background: var(--store-primary); }
.mini-body { position: relative; padding: 0 16px 16px; display: flex; align-items: flex-end; gap: 12px; }
.mini-body img { width: 72px; height: 72px; margin-top: -36px; border-radius: 50%; border: 4px solid var(--white); object-fit: cover; flex-shrink: 0; }
.mini-body h3 { font-size: 15.5px; line-height: 1.3; }
.mini-body .rating { margin-top: 2px; }
.mini-meta { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.mini-meta b { color: var(--store-primary); }

/* ---------- التصنيفات ---------- */
.cat-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18px 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, transform .25s var(--ease); }
.cat-card:hover { border-color: var(--store-primary); transform: translateY(-3px); }
.cat-card img { width: 60px; height: 60px; padding: 11px; border-radius: 50%; background: var(--tint); }
.cat-card b { font-size: 14px; }
.cat-card small { font-size: 12px; color: var(--muted); }

/* ---------- الآراء ---------- */
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.review-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.review-card blockquote { margin: 0; flex: 1; }
.review-person { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.review-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--tint); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.review-name { font-weight: 800; display: block; }
.review-book { font-size: 12px; color: var(--muted); }

/* ---------- رأس الغلاف (المؤلّف والتصنيف) ---------- */
.cover-head { padding-top: 20px; }
.cover-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cover-img { position: relative; height: 240px; background: var(--store-primary-dark); }
.cover-img img { width: 100%; height: 100%; object-fit: cover; }
.cover-info { position: relative; display: flex; align-items: flex-end; gap: 22px; padding: 0 28px 22px; flex-wrap: wrap; }
.cover-avatar { width: 148px; height: 148px; margin-top: -74px; border-radius: 50%; border: 6px solid var(--white); background: var(--tint); box-shadow: var(--shadow); object-fit: cover; flex-shrink: 0; }
.cover-avatar.is-icon { padding: 30px; }
.cover-text { flex: 1; min-width: 240px; padding-top: 14px; }
.cover-text h1 { font-size: 30px; }
.cover-lines { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.cover-lines span { display: inline-flex; align-items: center; gap: 6px; }
.cover-lines .cl-num, .cover-lines .cl-num span { display: inline; }
.cover-lines svg { color: var(--store-primary); }
.cover-actions { display: flex; gap: 10px; padding-top: 14px; }
.cover-tabs { display: flex; gap: 4px; padding-inline: 20px; border-top: 1px solid var(--line); overflow-x: auto; }
.cover-tabs button, .cover-tabs a { position: relative; padding: 14px 16px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.cover-tabs [aria-selected="true"], .cover-tabs [aria-current="page"] { color: var(--store-primary); }
.cover-tabs [aria-selected="true"]::after, .cover-tabs [aria-current="page"]::after { content: ""; position: absolute; inset-inline: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--store-primary); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.breadcrumb a:hover { color: var(--store-primary); }
.breadcrumb .sep { opacity: .5; }
.crumb-bar { padding-block: 14px 0; }
.about-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; line-height: 1.95; }
.about-panel p + p { margin-top: 10px; }
.tab-panel[hidden] { display: none; }

/* ---------- التصنيف ---------- */
.shop-layout { display: grid; grid-template-columns: 270px 1fr; gap: 20px; padding-block: 20px 56px; align-items: start; }
.shop-layout > * { min-width: 0; }
.shop-layout .books-grid { --per-row: 4; }
body[data-books-per-row="3"] .shop-layout .books-grid { --per-row: 3; }
.filters { display: grid; gap: 14px; position: sticky; top: 156px; }
.filters-toggle { display: none; }
.filters-body { display: grid; gap: 14px; }
.widget { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.widget h3 { display: flex; align-items: center; gap: 10px; font-size: 15.5px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.widget h3::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--store-accent); }
.tree li + li { margin-top: 2px; }
.tree details summary { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; list-style: none; font-weight: 700; }
.tree details summary::-webkit-details-marker { display: none; }
.tree details summary .num { margin-inline-start: auto; }
.tree details summary .chev { transition: transform .2s; color: var(--muted); }
.tree details[open] summary .chev { transform: rotate(-90deg); }
.tree details ul { padding-inline-start: 22px; padding-bottom: 6px; }
.tree a { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; color: var(--muted); }
.tree a:hover, .tree a[aria-current="true"] { color: var(--store-primary); }
.num { font-size: 12px; color: var(--muted); background: var(--tint); padding: 0 8px; border-radius: 10px; font-weight: 500; }
.filter-list li + li { margin-top: 9px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--store-primary); }
.check .num { margin-inline-start: auto; }
.check .type-dot { position: static; width: 22px; height: 22px; box-shadow: none; }
.check .type-dot svg { width: 12px; height: 12px; }
.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input { width: 100%; min-width: 0; border: 1px solid var(--line-strong); padding: 8px 10px; border-radius: var(--radius-sm); }
.filters-actions { display: flex; gap: 8px; margin-top: 14px; }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.toolbar-end { display: flex; align-items: center; gap: 10px; }
.view-switch { display: flex; gap: 4px; }
.view-switch button { width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.view-switch button[aria-pressed="true"] { background: var(--store-primary); border-color: var(--store-primary); color: var(--white); }
.select { appearance: none; -webkit-appearance: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); padding: 8px 14px 8px 36px; min-height: 40px; font-size: 14px; color: var(--store-text); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C6B63' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--pill); background: var(--white); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 700; }
.chip:hover { border-color: var(--store-primary); color: var(--store-primary); }
.shop-layout .pagination { margin-top: 32px; }

/* ---------- صفحة الكتاب ---------- */
.product { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; padding-block: 16px 24px; align-items: start; }
.product > * { min-width: 0; }
.gallery { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; grid-template-columns: 76px 1fr; gap: 14px; position: sticky; top: 156px; }
.gallery-main { position: relative; background: var(--tint); border-radius: var(--radius-sm); padding: 32px; }
.gallery-main img { width: 100%; max-width: 340px; margin-inline: auto; aspect-ratio: 2/3; object-fit: cover; box-shadow: 0 18px 40px rgba(30,38,34,.2); }
.gallery-main .type-dot { width: 40px; height: 40px; top: 14px; inset-inline-end: 14px; }
.gallery-main .type-dot svg { width: 20px; height: 20px; }
.gallery-main .badges { top: 14px; inset-inline-start: 14px; }
.gallery-thumbs { display: flex; flex-direction: column; gap: 10px; }
.gallery-thumbs button { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 3px; background: var(--white); }
.gallery-thumbs button[aria-current="true"], .gallery-thumbs button:hover { border-color: var(--store-primary); }
.gallery-thumbs img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.buy-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.type-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.type-label .type-dot { position: static; width: 24px; height: 24px; box-shadow: none; }
.type-label .type-dot svg { width: 13px; height: 13px; }
.product-title { font-size: clamp(24px, 2.6vw, 33px); line-height: 1.3; margin-top: 10px; }
.product-meta { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--muted); }
.product-meta a { color: var(--store-primary); font-weight: 800; }
.product-meta .sep { width: 1px; height: 14px; background: var(--line-strong); }
.price-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding: 14px 18px; background: var(--tint); border-radius: var(--radius-sm); }
.price-box .price-now { font-size: 30px; }
.price-box .price-old { font-size: 17px; }
.save-tag { padding: 2px 10px; border-radius: 4px; background: var(--store-accent); color: var(--store-text); font-size: 13px; font-weight: 800; }
.product-excerpt { margin-top: 16px; color: var(--muted); }
.stock-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; font-weight: 800; color: var(--store-primary); }
.stock-line::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.buy-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.buy-row .btn { flex: 1; min-width: 160px; min-height: 50px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); height: 50px; background: var(--white); }
.qty button { width: 40px; height: 100%; display: inline-flex; align-items: center; justify-content: center; color: var(--store-primary); }
.qty input { width: 42px; height: 100%; border: 0; text-align: center; font-weight: 800; background: transparent; outline: none; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wish-inline { width: 50px; height: 50px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--store-primary); }
.wish-inline:hover, .wish-inline.is-active { border-color: var(--store-primary); }
.wish-inline.is-active svg { fill: currentColor; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.fact { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.fact > span { display: block; font-size: 12px; color: var(--muted); }
.fact b { font-size: 14px; }
.author-mini { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(to left, var(--tint), var(--white) 70%); }
.author-mini img { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 2px var(--store-primary); object-fit: cover; }
.author-mini small { display: block; font-size: 12px; color: var(--muted); }
.author-mini b { display: block; font-size: 16px; }
.author-mini .link-more { margin-inline-start: auto; }
.tabs { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-block: 0 8px; }
.tab-list { display: flex; gap: 4px; padding-inline: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-list button { position: relative; padding: 16px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.tab-list button[aria-selected="true"] { color: var(--store-primary); }
.tab-list button[aria-selected="true"]::after { content: ""; position: absolute; inset-inline: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--store-primary); }
.tabs .tab-panel { padding: 26px 30px; }
.tabs .tab-panel > p { line-height: 1.95; }
.tabs .tab-panel > p + p { margin-top: 10px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table th, .spec-table td { text-align: start; padding: 11px 14px; border: 1px solid var(--line); }
.spec-table th { width: 30%; background: var(--tint); font-weight: 700; }
.review-summary { display: flex; align-items: center; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.review-summary b { font-size: 42px; line-height: 1; color: var(--store-primary); }
.review-summary p { font-size: 13px; color: var(--muted); }
.review-item { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-item header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.review-item time { font-size: 12px; color: var(--muted); }

/* ---------- السلّة ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; padding-block: 16px 56px; align-items: start; }
.cart-layout > * { min-width: 0; }
.cart-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.free-ship { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--tint); font-size: 14px; }
.free-ship > svg { color: var(--store-primary); }
.free-ship > div { flex: 1; }
.free-ship b { color: var(--store-primary); }
.free-ship i { display: block; height: 6px; margin-top: 8px; background: var(--white); border-radius: 3px; overflow: hidden; }
.free-ship i::before { content: ""; display: block; height: 100%; width: var(--w, 0%); background: var(--store-primary); }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table thead th { text-align: start; font-size: 13px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--line); }
.cart-table td { padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-product { display: flex; align-items: center; gap: 14px; }
.cart-product img { width: 68px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.cart-product h3 { font-size: 15px; margin-top: 2px; }
.cart-product h3 a:hover { color: var(--store-primary); }
.cart-table .qty { height: 40px; }
.cart-table .qty button { width: 34px; }
.cart-table .qty input { width: 36px; }
.remove-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.remove-btn:hover { background: #FBEAEA; color: #B42318; }
.cart-foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.coupon { display: flex; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.coupon input { border: 0; padding: 0 14px; min-width: 0; width: 100%; outline: none; }
.coupon .btn { border-radius: 0; min-height: 100%; }
.applied-coupon { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.summary { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: sticky; top: 156px; }
.summary h2 { font-size: 18px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding-block: 10px; font-size: 14px; }
.summary-row span:first-child { color: var(--muted); }
.summary-row.discount span:last-child { color: var(--store-primary); font-weight: 800; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; font-size: 18px; font-weight: 800; }
.summary-row.total span:first-child { color: var(--store-text); }
.summary .btn { margin-top: 14px; min-height: 52px; }
.summary-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ---------- 404 ---------- */
.notfound { padding-block: 24px 8px; }
.notfound .cover-box { text-align: center; padding-bottom: 36px; }
.notfound .cover-img { height: 170px; }
.notfound-badge { width: 150px; height: 150px; margin: -75px auto 0; position: relative; border-radius: 50%; border: 6px solid var(--white); background: var(--store-accent); color: var(--store-text); display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; box-shadow: var(--shadow); }
.notfound h1 { font-size: 28px; margin-top: 18px; }
.notfound p { color: var(--muted); max-width: 480px; margin: 8px auto 0; }
.notfound .search-bar { margin: 24px auto 0; }
.notfound-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ============================================================
   الاستجابة
   ============================================================ */
@media (max-width: 1279px) {
  .account-link span { display: none; }
  .cart-pill .cart-total { display: none; }
  .cart-pill { padding: 4px; }
  .books-grid { --per-row: 4 !important; }
  .cat-row { grid-template-columns: repeat(4, 1fr); }
  .authors-row { grid-template-columns: repeat(2, 1fr); }
  .shop-layout { grid-template-columns: 240px 1fr; }
  .shop-layout .books-grid { --per-row: 3 !important; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 991px) {
  .topbar-end > span { display: none; }
  /* الهاتف واللوح: القائمة والشعار يمينًا، والسلّة يسارًا، والبحث تحتها */
  .header-main .container { grid-template-columns: auto 1fr auto; min-height: 68px; gap: 8px; }
  .menu-toggle { display: inline-flex; grid-column: 1; grid-row: 1; justify-self: start; }
  .brand { grid-column: 2; grid-row: 1; justify-self: start; }
  .brand img { width: 40px; height: 40px; }
  .brand-tag { display: none; }
  .brand-name { font-size: 19px; }
  .header-actions { display: contents; }
  .header-tools { grid-column: 3; grid-row: 1; justify-self: end; }
  .account-link, .header-wish { display: none; }
  .search-bar { grid-column: 1 / -1; grid-row: 2; max-width: none; margin-bottom: 12px; height: 46px; }
  .nav-bar { display: none; }
  .site-header { box-shadow: 0 2px 10px rgba(30,38,34,.06); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-cats { display: none; }
  .books-grid { --per-row: 3 !important; }
  .banner-pair { grid-template-columns: 1fr; }
  .reviews-grid { grid-template-columns: 1fr; }
  .newsletter .container { grid-template-columns: auto 1fr; }
  .newsletter-form { grid-column: 1 / -1; }
  .shop-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filters-toggle { display: inline-flex; }
  .filters-body { display: none; grid-template-columns: 1fr 1fr; }
  .filters.is-open .filters-body { display: grid; }
  .shop-layout .books-grid { --per-row: 3 !important; }
  .product { grid-template-columns: 1fr; }
  .gallery { position: static; }
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .cover-img { height: 180px; }
}

@media (hover: none) {
  .wish-btn { opacity: 1; }
}

@media (max-width: 767px) {
  body { padding-bottom: 62px; }
  .topbar .container { justify-content: center; }
  .topbar-end { display: none; }
  .section { padding-block: 30px; }
  .section-title { font-size: 19px; }
  .section-sub { display: none; }
  .hero { padding-top: 12px; }
  .hero-track { min-height: 488px; }
  .hero-slide > img { height: 188px; bottom: auto; object-position: left center; }
  .hero-caption { justify-content: flex-start; padding: 206px 20px 52px; max-width: none; }
  .hero-text { font-size: 14.5px; }
  .hero-caption .btn { width: 100%; }
  .hero-dots { inset-inline-start: 20px; }
  .trust-item p { font-size: 12px; }
  .books-grid { --per-row: 2 !important; gap: 10px; }
  .book-card { padding: 8px; }
  .book-title { font-size: 14px; }
  .price-now { font-size: 16px; }
  .book-card .card-cart .btn { font-size: 13px; padding-inline: 6px; gap: 6px; }
  .type-dot { width: 28px; height: 28px; top: 6px; inset-inline-end: 6px; }
  .type-dot svg { width: 14px; height: 14px; }
  .wish-btn { width: 28px; height: 28px; top: 40px; inset-inline-end: 6px; }
  .badges { top: 6px; inset-inline-start: 6px; }
  .promo { min-height: 200px; }
  .promo-body { padding: 22px 20px; max-width: 72%; }
  .promo.is-green::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, var(--store-primary) 52%, rgba(23,115,74,0) 85%); }
  .promo.is-yellow::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, rgba(255,255,255,.88) 52%, rgba(255,255,255,0) 85%); }
  .authors-row { grid-template-columns: 1fr; gap: 10px; }
  .cat-row { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .cat-card { padding: 12px 4px; }
  .cat-card img { width: 46px; height: 46px; padding: 8px; }
  .cat-card b { font-size: 12.5px; }
  .cat-card small { display: none; }
  .newsletter .container { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .newsletter-icon { display: none; }
  .newsletter-form { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; padding-block: 38px 26px; }
  .footer-bottom .container { justify-content: center; text-align: center; padding-block: 12px; }
  .cover-img { height: 130px; }
  .cover-info { flex-direction: column; align-items: center; text-align: center; padding: 0 16px 18px; gap: 6px; }
  .cover-avatar { width: 110px; height: 110px; margin-top: -55px; }
  .cover-avatar.is-icon { padding: 22px; }
  .cover-text { padding-top: 6px; min-width: 0; }
  .cover-text h1 { font-size: 24px; }
  .cover-lines { justify-content: center; }
  .cover-actions { justify-content: center; }
  .about-panel { padding: 20px 18px; }
  .filters-body { grid-template-columns: 1fr; }
  .shop-layout .books-grid { --per-row: 2 !important; }
  .shop-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-end .select { flex: 1; }
  .view-switch { display: none; }
  .books-grid.is-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .books-grid.is-list .book-card { flex-direction: column; gap: 0; }
  .books-grid.is-list .book-media { width: auto; }
  .gallery { grid-template-columns: 1fr; padding: 14px; }
  .gallery-thumbs { flex-direction: row; justify-content: center; order: 2; }
  .gallery-thumbs button { width: 60px; }
  .gallery-main { padding: 20px; }
  .gallery-main img { max-width: 230px; }
  .buy-box { padding: 20px 16px; }
  .buy-row .btn { min-width: 0; }
  .facts { grid-template-columns: 1fr 1fr; }
  .author-mini { flex-wrap: wrap; }
  .tabs .tab-panel { padding: 20px 16px; }
  .cart-card { padding: 14px; }
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; }
  .cart-table tr { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding-block: 14px; border-bottom: 1px solid var(--line); }
  .cart-table td { padding: 0; border: 0; }
  .cart-table td.cell-product { grid-column: 1 / -1; padding-inline-end: 40px; }
  .cart-table td.cell-price { display: none; }
  .cart-table td.cell-total { align-self: center; }
  .cart-table td.cell-remove { position: absolute; top: 10px; inset-inline-end: 0; }
  .cart-foot { flex-direction: column; }
  .cart-foot > div { width: 100%; }
  .notfound-badge { width: 120px; height: 120px; margin-top: -60px; font-size: 36px; }
  .notfound .cover-box { padding-inline: 16px; }

  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 60; height: 62px; background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(30,38,34,.06); }
  .bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); }
  .bottom-nav a[aria-current="page"] { color: var(--store-primary); font-weight: 800; }
  .bottom-nav .badge-count { top: 6px; inset-inline-end: auto; inset-inline-start: calc(50% + 2px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* اسم المؤلّف في البطاقة المصغّرة تحت الغلاف لا فوقه */
.mini-body { align-items: flex-start; }
.mini-body > div { padding-top: 10px; min-width: 0; }

/* ---------- خيارات الإظهار والنصوص (الملحق، البند 3) ---------- */
body[data-show-trust-bar="false"] .trust,
body[data-show-reviews="false"] .reviews-section,
body[data-show-reviews="false"] .reviews-tab,
body[data-show-newsletter="false"] .newsletter { display: none; }
.topbar-note:has(> [data-option="delivery_note"]:empty),
.nav-hot [data-option="offers_label"]:empty { display: none; }

/* روابط داخل الصفحة: لا يختفي الهدف تحت الرأس المثبّت */
#tab-reviews, #works { scroll-margin-top: 156px; }
@media (max-width: 991px) { #tab-reviews, #works { scroll-margin-top: 130px; } }


/* ---------- الأسئلة الشائعة (home_faq) ---------- */
.faq-list { display: grid; gap: 10px; }
@media (min-width: 992px) { .faq-list { grid-template-columns: 1fr 1fr; align-items: start; } }
.faq-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s; }
.faq-item[open] { border-color: var(--store-primary); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 700; font-size: 15px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-sign { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--tint); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; transition: transform .25s var(--ease), background .2s; }
.faq-item[open] .faq-sign { transform: rotate(45deg); background: var(--store-accent); color: var(--store-text); }
.faq-answer { padding: 0 18px 16px; font-size: 14px; color: var(--muted); line-height: 1.8; }

/* شريط الشحن المجّانيّ: يختفي موضعه بلا فراغ حين يُخفيه theme.js */
[data-slot="cart.free_shipping_left"][hidden] { display: none !important; }

/* ============================================================
   الإصدار الثاني: إيقاع الرئيسيّة، والبطاقة الأخفّ، والأقسام الجديدة
   ============================================================ */
:root { --band-tint: #EEF6F1; --cream: #FBF6E9; --cream-line: #E8D9AE; }

/* ---------- خلفيّات الأقسام المتناوبة ---------- */
.hero { padding-bottom: 32px; }
.band { padding-block: 48px; }
.band-white { background: var(--white); }
.band-tint { background: var(--band-tint); }
.band-cream { background: var(--cream); }
.band-white .book-card { border-color: var(--line); }
.section-sub:empty { display: none; }
.section-head.is-center { justify-content: center; text-align: center; }
.section-head.is-center .section-title { flex-direction: column; gap: 10px; }
.section-head.is-center .section-title::before { order: 2; width: 46px; height: 4px; border-radius: 2px; }
.section-head.is-center .section-sub { padding-inline-start: 0; }
.section-more { text-align: center; margin-top: 28px; }

/* ---------- البطاقة: أدوات الغلاف، والشراء عند التحويم ---------- */
.card-tools { position: absolute; top: 46px; inset-inline-end: 8px; z-index: 2; display: grid; gap: 6px; opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s var(--ease); }
.book-card:hover .card-tools, .book-card:focus-within .card-tools, .card-tools:has(.is-active) { opacity: 1; transform: none; }
.tool-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--white); color: var(--store-text); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.14); transition: background .2s, color .2s; }
.tool-btn:hover { background: var(--store-primary); color: var(--white); }
.card-tools .wish-btn { position: static; opacity: 1; }
.card-tools .wish-btn.is-active { color: var(--store-primary); background: var(--white); }
@media (hover: none) { .card-tools { opacity: 1; transform: none; } }

/* ---------- صفٌّ واحد (الأكثر مبيعًا والعروض) ---------- */
.books-grid.one-row > :nth-child(n+6) { display: none; }
body[data-books-per-row="3"] .books-grid.one-row > :nth-child(n+4),
body[data-books-per-row="4"] .books-grid.one-row > :nth-child(n+5) { display: none; }
body[data-books-per-row="6"] .books-grid.one-row > :nth-child(6) { display: flex; }
@media (max-width: 1279px) { .books-grid.one-row > :nth-child(n+5) { display: none !important; } }
@media (max-width: 991px) { .books-grid.one-row > :nth-child(n+4) { display: none !important; } }
@media (max-width: 767px) { .books-grid.one-row > :nth-child(4) { display: flex !important; } }

/* ---------- تبويبات صفّ الكتب (القاعدة 16) ---------- */
.section-head.has-tabs { flex-wrap: wrap; }
.row-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.row-tab { padding: 6px 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--white); color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.row-tab:hover { border-color: var(--store-primary); color: var(--store-primary); }
.row-tab[aria-selected="true"] { background: var(--store-primary); border-color: var(--store-primary); color: var(--white); }
[data-slot="section.tabs"]:not(:has([data-repeat="tab"] ~ [role="tab"])) { display: none; }

/* ---------- العروض محدودة المدّة (offer.ends_at) ---------- */
.deal-frame { position: relative; overflow: hidden; background: var(--store-primary-dark); border-radius: calc(var(--radius) + 6px); padding: 30px; }
.deal-frame::before { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.05); top: -190px; inset-inline-start: -90px; pointer-events: none; }
.deal-frame::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; border: 22px solid rgba(242,213,75,.14); bottom: -70px; inset-inline-end: 8%; pointer-events: none; }
.deal-frame > * { position: relative; z-index: 1; }
.deal-head { flex-wrap: wrap; align-items: flex-end; }
.deal-head .section-title { color: var(--white); font-size: 26px; }
.deal-head .section-sub { color: #D3E6DA; }
.deal-kicker { display: inline-flex; align-items: center; gap: 6px; padding-inline-start: 18px; margin-bottom: 2px; color: var(--store-accent); font-size: 13px; font-weight: 800; }
.countdown { display: flex; align-items: center; gap: 8px; direction: rtl; }
.countdown[hidden] { display: none; }
.cd-label { color: #D3E6DA; font-size: 13px; font-weight: 700; margin-inline-end: 4px; }
.cd-unit { display: grid; justify-items: center; min-width: 58px; padding: 6px 4px 5px; border-radius: var(--radius-sm); background: var(--store-accent); color: var(--store-text); line-height: 1.15; }
.cd-unit b { font-size: 22px; font-variant-numeric: tabular-nums; }
.cd-unit small { font-size: 11px; font-weight: 700; }
.deal-frame .book-card { border-color: transparent; }

/* ---------- الدوّار الأفقيّ (وصل حديثًا) ---------- */
.carousel-nav { display: flex; align-items: center; gap: 8px; }
.carousel-nav .link-more { margin-inline-start: 8px; }
.carousel-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--white); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s, opacity .2s; }
.carousel-btn:hover:not(:disabled) { background: var(--store-primary); border-color: var(--store-primary); color: var(--white); }
.carousel-btn:disabled { opacity: .4; cursor: default; }
.carousel-track { --per-row: 5; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--per-row) - 1) * 16px) / var(--per-row)); gap: 16px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding-block: 4px 8px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; }
body[data-books-per-row="3"] .carousel-track { --per-row: 3; }
body[data-books-per-row="4"] .carousel-track { --per-row: 4; }
body[data-books-per-row="6"] .carousel-track { --per-row: 6; }
@media (max-width: 1279px) { .carousel-track { --per-row: 4 !important; } }
@media (max-width: 991px) { .carousel-track { --per-row: 3 !important; } }
@media (hover: none) { .carousel-btn { display: none; } }

/* ---------- الكتاب المميّز (book_row بكتابٍ واحد) ---------- */
.featured { display: grid; gap: 22px; }
.featured-head { text-align: center; }
.featured-kicker { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--pill); background: var(--store-accent); color: var(--store-text); font-size: 13px; font-weight: 800; }
.featured-kicker svg { fill: currentColor; }
.featured-heading { font-size: 26px; margin-top: 8px; }
.feature-book { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 56px; align-items: center; max-width: 1060px; margin-inline: auto; padding: 40px 52px; background: var(--white); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); }
.feature-media { position: relative; }
.feature-media::before { content: ""; position: absolute; inset: 18px 18px -18px -18px; border-radius: var(--radius); background: var(--store-accent); }
.feature-cover { position: relative; display: block; }
.feature-cover img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius-sm); box-shadow: 0 22px 44px rgba(30,38,34,.22); }
.feature-media .type-dot { top: 12px; inset-inline-end: 12px; width: 38px; height: 38px; }
.feature-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.feature-title { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.3; }
.feature-title a:hover { color: var(--store-primary); }
.feature-body .book-author { font-size: 15px; }
.feature-body .price-now { font-size: 26px; }
.feature-desc { margin-top: 6px; max-width: 560px; color: var(--muted); line-height: 1.85; }
.feature-desc p + p { margin-top: 8px; }
.feature-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.feature-actions .qty, .feature-actions .btn { height: 48px; min-height: 48px; }
.feature-actions .wish-inline { width: 48px; height: 48px; }
.feature-actions .link-more { margin-inline-start: 8px; }

/* ---------- بطاقات المؤلّفين: نقشٌ هادئ بدل الخطوط ---------- */
.mini-cover { background-color: var(--store-primary); background-image: radial-gradient(circle at 12% 135%, rgba(255,255,255,.12) 0 54px, transparent 55px), radial-gradient(rgba(255,255,255,.16) 1.3px, transparent 1.6px); background-size: auto, 14px 14px; }
.mini-store:nth-child(2n) .mini-cover { background-color: var(--store-primary-dark); }

/* ---------- المدوّنة (latest_posts) ---------- */
.posts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.post-card { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.post-card:hover { border-color: var(--store-primary); box-shadow: var(--shadow); }
.post-media { display: block; overflow: hidden; }
.post-media img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .5s var(--ease); }
.post-card:hover .post-media img { transform: scale(1.04); }
.post-body { display: grid; align-content: start; gap: 6px; padding: 16px 18px 20px; }
.post-date { font-size: 13px; font-weight: 700; color: var(--muted); }
.post-title { font-size: 17.5px; line-height: 1.45; }
.post-title a:hover { color: var(--store-primary); }
.post-excerpt { font-size: 14px; color: var(--muted); }
.posts-grid.is-blog .is-lead { grid-column: 1 / -1; display: grid; grid-template-columns: 1.25fr 1fr; }
.posts-grid.is-blog .is-lead .post-media img { height: 100%; }
.posts-grid.is-blog .is-lead .post-body { align-content: center; padding: 28px 34px; }
.posts-grid.is-blog .is-lead .post-title { font-size: 26px; }
.page-head { padding-block: 18px 0; }
.page-head h1 { font-size: 30px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.blog-list { padding-top: 22px; }
.article { max-width: 820px; padding-block: 22px 52px; }
.article-title { font-size: clamp(26px, 3vw, 38px); line-height: 1.3; margin: 6px 0 20px; }
.article-img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }
.article-body { margin-top: 26px; font-size: 17px; line-height: 2; }
.article-body h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 28px 0 8px; }
.article-body h2::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--store-accent); }
.article-body p + p { margin-top: 12px; }
.article-body blockquote { margin: 24px 0; padding: 18px 22px; border-inline-start: 4px solid var(--store-accent); border-radius: var(--radius-sm); background: var(--band-tint); color: var(--store-primary-dark); font-size: 19px; font-weight: 700; line-height: 1.7; }
.article-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- صفحة الكتاب: الصيغ والتوصيل ---------- */
.formats-box { margin-top: 16px; }
.formats-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.formats { display: flex; flex-wrap: wrap; gap: 8px; }
.format-opt { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; min-width: 132px; padding: 8px 14px 8px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); transition: border-color .2s, background .2s; }
.format-opt .type-dot { position: static; grid-row: span 2; width: 28px; height: 28px; box-shadow: none; }
.format-opt .type-dot svg { width: 14px; height: 14px; }
.format-name { font-size: 14px; font-weight: 800; line-height: 1.35; }
.format-price { font-size: 13px; color: var(--muted); line-height: 1.35; }
.format-opt:hover { border-color: var(--store-primary); }
.format-opt.is-current { border-color: var(--store-primary); background: var(--band-tint); box-shadow: inset 0 0 0 1px var(--store-primary); }
[data-slot="book.formats"]:not(:has([data-repeat="format"] ~ [data-preview-copy])) { display: none; }
.facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.info-list { display: grid; gap: 8px; margin-top: 16px; padding: 14px 16px; border: 1px dashed var(--cream-line); border-radius: var(--radius-sm); background: var(--cream); font-size: 14px; }
.info-list li { display: flex; align-items: center; gap: 10px; }
.info-list svg { color: var(--store-primary); }
.info-list li:has(> [data-option="delivery_note"]:empty) { display: none; }

/* ---------- الاستجابة للأقسام الجديدة ---------- */
@media (max-width: 991px) {
  .trust { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .trust::-webkit-scrollbar { display: none; }
  .trust-item { flex: 0 0 auto; scroll-snap-align: start; border-top: 0 !important; }
  .trust-item + .trust-item { border-inline-start: 1px solid var(--line) !important; }
  .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posts-grid.is-blog .is-lead { grid-template-columns: 1fr; }
  .feature-book { gap: 36px; padding: 32px; }
  .section-head.has-tabs .row-tabs { order: 3; width: 100%; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 767px) {
  .band { padding-block: 32px; }
  .hero { padding-bottom: 20px; }
  .trust { margin-top: 12px; }
  .trust-item { flex-direction: row; text-align: start; gap: 10px; padding: 10px 14px; }
  .trust-icon { width: 36px; height: 36px; }
  .trust-icon svg { width: 18px; height: 18px; }
  .trust-item h3, .trust-item p { white-space: nowrap; }
  .trust-item h3 { font-size: 13.5px; }
  .card-tools { top: 40px; inset-inline-end: 6px; }
  .tool-btn { width: 28px; height: 28px; }
  .deal-frame { padding: 18px 14px; }
  .deal-head .section-title { font-size: 21px; }
  .countdown { gap: 6px; }
  .cd-label { display: none; }
  .cd-unit { min-width: 50px; }
  .cd-unit b { font-size: 19px; }
  .carousel-track { grid-auto-columns: 46%; gap: 10px; }
  .carousel-btn { display: none; }
  .feature-book { grid-template-columns: 1fr; gap: 30px; padding: 26px 18px; }
  .feature-media { width: 62%; max-width: 230px; margin-inline: auto; }
  .featured-heading { font-size: 22px; }
  .feature-actions .btn { flex: 1; }
  .posts-grid:not(.is-blog) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .posts-grid:not(.is-blog) > * { scroll-snap-align: start; }
  .posts-grid.is-blog { grid-template-columns: 1fr; }
  .posts-grid.is-blog .is-lead .post-body { padding: 16px 18px 20px; }
  .posts-grid.is-blog .is-lead .post-title { font-size: 20px; }
  .page-head h1 { font-size: 24px; }
  .article-body { font-size: 16px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .format-opt { min-width: 0; flex: 1 1 30%; padding-inline: 10px; }
}

/* نصّ الرأي: أربعة أسطر على الأكثر، والنصّ الكامل في title (الملحق، البند 5) */
[data-slot="review.text"] { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
